Class: Sphinxtrain::MapAdapter
- Inherits:
-
Object
- Object
- Sphinxtrain::MapAdapter
- Defined in:
- lib/sphinxtrain/map_adapter.rb
Constant Summary collapse
- SPHINX_FE_COMMAND =
"sphinx_fe"- BW_COMMAND =
"/usr/local/Cellar/cmu-sphinxtrain/HEAD/libexec/sphinxtrain/bw"- MAP_ADAPT_COMMAND =
"/usr/local/Cellar/cmu-sphinxtrain/HEAD/libexec/sphinxtrain/map_adapt"
Instance Attribute Summary collapse
-
#new_model ⇒ Object
Returns the value of attribute new_model.
-
#old_model ⇒ Object
Returns the value of attribute old_model.
-
#recordings_dir ⇒ Object
Returns the value of attribute recordings_dir.
-
#sentences_dict ⇒ Object
Returns the value of attribute sentences_dict.
-
#sentences_files ⇒ Object
Returns the value of attribute sentences_files.
-
#sentences_transcription ⇒ Object
Returns the value of attribute sentences_transcription.
Instance Method Summary collapse
- #adapt ⇒ Object
-
#initialize(old_model:, new_model:, recordings_dir:, sentences_transcription:, sentences_files:, sentences_dict:) ⇒ MapAdapter
constructor
A new instance of MapAdapter.
Constructor Details
#initialize(old_model:, new_model:, recordings_dir:, sentences_transcription:, sentences_files:, sentences_dict:) ⇒ MapAdapter
Returns a new instance of MapAdapter.
9 10 11 12 13 14 15 16 |
# File 'lib/sphinxtrain/map_adapter.rb', line 9 def initialize(old_model:, new_model:, recordings_dir:, sentences_transcription:, sentences_files:, sentences_dict:) self.old_model = old_model self.new_model = new_model self.recordings_dir = recordings_dir self.sentences_transcription = sentences_transcription self.sentences_files = sentences_files self.sentences_dict = sentences_dict end |
Instance Attribute Details
#new_model ⇒ Object
Returns the value of attribute new_model.
7 8 9 |
# File 'lib/sphinxtrain/map_adapter.rb', line 7 def new_model @new_model end |
#old_model ⇒ Object
Returns the value of attribute old_model.
7 8 9 |
# File 'lib/sphinxtrain/map_adapter.rb', line 7 def old_model @old_model end |
#recordings_dir ⇒ Object
Returns the value of attribute recordings_dir.
7 8 9 |
# File 'lib/sphinxtrain/map_adapter.rb', line 7 def recordings_dir @recordings_dir end |
#sentences_dict ⇒ Object
Returns the value of attribute sentences_dict.
7 8 9 |
# File 'lib/sphinxtrain/map_adapter.rb', line 7 def sentences_dict @sentences_dict end |
#sentences_files ⇒ Object
Returns the value of attribute sentences_files.
7 8 9 |
# File 'lib/sphinxtrain/map_adapter.rb', line 7 def sentences_files @sentences_files end |
#sentences_transcription ⇒ Object
Returns the value of attribute sentences_transcription.
7 8 9 |
# File 'lib/sphinxtrain/map_adapter.rb', line 7 def sentences_transcription @sentences_transcription end |
Instance Method Details
#adapt ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/sphinxtrain/map_adapter.rb', line 18 def adapt `#{SPHINX_FE_COMMAND} \ -argfile #{new_model_file 'feat.params'} \ -samprate 16000 \ -c #{sentences_files} \ -di #{recordings_dir} \ -do #{recordings_dir} \ -ei raw \ -eo mfc \ -seed 1 > /dev/null 2>&1` `#{BW_COMMAND} \ -hmmdir #{new_model} \ -moddeffn #{new_model_file 'mdef'} \ -ts2cbfn ".cont." \ -feat 1s_c_d_dd \ -cmn current \ -agc none \ -dictfn #{sentences_dict} \ -ctlfn #{sentences_files} \ -lsnfn #{sentences_transcription} \ -accumdir #{recordings_dir} \ -lda #{new_model_file 'feature_transform'} \ -cepdir #{recordings_dir} > /dev/null 2>&1` `#{MAP_ADAPT_COMMAND} \ -meanfn #{old_model_file 'means'} \ -varfn #{old_model_file 'variances'} \ -mixwfn #{old_model_file 'mixture_weights'} \ -tmatfn #{old_model_file 'transition_matrices'} \ -accumdir #{recordings_dir} \ -mapmeanfn #{new_model_file 'means'} \ -mapvarfn #{new_model_file 'variances'} \ -mapmixwfn #{new_model_file 'mixture_weights'} \ -maptmatfn #{new_model_file 'transition_matrices'} > /dev/null 2>&1` end |