- 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.
data : dict, optional
Mapping from segment symbol to Segment objects
_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_features : 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
Given a feature description, return the segments in the inventory
Takes an InventoryModel as input, and updates attributes.
Get all combinations of
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’.
feature_description : string or list
Feature values that specify the segments, see above for format
list of Segments
Segments that match the feature description
Takes an InventoryModel as input, and updates attributes. This is called in main.py in saveCorpus().
Get all combinations of
List of valid feature strings