Anchor-annotator 0.6.0__py3-none-any.whl → 0.7.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {Anchor_annotator-0.6.0.dist-info → Anchor_annotator-0.7.0.dist-info}/METADATA +1 -1
- Anchor_annotator-0.7.0.dist-info/RECORD +22 -0
- {Anchor_annotator-0.6.0.dist-info → Anchor_annotator-0.7.0.dist-info}/WHEEL +1 -1
- anchor/_version.py +2 -2
- anchor/db.py +1 -0
- anchor/main.py +25 -2
- anchor/models.py +103 -58
- anchor/plot.py +383 -360
- anchor/settings.py +9 -3
- anchor/ui_main_window.py +10 -0
- anchor/undo.py +18 -18
- anchor/widgets.py +26 -12
- anchor/workers.py +2483 -2462
- Anchor_annotator-0.6.0.dist-info/RECORD +0 -22
- {Anchor_annotator-0.6.0.dist-info → Anchor_annotator-0.7.0.dist-info}/LICENSE +0 -0
- {Anchor_annotator-0.6.0.dist-info → Anchor_annotator-0.7.0.dist-info}/top_level.txt +0 -0
anchor/settings.py
CHANGED
@@ -116,6 +116,8 @@ class AnchorSettings(QtCore.QSettings):
|
|
116
116
|
CLUSTERING_DISTANCE_THRESHOLD = "anchor/clustering/distance_threshold"
|
117
117
|
CLUSTERING_METRIC = "anchor/clustering/metric"
|
118
118
|
|
119
|
+
PLOT_THREAD_COUNT = "anchor/plot/max_thread_count"
|
120
|
+
|
119
121
|
PITCH_MAX_TIME = "anchor/pitch/max_time"
|
120
122
|
PITCH_MIN_F0 = "anchor/pitch/min_f0"
|
121
123
|
PITCH_MAX_F0 = "anchor/pitch/max_f0"
|
@@ -218,6 +220,7 @@ class AnchorSettings(QtCore.QSettings):
|
|
218
220
|
AnchorSettings.TIER_TRANSCRIBED_WORDS_VISIBLE: True,
|
219
221
|
AnchorSettings.TIER_TRANSCRIBED_PHONES_VISIBLE: True,
|
220
222
|
AnchorSettings.THEME_PRESET: "MFA",
|
223
|
+
AnchorSettings.PLOT_THREAD_COUNT: 10,
|
221
224
|
}
|
222
225
|
self.default_values.update(self.mfa_theme)
|
223
226
|
self.border_radius = 5
|
@@ -264,9 +267,10 @@ class AnchorSettings(QtCore.QSettings):
|
|
264
267
|
super(AnchorSettings, self).value(arg__1, self.default_values[arg__1])
|
265
268
|
)
|
266
269
|
elif "color" in arg__1:
|
267
|
-
value =
|
268
|
-
|
269
|
-
|
270
|
+
value = super(AnchorSettings, self).value(arg__1, self.default_values[arg__1])
|
271
|
+
if value is None:
|
272
|
+
value = self.default_values[arg__1]
|
273
|
+
value = QtGui.QColor(value)
|
270
274
|
elif "keybind" in arg__1:
|
271
275
|
value = QtGui.QKeySequence(
|
272
276
|
super(AnchorSettings, self).value(arg__1, self.default_values[arg__1])
|
@@ -319,6 +323,8 @@ class AnchorSettings(QtCore.QSettings):
|
|
319
323
|
|
320
324
|
def set_theme(self, theme):
|
321
325
|
for k, v in theme.items():
|
326
|
+
if v is None:
|
327
|
+
continue
|
322
328
|
self.setValue(k, v)
|
323
329
|
self.sync()
|
324
330
|
self.themeUpdated.emit()
|
anchor/ui_main_window.py
CHANGED
@@ -262,6 +262,8 @@ class Ui_MainWindow(object):
|
|
262
262
|
self.segmentUtteranceAct.setIcon(icon6)
|
263
263
|
self.openCorpusManagerAct = QAction(MainWindow)
|
264
264
|
self.openCorpusManagerAct.setObjectName("openCorpusManagerAct")
|
265
|
+
self.verifyTranscriptsAct = QAction(MainWindow)
|
266
|
+
self.verifyTranscriptsAct.setObjectName("verifyTranscriptsAct")
|
265
267
|
self.centralwidget = QWidget(MainWindow)
|
266
268
|
self.centralwidget.setObjectName("centralwidget")
|
267
269
|
self.verticalLayout_4 = QVBoxLayout(self.centralwidget)
|
@@ -663,6 +665,14 @@ class Ui_MainWindow(object):
|
|
663
665
|
QCoreApplication.translate("MainWindow", "Manage corpora and models", None)
|
664
666
|
)
|
665
667
|
# endif // QT_CONFIG(tooltip)
|
668
|
+
self.verifyTranscriptsAct.setText(
|
669
|
+
QCoreApplication.translate("MainWindow", "Verify transcripts", None)
|
670
|
+
)
|
671
|
+
# if QT_CONFIG(tooltip)
|
672
|
+
self.verifyTranscriptsAct.setToolTip(
|
673
|
+
QCoreApplication.translate("MainWindow", "Verify transcripts", None)
|
674
|
+
)
|
675
|
+
# endif // QT_CONFIG(tooltip)
|
666
676
|
self.menuCorpus.setTitle(QCoreApplication.translate("MainWindow", "Corpus", None))
|
667
677
|
self.loadRecentCorpusMenu.setTitle(
|
668
678
|
QCoreApplication.translate("MainWindow", "Load a recent corpus", None)
|
anchor/undo.py
CHANGED
@@ -427,28 +427,26 @@ class UpdateUtteranceTextCommand(FileCommand):
|
|
427
427
|
"UpdateUtteranceTextCommand", "Update utterance text"
|
428
428
|
)
|
429
429
|
)
|
430
|
+
self.tokenizer = self.corpus_model.corpus.get_tokenizer(
|
431
|
+
self.corpus_model.corpus.get_dict_id_for_speaker(
|
432
|
+
self.corpus_model.get_speaker_name(self.speaker_id)
|
433
|
+
)
|
434
|
+
)
|
430
435
|
|
431
|
-
def
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
self.utterance.text = self.new_text
|
437
|
-
self.utterance.normalized_text = self.new_text # FIXME: Update this
|
436
|
+
def _process_text(self, session, text: str):
|
437
|
+
self.utterance.text = text
|
438
|
+
normalized_text, normalized_character_text, oovs = self.tokenizer(text)
|
439
|
+
self.utterance.normalized_text = normalized_text
|
440
|
+
self.utterance.normalized_character_text = normalized_character_text
|
438
441
|
self.utterance.oovs = " ".join(oovs)
|
439
|
-
self.utterance.ignored = not
|
442
|
+
self.utterance.ignored = not text
|
440
443
|
session.merge(self.utterance)
|
441
444
|
|
445
|
+
def _redo(self, session) -> None:
|
446
|
+
self._process_text(session, self.new_text)
|
447
|
+
|
442
448
|
def _undo(self, session) -> None:
|
443
|
-
|
444
|
-
for w in self.new_text.split():
|
445
|
-
if not self.corpus_model.dictionary_model.check_word(w, self.speaker_id):
|
446
|
-
oovs.add(w)
|
447
|
-
self.utterance.text = self.old_text
|
448
|
-
self.utterance.normalized_text = self.old_text # FIXME: Update this
|
449
|
-
self.utterance.oovs = " ".join(oovs)
|
450
|
-
self.utterance.ignored = not self.old_text
|
451
|
-
session.merge(self.utterance)
|
449
|
+
self._process_text(session, self.old_text)
|
452
450
|
|
453
451
|
def id(self) -> int:
|
454
452
|
return 1
|
@@ -767,7 +765,9 @@ class AddPronunciationCommand(DictionaryCommand):
|
|
767
765
|
|
768
766
|
def _redo(self, session) -> None:
|
769
767
|
if self.word_id is None:
|
770
|
-
|
768
|
+
q = session.query(Word.id).filter(Word.word == self.word).first()
|
769
|
+
if q is not None:
|
770
|
+
self.word_id = q[0]
|
771
771
|
if self.word_id is None:
|
772
772
|
self.word_id = session.query(sqlalchemy.func.max(Word.id)).scalar() + 1
|
773
773
|
word_mapping_id = (
|
anchor/widgets.py
CHANGED
@@ -1160,7 +1160,7 @@ class SearchBox(ClearableField):
|
|
1160
1160
|
def query(self) -> TextFilterQuery:
|
1161
1161
|
filter = TextFilterQuery(
|
1162
1162
|
super().text(),
|
1163
|
-
self.regex_action.isChecked()
|
1163
|
+
self.regex_action.isChecked(),
|
1164
1164
|
self.word_action.isChecked(),
|
1165
1165
|
self.case_action.isChecked(),
|
1166
1166
|
)
|
@@ -2115,7 +2115,7 @@ class OovTableView(AnchorTableView):
|
|
2115
2115
|
|
2116
2116
|
def generate_context_menu(self, location):
|
2117
2117
|
menu = QtWidgets.QMenu()
|
2118
|
-
|
2118
|
+
menu.setStyleSheet(self.settings.menu_style_sheet)
|
2119
2119
|
menu.addAction(self.add_pronunciation_action)
|
2120
2120
|
menu.exec_(self.mapToGlobal(location))
|
2121
2121
|
|
@@ -2174,7 +2174,7 @@ class DictionaryTableView(AnchorTableView):
|
|
2174
2174
|
|
2175
2175
|
def generate_context_menu(self, location):
|
2176
2176
|
menu = QtWidgets.QMenu()
|
2177
|
-
|
2177
|
+
menu.setStyleSheet(self.settings.menu_style_sheet)
|
2178
2178
|
menu.addAction(self.add_pronunciation_action)
|
2179
2179
|
menu.addSeparator()
|
2180
2180
|
menu.addAction(self.delete_words_action)
|
@@ -2950,9 +2950,13 @@ class AlignmentWidget(QtWidgets.QWidget):
|
|
2950
2950
|
def __init__(self, *args):
|
2951
2951
|
super().__init__(*args)
|
2952
2952
|
self.button = QtWidgets.QToolButton()
|
2953
|
-
|
2953
|
+
self.verify_button = QtWidgets.QToolButton()
|
2954
|
+
form_layout = QtWidgets.QFormLayout()
|
2955
|
+
button_layout = QtWidgets.QHBoxLayout()
|
2956
|
+
layout = QtWidgets.QVBoxLayout()
|
2954
2957
|
self.acoustic_model_label = QtWidgets.QLabel("Not loaded")
|
2955
2958
|
self.dictionary_label = QtWidgets.QLabel("Not loaded")
|
2959
|
+
self.interjection_word_label = QtWidgets.QLabel("Not loaded")
|
2956
2960
|
self.fine_tune_check = QtWidgets.QCheckBox()
|
2957
2961
|
self.beam = QtWidgets.QSpinBox()
|
2958
2962
|
self.beam.setMinimum(6)
|
@@ -2965,14 +2969,18 @@ class AlignmentWidget(QtWidgets.QWidget):
|
|
2965
2969
|
self.silence_boost = ThresholdWidget()
|
2966
2970
|
self.silence_boost.setText("1.0")
|
2967
2971
|
self.cutoff_check = QtWidgets.QCheckBox()
|
2968
|
-
|
2969
|
-
|
2970
|
-
|
2971
|
-
|
2972
|
-
|
2973
|
-
|
2974
|
-
|
2975
|
-
|
2972
|
+
form_layout.addRow(QtWidgets.QLabel("Acoustic model"), self.acoustic_model_label)
|
2973
|
+
form_layout.addRow(QtWidgets.QLabel("Dictionary"), self.dictionary_label)
|
2974
|
+
form_layout.addRow(QtWidgets.QLabel("Beam"), self.beam)
|
2975
|
+
form_layout.addRow(QtWidgets.QLabel("Retry beam"), self.retry_beam)
|
2976
|
+
form_layout.addRow(QtWidgets.QLabel("Silence boost factor"), self.silence_boost)
|
2977
|
+
form_layout.addRow(QtWidgets.QLabel("Fine tune"), self.fine_tune_check)
|
2978
|
+
form_layout.addRow(QtWidgets.QLabel("Cutoff modeling"), self.cutoff_check)
|
2979
|
+
form_layout.addRow(QtWidgets.QLabel("Interjection words"), self.interjection_word_label)
|
2980
|
+
layout.addLayout(form_layout)
|
2981
|
+
button_layout.addWidget(self.button)
|
2982
|
+
button_layout.addWidget(self.verify_button)
|
2983
|
+
layout.addLayout(button_layout)
|
2976
2984
|
self.text = QtWidgets.QTextEdit()
|
2977
2985
|
self.text.setReadOnly(True)
|
2978
2986
|
layout.addWidget(self.text)
|
@@ -2981,6 +2989,10 @@ class AlignmentWidget(QtWidgets.QWidget):
|
|
2981
2989
|
|
2982
2990
|
def refresh(self):
|
2983
2991
|
validate_enabled = True
|
2992
|
+
num_interjection_words = self.corpus_model.get_interjection_count()
|
2993
|
+
self.interjection_word_label.setText(str(num_interjection_words))
|
2994
|
+
if self.verify_button.defaultAction() is not None:
|
2995
|
+
self.verify_button.defaultAction().setEnabled(num_interjection_words > 0)
|
2984
2996
|
if self.corpus_model.has_dictionary:
|
2985
2997
|
self.dictionary_label.setText(self.corpus_model.corpus.dictionary_model.name)
|
2986
2998
|
else:
|
@@ -2999,6 +3011,7 @@ class AlignmentWidget(QtWidgets.QWidget):
|
|
2999
3011
|
self.refresh()
|
3000
3012
|
self.corpus_model.dictionaryChanged.connect(self.refresh)
|
3001
3013
|
self.corpus_model.acousticModelChanged.connect(self.refresh)
|
3014
|
+
self.corpus_model.corpusLoaded.connect(self.refresh)
|
3002
3015
|
|
3003
3016
|
def parameters(self):
|
3004
3017
|
return {
|
@@ -3279,6 +3292,7 @@ class SpeakerWidget(QtWidgets.QWidget):
|
|
3279
3292
|
session.query(Speaker.id).filter(Speaker.name == speaker_id).first()
|
3280
3293
|
)
|
3281
3294
|
if actual_speaker_id is None:
|
3295
|
+
self.speaker_model.set_speaker_filter(speaker_id)
|
3282
3296
|
return
|
3283
3297
|
self.speaker_dropdown.completions[speaker_id] = actual_speaker_id[0]
|
3284
3298
|
speaker_id = actual_speaker_id[0]
|