Beispiel #1
0
def create_graph_with_filters(triplet_filters, group_filters):
    nlp = bg.load_danish()
    bp = bg.BeliefParser(nlp=nlp)

    graph = bg.BeliefGraph(parser=bp, triplet_filters=[], group_filters=[])
    graph.add_texts(EXAMPLES)
    graph.replace_filters(triplet_filters=triplet_filters,
                          group_filters=group_filters)
    return graph
Beispiel #2
0
def test_belief_parser():
    nlp = bg.load_danish()
    belief_parser = bg.BeliefParser(nlp=nlp)
    triplets = belief_parser.parse_texts(EXAMPLE)

    assert isinstance(triplets, Iterable)

    triplets = list(triplets)
    assert isinstance(triplets[0], bg.BeliefTriplet)

    for t in triplets:
        print(t)
def simple_graph():
    nlp = bg.load_danish()
    bp = bg.BeliefParser(nlp=nlp)

    graph = bg.BeliefGraph(parser=bp, triplet_filters=[], group_filters=[])
    return graph