Пример #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]
Пример #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]
Пример #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]    
Пример #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
Пример #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
Пример #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]
Пример #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]
Пример #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]