Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
stannam committed Dec 21, 2021
2 parents 686d466 + 99ab515 commit f928382
Show file tree
Hide file tree
Showing 3 changed files with 25 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
5 changes: 5 additions & 0 deletions corpustools/corpus/classes/spontaneous.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ def add_word(self, wordtoken):
wordtoken.add_attribute(a.name, a.default_value)
a.update_range(getattr(wordtoken,a.name))

added_default_var = False
if wordtoken.transcription is not None:
added_default_var = self.lexicon.update_inventory(wordtoken.transcription)
return added_default_var

def add_attribute(self, attribute, initialize_defaults = False):
"""
Add an Attribute of any type to the Discourse or replace an existing Attribute.
Expand Down
12 changes: 12 additions & 0 deletions corpustools/gui/psgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,19 @@ def __init__(self, parent, settings, recents, saved, corpus, inventory, showTool
self.pslayout.addWidget(filterFrame)

self.psFrame.setLayout(self.pslayout)

psTempnote_Frame = QFrame()
notelayout = QVBoxLayout()
temp_note = QLabel(text=('* Currently, PCT cannot search for symbols that are only found in '
'pronunciation variants.\n* Even if you can select one from the inventory table,'
' searching for a variant-only segment returns 0.'))
note_font = QFont()
note_font.setPointSize(12)
temp_note.setFont(note_font)
notelayout.addWidget(temp_note)
psTempnote_Frame.setLayout(notelayout)
self.layout().insertWidget(0, self.psFrame)
self.layout().insertWidget(1, psTempnote_Frame)

self.progressDialog.setWindowTitle('Searching')

Expand Down

0 comments on commit f928382

Please sign in to comment.