From ad7ba8c0b2fb4629c62588de3cf4b22428967572 Mon Sep 17 00:00:00 2001 From: Ozbolt Menegatti Date: Sat, 1 Jun 2019 10:31:29 +0200 Subject: [PATCH] removing debugging/dead code --- wani.py | 51 --------------------------------------------------- 1 file changed, 51 deletions(-) diff --git a/wani.py b/wani.py index 055e78c..2a62094 100644 --- a/wani.py +++ b/wani.py @@ -176,7 +176,6 @@ class ComponentRepresentation: def render(self): if self.rendition_text is None: - print(type(self)) self.rendition_text = self._render() def rendition(self): @@ -900,56 +899,9 @@ class SyntacticStructure: return c raise RuntimeError("Unknown component id: {}".format(idx)) - def check_agreements(self, match): - for agr in self.agreements: - w1 = match[agr['n1']] - w2 = match[agr['n2']] - - for agr_case in agr['match']: - t1 = w1.msd[0] - v1 = TAGSET[t1].index(agr_case) - assert(v1 >= 0) - # if none specified: nedolocnik, always agrees - if v1 + 1 >= len(w1.msd): - continue - # first is uppercase, not in TAGSET - m1 = w1.msd[v1 + 1] - - # REPEAT (not DRY!) - t2 = w2.msd[0] - v2 = TAGSET[t2].index(agr_case) - assert(v2 >= 0) - if v2 + 1 >= len(w2.msd): - continue - m2 = w2.msd[v2 + 1] - - # match! - if '-' not in [m1, m2] and m1 != m2: - return False - - return True - - def check_form(self, match): - for midx, w in match.items(): - c = self.get_component(midx) - for key, value in c.selection.items(): - t = w.msd[0] - v = TAGSET[t].index(key.lower()) - f1 = w.msd[v + 1] - f2 = CODES[value] - - if '-' not in [f1, f2] and f1 != f2: - return False - - return True - def match(self, word): matches = self.components[0].match(word) return [] if matches is None else matches - - # for m in matches: - # to_ret.append((m, self.check_agreements(m))) - def load_structures(filename): with open(filename, 'r') as fp: @@ -1358,7 +1310,6 @@ class ColocationIds: idx = 1 for _1, sm in tqdm(self.data.items()): ComponentRendition.set_representations(sm, components_dict[sm.structure_id], word_renderer) - print(idx) idx += 1 @@ -1382,8 +1333,6 @@ def match_file(words, structures): def main(input_file, structures_file, args): structures, lemma_msds = load_structures(structures_file) - for s in structures: - logging.debug(str(s)) colocation_ids = ColocationIds() word_renderer = WordMsdRenderer(lemma_msds)