Segment

class corpustools.corpus.classes.lexicon.Segment(symbol, features=None)[source]

Class for segment symbols

Parameters:

symbol : str

Segment symbol

Attributes

_features (dict) Feature specification for the segment

Methods

__init__(symbol[, features])
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

specify(feature_dict)[source]

Specify a segment with a new feature specification

Parameters:

feature_dict : dict

Feature specification