예제 #1
0
 def link(self, i):
     return Link(self, i, self.word(clg.linkage_get_link_lword(self._obj, i)),
                 clg.linkage_get_link_llabel(self._obj, i),
                 clg.linkage_get_link_rlabel(self._obj, i),
                 self.word(clg.linkage_get_link_rword(self._obj, i)))
예제 #2
0
 def link(self, i):
     return Link(self, i, self.word(clg.linkage_get_link_lword(self._obj, i)),
                 clg.linkage_get_link_llabel(self._obj, i),
                 clg.linkage_get_link_rlabel(self._obj, i),
                 self.word(clg.linkage_get_link_rword(self._obj, i)))
예제 #3
0
def link_analiz(i, linkage, actions_index, objects_index, conditions_index):
    """
    Распределение индексов слов на дейсвие, объект и условие в зависимости от связи
    Аргументы:
    i - индекс связи в структуре предложения
    linkage - структура предложения выданная парсером
    actions_index - индексы слов действий
    objects_index - индексы слов объектов
    conditions_index - индексы слов условий
    """ 
    if (clg.linkage_get_link_label(linkage, i).find("W") == 0):
        actions_index.append(clg.linkage_get_link_rword(linkage, i))
    if (clg.linkage_get_link_label(linkage, i).find("Sp") == 0):
        actions_index.append(clg.linkage_get_link_lword(linkage, i))
    elif (clg.linkage_get_link_label(linkage, i).find("I") == 0):
        if (len(clg.linkage_get_link_label(linkage, i)) == 1):
            actions_index.append(clg.linkage_get_link_rword(linkage, i))
        elif (clg.linkage_get_link_label(linkage, i)[1] != "I"):
            actions_index.append(clg.linkage_get_link_rword(linkage, i))
    elif (clg.linkage_get_link_label(linkage, i).find("MV") == 0 and clg.linkage_get_link_label(linkage, i)[2] != "I"):
        if (clg.linkage_get_link_lword(linkage, i) in objects_index or clg.linkage_get_link_lword(linkage, i) in actions_index):
            objects_index.append(clg.linkage_get_link_rword(linkage, i))
        elif (clg.linkage_get_link_lword(linkage, i) in conditions_index):
            conditions_index.append(clg.linkage_get_link_rword(linkage, i))
    elif (clg.linkage_get_link_label(linkage, i).find("SI") == 0):
        objects_index.append(clg.linkage_get_link_rword(linkage, i))
    elif (clg.linkage_get_link_label(linkage, i) == "E"):
        conditions_index.append(clg.linkage_get_link_rword(linkage, i))
    elif (clg.linkage_get_link_label(linkage, i).find("E") == 0 and clg.linkage_get_link_label(linkage, i)[1].islower() == True):
        conditions_index.append(clg.linkage_get_link_rword(linkage, i))
    elif (clg.linkage_get_link_label(linkage, i).find("EI") == 0):
        conditions_index.append(clg.linkage_get_link_lword(linkage, i))
    elif (clg.linkage_get_link_label(linkage, i).find("J") == 0):
        conditions_index.append(clg.linkage_get_link_rword(linkage, i))
    elif (clg.linkage_get_link_label(linkage, i).find("A") == 0 and clg.linkage_get_link_label(linkage, i)[1].islower() == True):
        if (clg.linkage_get_link_rword(linkage, i) in objects_index):
            objects_index.append(clg.linkage_get_link_lword(linkage, i))
        elif (clg.linkage_get_link_rword(linkage, i) in conditions_index):
            conditions_index.append(clg.linkage_get_link_lword(linkage, i))
    elif (clg.linkage_get_link_label(linkage, i).find("AXP") == 0):
        if (clg.linkage_get_link_rword(linkage, i) in objects_index):
            objects_index.append(clg.linkage_get_link_lword(linkage, i))
        elif (clg.linkage_get_link_rword(linkage, i) in conditions_index):
            conditions_index.append(clg.linkage_get_link_lword(linkage, i))
    elif (clg.linkage_get_link_label(linkage, i).find("PI") == 0):
        if (clg.linkage_get_link_rword(linkage, i) in objects_index):
            objects_index.append(clg.linkage_get_link_lword(linkage, i))
        elif (clg.linkage_get_link_rword(linkage, i) in conditions_index):
            conditions_index.append(clg.linkage_get_link_lword(linkage, i))
    elif (clg.linkage_get_link_label(linkage, i).find("M") == 0 and clg.linkage_get_link_label(linkage, i)[1] != "V"):
        if (clg.linkage_get_link_lword(linkage, i) in conditions_index):
            conditions_index.append(clg.linkage_get_link_rword(linkage, i))
        else:
            objects_index.append(clg.linkage_get_link_rword(linkage, i))