dhlab.ngram.nb_ngram

Module Contents

Functions

nb_ngram

Extract N-gram frequencies from given terms and years. lang param is not supported for corpus=avis and will be set to None if avis is passed.

ngram_conv_old

Construct a dataframe with ngram mean frequencies per year over a given time period.

ngram_conv

Construct a dataframe with ngram mean frequencies per year over a given time period.

API

dhlab.ngram.nb_ngram.nb_ngram(terms: str, corpus: str = 'bok', smooth: int = 1, years: tuple = (1810, 2010), mode: str = 'relative', lang: str = 'nob')

Extract N-gram frequencies from given terms and years. lang param is not supported for corpus=avis and will be set to None if avis is passed.

The lang param is not supported for corpus="avis" and will be set to None if avis is passed.

Returns: A sorted Pandas DataFrame indexed by year, with columns for each term.

dhlab.ngram.nb_ngram.ngram_conv_old(ngrams, smooth: int = 1, years: tuple = (1810, 2013), mode: str = 'relative') pandas.DataFrame

Construct a dataframe with ngram mean frequencies per year over a given time period.

dhlab.ngram.nb_ngram.ngram_conv(ngrams, smooth: int = 1, years: tuple = (1810, 2013), mode: str = 'relative') pandas.DataFrame

Construct a dataframe with ngram mean frequencies per year over a given time period.

Args: ngrams: To be filled in. smooth: Smoothing factor for the graph visualisation. years: Tuple with start and end years for the time period of interest mode: Frequency measure.

Returns: pandas dataframe with mean values for each year