Пример #1
0
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
Пример #2
0
 def __init__(self, text, lgdict, parse_options):
     # Keep all args passed into clg.* functions.
     self.text, self.dict, self.parse_options = text, lgdict, parse_options
     self._obj = clg.sentence_create(self.text, self.dict._obj)
Пример #3
0
 def __init__(self, text, lgdict, parse_options):
     # Keep all args passed into clg.* functions.
     self.text, self.dict, self.parse_options = text, lgdict, parse_options
     self._obj = clg.sentence_create(self.text, self.dict._obj)
Пример #4
0
 def __init__(self, text, lgdict, parse_options):
     # Keep all args passed into clg.* functions.
     self.text, self.dict, self.parse_options = text, lgdict, parse_options
     clg._py_incref(
         self.dict)  # The Sentence struct refers to the Dictionary struct
     self._obj = clg.sentence_create(self.text, self.dict._obj)
Пример #5
0
 def __init__(self, text, lgdict, parse_options):
     # Keep all args passed into clg.* functions.
     self.text, self.dict, self.parse_options = text, lgdict, parse_options
     clg._py_incref(self.dict) # The Sentence struct refers to the Dictionary struct
     self._obj = clg.sentence_create(self.text, self.dict._obj)