Beispiel #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
Beispiel #2
0
 def diagram(self, display_walls=False, screen_width=180):
     return clg.linkage_print_diagram(self._obj, display_walls, screen_width)
Beispiel #3
0
 def diagram(self, display_walls=False, screen_width=180):
     return clg.linkage_print_diagram(self._obj, display_walls, screen_width)