Exemplo n.º 1
0
 def __init__(self, sent, parse_options):
     self.sent = sent
     self.num = 0
     self.parse_options = sent.parse_options if parse_options is None else parse_options
     self.rc = clg.sentence_parse(sent._obj, self.parse_options._obj)
     if clg.parse_options_timer_expired(self.parse_options._obj):
         raise LG_TimerExhausted()
Exemplo n.º 2
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
Exemplo n.º 3
0
 def __init__(self, sent, parse_options):
     self.sent = sent
     self.num = 0
     self.parse_options = sent.parse_options if parse_options is None else parse_options
     self.rc = clg.sentence_parse(sent._obj, self.parse_options._obj)
     if clg.parse_options_timer_expired(self.parse_options._obj):
         raise LG_TimerExhausted()
Exemplo n.º 4
0
 def __init__(self, sent):
     self.sent = sent
     self.num = 0
     clg.sentence_parse(sent._obj, sent.parse_options._obj)