Пример #1
0
    def read_docs(self, toks):
        docs = []

        while toks.peek() == '(':
            docs.append( self.read_paren(toks) )
        ensure_stream_exhausted(toks, 'penn.parse_tree')

        return docs
Пример #2
0
def parse_tree(tree_string, node_factory=CCGNodeFactory):
    parser = CCGParser(node_factory)

    toks = preserving_split(tree_string, "()<>", suppressors='<>')

    deriv = parser.read_paren(toks)
    ensure_stream_exhausted(toks, 'ccg.parse_tree')

    return deriv
Пример #3
0
def parse_tree(tree_string, node_factory=CCGNodeFactory):
    parser = CCGParser(node_factory)
    
    toks = preserving_split(tree_string, "()<>", suppressors='<>')

    deriv = parser.read_paren(toks)
    ensure_stream_exhausted(toks, 'ccg.parse_tree')

    return deriv
Пример #4
0
    def read_docs(self, toks):
        docs = []

        while toks.peek() is not None:
            result = self.read_deriv(toks)
            docs.append(result)

        ensure_stream_exhausted(toks, 'penn.parse_tree')

        return docs