diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index a4e456ad2a36708a04722acb51f8441880e9d443..71463e777c56f3e1e24207a3c2d57bd249820617 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -2,7 +2,7 @@ name: Python package on: pull_request: - branches: [ master, develop ] + branches: [ main, develop ] jobs: build: @@ -20,6 +20,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | + ls -la python -m pip install --upgrade pip pip install tox pip install --upgrade -r requirements.txt diff --git a/README.md b/README.md deleted file mode 100644 index 4be6789d0478434e15827aa7310a70ce57f6daca..0000000000000000000000000000000000000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# asr-benchmarks \ No newline at end of file diff --git a/sziszapangma/core/wer/wer_embedding_calculator.py b/sziszapangma/core/wer/wer_embedding_calculator.py index 30dc82a07e036c5e7c9b27bfea2295aba867d3e8..5f371b7f519dc6f17b618c0a19e252cefd900089 100644 --- a/sziszapangma/core/wer/wer_embedding_calculator.py +++ b/sziszapangma/core/wer/wer_embedding_calculator.py @@ -19,7 +19,10 @@ class WerEmbeddingCalculator(WerCalculator): self._distance_calculator = CosineDistanceCalculator( embedding_transformer) - def _calculate_distance_for_word_step(self, step_words: StepWords) -> float: + def _calculate_distance_for_word_step( + self, + step_words: StepWords + ) -> float: return self._distance_calculator.calculate_distance_for_words( step_words.reference_word, step_words.hypothesis_word diff --git a/sziszapangma/integration/__pycache__/metrics_calculator.cpython-38.pyc b/sziszapangma/integration/__pycache__/metrics_calculator.cpython-38.pyc deleted file mode 100644 index 64abcc4563ec492321106b4c30b36abb903f4342..0000000000000000000000000000000000000000 Binary files a/sziszapangma/integration/__pycache__/metrics_calculator.cpython-38.pyc and /dev/null differ diff --git a/sziszapangma/integration/metrics_calculator.py b/sziszapangma/integration/metrics_calculator.py deleted file mode 100644 index 0d145c0386dfa66712f76128bef604991883ba30..0000000000000000000000000000000000000000 --- a/sziszapangma/integration/metrics_calculator.py +++ /dev/null @@ -1,34 +0,0 @@ -"""Main calculator of metrics.""" -from typing import List, Dict - - -class MetricsCalculator: - """Main calculator of metrics.""" - - _calculate_classic_wer: bool - - def __init__(self, calculate_classic_wer): - self._calculate_classic_wer = calculate_classic_wer - - @staticmethod - def _run_wer_calculations( - gold_transcript: List[Dict[str, any]], - asr_result: List[str] - ) -> float: - return simple_calculate_wer( - reference=[it[_WORD] for it in gold_transcript], - hypothesis=[it for it in asr_result], - ) - - def calculate_metrics( - self, - gold_transcript: List[Dict[str, any]], - asr_result: List[str] - ) -> Dict[str, any]: - """Calculate all metrics for data sample.""" - metrics = dict() - if self._calculate_classic_wer: - metrics[_CLASSIC_WER] = MetricsCalculator._run_wer_calculations( - gold_transcript, asr_result) - # TODO: put additional metrics here - return metrics diff --git a/sziszapangma/integration/path_filter.py b/sziszapangma/integration/path_filter.py index aa9db3a8bd1ca104e043a9a2915a25ee483d8c91..1ac6eb41e04b1fddd8930ea00c5db93321e32dc4 100644 --- a/sziszapangma/integration/path_filter.py +++ b/sziszapangma/integration/path_filter.py @@ -38,9 +38,11 @@ class ExtensionPathFilter(PathFilter): """ Implementation of searching files with extension. """ + path_generator = Path(self._root_directory).glob( + f'**/*.{self._extension}') all_files = [ str(it) - for it in Path(self._root_directory).glob(f'**/*.{self._extension}') + for it in path_generator ] return all_files \ if self._files_limit is None \ diff --git a/sziszapangma/integration/repository/mongo_experiment_repository.py b/sziszapangma/integration/repository/mongo_experiment_repository.py index 73f3f6f05fcd32b607f70ccabf04b875ffb1a4ad..19c11aa4d7215642840e8b3ca85b15b08f4fb167 100644 --- a/sziszapangma/integration/repository/mongo_experiment_repository.py +++ b/sziszapangma/integration/repository/mongo_experiment_repository.py @@ -1,4 +1,4 @@ -from typing import Optional, List, Set +from typing import Optional, Set from pymongo import MongoClient from pymongo.database import Database diff --git a/sziszapangma/integration/task/gold_transcript_task.py b/sziszapangma/integration/task/gold_transcript_task.py index 291eb80e1eac3077ce438380b05ffac0520665bd..0b407b4767d05c703a05475a58a113efbd247005 100644 --- a/sziszapangma/integration/task/gold_transcript_task.py +++ b/sziszapangma/integration/task/gold_transcript_task.py @@ -1,6 +1,5 @@ from sziszapangma.integration.gold_transcript_processor import \ GoldTranscriptProcessor -from sziszapangma.integration.record_path_provider import RecordPathProvider from sziszapangma.integration.repository.experiment_repository \ import ExperimentRepository from sziszapangma.integration.task.processing_task import ProcessingTask diff --git a/tests/test_classic_wer.py b/tests/test_classic_wer.py index 90a29bc60254ef54c6ca335629772ca4e6862d72..cdead597bc6e4e2a20db4f2089fbdc90985a8f31 100644 --- a/tests/test_classic_wer.py +++ b/tests/test_classic_wer.py @@ -32,9 +32,9 @@ def test_classic_calculate_wer_steps(): StepWords('recognize', 'nice'), StepWords('speech', 'beach')] step_types = [ - StepType.CORRECT, StepType.DELETION, StepType.CORRECT, StepType.CORRECT, - StepType.INSERTION, StepType.INSERTION, StepType.SUBSTITUTION, - StepType.SUBSTITUTION] + StepType.CORRECT, StepType.DELETION, StepType.CORRECT, + StepType.CORRECT, StepType.INSERTION, StepType.INSERTION, + StepType.SUBSTITUTION, StepType.SUBSTITUTION] assert len(wer_result[1]) == 8 assert [it.step_type for it in wer_result[1]] == step_types diff --git a/tox.ini b/tox.ini index c5655d8732339d25937df8285fa3c7fb046f6df6..4dc38fb541aa720338639b776759f9d0205a9e7e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,6 @@ [tox] -envlist = py38, py39, flake8 - -;[travis] -;python = -; 3.9: py39 -; 3.8: py38 +envlist = flake8 +skipsdist = True [testenv:flake8] basepython = python @@ -20,6 +16,8 @@ deps = ; requirements.txt with the pinned versions and uncomment the following line: ; -r{toxinidir}/requirements.txt commands = + ls -la pip install -U pip - pytest --basetemp={envtmpdir} + pytest +; pytest --basetemp={envtmpdir}