Skip to content

Commit

Permalink
working on #792 -- merged inv table for now.
Browse files Browse the repository at this point in the history
For now, this just adds all variant segments. Eventually, need to have different tables for phonetic, phonological and total inventory (but after the release).
  • Loading branch information
stannam committed Dec 7, 2021
1 parent f1ba665 commit de22852
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion corpustools/corpus/classes/lexicon.py
Original file line number Diff line number Diff line change
Expand Up @@ -3269,6 +3269,13 @@ def add_word(self, word, allow_duplicates=False):
#in this case, the symbol has been given a default value of 'n' for every feature
word.transcription._list = [self.inventory[x].symbol for x in word.transcription._list]

# make shift code for adding variant segs to the inventory. Need to be removed eventually
added_default_var = False
for alt_trans in word.alt_transcriptions:
if getattr(word, alt_trans) is not None:
added_default_var = self.update_inventory(getattr(word, alt_trans))
word.transcription._list = [self.inventory[x].symbol for x in word.transcription._list]

for d in word.descriptors:
if d not in self._attributes:
if isinstance(getattr(word, d), str):
Expand All @@ -3284,7 +3291,7 @@ def add_word(self, word, allow_duplicates=False):
word.add_attribute(a.name, a.default_value)
a.update_range(getattr(word, a.name))

return added_default
return added_default or added_default_var

def update_features(self):
for seg in self.inventory:
Expand Down

0 comments on commit de22852

Please sign in to comment.