Segment¶
-
class
corpustools.corpus.classes.lexicon.
Segment
(symbol)[source]¶ Class for segment symbols
Parameters: symbol : str
Segment symbol
Attributes
features (dict) Feature specification for the segment Methods
__init__
(symbol)feature_match
(specification)Return true if segment matches specification, false otherwise. minimal_difference
(other, features)Check if this segment is a minimal feature difference with another specify
(feature_dict)Specify a segment with a new feature specification -
feature_match
(specification)[source]¶ Return true if segment matches specification, false otherwise.
Parameters: specification : object
Specification can be a single feature value ‘+feature’, a list of feature values [‘+feature1’,’-feature2’], or a dictionary of features and values {‘feature1’: ‘+’, ‘feature2’: ‘-‘}
Returns: bool
True if this segment contains the feature values in the specification
-
minimal_difference
(other, features)[source]¶ Check if this segment is a minimal feature difference with another segment (ignoring some features)
Parameters: other : Segment
Segment to compare with
features : list
Features that are allowed to vary between the two segments
Returns: bool
True if all features other than the specified ones match, False otherwise
-