{"action":"created","issue":{"url":"https://api.github.com/repos/gooofy/speech/issues/13","repository_url":"https://api.github.com/repos/gooofy/speech","labels_url":"https://api.github.com/repos/gooofy/speech/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/gooofy/speech/issues/13/comments","events_url":"https://api.github.com/repos/gooofy/speech/issues/13/events","html_url":"https://github.com/gooofy/speech/issues/13","id":308030088,"number":13,"title":"Replace arg --lang with --lang-model and --audio-corpus","user":{"login":"mpuels","id":2924816,"avatar_url":"https://avatars2.githubusercontent.com/u/2924816?v=4","gravatar_id":"","url":"https://api.github.com/users/mpuels","html_url":"https://github.com/mpuels","followers_url":"https://api.github.com/users/mpuels/followers","following_url":"https://api.github.com/users/mpuels/following{/other_user}","gists_url":"https://api.github.com/users/mpuels/gists{/gist_id}","starred_url":"https://api.github.com/users/mpuels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpuels/subscriptions","organizations_url":"https://api.github.com/users/mpuels/orgs","repos_url":"https://api.github.com/users/mpuels/repos","events_url":"https://api.github.com/users/mpuels/events{/privacy}","received_events_url":"https://api.github.com/users/mpuels/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-03-23T13:31:49Z","updated_at":"2018-04-03T14:41:54Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"##  Introduction\r\n\r\nCurrently, most scripts offer the argument `--lang` to choose between `de` and `en`. The choice `de` means that a language model is trained on the text corpora\r\n\r\n- Europarl\r\n- Parole\r\n\r\nand that an acoustic model is trained on\r\n\r\n- a corrected version of the VoxForge corpus\r\n- a corrected version of the TU-Darmstadt corpus (gspv2)\r\n\r\nThere is no way to choose for example just one text corpus and one audio corpus. Hereby I propose to change the command line arguments of some scripts to make it simpler to pick text and audio corpora to train an ASR system.\r\n\r\n## Current workflow\r\n\r\nAn example workflow to train a German speech recognition system might look like\r\n\r\n    $ ./speech_sentences_de.py\r\n    $ ./speech_build_lm.py --lang de\r\n    $ ./speech_kaldi_export.py --lang de\r\n    $ cd data/dst/speech/de/kaldi\r\n    $ ./build-lm.sh\r\n    $ ./run-chain.sh\r\n\r\nUnder the hood `speech_sentences_de.py` extracts sentences from two text corpora (Europarl and Parole) and writes them to a text file containing one sentence per line. Both of the corpora have to be parsed in a unique way to extract sentences from them. **Currently, there is no way to build a language model just on exactly one corpus** (except by altering the script of course).\r\n\r\nThe command `speech_build_lm.py --lang de` concatenates text files containing one sentence per line and builds a language model (3-gram) using the program `ngram`.\r\n\r\nThe command `speech_kaldi_export.py --lang de` consumes all transcripts for the VoxForge and TU-Darmstadt corpora in `data/src/speech/de/transcripts_*.csv`, the pronunciation dictionary `data/src/speech/de/dict.ipa` and the language model created in the previous step and \"deploys\" them to `speech/data/dst/speech/de/kaldi` in a way that adheres to the Kaldi interface (regarding directory and file structure). **Currently there is no way to conveniently choose exactly one, two, or more audio corpora**. But it would be nice to be able to choose a small audio corpus to do regression testing.\r\n\r\nThe script `build-lm.sh` converts the language model from the ARPA format to the finite state transducer `G.fst` - as Kaldi expects it.\r\n\r\nFinally, `run-chain.sh` uses Kaldi to train the acoustic model.\r\n\r\nHere is an example sequence of commands to train a complete English ASR system with Kaldi:\r\n\r\n    $ ./speech_sentences_en.py\r\n    $ ./speech_build_lm.py --lang en\r\n    $ ./speech_kaldi_export.py --lang en\r\n    $ cd data/dst/speech/en/kaldi\r\n    $ ./build-lm.sh\r\n    $ ./run-chain.sh\r\n\r\n## Proposed workflow\r\n\r\nThis is an example of the proposed workflow for creating an ASR system:\r\n\r\n    $ ./speech_sentences.py europarl-de\r\n    $ ./speech_sentences.py parole\r\n    $ ./speech_sentences.py voxforge-de-prompts\r\n    $ ./speech_build_lm.py europarl-de \\\r\n                           parole \\\r\n                           voxforge-de-prompts \\\r\n                           lm-europarl-de-parole-voxforge-de-prompts\r\n    $ ./speech_kaldi_export.py --audio-corpus voxforge \\\r\n                               --audio-corpus tu-darmstadt \\\r\n                               --language-model lm-europarl-de-parole-voxforge-de-prompts \\\r\n                               --dictionary dict-de.ipa \\\r\n                               --model-name experiment1\r\n    $ cd data/dst/speech/kaldi/experiment1\r\n    $ ./build-lm.sh\r\n    $ ./run-chain.sh\r\n\r\nIn the example we create an ASR system where the language model is based on the Europarl and Parole corpora. To train the acoustic model, the VoxForge and TU-Darmstadt corpuora are used.\r\n\r\nThe command `./speech_sentences.py TEXTCORPUS` writes the extracted sentences by convention to `data/dst/text-corpora/TEXTCORPUS.txt`.\r\n\r\nThe command `speech_build_lm.py TEXTCORPUS [TEXTCORPUS ...] LMNAME` expects as arguments a list of text corpora and a name for the resulting language model (`LMNAME`). The files of the language model are written to the directory `data/dst/lm/LMNAME/`.\r\n\r\nThe command `speech_kaldi_export.py` expects one or more `--audio-corpus`, exactly one `--language-model`, and exactly one `--model-name MODELNAME`. The script creates a directory `data/dst/asr-models/kaldi/MODELNAME` and places all files required by Kaldi in it.\r\n\r\n@gooofy What do you think about my suggested changes?\r\n\r\n**UPDATES 2018-04-03**\r\n- Augmented example workflow to show that `speech_sentences.py` can also extract sentences from VoxForge's prompts.\r\n- In example for proposed workflow: add `--dictionary` to `speech_kaldi_export.py`"},"comment":{"url":"https://api.github.com/repos/gooofy/speech/issues/comments/378274609","html_url":"https://github.com/gooofy/speech/issues/13#issuecomment-378274609","issue_url":"https://api.github.com/repos/gooofy/speech/issues/13","id":378274609,"user":{"login":"mpuels","id":2924816,"avatar_url":"https://avatars2.githubusercontent.com/u/2924816?v=4","gravatar_id":"","url":"https://api.github.com/users/mpuels","html_url":"https://github.com/mpuels","followers_url":"https://api.github.com/users/mpuels/followers","following_url":"https://api.github.com/users/mpuels/following{/other_user}","gists_url":"https://api.github.com/users/mpuels/gists{/gist_id}","starred_url":"https://api.github.com/users/mpuels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpuels/subscriptions","organizations_url":"https://api.github.com/users/mpuels/orgs","repos_url":"https://api.github.com/users/mpuels/repos","events_url":"https://api.github.com/users/mpuels/events{/privacy}","received_events_url":"https://api.github.com/users/mpuels/received_events","type":"User","site_admin":false},"created_at":"2018-04-03T14:41:54Z","updated_at":"2018-04-03T14:41:54Z","author_association":"CONTRIBUTOR","body":"1. **Name of tool in name of language model** My example of the proposed workflow contains the language model `lm-europarl-de`, but this name it arbitrary. A user can name her language models however she likes on the command line.\r\n\r\n2. **Replace name `speech`** I prefer to replace it with `asr-models`, because a) `asr` is too generic b) `models` is too generic as well; it could mean \"language model\" or \"acoustic model\" c) `audio-model` is not an established term in the ASR community. I've updated https://github.com/gooofy/speech/issues/13#issuecomment-376138989 accordingly.\r\n\r\n3. **Required scripts to grow audio corpus** Ok, I've removed `speech_editor.py` and `speech_lex_edit.py` and have added `speech_audio_scan.py` and `auto_review.py` to the list of scripts in https://github.com/gooofy/speech/issues/13#issuecomment-376138989\r\n\r\n"}}
{"actor":{"display_login":"mpuels"}}