Class: Pocketsphinx::Configuration::Grammar

Inherits:
Default
  • Object
show all
Defined in:
lib/pocketsphinx/configuration/grammar.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#ps_config, #setting_definitions

Instance Method Summary collapse

Methods inherited from Default

#changes

Methods inherited from Base

#[], #[]=, #details, #setting_names

Constructor Details

#initialize(*args, &block) ⇒ Grammar

(grammar_path = nil)


6
7
8
9
10
# File 'lib/pocketsphinx/configuration/grammar.rb', line 6

def initialize(*args, &block)#(grammar_path = nil)
  super()

  @grammar = Pocketsphinx::Grammar::Jsgf.new(*args, &block)
end

Instance Attribute Details

#grammarObject

Returns the value of attribute grammar


4
5
6
# File 'lib/pocketsphinx/configuration/grammar.rb', line 4

def grammar
  @grammar
end

Instance Method Details

#post_init_decoder(decoder) ⇒ Object

Since JSGF strings are not supported in Pocketsphinx configuration (only files), we use the post_init_decoder hook to configure the JSGF


14
15
16
17
# File 'lib/pocketsphinx/configuration/grammar.rb', line 14

def post_init_decoder(decoder)
  decoder.set_jsgf_string(grammar.raw)
  decoder.set_search
end