示例#1
0
def gexf_export(text, language="english", path="test.gexf", labels=None, by_sentence=True, by_word=False):
    if (by_sentence and by_word) or (not by_sentence and not by_word):
        raise TypeError("Must select one and only one of by_sentence or by_word")
    if labels is None:
        labels = _get_labels(text, language, by_sentence)

    graph = _get_sentence_graph(text, language) if by_sentence else _get_word_graph(text, language)
    scores = _pagerank_weighted_scipy(graph)
    _write_gexf(graph, scores, path, labels)
示例#2
0
def gexf_export(text,
                language="english",
                path="test.gexf",
                labels=None,
                by_sentence=True,
                by_word=False):
    if (by_sentence and by_word) or (not by_sentence and not by_word):
        raise TypeError(
            "Must select one and only one of by_sentence or by_word")
    if labels is None:
        labels = _get_labels(text, language, by_sentence)

    graph = _get_sentence_graph(
        text, language) if by_sentence else _get_word_graph(text, language)
    scores = _pagerank_weighted_scipy(graph)
    _write_gexf(graph, scores, path, labels)
示例#3
0
def gexf_export_from_graph(graph, path="test.gexf", labels=None):
    scores = _pagerank_weighted_scipy(graph)
    _write_gexf(graph, scores, path, labels)
示例#4
0
def gexf_export_from_graph(graph, path="test.gexf", labels=None):
    scores = _pagerank_weighted_scipy(graph)
    _write_gexf(graph, scores, path, labels)