Word

class corpustools.corpus.classes.lexicon.Word(update=False, **kwargs)[source]

An object representing a word in a corpus

Information about the attributes are contained in the Corpus’ attributes.

Attributes

spelling (str) A representation of a word that lacks phonological information.
transcription (Transcription) A representation of a word that includes phonological information.
frequency (float) Token frequency in a corpus

Methods

__init__([update])
add_abstract_tier(tier_name, tier_segments) Add an abstract tier to the Word
add_attribute(tier_name, value) Add an arbitrary attribute to the Word
add_tier(tier_name, tier_segments) Adds a new tier attribute to the Word
enumerate_symbols(tier_name[, reversed])
get_len(tier_name)
initDefaults()
remove_attribute(attribute_name) Deletes a tier attribute from a Word
update(old_word)
variants([sequence_type]) Get variants and frequencies for a Word
add_abstract_tier(tier_name, tier_segments)[source]

Add an abstract tier to the Word

Parameters:

tier_name : str

Attribute name

tier_segments: dict

Dictionary with keys of the abstract segments (i.e., ‘C’ or ‘V’) and values that are sets of segments

add_attribute(tier_name, value)[source]

Add an arbitrary attribute to the Word

Parameters:

tier_name : str

Attribute name

value: object

Attribute value

add_tier(tier_name, tier_segments)[source]

Adds a new tier attribute to the Word

Parameters:

tier_name : str

Name for the new tier

tier_segments: list of segments

Segments that count for inclusion in the tier

remove_attribute(attribute_name)[source]

Deletes a tier attribute from a Word

Parameters:

attribute_name : str

Name of tier attribute to be deleted.

Notes

If attribute_name is not a valid attribute, this function does nothing. It does not raise an error.

variants(sequence_type='transcription')[source]

Get variants and frequencies for a Word

Parameters:

sequence_type : str, optional

Tier name to get variants

Returns:

dict

Dictionary with keys of Transcriptions and values of their frequencies