Exemplo n.º 1
0
    def parse_to_readings(self, sentence):
        """:see: ReadingCommand.parse_to_readings()"""
        from nltk.sem import root_semrep

        tokens = sentence.split()
        trees = self._parser.parse(tokens)
        return [root_semrep(tree) for tree in trees]
Exemplo n.º 2
0
    def parse_to_readings(self, sentence):
        """:see: ReadingCommand.parse_to_readings()"""
        from nltk.sem import root_semrep

        tokens = sentence.split()
        trees = self._parser.parse(tokens)
        return [root_semrep(tree) for tree in trees]
Exemplo n.º 3
0
 def _get_readings(self, sentence):
     """
     Build a list of semantic readings for a sentence.
     
     @rtype: C{list} of  L{logic.Expression}.
     """
     tokens = sentence.split()
     trees = self._parser.nbest_parse(tokens)
     return [root_semrep(tree) for tree in trees]    
Exemplo n.º 4
0
def demo():
    cp = parse.load_parser('file:rdf.fcfg', trace=0)
    tokens = 'list the actors in the_shining'.split()
    trees = cp.nbest_parse(tokens)
    tree = trees[0]
    semrep = sem.root_semrep(tree)
    trans = SPARQLTranslator()
    trans.translate(semrep)
    print trans.query
Exemplo n.º 5
0
def demo():
    cp = parse.load_parser('file:rdf.fcfg', trace=0)
    tokens = 'list the actors in the_shining'.split()
    trees = cp.nbest_parse(tokens)
    tree = trees[0]
    semrep = sem.root_semrep(tree)
    trans = SPARQLTranslator()
    trans.translate(semrep)
    print trans.query
Exemplo n.º 6
0
 def _get_readings(self, sentence):
     """
     Build a list of semantic readings for a sentence.
     
     @rtype: C{list} of  L{logic.Expression}.
     """
     tokens = sentence.split()
     trees = self._parser.nbest_parse(tokens)
     return [root_semrep(tree) for tree in trees]
Exemplo n.º 7
0
 def parse_to_readings(self, sentence):
     """@see: ReadingCommand.parse_to_readings()"""
     tokens = sentence.split()
     trees = self._parser.nbest_parse(tokens)
     return [root_semrep(tree) for tree in trees]
Exemplo n.º 8
0
 def parse_to_readings(self, sentence):
     """@see: ReadingCommand.parse_to_readings()"""
     tokens = sentence.split()
     trees = self._parser.nbest_parse(tokens)
     return [root_semrep(tree) for tree in trees]