23 from language_support
import *
33 super(EnglishSupport, self).
__init__()
47 english_dictionary = self._globalParams._language_models_url + \
48 "/englishPack/cmudict-en-us.dict"
51 RappUtilities.rapp_print(
"English dictionary could not be opened!")
54 access = mmap.ACCESS_READ)
66 index = self._english_dict_mapping.find(
"\n" + word +
" ")
68 raise RappError(
"ERROR: Word " + word +\
69 " does not exist in the English Dictionary")
71 self._english_dict_file.seek(index + 1)
72 line = self._english_dict_file.readline()
74 split_line = line.split(
" ")
75 inner_phonemes = split_line[1:]
78 inner_words = word.split(
"-")
79 for in_w
in inner_words:
80 index = self._english_dict_mapping.find(
"\n" + in_w +
" ")
82 raise RappError(
"ERROR: Word " + in_w +\
83 " does not exist in the English Dictionary")
85 self._english_dict_file.seek(index + 1)
86 line = self._english_dict_file.readline()
88 split_line = line.split(
" ")
91 for i
in range(1, len(split_line)):
92 inner_phonemes.append(split_line[i])
93 enhanced_words[word] = inner_phonemes
109 engEngDict.update( {word: word} )
111 RappUtilities.rapp_print(words)
115 except RappError
as e:
116 raise RappError(e.value)
119 limited_sphinx_configuration= \
120 self._vocabulary.createConfigurationFiles(enhanced_words, grammar, sentences)
121 except RappError
as e:
122 raise RappError(e.value)
124 return limited_sphinx_configuration, engEngDict
def getWordPhonemes
Compute the English word phonemes.
_english_dict_mapping
The mmap of the English dictionary file contents.
def __init__
Performs initializations.
def getLimitedVocebularyConfiguration
Computes the Limited English Configuration.
Allows the creation of configuration files for Sphinx speech recognition.
Allows the creation of configuration files for English Sphinx speech recognition. ...
_english_dict_file
The English dictionary file.