module_dependencies
The module_dependencies
Python module can be used to determine which sections of some arbitrary Python module are most frequently used,
allowing you to prioritise your development efforts appropriately. For example:
>>> from module_dependencies import Module
>>> module = Module ( "nltk" , count = 1000 )
>>> module . plot ()
nltk tokenize corpus download stem tag translate data probability tree classify util metrics sentiment chunk CFG grammar text sem collocations __version__ twitter RegexpParser cluster parse ChartParser ConditionalFreqDist TextCollection draw help clean_html downloader flatten lm RegexpTagger RecursiveDescentParser casual_tokenize raise_error MaxentClassifier everygrams WhitespaceTokenizer wsd model featstruct MLEProbDist FeatureChartParser BigramCollocationFinder ChunkParserI DecisionTreeClassifier ConditionalProbDist trigrams LidstoneProbDist Production word_tokenize sent_tokenize RegexpTokenizer TweetTokenizer treebank regexp wordpunct_tokenize punkt toktok regexp_tokenize util api moses MWETokenizer sexpr stanford word TabTokenizer WhitespaceTokenizer blankline_tokenize stopwords wordnet brown gutenberg twitter_samples reuters movie_reviews words sentiwordnet treebank reader webtext cmudict ptb names subjectivity inaugural wordnet_ic util nps_chat conll2000 europarl_raw porter wordnet snowball lancaster isri SnowballStemmer RegexpStemmer pos_tag StanfordNERTagger perceptron BigramTagger UnigramTagger util TrigramTagger stanford StanfordPOSTagger api _pos_tag bleu_score AlignedSent IBMModel1 meteor meteor_score chrf_score gleu_score path load find ZipFilePathPointer FreqDist ELEProbDist MLEProbDist ConditionalFreqDist Tree bracket_parse naivebayes util accuracy scikitlearn maxent PositiveNaiveBayesClassifier decisiontree NaiveBayesClassifier ngrams bigrams skipgrams ingrams distance scores BigramAssocMeasures agreement interval_distance TrigramAssocMeasures association accuracy vader util SentimentAnalyzer ne_chunk tree2conlltags regexp util RegexpParser fromstring Nonterminal nonterminals is_terminal CFG is_nonterminal read_grammar Production FeatureGrammar standard_nonterm_parser Text logic BigramAssocMeasures TrigramCollocationFinder TrigramAssocMeasures AbstractCollocationFinder BigramCollocationFinder common TweetWriter TweetViewer Query Streamer Twitter credsfromfile util euclidean_distance KMeansClusterer DependencyGraph stanford generate CoreNLPParser BottomUpChartParser TreeWidget util upenn_tagset load Downloader build_index MLE Lidstone train lesk NgramModel Feature from_words train TreebankWordTokenizer TreebankWordDetokenizer WordPunctTokenizer PunktSentenceTokenizer PunktLanguageVars PunktTrainer ToktokTokenizer align_tokens string_span_tokenize TokenizerI MosesTokenizer sexpr_tokenize StanfordTokenizer words fileids sents raw extend readme synsets synset NOUN ADJ ADV VERB lemma all_synsets words morphy wup_similarity lemmas synset_from_pos_and_offset ADJ_SAT all_lemma_names langs path_similarity _synset_from_pos_and_offset get_version sents tagged_sents words fileids tagged_words append categories words fileids sents raw paras readme open strings abspath tokenized fileids fileids words categories raw sents readme words fileids raw words readme fileids senti_synsets get synset load tagged_sents parsed_sents fileids tagged_words sents wordnet api BracketParseCorpusReader Synset bracket_parse fileids raw sents words dict entries parsed_sents fileids words fileids readme sents fileids categories words fileids raw ic LazyCorpusLoader words chunked_sents german PorterStemmer WordNetLemmatizer SnowballStemmer EnglishStemmer LancasterStemmer ISRIStemmer languages PerceptronTagger untag StanfordPOSTagger StanfordNERTagger TaggerI corpus_bleu sentence_bleu SmoothingFunction closest_ref_length brevity_penalty modified_precision single_meteor_score sentence_chrf corpus_gleu append fromstring root NaiveBayesClassifier apply_features accuracy SklearnClassifier MaxentClassifier DecisionTreeClassifier edit_distance jaccard_distance masi_distance precision f_measure recall chi_sq pmi AnnotationTask chi_sq BigramAssocMeasures SentimentIntensityAnalyzer extract_unigram_feats mark_negation RegexpParser conlltags2tree fromstring ANY_TYPE ComplexType TRUTH_TYPE BasicType EntityType ApplicationExpression ConstantExpression Variable LogicParser from_words from_documents __init__ from_words from_documents json2csv json2csv_entities cosine_distance StanfordParser generate CanvasFrame
Beyond simply plotting this data, it can also be returned in machine-readable formats.
See the general Module documentation for more information.
Alternatively, module_dependencies
allows for determining the dependencies or imports of a given Python file, for example:
from module_dependencies import Source
from pprint import pprint
# This creates a Source instance for this file itself
src = Source . from_file ( __file__ )
pprint ( src . dependencies ())
pprint ( src . imports ())
This program outputs:
[ 'module_dependencies.Source.from_file' , 'pprint.pprint' ]
[ 'module_dependencies' , 'pprint' ]
See the general Source documentation for more information.
Furthermore, the general API Reference documentation has more examples and details on module_dependencies
.