2016-10-06 1 views
1

Je suis en train de travailler avec pocketsphinx pour la reconnaissance vocale avec Ubuntu 32b et python 2.7Comment puis-je configurer l'espagnol dans pocketsphinx avec python?

Je suis natif espagnol et je veux utiliser un modèle espagnol, mais il est difficile en raison des informations limitées et ma petite connaissance cette zone spécifique. Il a été difficile de trouver une source facile pour les étapes d'installation.

Répondre

0

Enregistrez un exemple de fichier hola.wav au format 16 kHz 16 bits mono.

Installez ensuite pocketsphinx-python

sudo apt-get install -y python python-dev python-pip build-essential swig git 
git clone --recursive https://github.com/cmusphinx/pocketsphinx-python 
cd pocketsphinx-python 
sudo python setup.py install 

Ensuite, téléchargez espagnol models du site cmusphinx.

Ensuite, écrire un script et essayer de l'exécuter, il devrait ressembler à ceci:

#!/usr/bin/env python 
from os import environ, path 

from pocketsphinx.pocketsphinx import * 
from sphinxbase.sphinxbase import * 

# Here is the configuration for Spanish 
config = Decoder.default_config() 
config.set_string('-hmm', 'cmusphinx-es-5.2/model_parameters/voxforge_es_sphinx.cd_ptm_4000') 
config.set_string('-lm', 'es-20k.lm.gz') 
config.set_string('-dict', 'es.dict') 
decoder = Decoder(config) 

# Decode streaming data. 
decoder = Decoder(config) 
decoder.start_utt() 
stream = open('hola.wav', 'rb') 
while True: 
    buf = stream.read(1024) 
    if buf: 
    decoder.process_raw(buf, False, False) 
    else: 
    break 
decoder.end_utt() 
print ('Best hypothesis segments: ', [seg.word for seg in decoder.seg()]) 

Pour en savoir plus sur CMUSphinx lire le tutorial.