def nonprojective_conll_parse_demo():
    graphs = [DependencyGraph(entry)
              for entry in conll_data2.split('\n\n') if entry]
    npp = ProbabilisticNonprojectiveParser()
    npp.train(graphs, NaiveBayesDependencyScorer())
    parse_graph = npp.parse(['Cathy', 'zag', 'hen', 'zwaaien', '.'], ['N', 'V', 'Pron', 'Adj', 'N', 'Punc'])
    print(parse_graph)
def nonprojective_conll_parse_demo():
    from nltk.parse.dependencygraph import conll_data2

    graphs = [DependencyGraph(entry) for entry in conll_data2.split("\n\n") if entry]
    npp = ProbabilisticNonprojectiveParser()
    npp.train(graphs, NaiveBayesDependencyScorer())
    for parse_graph in npp.parse(["Cathy", "zag", "hen", "zwaaien", "."], ["N", "V", "Pron", "Adj", "N", "Punc"]):
        print(parse_graph)
Пример #3
0
def nonprojective_conll_parse_demo():
    graphs = [
        DependencyGraph(entry) for entry in conll_data2.split('\n\n') if entry
    ]
    npp = ProbabilisticNonprojectiveParser()
    npp.train(graphs, NaiveBayesDependencyScorer())
    parse_graph = npp.parse(['Cathy', 'zag', 'hen', 'zwaaien', '.'],
                            ['N', 'V', 'Pron', 'Adj', 'N', 'Punc'])
    print(parse_graph)
Пример #4
0
def nonprojective_conll_parse_demo():
    from nltk.parse.dependencygraph import conll_data2

    graphs = [DependencyGraph(entry) for entry in conll_data2.split("\n\n") if entry]
    npp = ProbabilisticNonprojectiveParser()
    npp.train(graphs, NaiveBayesDependencyScorer())
    for parse_graph in npp.parse(
        ["Cathy", "zag", "hen", "zwaaien", "."], ["N", "V", "Pron", "Adj", "N", "Punc"]
    ):
        print(parse_graph)
Пример #5
0
def projective_prob_parse_demo():
    """
    A demo showing the training and use of a projective
    dependency parser.
    """
    graphs = [DependencyGraph(entry) for entry in conll_data2.split("\n\n") if entry]
    ppdp = ProbabilisticProjectiveDependencyParser()
    print "Training Probabilistic Projective Dependency Parser..."
    ppdp.train(graphs)
    sent = ["Cathy", "zag", "hen", "wild", "zwaaien", "."]
    print "Parsing '", " ".join(sent), "'..."
    parse = ppdp.parse(sent)
    print "Parse:"
    print parse[0]
Пример #6
0
def projective_prob_parse_demo():
    """
    A demo showing the training and use of a projective
    dependency parser.
    """
    graphs = [DependencyGraph(entry)
              for entry in conll_data2.split('\n\n') if entry]
    ppdp = ProbabilisticProjectiveDependencyParser()
    print('Training Probabilistic Projective Dependency Parser...')
    ppdp.train(graphs)
    sent = ['Cathy', 'zag', 'hen', 'wild', 'zwaaien', '.']
    print('Parsing \'', " ".join(sent), '\'...')
    parse = ppdp.parse(sent)
    print('Parse:')
    print(parse[0])
def projective_prob_parse_demo():
    """
    A demo showing the training and use of a projective
    dependency parser.
    """
    graphs = [DependencyGraph(entry)
              for entry in conll_data2.split('\n\n') if entry]
    ppdp = ProbabilisticProjectiveDependencyParser()
    print('Training Probabilistic Projective Dependency Parser...')
    ppdp.train(graphs)
    sent = ['Cathy', 'zag', 'hen', 'wild', 'zwaaien', '.']
    print('Parsing \'', " ".join(sent), '\'...')
    print('Parse:')
    for tree in ppdp.parse(sent):
    	print(tree)
Пример #8
0
def projective_prob_parse_demo():
    """
    A demo showing the training and use of a projective
    dependency parser.
    """
    from nltk.parse.dependencygraph import conll_data2

    graphs = [DependencyGraph(entry) for entry in conll_data2.split("\n\n") if entry]
    ppdp = ProbabilisticProjectiveDependencyParser()
    print("Training Probabilistic Projective Dependency Parser...")
    ppdp.train(graphs)

    sent = ["Cathy", "zag", "hen", "wild", "zwaaien", "."]
    print("Parsing '", " ".join(sent), "'...")
    print("Parse:")
    for tree in ppdp.parse(sent):
        print(tree)