# Inventory¶

class corpustools.corpus.classes.lexicon.Inventory(data=None)[source]

Inventories contain information about a Corpus’ segmental inventory. In many cases, they are similar to FeatureMatrices, but more tailored to a specific corpus. Where a FeatureMatrix would deal in feature specifications, inventories will deal primarily in sets of segments.

Parameters: data : dict, optional Mapping from segment symbol to Segment objects

Attributes

 features (list) List of all features used as specifications for segments possible_values (set) Set of values that segments use for features stresses (dict) Mapping of stress values to segments that bear that stress places (dict) Mapping from place of articulation labels to sets of segments manners (dict) Mapping from manner of articulation labels to sets of segments height (dict) Mapping from vowel height labels to sets of segments backness (dict) Mapping from vowel backness labels to sets of segments vowel_feature (str) Feature value (i.e., ‘+voc’) that separates vowels from consonants voice_feature (str) Feature value (i.e., ‘+voice’) that codes voiced obstruents diph_feature (str) Feature value (i.e., ‘+diphthong’ or ‘.high’) that separates diphthongs from monophthongs rounded_feature (str) Feature value (i.e., ‘+round’) that codes rounded vowels

Methods

 __init__([data]) categorize(seg) Categorize a segment into consonant/vowel, place of articulation, manner of articulation, voicing, vowel height, vowel backness, and vowel rounding. features_to_segments(feature_description) Given a feature description, return the segments in the inventory find_min_feature_pairs(features[, others]) Find sets of segments that differ only in certain features, get_redundant_features(features[, others]) Autodetects redundent features, with the ability to subset items() keys() specify(specifier) Specify segments in the inventory using a FeatureMatrix valid_feature_strings() Get all combinations of possible_values and features values()
categorize(seg)[source]

Categorize a segment into consonant/vowel, place of articulation, manner of articulation, voicing, vowel height, vowel backness, and vowel rounding.

For consonants, the category is of the format:

(‘Consonant’, PLACE, MANNER, VOICING)

For vowels, the category is of the format:

(‘Vowel’, HEIGHT, BACKNESS, ROUNDED)

Diphthongs are categorized differently:

(‘Diphthong’, ‘Vowel’)

Parameters: seg : Segment Segment to categorize tuple or None Returns categories according to the formats above, if any are unable to be calculated, returns None in those places. Returns None if a category cannot be found.
features_to_segments(feature_description)[source]

Given a feature description, return the segments in the inventory that match that feature description

Feature descriptions should be either lists, such as [‘+feature1’, ‘-feature2’] or strings that can be separated into lists by ‘,’, such as ‘+feature1,-feature2’.

Parameters: feature_description : string or list Feature values that specify the segments, see above for format list of Segments Segments that match the feature description
find_min_feature_pairs(features, others=None)[source]

Find sets of segments that differ only in certain features, optionally limited by a feature specification

Parameters: features : list List of features (i.e. ‘back’ or ‘round’) others : list, optional Feature specification to limit sets dict Dictionary with keys that correspond to the values of features and values that are the set of segments with those feature values
get_redundant_features(features, others=None)[source]

Autodetects redundent features, with the ability to subset the segments

Parameters: features : list List of features to find other features that consistently covary with them others : list, optional Feature specification that specifies a subset to look at list List of redundant features
specify(specifier)[source]

Specify segments in the inventory using a FeatureMatrix

Parameters: specifier : FeatureMatrix Specifier to use for updating feature specifications
valid_feature_strings()[source]

Get all combinations of possible_values and features

Returns: list List of valid feature strings