def tag(self, word, word_lower, seen_tags): result = [] for _, unprefixed_word in word_splits(word_lower): tags = self.dict_analyzer.tag(unprefixed_word, unprefixed_word, seen_tags) for tag in tags: if not tag.is_productive(): continue add_tag_if_not_seen(tag, result, seen_tags) return result
def parse(self, word, word_lower, seen_parses): result = [] for prefix, unprefixed_word in word_splits(word_lower): method = (self, prefix) parses = self.dict_analyzer.parse(unprefixed_word, unprefixed_word, seen_parses) for fixed_word, tag, normal_form, score, methods_stack in parses: if not tag.is_productive(): continue parse = (prefix + fixed_word, tag, prefix + normal_form, score * self.score_multiplier, methods_stack + (method, )) add_parse_if_not_seen(parse, result, seen_parses) return result
def parse(self, word, word_lower, seen_parses): result = [] for prefix, unprefixed_word in word_splits(word_lower): method = (self, prefix) parses = self.dict_analyzer.parse(unprefixed_word, unprefixed_word, seen_parses) for fixed_word, tag, normal_form, score, methods_stack in parses: if not tag.is_productive(): continue parse = ( prefix + fixed_word, tag, prefix + normal_form, score * self.score_multiplier, methods_stack + (method,) ) add_parse_if_not_seen(parse, result, seen_parses) return result