Beispiel #1
0
 def loadNodeFromSumitChunk(self, sentence_node, parent, chunk, discourse):
     result = None
     
     ''' If the chunk is a non-atomic node '''
     if chunk.attributes['span'].value.find('..') >= 0:           
         result = Node(parent)
         ''' For child = each one of chunk's children '''
         for child in getDirectChildElements(chunk):  
             child_node = None              
             child_node = self.loadNodeFromSumitChunk(sentence_node, result, child, discourse)
             if child_node != None:
                 result.children.append(child_node)            
     else:
         ''' If the chunk is an atomic node (i.e., a word itself) '''
         ''' Look for the word in words list '''
         for sen in discourse.sentences:
             for word in sen.words:
                 if word.properties['id'] == chunk.attributes['span'].value:
                     result = word
                     result.parent = parent
                     sentence_node.words.append(result)
                     break
             if result != None:
                 break
          
             
     if result != None:       
         result.form = chunk.attributes['form'].value
     
         
     return result