BaseCorpusContext

class corpustools.contextmanagers.BaseCorpusContext(corpus, sequence_type, type_or_token, attribute=None, frequency_threshold=0, log_count=True)[source]

Abstract Corpus context class that all other contexts inherit from.

Parameters
corpusCorpus

Corpus to form context from

sequence_typestr

Sequence type to evaluate algorithms on (i.e., ‘transcription’)

type_or_tokenstr

The type of frequency to use for calculations

attributeAttribute, optional

Attribute to save results to for calculations involving all words in the Corpus

frequency_threshold: float, optional

If specified, ignore words below this token frequency

Methods

__init__(corpus, sequence_type, type_or_token)

get_frequency_base([gramsize, halve_edges, ...])

Generate (and cache) frequencies for each segment in the Corpus.

get_phone_probs([gramsize, probability, ...])

Generate (and cache) phonotactic probabilities for segments in the Corpus.