Anchor-annotator 0.0.11__py3-none-any.whl → 0.2.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
- Name: Anchor-annotator
3
- Version: 0.0.11
2
+ Name: Anchor_annotator
3
+ Version: 0.2.0
4
4
  Summary: Anchor annotator is a program for inspecting corpora for the Montreal Forced Aligner and correcting transcriptions and pronunciations.
5
5
  Home-page: https://github.com/MontrealCorpusTools/Anchor-annotator
6
6
  Author: Montreal Corpus Tools
@@ -0,0 +1,21 @@
1
+ anchor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ anchor/__main__.py,sha256=5ufG8lcx2x1am-04xI991AG7saJd24dxPw5JzjmB878,45
3
+ anchor/_version.py,sha256=H-qsvrxCpdhaQzyddR-yajEqI71hPxLa4KxzpP3uS1g,411
4
+ anchor/command_line.py,sha256=xvuCWaPWNVZTg5Ic28qbOYsOLaFbodhBsoZHKJSBazs,482
5
+ anchor/db.py,sha256=ef4lO6HtCKoxC9CorIc0ZbPxKpjHa576a0ZIBOWNU9E,4956
6
+ anchor/main.py,sha256=ySas07cnXXBkANqIMHai7tjNwqa5mNd4UaIjh358GgE,114287
7
+ anchor/models.py,sha256=89gqY5qhhO_o_icMv23Zw43hrYP95WglsQNHOkXFs7M,88922
8
+ anchor/plot.py,sha256=wyQQR984vZrVVzB0AvPckJ1SWAQvkyCxQQGT2E0Ikig,107014
9
+ anchor/resources_rc.py,sha256=sQ6GvAK3NTVR5bvgR9jCWDeepSYOhEph2mg1ECxnMOs,3560262
10
+ anchor/settings.py,sha256=SJ9-5xjThJp3-zl99OBLWLSXZmsyUU1JNsgGWHlkJS8,46649
11
+ anchor/ui_error_dialog.py,sha256=c_QS0s1VaJEV9AhcrQZQyWHHpUPudWjJY1NI7Ytipio,3832
12
+ anchor/ui_main_window.py,sha256=aEABdKi1Eb1c2MKUsbCbufEp1lKSLFNsC9TPX244UPI,64618
13
+ anchor/ui_preferences.py,sha256=uer2Xzyq26j-5wwbIKKcK8YEe2w7OFJPXfWSkKcPWhI,40146
14
+ anchor/undo.py,sha256=okCDebeamNqSgRahxHjX8l0mcwqZhoQ6i-nOXbzLoZ4,34613
15
+ anchor/widgets.py,sha256=SdNKryO0nzrrmdHXIh3oO0KMkoexYEvExQlN0XL0oQg,135415
16
+ anchor/workers.py,sha256=-YPdxgZwZIGq8DPNFGD3oXZqFpruD6alEMMzHdvvVIE,170880
17
+ Anchor_annotator-0.2.0.dist-info/LICENSE,sha256=C0oIsblENEgWQ7XMNdYoXyXsIA5wa3YF0I9lK3H7A1s,1076
18
+ Anchor_annotator-0.2.0.dist-info/METADATA,sha256=dKWrW_uX2g3NRWdzRv8OXKKbTiN8tofwt4Oa09mbEI8,1500
19
+ Anchor_annotator-0.2.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
20
+ Anchor_annotator-0.2.0.dist-info/top_level.txt,sha256=wX6ZKxImGRZKFQjs3f6XYw_TfbAp6Xs3SmbLfLbFAJ0,7
21
+ Anchor_annotator-0.2.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.3)
2
+ Generator: bdist_wheel (0.43.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
anchor/_version.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.0.11'
16
- __version_tuple__ = version_tuple = (0, 0, 11)
15
+ __version__ = version = '0.2.0'
16
+ __version_tuple__ = version_tuple = (0, 2, 0)
anchor/main.py CHANGED
@@ -33,6 +33,8 @@ from anchor.models import (
33
33
  CorpusSelectionModel,
34
34
  DiarizationModel,
35
35
  DictionaryTableModel,
36
+ FileSelectionModel,
37
+ FileUtterancesModel,
36
38
  OovModel,
37
39
  SpeakerModel,
38
40
  )
@@ -489,9 +491,12 @@ class MainWindow(QtWidgets.QMainWindow):
489
491
  self.dictionary_model = DictionaryTableModel(self)
490
492
  self.oov_model = OovModel(self)
491
493
  self.corpus_model = CorpusModel(self)
494
+ self.file_utterances_model = FileUtterancesModel(self)
492
495
  self.speaker_model = SpeakerModel(self)
493
496
  self.diarization_model = DiarizationModel(self)
494
497
 
498
+ self.file_utterances_model.set_corpus_model(self.corpus_model)
499
+
495
500
  self.corpus_model.databaseSynced.connect(self.handle_changes_synced)
496
501
  self.corpus_model.runFunction.connect(self.execute_runnable)
497
502
  self.diarization_model.runFunction.connect(self.execute_runnable)
@@ -510,11 +515,15 @@ class MainWindow(QtWidgets.QMainWindow):
510
515
  self.diarization_model.set_corpus_model(self.corpus_model)
511
516
  self.oov_model.set_corpus_model(self.corpus_model)
512
517
  self.selection_model = CorpusSelectionModel(self.corpus_model)
518
+ self.file_selection_model = FileSelectionModel(self.file_utterances_model)
513
519
  self.ui.utteranceListWidget.set_models(
514
520
  self.corpus_model, self.selection_model, self.speaker_model
515
521
  )
516
522
  self.ui.utteranceDetailWidget.set_models(
517
- self.corpus_model, self.selection_model, self.dictionary_model
523
+ self.corpus_model,
524
+ self.file_utterances_model,
525
+ self.file_selection_model,
526
+ self.dictionary_model,
518
527
  )
519
528
  self.ui.speakerWidget.set_models(
520
529
  self.corpus_model, self.selection_model, self.speaker_model
@@ -526,17 +535,25 @@ class MainWindow(QtWidgets.QMainWindow):
526
535
  self.ui.dictionaryWidget.set_models(self.dictionary_model)
527
536
  self.ui.diarizationWidget.set_models(self.diarization_model, self.selection_model)
528
537
  self.ui.oovWidget.set_models(self.oov_model)
529
- self.selection_model.currentUtteranceChanged.connect(self.change_utterance)
530
- self.selection_model.fileChanged.connect(self.change_file)
538
+ self.file_selection_model.currentUtteranceChanged.connect(self.change_utterance)
539
+ self.selection_model.fileViewRequested.connect(self.file_selection_model.set_current_file)
540
+ self.file_selection_model.fileChanged.connect(self.change_file)
531
541
  self.selection_model.fileAboutToChange.connect(self.check_media_stop)
532
- self.media_player.set_corpus_models(self.corpus_model, self.selection_model)
542
+ self.media_player.set_models(self.file_selection_model)
533
543
  self.corpus_model.addCommand.connect(self.update_corpus_stack)
544
+ self.file_utterances_model.addCommand.connect(self.update_corpus_stack)
545
+ self.file_selection_model.selectionChanged.connect(self.sync_selected_utterances)
534
546
 
535
547
  self.g2p_model = None
536
548
  self.acoustic_model = None
537
549
  self.language_model = None
538
550
  self.ivector_extractor = None
539
551
 
552
+ def sync_selected_utterances(self):
553
+ self.selection_model.update_selected_utterances(
554
+ self.file_selection_model.selected_utterances()
555
+ )
556
+
540
557
  def check_media_stop(self):
541
558
  if self.ui.playAct.isChecked():
542
559
  self.ui.playAct.setChecked(False)
@@ -562,16 +579,18 @@ class MainWindow(QtWidgets.QMainWindow):
562
579
  self.dictionary_undo_stack.push(command)
563
580
 
564
581
  def delete_utterances(self):
565
- utts = self.selection_model.selectedUtterances()
566
- self.corpus_model.delete_utterances(utts)
582
+ utts = self.file_selection_model.selected_utterances()
583
+ self.file_utterances_model.delete_utterances(utts)
567
584
 
568
585
  def split_utterances(self):
569
- utts = self.selection_model.selectedUtterances()
570
- self.corpus_model.split_utterances(utts)
586
+ utts = self.file_selection_model.selected_utterances()
587
+ if len(utts) != 1:
588
+ return
589
+ self.file_utterances_model.split_utterances(utts[0])
571
590
 
572
591
  def merge_utterances(self):
573
- utts = self.selection_model.selectedUtterances()
574
- self.corpus_model.merge_utterances(utts)
592
+ utts = self.file_selection_model.selected_utterances()
593
+ self.file_utterances_model.merge_utterances(utts)
575
594
 
576
595
  def check_actions(self):
577
596
  self.ui.lockEditAct.setEnabled(True)
@@ -635,7 +654,7 @@ class MainWindow(QtWidgets.QMainWindow):
635
654
 
636
655
  def change_file(self):
637
656
  self.ui.playAct.setChecked(False)
638
- if self.selection_model.current_file is None:
657
+ if self.file_utterances_model.file is None:
639
658
  self.ui.playAct.setEnabled(False)
640
659
  self.ui.panLeftAct.setEnabled(False)
641
660
  self.ui.panRightAct.setEnabled(False)
@@ -655,14 +674,14 @@ class MainWindow(QtWidgets.QMainWindow):
655
674
  self.channel_select.addItem("Channel 0", userData=0)
656
675
  self.channel_select.setEnabled(False)
657
676
  if (
658
- self.selection_model.current_file is not None
659
- and self.selection_model.current_file.num_channels > 1
677
+ self.file_utterances_model.file is not None
678
+ and self.file_utterances_model.file.num_channels > 1
660
679
  ):
661
680
  self.channel_select.addItem("Channel 1", userData=1)
662
681
  self.channel_select.setEnabled(True)
663
682
 
664
683
  def change_utterance(self):
665
- selection = self.selection_model.selectedUtterances()
684
+ selection = self.file_selection_model.selected_utterances()
666
685
  self.ui.deleteUtterancesAct.setEnabled(False)
667
686
  self.ui.splitUtterancesAct.setEnabled(False)
668
687
  self.ui.alignUtteranceAct.setEnabled(False)
@@ -670,8 +689,8 @@ class MainWindow(QtWidgets.QMainWindow):
670
689
  if not selection and self.selection_model.current_utterance_id is None:
671
690
  return
672
691
 
673
- self.ui.splitUtterancesAct.setEnabled(True)
674
692
  if len(selection) == 1 or self.selection_model.current_utterance_id is not None:
693
+ self.ui.splitUtterancesAct.setEnabled(True)
675
694
  if self.corpus_model.acoustic_model is not None and self.corpus_model.has_dictionary:
676
695
  self.ui.alignUtteranceAct.setEnabled(True)
677
696
  self.ui.segmentUtteranceAct.setEnabled(True)
@@ -684,7 +703,8 @@ class MainWindow(QtWidgets.QMainWindow):
684
703
  def closeEvent(self, a0: QtGui.QCloseEvent) -> None:
685
704
  for worker in self.workers:
686
705
  worker.stopped.set()
687
- self.ui.utteranceDetailWidget.plot_widget.clean_up_for_close()
706
+ self.file_selection_model.clean_up_for_close()
707
+ self.file_utterances_model.clean_up_for_close()
688
708
  self.settings.setValue(
689
709
  AnchorSettings.UTTERANCES_VISIBLE, self.ui.utteranceDockWidget.isVisible()
690
710
  )
@@ -739,11 +759,14 @@ class MainWindow(QtWidgets.QMainWindow):
739
759
  w.setSizePolicy(
740
760
  QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding
741
761
  )
742
- self.ui.toolBar.insertWidget(self.ui.toolBar.actions()[0], w)
743
- self.ui.toolBar.setSizePolicy(
762
+ w2 = QtWidgets.QWidget(self)
763
+ w2.setSizePolicy(
744
764
  QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding
745
765
  )
746
- self.ui.toolBar.addWidget(w)
766
+ self.ui.toolBar.insertWidget(self.ui.toolBar.actions()[0], w)
767
+ # self.ui.toolBar.setSizePolicy(
768
+ # QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding
769
+ # )
747
770
  self.ui.toolBar.setAttribute(QtCore.Qt.WidgetAttribute.WA_AlwaysShowToolTips, True)
748
771
  self.ui.lockEditAct.setEnabled(True)
749
772
  self.ui.lockEditAct.setChecked(bool(self.settings.value(AnchorSettings.LOCKED, False)))
@@ -770,9 +793,9 @@ class MainWindow(QtWidgets.QMainWindow):
770
793
  self.ui.cluster_utterances_action.triggered.connect(self.begin_cluster_utterances)
771
794
  self.ui.classify_speakers_action.triggered.connect(self.begin_classify_speakers)
772
795
  self.selection_model.selectionAudioChanged.connect(self.enable_zoom)
773
- self.ui.zoomInAct.triggered.connect(self.selection_model.zoom_in)
774
- self.ui.zoomToSelectionAct.triggered.connect(self.selection_model.zoom_to_selection)
775
- self.ui.zoomOutAct.triggered.connect(self.selection_model.zoom_out)
796
+ self.ui.zoomInAct.triggered.connect(self.file_selection_model.zoom_in)
797
+ self.ui.zoomToSelectionAct.triggered.connect(self.file_selection_model.zoom_to_selection)
798
+ self.ui.zoomOutAct.triggered.connect(self.file_selection_model.zoom_out)
776
799
  self.ui.panLeftAct.triggered.connect(self.ui.utteranceDetailWidget.pan_left)
777
800
  self.ui.panRightAct.triggered.connect(self.ui.utteranceDetailWidget.pan_right)
778
801
  self.ui.mergeUtterancesAct.triggered.connect(self.merge_utterances)
@@ -803,7 +826,10 @@ class MainWindow(QtWidgets.QMainWindow):
803
826
  self.channel_select.addItem("Channel 0")
804
827
  self.ui.toolBar.addWidget(self.volume_slider)
805
828
  self.ui.toolBar.addWidget(self.channel_select)
806
- self.channel_select.currentIndexChanged.connect(self.selection_model.set_current_channel)
829
+ self.ui.toolBar.addWidget(w2)
830
+ self.channel_select.currentIndexChanged.connect(
831
+ self.file_selection_model.set_current_channel
832
+ )
807
833
  self.ui.changeVolumeAct.triggered.connect(self.media_player.set_volume)
808
834
  self.ui.addSpeakerAct.triggered.connect(self.add_new_speaker)
809
835
  self.ui.speakerWidget.tool_bar.addAction(self.ui.addSpeakerAct)
@@ -926,7 +952,7 @@ class MainWindow(QtWidgets.QMainWindow):
926
952
  if not self.corpus_model.corpus.has_any_ivectors():
927
953
  return
928
954
  kwargs = {
929
- "threshold": 0.28,
955
+ "threshold": 0.25,
930
956
  }
931
957
  if False and self.corpus_model.plda is not None:
932
958
  kwargs["metric"] = "plda"
@@ -1205,6 +1231,7 @@ class MainWindow(QtWidgets.QMainWindow):
1205
1231
  def close_corpus(self):
1206
1232
  self.set_application_state("unloaded")
1207
1233
  self.selection_model.clearSelection()
1234
+ self.file_selection_model.clearSelection()
1208
1235
  if self.corpus_model.corpus is not None:
1209
1236
  self.corpus_model.session.close()
1210
1237
  self.corpus_model.setCorpus(None)
@@ -1513,8 +1540,8 @@ class MainWindow(QtWidgets.QMainWindow):
1513
1540
 
1514
1541
  def finalize_segmentation(self, data):
1515
1542
  original_utterance_id, split_data = data
1516
- self.corpus_model.split_vad_utterance(original_utterance_id, split_data)
1517
- self.corpus_model.update_data()
1543
+ self.file_utterances_model.split_vad_utterance(original_utterance_id, split_data)
1544
+ self.ensure_utterance_panel_visible()
1518
1545
 
1519
1546
  def finalize_saving(self):
1520
1547
  self.check_actions()
@@ -1694,6 +1721,20 @@ class MainWindow(QtWidgets.QMainWindow):
1694
1721
  if search_term is not None:
1695
1722
  self.ui.utteranceListWidget.search_box.setQuery(search_term)
1696
1723
 
1724
+ def ensure_utterance_panel_visible(self):
1725
+ dock_tab_bars = self.findChildren(QtWidgets.QTabBar, "")
1726
+
1727
+ for j in range(len(dock_tab_bars)):
1728
+ dock_tab_bar = dock_tab_bars[j]
1729
+ if not dock_tab_bar.count():
1730
+ continue
1731
+ for i in range(dock_tab_bar.count()):
1732
+ if dock_tab_bar.tabText(i) == "Utterances":
1733
+ dock_tab_bar.setCurrentIndex(i)
1734
+ break
1735
+ else:
1736
+ self.ui.utteranceDockWidget.toggleViewAction().trigger()
1737
+
1697
1738
  def open_search_speaker(self, search_term=None, show=False):
1698
1739
  if search_term is not None:
1699
1740
  self.ui.utteranceListWidget.speaker_dropdown.line_edit.setText(search_term)
@@ -1705,18 +1746,7 @@ class MainWindow(QtWidgets.QMainWindow):
1705
1746
  )
1706
1747
  self.ui.utteranceListWidget.search()
1707
1748
  if show:
1708
- dock_tab_bars = self.findChildren(QtWidgets.QTabBar, "")
1709
-
1710
- for j in range(len(dock_tab_bars)):
1711
- dock_tab_bar = dock_tab_bars[j]
1712
- if not dock_tab_bar.count():
1713
- continue
1714
- for i in range(dock_tab_bar.count()):
1715
- if dock_tab_bar.tabText(i) == "Utterances":
1716
- dock_tab_bar.setCurrentIndex(i)
1717
- break
1718
- else:
1719
- self.ui.utteranceDockWidget.toggleViewAction().trigger()
1749
+ self.ensure_utterance_panel_visible()
1720
1750
 
1721
1751
  def open_search_file(self, search_term=None, utterance_id=None, show=False):
1722
1752
  if search_term is not None:
@@ -1729,18 +1759,7 @@ class MainWindow(QtWidgets.QMainWindow):
1729
1759
  self.ui.utteranceListWidget.requested_utterance_id = utterance_id
1730
1760
  self.ui.utteranceListWidget.search()
1731
1761
  if show:
1732
- dock_tab_bars = self.findChildren(QtWidgets.QTabBar, "")
1733
-
1734
- for j in range(len(dock_tab_bars)):
1735
- dock_tab_bar = dock_tab_bars[j]
1736
- if not dock_tab_bar.count():
1737
- continue
1738
- for i in range(dock_tab_bar.count()):
1739
- if dock_tab_bar.tabText(i) == "Utterances":
1740
- dock_tab_bar.setCurrentIndex(i)
1741
- break
1742
- else:
1743
- self.ui.utteranceDockWidget.toggleViewAction().trigger()
1762
+ self.ensure_utterance_panel_visible()
1744
1763
 
1745
1764
  def refresh_shortcuts(self):
1746
1765
  self.ui.playAct.setShortcut(self.settings.value(AnchorSettings.PLAY_KEYBIND))
@@ -2283,6 +2302,11 @@ class OptionsDialog(QtWidgets.QDialog):
2283
2302
  self.settings.value(self.settings.AUTOLOAD)
2284
2303
  )
2285
2304
  self.ui.resultsPerPageEdit.setValue(self.settings.value(self.settings.RESULTS_PER_PAGE))
2305
+ self.ui.timeDirectionComboBox.setCurrentIndex(
2306
+ self.ui.timeDirectionComboBox.findText(
2307
+ self.settings.value(self.settings.TIME_DIRECTION)
2308
+ )
2309
+ )
2286
2310
 
2287
2311
  self.ui.dynamicRangeEdit.setValue(self.settings.value(self.settings.SPEC_DYNAMIC_RANGE))
2288
2312
  self.ui.fftSizeEdit.setValue(self.settings.value(self.settings.SPEC_N_FFT))
@@ -2421,6 +2445,9 @@ class OptionsDialog(QtWidgets.QDialog):
2421
2445
  self.settings.setValue(self.settings.AUTOSAVE, self.ui.autosaveOnExitCheckBox.isChecked())
2422
2446
  self.settings.setValue(self.settings.AUDIO_DEVICE, self.ui.audioDeviceEdit.currentData())
2423
2447
  self.settings.setValue(self.settings.RESULTS_PER_PAGE, self.ui.resultsPerPageEdit.value())
2448
+ self.settings.setValue(
2449
+ self.settings.TIME_DIRECTION, self.ui.timeDirectionComboBox.currentText()
2450
+ )
2424
2451
  self.settings.sync()
2425
2452
  super(OptionsDialog, self).accept()
2426
2453