def extract_func(line): """ Выделение действий, объектов и условий в преложении Аргументы: line - предложение Возвращаемое значение: dgh - действие объект условие """ actions_index = [] objects_index = [] conditions_index = [] dgh = {} sent = clg.sentence_create(line, lang_dict) if (len(line) > 2 and len(line) < 190): clg.sentence_split(sent, parse_opts) num_linkages = clg.sentence_parse(sent, parse_opts) if (num_linkages > 0): linkage = select_linkage(sent, num_linkages) diagram = clg.linkage_print_diagram(linkage, False, 800); num_link = clg.linkage_get_num_links(linkage) for i in range(num_link): link_analiz(i, linkage, actions_index, objects_index, conditions_index) dgh['d'] = fill_func(linkage, actions_index) dgh['g'] = fill_func(linkage, objects_index) dgh['h'] = fill_func(linkage, conditions_index) clg.linkage_delete(linkage) else: return dgh clg.sentence_delete(sent) return dgh
def __del__(self): if hasattr(self, '_obj'): clg.sentence_delete(self._obj) del self._obj
def __del__(self): if hasattr(self, '_obj'): clg.sentence_delete(self._obj) clg._py_decref(self.dict) del self._obj