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)
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)
def gexf_export_from_graph(graph, path="test.gexf", labels=None): scores = _pagerank_weighted_scipy(graph) _write_gexf(graph, scores, path, labels)