home << dhlab reference << dhlab.api.nb_ngram_api

make_word_graph#

from dhlab.api.nb_ngram_api import make_word_graph
make_word_graph(words, corpus='all', cutoff=16, leaves=0)[source]#

Get galaxy from ngram-database.

Call the GALAXY_API endpoint.

Parameters:
  • words (str) – comma-separated string of words

  • corpus (str) – document type: 'book', 'avis', or 'all',

  • cutoff (int) – Number of nodes to include.

  • leaves (int) – Set leaves=1 to get the leaves.

Returns:

A networkx.DiGraph with the results.

Return type:

DiGraph