'Can CMUSphinx make distinctions between speech and background noise/music

I've been fiddling with Sphinx's word searching functionality for a bit now and have come to the conclusion that sorting through music to find words is a lost cause. However I don't need Sphinx to make such rigid distinctions. I only want to know where a potential word begins and ends, or more preferably where a phrase ends and one begins. Is there any way I can get a probabilistic reading on sounds to see a sound(s) potential for being word.

import os, sys
from pocketsphinx import AudioFile

fps=100
config = {
    'verbose': False,
    'audio_file': sys.argv[2],
    'buffer_size': 2000,
    'frate': fps,
    'no_search': False,
    'keyphrase': sys.argv[1],
    'hmm': '../../git/pocketsphinx/model/en-us/en-us',
    'lm': False,
    'dict': '../../git/pocketsphinx/model/en-us/cmudict-en-us.dict'
}

audio = AudioFile(**config)
for phrase in audio:
    for s in phrase.seg():
        print('| %4ss | %4ss | %8s |' % (s.start_frame / fps, s.end_frame / fps, s.word)

Could I make any modifications to the above code to get this sort of data? Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source