cmusphinx / pocketsphinx

A small speech recognizer
Other
3.96k stars 720 forks source link

Can't initialize Pocketsphinx, '_NamespacePath' object is not subscriptable. #391

Open daniel-maxwell opened 4 months ago

daniel-maxwell commented 4 months ago

Hi, would someone mind taking a look at my setup? Tried multiple different approaches including trying to pass a hard coded string path, but I always get '_NamespacePath' object is not subscriptable. error.

Processor: AMD Ryzen 9 5900X 12-Core Processor 4.20 GHz Installed RAM: 32.0 GB System type: 64-bit operating system, x64-based processor Edition: Windows 10 Pro Python version: 3.7.16 Pocketsphinx version: 5.0.3 Location: c:\programdata\anaconda\envs\speech_recognition_venv\lib\site-packages

from pocketsphinx import Pocketsphinx

    def initialize_models(self):
        # Initialize PocketSphinx
        try:
            ps = Pocketsphinx()
            self.ps_decoder = ps.decode
            self.asr_systems['pocketsphinx'] = self.pocketsphinx_recognize
        except ImportError:
            print("PocketSphinx is not installed.")
        except Exception as e:
            print(f"There was an error initializing PocketSphinx: {str(e)}.")

Output: There was an error initializing PocketSphinx: '_NamespacePath' object is not subscriptable.

dhdaines commented 4 months ago

Hrm! I'm not familiar with that code as it was added by previous maintainers. Looks like a bug in PocketSphinx, will check it out now.