def merge_const_phrases(self, in_existence_areas): # detecting constant phrases phrases_merged = const_phrase.extract_constant_phrases(in_existence_areas) lexemes_to_remove = set([]) replace_map = {} for phrase in phrases_merged: lexemes_to_remove |= set(phrase[1:]) replace_map[phrase[0]] = phrase merged_existence_areas = {} for (lex_id, area) in in_existence_areas.iteritems(): if lex_id in replace_map: merged_existence_areas[tuple(replace_map[lex_id])] = area elif not lex_id in lexemes_to_remove: merged_existence_areas[tuple([lex_id])] = area return merged_existence_areas
def merge_const_phrases(self, in_existence_areas): # detecting constant phrases phrases_merged = const_phrase.extract_constant_phrases( in_existence_areas) lexemes_to_remove = set([]) replace_map = {} for phrase in phrases_merged: lexemes_to_remove |= set(phrase[1:]) replace_map[phrase[0]] = phrase merged_existence_areas = {} for (lex_id, area) in in_existence_areas.iteritems(): if lex_id in replace_map: merged_existence_areas[tuple(replace_map[lex_id])] = area elif not lex_id in lexemes_to_remove: merged_existence_areas[tuple([lex_id])] = area return merged_existence_areas
def merge_constant_phrases(self, in_existence_areas): const_phrases = const_phrase.extract_constant_phrases( in_existence_areas)
def merge_constant_phrases(self, in_existence_areas): const_phrases = const_phrase.extract_constant_phrases(in_existence_areas)