class StructureMatch: def __init__(self, match_id, structure): self.match_id = match_id self.structure = structure self.matches = [] self.representations = {} def distinct_forms(self): dm = set() keys = list(self.matches[0].keys()) for words in self.matches: dm.add(" ".join(words[k].text for k in keys)) return len(dm) def append(self, match): self.matches.append(match) def __len__(self): return len(self.matches)