Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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)