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 split(self, parse_options=None): """Split a sentence. If an error occurs, return a negative number.""" if not parse_options: parse_options = self.parse_options return clg.sentence_split(self._obj, parse_options._obj)
def split(self, parse_options=None): """Split a sentence. If an error occurs, return a negative number.""" if not parse_options: parse_options = self.parse_options return clg.sentence_split(self._obj, parse_options._obj)
def split(self, parse_options=None): if not parse_options: parse_options = self.parse_options return clg.sentence_split(self._obj, parse_options._obj)