sphinxtrain-ruby 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/.rspec +2 -0
- data/.travis.yml +31 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +51 -0
- data/Rakefile +9 -0
- data/bin/sphinxtrain-ruby +5 -0
- data/lib/sphinxtrain-ruby.rb +1 -0
- data/lib/sphinxtrain.rb +13 -0
- data/lib/sphinxtrain/analyser.rb +37 -0
- data/lib/sphinxtrain/map_adapter.rb +65 -0
- data/lib/sphinxtrain/trainer.rb +128 -0
- data/lib/sphinxtrain/training_decoder.rb +22 -0
- data/lib/sphinxtrain/version.rb +3 -0
- data/spec/spec_helper.rb +89 -0
- data/sphinxtrain-ruby.gemspec +28 -0
- metadata +147 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4a9fb198c5caf9b81b6cbd645e86850c3e615517
|
4
|
+
data.tar.gz: 640907aaafb8a83d0a1e8ffe41ac301704964421
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a3d64a1a77606bc4f2f5adbec12f549d8e366d8955e7c30194c3921175bc1b55d22cd232f284f1386810a2b02ce85212b71776057dbc02000d063e379aae1f59
|
7
|
+
data.tar.gz: f9d858fddae5f06562c7de6f80ccedbddccd7f0d401ccda81faee617350314766c8cc7baf464f57edaec2868a3eddb3380769ccd20c57fabae655f128d56e5b7
|
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
.DS_Store
|
data/.rspec
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.1.2
|
4
|
+
- 2.0.0
|
5
|
+
- 1.9.3
|
6
|
+
- rbx-2.2.9
|
7
|
+
- jruby-1.7.16
|
8
|
+
before_install:
|
9
|
+
- sudo apt-get update -qq
|
10
|
+
- sudo apt-get install -y swig
|
11
|
+
- git clone https://github.com/cmusphinx/sphinxbase.git
|
12
|
+
- cd sphinxbase
|
13
|
+
- ./autogen.sh
|
14
|
+
- ./configure
|
15
|
+
- make
|
16
|
+
- sudo make install
|
17
|
+
- cd ..
|
18
|
+
- git clone https://github.com/cmusphinx/pocketsphinx.git
|
19
|
+
- cd pocketsphinx
|
20
|
+
- ./autogen.sh
|
21
|
+
- ./configure
|
22
|
+
- make
|
23
|
+
- sudo make install
|
24
|
+
- cd ..
|
25
|
+
- git clone https://github.com/cmusphinx/sphinxtrain.git
|
26
|
+
- cd sphinxtrain
|
27
|
+
- ./autogen.sh
|
28
|
+
- ./configure
|
29
|
+
- sudo make install
|
30
|
+
- cd ..
|
31
|
+
- sudo ldconfig
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Howard Wilson
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# sphinxtrain-ruby
|
2
|
+
|
3
|
+
[![Build Status](http://img.shields.io/travis/watsonbox/sphinxtrain-ruby.svg?style=flat)](https://travis-ci.org/watsonbox/sphinxtrain-ruby)
|
4
|
+
|
5
|
+
Toolkit for training/adapting CMU Sphinx acoustic models.
|
6
|
+
|
7
|
+
The main goal is to help with [adapting existing acoustic models](http://cmusphinx.sourceforge.net/wiki/tutorialadapt) to a specific speaker/accent. Currently only the English [Voxforge](http://voxforge.org/) model is supported as a base - in fact [an adapted one](http://grasch.net/node/21) created by Peter Grasch in 2013 using the most up to date training data available at that time. I can confirm his results of a few percent performance increase over Voxforge 0.4 for my accent at least (British English).
|
8
|
+
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'sphinxtrain-ruby'
|
16
|
+
```
|
17
|
+
|
18
|
+
And then execute:
|
19
|
+
|
20
|
+
```bash
|
21
|
+
$ bundle
|
22
|
+
```
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
```bash
|
27
|
+
$ gem install sphinxtrain-ruby
|
28
|
+
```
|
29
|
+
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
Run `sphinxtrain-ruby` from the command line and follow the instructions. See some example output [here](https://github.com/watsonbox/sphinxtrain-ruby/wiki/Example-Output).
|
34
|
+
|
35
|
+
|
36
|
+
## To Do
|
37
|
+
|
38
|
+
- [ ] Add support for different data sets, not just the example from CPU Sphinx
|
39
|
+
- [ ] Allow re-recording when mistakes are made
|
40
|
+
- [ ] Re-factor code and add specs
|
41
|
+
- [ ] Consider using actual libs rather than command line tools for adapting model
|
42
|
+
- [ ] Make command line wget downloads less verbose
|
43
|
+
|
44
|
+
|
45
|
+
## Contributing
|
46
|
+
|
47
|
+
1. Fork it ( https://github.com/watsonbox/sphinxtrain-ruby/fork )
|
48
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
49
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
50
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
51
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'sphinxtrain'
|
data/lib/sphinxtrain.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "pocketsphinx-ruby"
|
2
|
+
require "colorize"
|
3
|
+
require "word_aligner"
|
4
|
+
|
5
|
+
require "sphinxtrain/version"
|
6
|
+
require "sphinxtrain/analyser"
|
7
|
+
require "sphinxtrain/map_adapter"
|
8
|
+
require "sphinxtrain/training_decoder"
|
9
|
+
require "sphinxtrain/trainer"
|
10
|
+
|
11
|
+
module Sphinxtrain
|
12
|
+
# Your code goes here...
|
13
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Sphinxtrain
|
2
|
+
class Analyser
|
3
|
+
def initialize(model)
|
4
|
+
configuration['hmm'] = model
|
5
|
+
configuration['seed'] = 1 # Ensure deterministic results
|
6
|
+
end
|
7
|
+
|
8
|
+
def analyse(sentences_file, recordings_dir)
|
9
|
+
total = 0
|
10
|
+
|
11
|
+
File.open(sentences_file).each_line.with_index do |transcription, index|
|
12
|
+
transcription = transcription.downcase.gsub(/[,\.]/, '')
|
13
|
+
file_path = File.join(recordings_dir, "arctic_#{(index + 1).to_s.rjust(4, "0")}.raw")
|
14
|
+
decoder.decode file_path
|
15
|
+
hypothesis = decoder.hypothesis
|
16
|
+
error_rate = WordAligner.align(transcription, hypothesis)
|
17
|
+
total += error_rate.percentage_accurate
|
18
|
+
|
19
|
+
if block_given?
|
20
|
+
yield transcription, hypothesis, error_rate.percentage_accurate
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
total / 20
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def configuration
|
30
|
+
@configuration ||= Pocketsphinx::Configuration.default
|
31
|
+
end
|
32
|
+
|
33
|
+
def decoder
|
34
|
+
@decoder ||= Pocketsphinx::Decoder.new(configuration)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
module Sphinxtrain
|
2
|
+
class MapAdapter
|
3
|
+
SPHINX_FE_COMMAND = "sphinx_fe"
|
4
|
+
BW_COMMAND = "/usr/local/Cellar/cmu-sphinxtrain/HEAD/libexec/sphinxtrain/bw"
|
5
|
+
MAP_ADAPT_COMMAND = "/usr/local/Cellar/cmu-sphinxtrain/HEAD/libexec/sphinxtrain/map_adapt"
|
6
|
+
|
7
|
+
attr_accessor :old_model, :new_model, :recordings_dir, :sentences_transcription, :sentences_files, :sentences_dict
|
8
|
+
|
9
|
+
def initialize(old_model:, new_model:, recordings_dir:, sentences_transcription:, sentences_files:, sentences_dict:)
|
10
|
+
self.old_model = old_model
|
11
|
+
self.new_model = new_model
|
12
|
+
self.recordings_dir = recordings_dir
|
13
|
+
self.sentences_transcription = sentences_transcription
|
14
|
+
self.sentences_files = sentences_files
|
15
|
+
self.sentences_dict = sentences_dict
|
16
|
+
end
|
17
|
+
|
18
|
+
def adapt
|
19
|
+
`#{SPHINX_FE_COMMAND} \
|
20
|
+
-argfile #{new_model_file 'feat.params'} \
|
21
|
+
-samprate 16000 \
|
22
|
+
-c #{sentences_files} \
|
23
|
+
-di #{recordings_dir} \
|
24
|
+
-do #{recordings_dir} \
|
25
|
+
-ei raw \
|
26
|
+
-eo mfc \
|
27
|
+
-seed 1 > /dev/null 2>&1`
|
28
|
+
|
29
|
+
`#{BW_COMMAND} \
|
30
|
+
-hmmdir #{new_model} \
|
31
|
+
-moddeffn #{new_model_file 'mdef'} \
|
32
|
+
-ts2cbfn ".cont." \
|
33
|
+
-feat 1s_c_d_dd \
|
34
|
+
-cmn current \
|
35
|
+
-agc none \
|
36
|
+
-dictfn #{sentences_dict} \
|
37
|
+
-ctlfn #{sentences_files} \
|
38
|
+
-lsnfn #{sentences_transcription} \
|
39
|
+
-accumdir #{recordings_dir} \
|
40
|
+
-lda #{new_model_file 'feature_transform'} \
|
41
|
+
-cepdir #{recordings_dir} > /dev/null 2>&1`
|
42
|
+
|
43
|
+
`#{MAP_ADAPT_COMMAND} \
|
44
|
+
-meanfn #{old_model_file 'means'} \
|
45
|
+
-varfn #{old_model_file 'variances'} \
|
46
|
+
-mixwfn #{old_model_file 'mixture_weights'} \
|
47
|
+
-tmatfn #{old_model_file 'transition_matrices'} \
|
48
|
+
-accumdir #{recordings_dir} \
|
49
|
+
-mapmeanfn #{new_model_file 'means'} \
|
50
|
+
-mapvarfn #{new_model_file 'variances'} \
|
51
|
+
-mapmixwfn #{new_model_file 'mixture_weights'} \
|
52
|
+
-maptmatfn #{new_model_file 'transition_matrices'} > /dev/null 2>&1`
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def old_model_file(file)
|
58
|
+
File.join(old_model, file)
|
59
|
+
end
|
60
|
+
|
61
|
+
def new_model_file(file)
|
62
|
+
File.join(new_model, file)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,128 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Sphinxtrain
|
4
|
+
class Trainer
|
5
|
+
BASE_DIR = File.join(Dir.home, '.sphinxtrain-ruby')
|
6
|
+
#VOXFORGE_URL = "http://downloads.sourceforge.net/project/cmusphinx/Acoustic%20and%20Language%20Models/English%20Voxforge/voxforge-en-0.4.tar.gz"
|
7
|
+
VOXFORGE_URL = "http://files.kde.org/accessibility/Simon/am/voxforge_en_sphinx.cd_cont_5000.tar.gz"
|
8
|
+
VOXFORGE_FILE = File.basename(VOXFORGE_URL)
|
9
|
+
VOXFORGE_FOLDER = File.basename(VOXFORGE_FILE, '.tar.gz')
|
10
|
+
#VOXFORGE_MODEL = File.join(BASE_DIR, VOXFORGE_FOLDER, "model_parameters/voxforge_en_sphinx.cd_cont_5000")
|
11
|
+
VOXFORGE_MODEL = VOXFORGE_FOLDER
|
12
|
+
RECORDINGS_DIR = File.join(BASE_DIR, 'recordings')
|
13
|
+
NEW_MODEL = File.join(BASE_DIR, 'new_model')
|
14
|
+
|
15
|
+
def train
|
16
|
+
Pocketsphinx.disable_logging
|
17
|
+
|
18
|
+
Dir.mkdir BASE_DIR rescue Errno::EEXIST
|
19
|
+
Dir.chdir BASE_DIR do
|
20
|
+
download_voxforge unless File.exist?(VOXFORGE_FILE)
|
21
|
+
download_assets unless arctic_file(:txt, :listoffiles, :transcription, :dic).all? { |f| File.exist? f }
|
22
|
+
record_sentences unless Dir.exist?(RECORDINGS_DIR)
|
23
|
+
|
24
|
+
analyse_model VOXFORGE_MODEL
|
25
|
+
|
26
|
+
duplicate_model
|
27
|
+
adapt_model
|
28
|
+
|
29
|
+
analyse_model NEW_MODEL
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def download_voxforge
|
36
|
+
log "=> Downloading Voxforge English 0.4 Acoustic Model..."
|
37
|
+
`wget #{VOXFORGE_URL}`
|
38
|
+
`tar xfz #{VOXFORGE_FILE}`
|
39
|
+
end
|
40
|
+
|
41
|
+
def download_assets
|
42
|
+
log "=> Downloading CMU ARCTIC Example Sentences..."
|
43
|
+
|
44
|
+
arctic_file(:txt, :listoffiles, :transcription, :dic).each do |file|
|
45
|
+
`wget http://www.speech.cs.cmu.edu/cmusphinx/moindocs/#{file} -O #{file}`
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def arctic_file(*keys)
|
50
|
+
keys.length == 1 ? "arctic20.#{keys.first}" : keys.map { |k| arctic_file k }
|
51
|
+
end
|
52
|
+
|
53
|
+
def record_sentences
|
54
|
+
log "=> Recording sentences..."
|
55
|
+
Dir.mkdir RECORDINGS_DIR unless Dir.exist?(RECORDINGS_DIR)
|
56
|
+
|
57
|
+
recognizer = Pocketsphinx::LiveSpeechRecognizer.new
|
58
|
+
decoder = TrainingDecoder.new(recognizer.decoder)
|
59
|
+
recognizer.decoder = decoder
|
60
|
+
|
61
|
+
# Initialize the decoder and microphone
|
62
|
+
recognizer.decoder.ps_decoder
|
63
|
+
recognizer.recordable
|
64
|
+
|
65
|
+
File.open(arctic_file(:txt), 'r').lines.each_with_index do |sentence, index|
|
66
|
+
puts "SAY: #{sentence}"
|
67
|
+
puts "Press ENTER to continue"
|
68
|
+
gets
|
69
|
+
|
70
|
+
# Small delay to avoid capturing audio connected with keypress
|
71
|
+
sleep 0.2
|
72
|
+
|
73
|
+
# Record a single utterance captured by TrainingDecoder
|
74
|
+
recognizer.recognize do |speech|
|
75
|
+
save_audio decoder.last_utterance, index
|
76
|
+
break
|
77
|
+
end
|
78
|
+
|
79
|
+
puts "Saved audio\n\n"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def save_audio(data, sentence_index)
|
84
|
+
raise "Can't save empty audio data" if data.nil? || data.empty?
|
85
|
+
|
86
|
+
File.open(File.join(RECORDINGS_DIR, "arctic_#{(sentence_index + 1).to_s.rjust(4, "0")}.raw"), "wb") do |file|
|
87
|
+
file.write data
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def analyse_model(model)
|
92
|
+
log "=> Analysing acoustic model...\n"
|
93
|
+
|
94
|
+
result = Analyser.new(model).analyse(arctic_file(:txt), RECORDINGS_DIR) do |transcription, hypothesis, accuracy|
|
95
|
+
puts " ACTUAL: #{transcription}"
|
96
|
+
puts " RECORD: #{hypothesis}"
|
97
|
+
puts " RESULT: #{accuracy}\n\n"
|
98
|
+
end
|
99
|
+
|
100
|
+
puts " OVERALL: #{result}\n\n"
|
101
|
+
end
|
102
|
+
|
103
|
+
def duplicate_model
|
104
|
+
log "=> Duplicating Voxforge acoustic model..."
|
105
|
+
|
106
|
+
FileUtils.rm_rf(NEW_MODEL) if Dir.exist?(NEW_MODEL)
|
107
|
+
FileUtils.cp_r(VOXFORGE_MODEL, NEW_MODEL)
|
108
|
+
end
|
109
|
+
|
110
|
+
# Follows process described here: http://cmusphinx.sourceforge.net/wiki/tutorialadapt
|
111
|
+
def adapt_model
|
112
|
+
log "=> Adapting Voxforge acoustic model..."
|
113
|
+
|
114
|
+
MapAdapter.new(
|
115
|
+
old_model: VOXFORGE_MODEL,
|
116
|
+
new_model: NEW_MODEL,
|
117
|
+
recordings_dir: RECORDINGS_DIR,
|
118
|
+
sentences_transcription: arctic_file(:transcription),
|
119
|
+
sentences_files: arctic_file(:listoffiles),
|
120
|
+
sentences_dict: arctic_file(:dic)
|
121
|
+
).adapt
|
122
|
+
end
|
123
|
+
|
124
|
+
def log(message)
|
125
|
+
puts message.colorize(:green)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Sphinxtrain
|
2
|
+
# Wrap a decoder to save the last utterance
|
3
|
+
class TrainingDecoder < SimpleDelegator
|
4
|
+
attr_accessor :data
|
5
|
+
attr_accessor :last_utterance
|
6
|
+
|
7
|
+
def start_utterance(*args)
|
8
|
+
self.data = ""
|
9
|
+
super
|
10
|
+
end
|
11
|
+
|
12
|
+
def end_utterance(*args)
|
13
|
+
self.last_utterance = data
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
def process_raw(buffer, size, *args)
|
18
|
+
super
|
19
|
+
self.data << buffer.get_bytes(0, size * 2)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
4
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
5
|
+
#
|
6
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
7
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
8
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
9
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
10
|
+
# a separate helper file that requires the additional dependencies and performs
|
11
|
+
# the additional setup, and require it from the spec files that actually need it.
|
12
|
+
#
|
13
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
14
|
+
# users commonly want.
|
15
|
+
#
|
16
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
17
|
+
RSpec.configure do |config|
|
18
|
+
# rspec-expectations config goes here. You can use an alternate
|
19
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
20
|
+
# assertions if you prefer.
|
21
|
+
config.expect_with :rspec do |expectations|
|
22
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
23
|
+
# and `failure_message` of custom matchers include text for helper methods
|
24
|
+
# defined using `chain`, e.g.:
|
25
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
26
|
+
# # => "be bigger than 2 and smaller than 4"
|
27
|
+
# ...rather than:
|
28
|
+
# # => "be bigger than 2"
|
29
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
30
|
+
end
|
31
|
+
|
32
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
33
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
34
|
+
config.mock_with :rspec do |mocks|
|
35
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
36
|
+
# a real object. This is generally recommended, and will default to
|
37
|
+
# `true` in RSpec 4.
|
38
|
+
mocks.verify_partial_doubles = true
|
39
|
+
end
|
40
|
+
|
41
|
+
# The settings below are suggested to provide a good initial experience
|
42
|
+
# with RSpec, but feel free to customize to your heart's content.
|
43
|
+
=begin
|
44
|
+
# These two settings work together to allow you to limit a spec run
|
45
|
+
# to individual examples or groups you care about by tagging them with
|
46
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
47
|
+
# get run.
|
48
|
+
config.filter_run :focus
|
49
|
+
config.run_all_when_everything_filtered = true
|
50
|
+
|
51
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
52
|
+
# For more details, see:
|
53
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
54
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
55
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
56
|
+
config.disable_monkey_patching!
|
57
|
+
|
58
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
59
|
+
# be too noisy due to issues in dependencies.
|
60
|
+
config.warnings = true
|
61
|
+
|
62
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
63
|
+
# file, and it's useful to allow more verbose output when running an
|
64
|
+
# individual spec file.
|
65
|
+
if config.files_to_run.one?
|
66
|
+
# Use the documentation formatter for detailed output,
|
67
|
+
# unless a formatter has already been configured
|
68
|
+
# (e.g. via a command-line flag).
|
69
|
+
config.default_formatter = 'doc'
|
70
|
+
end
|
71
|
+
|
72
|
+
# Print the 10 slowest examples and example groups at the
|
73
|
+
# end of the spec run, to help surface which specs are running
|
74
|
+
# particularly slow.
|
75
|
+
config.profile_examples = 10
|
76
|
+
|
77
|
+
# Run specs in random order to surface order dependencies. If you find an
|
78
|
+
# order dependency and want to debug it, you can fix the order by providing
|
79
|
+
# the seed, which is printed after each run.
|
80
|
+
# --seed 1234
|
81
|
+
config.order = :random
|
82
|
+
|
83
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
84
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
85
|
+
# test failures related to randomization by passing the same `--seed` value
|
86
|
+
# as the one that triggered the failure.
|
87
|
+
Kernel.srand config.seed
|
88
|
+
=end
|
89
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'sphinxtrain/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "sphinxtrain-ruby"
|
8
|
+
spec.version = Sphinxtrain::VERSION
|
9
|
+
spec.authors = ["Howard Wilson"]
|
10
|
+
spec.email = ["howard@watsonbox.net"]
|
11
|
+
spec.summary = %q{Toolkit for training/adapting CMU Sphinx acoustic models.}
|
12
|
+
spec.description = %q{Toolkit for training/adapting CMU Sphinx acoustic models.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "pocketsphinx-ruby", "~> 0.1.1"
|
22
|
+
spec.add_dependency "word_aligner", "~> 0.1.2"
|
23
|
+
spec.add_dependency "colorize", "~> 0.7.3"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.1.0"
|
27
|
+
spec.add_development_dependency "rake"
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sphinxtrain-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Howard Wilson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pocketsphinx-ruby
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.1.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.1.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: word_aligner
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.1.2
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.1.2
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: colorize
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.7.3
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.7.3
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.6'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.6'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.1.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.1.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Toolkit for training/adapting CMU Sphinx acoustic models.
|
98
|
+
email:
|
99
|
+
- howard@watsonbox.net
|
100
|
+
executables:
|
101
|
+
- sphinxtrain-ruby
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
|
+
- ".travis.yml"
|
108
|
+
- Gemfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- bin/sphinxtrain-ruby
|
113
|
+
- lib/sphinxtrain-ruby.rb
|
114
|
+
- lib/sphinxtrain.rb
|
115
|
+
- lib/sphinxtrain/analyser.rb
|
116
|
+
- lib/sphinxtrain/map_adapter.rb
|
117
|
+
- lib/sphinxtrain/trainer.rb
|
118
|
+
- lib/sphinxtrain/training_decoder.rb
|
119
|
+
- lib/sphinxtrain/version.rb
|
120
|
+
- spec/spec_helper.rb
|
121
|
+
- sphinxtrain-ruby.gemspec
|
122
|
+
homepage: ''
|
123
|
+
licenses:
|
124
|
+
- MIT
|
125
|
+
metadata: {}
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 2.2.2
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: Toolkit for training/adapting CMU Sphinx acoustic models.
|
146
|
+
test_files:
|
147
|
+
- spec/spec_helper.rb
|