Inventory

class corpustools.corpus.classes.lexicon.Inventory(update=False)[source]

Inventories contain information about a Corpus’ segmental inventory. This class exists mainly for the purposes of saving and loading user data. When a user loads a corpus into PCT, the Inventory is passed to the constructor of an InventoryModel (corpustoolsguimodels). The InventoryModel is what the user will interact with, and it has several useful functions for analyzing, modifying and sorting the contents of an inventory. The InventoryModel is also connected with an InventoryView (corpustoolsgui

iews) for the purposes of displaying inventory charts in PCT.

User data is saved using Python’s built-in pickle module. However, Qt objects (like the InventoryModel) cannot be pickled. Instead, the data from the model is copied to this Inventory class, which is a native Python object and can be properly pickled.

Parameters
datadict, optional

Mapping from segment symbol to Segment objects

Attributes
_featureslist

List of all _features used as specifications for segments

possible_valuesset

Set of values that segments use for _features

stressesdict

Mapping of stress values to segments that bear that stress

placesdict

Mapping from place of articulation labels to sets of segments

mannersdict

Mapping from manner of articulation labels to sets of segments

heightdict

Mapping from vowel height labels to sets of segments

backnessdict

Mapping from vowel backness labels to sets of segments

vowel_featuresstr

Feature value (i.e., ‘+voc’) that separates vowels from consonants

voice_featurestr

Feature value (i.e., ‘+voice’) that codes voiced obstruents

diph_featurestr

Feature value (i.e., ‘+diphthong’ or ‘.high’) that separates diphthongs from monophthongs

rounded_featurestr

Feature value (i.e., ‘+round’) that codes rounded vowels

Methods

__init__([update])

features_to_segments(feature_description)

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

initDefaults()

items()

keys()

save(model)

Takes an InventoryModel as input, and updates attributes.

update(source)

update_features(specifier)

valid_feature_strings()

Get all combinations of possible_values and _features

values()