sonusai 0.18.1__tar.gz → 0.18.2__tar.gz
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.
- {sonusai-0.18.1 → sonusai-0.18.2}/PKG-INFO +1 -1
- {sonusai-0.18.1 → sonusai-0.18.2}/pyproject.toml +1 -1
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/mixdb.py +24 -27
- {sonusai-0.18.1 → sonusai-0.18.2}/README.rst +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/__init__.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/aawscd_probwrite.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/audiofe.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/calc_metric_spenh.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/data/__init__.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/data/genmixdb.yml +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/data/speech_ma01_01.wav +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/data/whitenoise.wav +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/doc/__init__.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/doc/doc.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/doc.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/genft.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/genmetrics.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/genmix.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/genmixdb.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/gentcst.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/lsdb.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/main.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/metrics/__init__.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/metrics/calc_class_weights.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/metrics/calc_optimal_thresholds.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/metrics/calc_pcm.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/metrics/calc_pesq.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/metrics/calc_sa_sdr.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/metrics/calc_sample_weights.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/metrics/calc_wer.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/metrics/calc_wsdr.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/metrics/class_summary.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/metrics/confusion_matrix_summary.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/metrics/one_hot.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/metrics/snr_summary.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/__init__.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/audio.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/augmentation.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/class_count.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/config.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/constants.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/datatypes.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/db_datatypes.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/eq_rule_is_valid.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/feature.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/generation.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/helpers.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/log_duration_and_sizes.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/mapped_snr_f.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/soundfile_audio.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/sox_audio.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/sox_augmentation.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/spectral_mask.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/target_class_balancing.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/targets.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/tokenized_shell_vars.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/torchaudio_audio.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/torchaudio_augmentation.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/truth.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/truth_functions/__init__.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/truth_functions/crm.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/truth_functions/data.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/truth_functions/energy.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/truth_functions/file.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/truth_functions/phoneme.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/truth_functions/sed.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mixture/truth_functions/target.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/mkwav.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/onnx_predict.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/plot.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/post_spenh_targetf.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/queries/__init__.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/queries/queries.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/speech/__init__.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/speech/l2arctic.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/speech/librispeech.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/speech/mcgill.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/speech/textgrid.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/speech/timit.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/speech/types.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/speech/vctk.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/speech/voxceleb.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/summarize_metric_spenh.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/tplot.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/__init__.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/asl_p56.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/asr.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/asr_functions/__init__.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/asr_functions/aaware_whisper.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/audio_devices.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/braced_glob.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/calculate_input_shape.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/convert_string_to_number.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/create_timestamp.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/create_ts_name.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/dataclass_from_dict.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/db.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/docstring.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/energy_f.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/engineering_number.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/get_frames_per_batch.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/get_label_names.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/grouper.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/human_readable_size.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/max_text_width.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/model_utils.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/numeric_conversion.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/onnx_utils.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/parallel.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/path_info.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/print_mixture_details.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/ranges.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/read_mixture_data.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/read_predict_data.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/reshape.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/seconds_to_hms.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/stacked_complex.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/stratified_shuffle_split.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/write_audio.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/utils/yes_or_no.py +0 -0
- {sonusai-0.18.1 → sonusai-0.18.2}/sonusai/vars.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "sonusai"
|
3
|
-
version = "0.18.
|
3
|
+
version = "0.18.2"
|
4
4
|
description = "Framework for building deep neural network models for sound, speech, and voice AI"
|
5
5
|
authors = ["Chris Eddington <chris@aaware.com>", "Jason Calderwood <jason@aaware.com>"]
|
6
6
|
maintainers = ["Chris Eddington <chris@aaware.com>", "Jason Calderwood <jason@aaware.com>"]
|
@@ -4,7 +4,6 @@ from functools import partial
|
|
4
4
|
from sqlite3 import Connection
|
5
5
|
from sqlite3 import Cursor
|
6
6
|
from typing import Any
|
7
|
-
from typing import Callable
|
8
7
|
from typing import Optional
|
9
8
|
|
10
9
|
from sonusai.mixture.datatypes import AudioF
|
@@ -1062,13 +1061,13 @@ class MixtureDatabase:
|
|
1062
1061
|
|
1063
1062
|
def mixids_for_speech_metadata(self,
|
1064
1063
|
tier: str,
|
1065
|
-
value: str
|
1066
|
-
|
1064
|
+
value: str = None,
|
1065
|
+
where: str = None) -> list[int]:
|
1067
1066
|
"""Get a list of mixture IDs for the given speech metadata tier.
|
1068
1067
|
|
1069
|
-
If '
|
1070
|
-
If '
|
1071
|
-
to include.
|
1068
|
+
If 'where' is None, then include mixture IDs whose tier values are equal to the given 'value'.
|
1069
|
+
If 'where' is not None, then ignore 'value' and use the given SQL where clause to determine
|
1070
|
+
which entries to include.
|
1072
1071
|
|
1073
1072
|
Examples:
|
1074
1073
|
>>> mixdb = MixtureDatabase('/mixdb_location')
|
@@ -1076,35 +1075,33 @@ class MixtureDatabase:
|
|
1076
1075
|
>>> mixids = mixdb.mixids_for_speech_metadata('speaker_id', 'TIMIT_ARC0')
|
1077
1076
|
Get mixutre IDs for mixtures with speakers whose speaker_ids are 'TIMIT_ARC0'.
|
1078
1077
|
|
1079
|
-
>>> mixids = mixdb.mixids_for_speech_metadata('age', '
|
1078
|
+
>>> mixids = mixdb.mixids_for_speech_metadata('age', where='age < 25')
|
1080
1079
|
Get mixture IDs for mixtures with speakers whose ages are less than 25.
|
1081
1080
|
|
1082
|
-
>>> mixids = mixdb.mixids_for_speech_metadata('dialect',
|
1081
|
+
>>> mixids = mixdb.mixids_for_speech_metadata('dialect', where="dialect in ('New York City', 'Northern')")
|
1083
1082
|
Get mixture IDs for mixtures with speakers whose dialects are either 'New York City' or 'Northern'.
|
1084
1083
|
"""
|
1085
|
-
from
|
1084
|
+
from sonusai import SonusAIError
|
1086
1085
|
|
1087
|
-
if
|
1088
|
-
|
1089
|
-
return x == value
|
1086
|
+
if value is None and where is None:
|
1087
|
+
raise SonusAIError('Must provide either value or where')
|
1090
1088
|
|
1091
|
-
|
1092
|
-
|
1093
|
-
is_textgrid = tier in self.textgrid_metadata_tiers
|
1094
|
-
for target_file_id, target_file in enumerate(self.target_files):
|
1095
|
-
if is_textgrid:
|
1096
|
-
metadata = get_textgrid_tier_from_target_file(target_file.name, tier)
|
1097
|
-
else:
|
1098
|
-
metadata = self.speaker(target_file.speaker_id, tier)
|
1089
|
+
if where is None:
|
1090
|
+
where = f"{tier} = '{value}'"
|
1099
1091
|
|
1100
|
-
|
1101
|
-
|
1092
|
+
if tier in self.textgrid_metadata_tiers:
|
1093
|
+
raise SonusAIError(f'TextGrid tier data, "{tier}", is not supported in mixids_for_speech_metadata().')
|
1102
1094
|
|
1103
|
-
# Next get list of mixture IDs that contain those target files
|
1104
1095
|
with self.db() as c:
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1096
|
+
speaker_ids = [speaker_id[0] for speaker_id in
|
1097
|
+
c.execute(f"SELECT id FROM speaker WHERE {where}").fetchall()]
|
1098
|
+
results = c.execute(f"SELECT id FROM target_file " +
|
1099
|
+
f"WHERE speaker_id IN ({','.join(map(str, speaker_ids))})").fetchall()
|
1100
|
+
target_file_ids = [target_file_id[0] for target_file_id in results]
|
1101
|
+
results = c.execute("SELECT mixture_id FROM mixture_target " +
|
1102
|
+
f"WHERE mixture_target.target_id IN ({','.join(map(str, target_file_ids))})").fetchall()
|
1103
|
+
|
1104
|
+
return [mixture_id[0] - 1 for mixture_id in results]
|
1108
1105
|
|
1109
1106
|
def mixture_all_speech_metadata(self, m_id: int) -> list[dict[str, SpeechMetadata]]:
|
1110
1107
|
from .helpers import mixture_all_speech_metadata
|
@@ -1160,7 +1157,7 @@ class MixtureDatabase:
|
|
1160
1157
|
)
|
1161
1158
|
|
1162
1159
|
if not (metric in supported_metrics or metric.startswith('MXWER')):
|
1163
|
-
raise
|
1160
|
+
raise SonusAIError(f'Unsupported metric: {metric}')
|
1164
1161
|
|
1165
1162
|
if not force:
|
1166
1163
|
result = self.read_mixture_data(m_id, metric)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|