Attribute¶
- class corpustools.corpus.classes.lexicon.Attribute(name, att_type, display_name=None, default_value=None, is_default=False)[source]¶
Attributes are for collecting summary information about attributes of Words or WordTokens, with different types of attributes allowing for different behaviour
- Parameters
- namestr
Python-safe name for using getattr and setattr on Words and WordTokens
- att_typestr
Either ‘spelling’, ‘tier’, ‘numeric’ or ‘factor’
- display_namestr
Human-readable name of the Attribute, defaults to None
- default_valueobject
Default value for initializing the attribute
- Attributes
- namestring
Python-readable name for the Attribute on Word and WordToken objects
- display_namestring
Human-readable name for the Attribute
- default_valueobject
Default value for the Attribute. The type of default_value is dependent on the attribute type. Numeric Attributes have a float default value. Factor and Spelling Attributes have a string default value. Tier Attributes have a Transcription default value.
- rangeobject
Range of the Attribute, type depends on the attribute type. Numeric Attributes have a tuple of floats for the range for the minimum and maximum. The range for Factor Attributes is a set of all factor levels. The range for Tier Attributes is the set of segments in that tier across the corpus. The range for Spelling Attributes is None.
Methods
__init__
(name, att_type[, display_name, ...])guess_type
(values[, trans_delimiters])Guess the attribute type for a sequence of values
sanitize_name
(name)Sanitize a display name into a Python-readable attribute name
update_range
(value)Update the range of the Attribute with the value specified.