def get_root(self, element): """Get the sentence of the element :param element: The constituent or word whose parent is wanted. """ element = element.get(CONSTITUENT, element) return GraphWrapper.get_in_neighbour_by_relation_type( self.graph, element, self.root_edge_type)
def get_syntactic_parent(self, element): """Return the syntactic parent of the node(constituent or word). :param element: The Word, constituent or Named entity whose parent is wanted. :return: The parent of the element. """ element = element.get(CONSTITUENT, element) return GraphWrapper.get_in_neighbour_by_relation_type( self.graph, element, self.syntactic_edge_type)