LID: Terminology and adaptation
Adaptation using command line (SPE 3.37 or older)
When using SPE 3.37 or older, LID adaptation requires various manual tasks and extra command line tools:
lpextract.exe
(Windows) orlpextract
(Linux) for extracting languageprints from audio fileslppack.exe
(Windows) orlppack
(Linux) for creating languageprint archiveslid.exe
(Windows) orlid
(Linux) for language pack training
Creating new language
STEP 1: Extract languageprints from recordings using lpextract
command line tool.
In the example below we
- assume that
lpextract
binary is located in the{SPE}/bsapi/lid
directory (hence the relative path to “settings” directory) - use the “L4” model (hence the “_l4” configuration file suffix)
./lpextract -v -c settings/lpextract_l4.bs -d /path/to/my/audio/MyLanguage -e wav -D /path/to/my/languageprints/MyLanguage ./lpextract -v -c settings/lpextract_l4.bs -d /other/path/to/audio/MyOtherLanguage -e wav -D /path/to/my/languageprints/MyOtherLanguage ...
where:
-v
parameter tells the tool to provide verbose console output-c
parameter specifies path to.bs
BSAPI configuration file forlpextract
(use suffix according to LID technological model you are using – “l4”, “l3”, “xl3”)-d
parameter specifies path to input directory with source audio files-D
parameter specifies path to output directory where you want to have the extracted languageprints stored
NOTE: the directory name will be used as the language name in next step-e
parameter specifies file extensions to be included in languageprint extraction (if you have raw files instead of wav, the extension would be e.g. “raw”)
NOTE:
If you want to enhance existing languge using your own audio files (as opposed to creating new language from scratch), copy the existing pre-trained .lpa
file into the directory with your languageprints before continuing to next step.
Make sure to use the .lpa
file from correct LID technological model ( “l4”, “l3”, “xl3”)!
STEP 2: Pack the individual languageprints to languageprint archives using lppack
command line tool.
You need to specify path to parent directory of the directory holding your languageprints extracted in the previous step. The subdirectory name(s) will be used as languageprint archive name(s).
In the example below we use input directory /path/to/my/languageprints
from previous step, which contains subdirectories MyLanguage
and MyOtherLanguage
with extracted languageprints (also used in previous step).
The lppack
tool automatically names the created languageprint archives using names of the subdirectories, i.e. in our example it will be MyLanguage.lpa
and MyOtherLanguage.lpa
.
./lppack -v -d /path/to/my/languageprints -D lprints/l4
where:
-v
parameter tells the tool to provide verbose console output-d
parameter specifies path to input parent directory-D
parameter specifies path to output directory where the output languageprint archive(s) will be created
NOTE: the archive(s) will be named using names of subdirectories under the input directory
Resulting languageprint archive(s) can be used for creating custom language packs, see below for details.
Creating language pack
STEP 1: Prepare a listfile with list of languageprint archives corresponding to the languages you want to have in the language pack – each line starts with language name, followed by a TAB
or SPACE
character, and a path to the .lpa
file.
Make sure that
- paths are valid – relative paths must be relative to the location of your list file… or simply use absolute paths
- paths lead to the technological model directory of your choice (
l4
,l3
,xl3
, …)
Example below assumes that the listfile is located in the {SPE}/bsapi/lid
directory (hence the relative paths to lprints/...
) and also assumes the “L4” model. You should reflect your setup accordingly.
cs-CZ lprints/l4/cs-CZ.lpa pl-PL lprints/l4/pl-PL.lpa en-GB lprints/l4/en-GB.lpa ru-RU lprints/l4/ru-RU.lpa MyLanguage lprints/l4/MyLanguage.lpa MyOtherLanguage lprints/l4/MyOtherLanguage.lpa
Save the listfile as e.g. MyLanguagePack.txt
.
STEP 2: Train language pack using the listfile and command line lid
application.
Example below assumes that lid
binary is located in the {SPE}/bsapi/lid
directory (hence the relative paths to “settings” and “models” directories) and uses the “L4” model… The l4_MyLanguagePack
is the chosen name of output directory where the trained language pack will be stored:
./lid -v -c settings/lid_l4.bs -l MyLanguagePack.txt -train -M models/l4_MyLanguagePack
where:
-v
parameter tells the tool to provide verbose console output-c
parameter specifies path to.bs
BSAPI configuration file forlid
(use suffix according to LID technological model you are using – “l4”, “l3”, “xl3”)-l
parameter specifies path to input listfile created in previous step-train
parameter tells the tool to train new language pack-M
parameter specifies path to output directory where you want to have the language pack created
NOTE: it is strongly recommended to use a subdirectory of “models” directory, to simplify the language pack registration to SPE
STEP 3: Register language pack to SPE and verify that it works as expected.
See Using custom language pack in Speech Engine chapter for details.