Class: Sphinxtrain::Trainer

Inherits:
Object
  • Object
show all
Defined in:
lib/sphinxtrain/trainer.rb

Constant Summary collapse

BASE_DIR =
File.join(Dir.home, '.sphinxtrain-ruby')
VOXFORGE_URL =
"http://files.kde.org/accessibility/Simon/am/voxforge_en_sphinx.cd_cont_5000.tar.gz"
VOXFORGE_FILE =
File.basename(VOXFORGE_URL)
VOXFORGE_FOLDER =
File.basename(VOXFORGE_FILE, '.tar.gz')
VOXFORGE_MODEL =

VOXFORGE_MODEL = File.join(BASE_DIR, VOXFORGE_FOLDER, “model_parameters/voxforge_en_sphinx.cd_cont_5000”)

VOXFORGE_FOLDER
RECORDINGS_DIR =
File.join(BASE_DIR, 'recordings')
NEW_MODEL =
File.join(BASE_DIR, 'new_model')

Instance Method Summary collapse

Instance Method Details

#trainObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/sphinxtrain/trainer.rb', line 15

def train
  Pocketsphinx.disable_logging

  Dir.mkdir BASE_DIR rescue Errno::EEXIST
  Dir.chdir BASE_DIR do
    download_voxforge unless File.exist?(VOXFORGE_FILE)
    download_assets unless arctic_file(:txt, :listoffiles, :transcription, :dic).all? { |f| File.exist? f }
    record_sentences unless Dir.exist?(RECORDINGS_DIR)

    analyse_model VOXFORGE_MODEL

    duplicate_model
    adapt_model

    analyse_model NEW_MODEL
  end
end