-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michael Hansen
committed
May 1, 2020
1 parent
081f7b3
commit c9ca91d
Showing
18 changed files
with
163 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env python3 | ||
"""Verifies sizes and sha256 sums for files.yml files.""" | ||
import os | ||
import subprocess | ||
import sys | ||
from pathlib import Path | ||
|
||
import yaml | ||
|
||
|
||
def main(): | ||
"""Main entry point""" | ||
for files_yaml_path in sys.argv[1:]: | ||
profile_root = Path(files_yaml_path).parent | ||
with open(files_yaml_path, "r") as files_yaml_file: | ||
files_yaml = yaml.safe_load(files_yaml_file) | ||
|
||
file_count = 0 | ||
for condition, files in files_yaml.items(): | ||
for file_path, file_info in files.items(): | ||
full_path = profile_root / file_path | ||
|
||
# Check byte size | ||
expected_bytes = int(file_info["bytes"]) | ||
actual_bytes = os.path.getsize(full_path) | ||
|
||
assert ( | ||
actual_bytes == expected_bytes | ||
), f"Expected size of {full_path} to be {expected_bytes}, got {actual_bytes}" | ||
|
||
# Check sha256 sum | ||
expected_sum = str(file_info["sha256"]).strip() | ||
sum_result = subprocess.check_output(["sha256sum", str(full_path)]).decode().strip() | ||
actual_sum = sum_result.split()[0] | ||
|
||
assert ( | ||
actual_sum == expected_sum | ||
), f"Expected sha256 sum of {full_path} to be {expected_sum}, got {actual_sum}" | ||
|
||
file_count += 1 | ||
|
||
print(profile_root.name, file_count, "OK") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
this_dir="$( cd "$( dirname "$0" )" && pwd )" | ||
src_dir="$(realpath "${this_dir}/..")" | ||
|
||
# ----------------------------------------------------------------------------- | ||
|
||
# Create a temporary directory for testing | ||
temp_dir="$(mktemp -d)" | ||
|
||
function cleanup { | ||
rm -rf "${temp_dir}" | ||
} | ||
|
||
trap cleanup EXIT | ||
|
||
# ----------------------------------------------------------------------------- | ||
|
||
profiles=() | ||
while [[ ! -z "$1" ]]; do | ||
profiles+=("$1") | ||
shift | ||
done | ||
|
||
if [[ -z "${profiles[*]}" ]]; then | ||
while read -r profile; do | ||
profiles+=("${profile}") | ||
done < "${src_dir}/PROFILES" | ||
fi | ||
|
||
# ----------------------------------------------------------------------------- | ||
|
||
for profile in "${profiles[@]}"; do | ||
echo "${profile}" | ||
|
||
# Copy to temporary directory | ||
dest_dir="${temp_dir}/${profile}" | ||
rm -rf "${dest_dir}" | ||
mkdir -p "${dest_dir}" | ||
|
||
echo 'Copying...' | ||
cp -aR "${src_dir}/${profile}"/* "${dest_dir}/" | ||
|
||
echo 'Training...' | ||
voice2json -p "${dest_dir}" --debug train-profile | ||
|
||
closed_dir="${dest_dir}/test/closed" | ||
if [[ -d "${closed_dir}" ]]; then | ||
echo 'Testing (closed)...' | ||
voice2json -p "${dest_dir}" --debug test-examples --directory "${closed_dir}" | \ | ||
jq . > "${closed_dir}/report.json" | ||
|
||
cp "${closed_dir}/report.json" "${src_dir}/${profile}/test/closed/" | ||
fi | ||
|
||
open_dir="${dest_dir}/test/open" | ||
if [[ -d "${open_dir}" ]]; then | ||
echo 'Testing (open)...' | ||
voice2json -p "${dest_dir}" --debug test-examples --open --directory "${open_dir}" | \ | ||
jq . > "${open_dir}/report.json" | ||
|
||
cp "${open_dir}/report.json" "${src_dir}/${profile}/test/open/" | ||
fi | ||
|
||
echo 'Done' | ||
echo '----------' | ||
echo '' | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python3 | ||
"""Update sizes and sha256 sums for files.yml files.""" | ||
import os | ||
import subprocess | ||
import sys | ||
from pathlib import Path | ||
|
||
import yaml | ||
|
||
|
||
def main(): | ||
"""Main entry point""" | ||
assert len(sys.argv) > 1 | ||
files_yaml_path = sys.argv[1] | ||
profile_root = Path(files_yaml_path).parent | ||
with open(files_yaml_path, "r") as files_yaml_file: | ||
files_yaml = yaml.safe_load(files_yaml_file) | ||
|
||
file_count = 0 | ||
for condition, files in files_yaml.items(): | ||
for file_path, file_info in files.items(): | ||
full_path = profile_root / file_path | ||
|
||
file_info["bytes"] = os.path.getsize(full_path) | ||
sum_result = subprocess.check_output(["sha256sum", str(full_path)]).decode().strip() | ||
file_info["sha256"] = sum_result.split()[0] | ||
|
||
print(yaml.dump(files_yaml)) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Submodule ca-es_pocketsphinx-cmu
updated
3 files
+2 −23 | README.md | |
+ − | base_language_model.fst.gz | |
+53 −0 | files.yml |
Submodule nl_pocketsphinx-cmu
updated
8 files
+3 −0 | README.md | |
+0 −0 | acoustic_model/README | |
+ − | base_language_model.fst.gz | |
+68 −0 | files.yml | |
+1 −0 | test/closed | |
+1 −0 | test/open | |
+655 −166 | test/voxforge/report.json | |
+913 −640 | test/wavenet/report.json |
Submodule en-us_julius-github
updated
3 files
+373 −1 | LICENSE | |
+3 −0 | README.md | |
+ − | base_language_model.fst.gz |
Submodule en-us_kaldi-zamia
updated
5 files
+3 −0 | README.md | |
+1 −1 | SOURCE | |
+ − | base_dictionary.txt.gz | |
+ − | base_language_model.fst.gz | |
+1 −0 | profile.yml |
Submodule en-us_pocketsphinx-cmu
updated
11 files
+31 −1 | LICENSE | |
+0 −9 | README | |
+3 −0 | README.md | |
+2 −34 | SOURCE | |
+ − | base_language_model.fst.gz | |
+65 −0 | files.yml | |
+4 −0 | profile.yml | |
+1 −0 | test/closed | |
+1 −0 | test/open | |
+1,421 −332 | test/voxforge/report.json | |
+4,573 −3,184 | test/wavenet/report.json |
Submodule fr_pocketsphinx-cmu
updated
6 files
+3 −0 | README.md | |
+0 −0 | acoustic_model/README | |
+ − | base_language_model.fst.gz | |
+56 −0 | files.yml | |
+1 −0 | test/closed | |
+1 −0 | test/open |
Submodule de_pocketsphinx-cmu
updated
7 files
+2 −206 | README.md | |
+ − | base_language_model.fst.gz | |
+62 −0 | files.yml | |
+1 −0 | test/closed | |
+1 −0 | test/open | |
+659 −171 | test/voxforge/report.json | |
+1,112 −747 | test/wavenet/report.json |
Submodule pt-br_pocketsphinx-cmu
updated
8 files
+21 −1 | LICENSE | |
+3 −0 | README.md | |
+ − | base_language_model.fst.gz | |
+47 −0 | files.yml | |
+1 −0 | test/closed | |
+1 −0 | test/open | |
+660 −170 | test/voxforge/report.json | |
+2,028 −1,028 | test/wavenet/report.json |
Submodule es-mexican_pocketsphinx-cmu
updated
4 files
+3 −0 | README.md | |
+0 −0 | acoustic_model/README.txt | |
+ − | base_language_model.fst.gz | |
+53 −0 | files.yml |
Submodule es_pocketsphinx-cmu
updated
7 files
+3 −0 | README.md | |
+ − | base_language_model.fst.gz | |
+53 −0 | files.yml | |
+1 −0 | test/closed | |
+1 −0 | test/open | |
+942 −172 | test/voxforge/report.json | |
+556 −286 | test/wavenet/report.json |
Submodule vi_kaldi-montreal
updated
27 files