python - How to use a keyword list on pocketsphinx -


i building program python , pocketsphinx in order control drone voice. have dictionary:

down  d aw n go  g ow left  l eh f t right  r ay t turn  t er n  ah p 

if word in dictionary works fine, if word not in dictionary pocketsphinx try find closest match dictionary. e.g if stop pocketsphinx display up, if case program should nothing. did search in internet , found problem can solved using keyword list, can't find information how use python. code have far

#!/usr/bin/env python  import os pocketsphinx import livespeech, get_model_path  = 0 j = 0 frase = '' tab = [['x','o','o'],['o','o','o'],['o','o','o']]  def move():     global i,j,frase      if 'down' in frase , i!= 2:         i=i+1     if 'up' in frase , i!= 0:         i=i-1     if 'left' in frase , j != 0:         j = j - 1     if 'right' in frase , j != 2:         j = j + 1  def draw():     global i,j     s = 0     l in range(3):         c in range(3):             if tab[l][c] == 'x':                 tab[l][c] = 'o'                 s = 1                 break         if s == 1:             break     tab[i][j] = 'x'     p in tab:         print p   model_path = get_model_path()  speech = livespeech(     verbose=false,     sampling_rate=16000,     buffer_size=2048,     no_search=false,     full_utt=false,     hmm= os.path.join(model_path,'en-us'),     lm=os.path.join(model_path, 'drone.lm.bin'),     dic=os.path.join(model_path, 'drone.dict'), )  p in tab:     print p  phrase in speech:     frase = str(phrase)     print frase     move()     draw() 

i using matrix x simulate drone. built dictionary , language model using lmtool, provinding corpus file.


Comments

Popular posts from this blog

cookies - Yii2 Advanced - Share session between frontend and mainsite (duplicate of frontend for www) -

angular - password and confirm password field validation angular2 reactive forms -

php - Permission denied. Laravel linux server -