0% found this document useful (0 votes)
16 views5 pages

AJ Python Speech Recog Part Two

This document provides summaries of methods available for the main pocketsphinx speech recognition package. The methods allow accessing configuration parameters, language models, recognition results, and more. They enable operations like loading dictionaries, looking up words, retrieving the current hypothesis, and managing speech recognition tasks.

Uploaded by

Abhishek Jain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
16 views5 pages

AJ Python Speech Recog Part Two

This document provides summaries of methods available for the main pocketsphinx speech recognition package. The methods allow accessing configuration parameters, language models, recognition results, and more. They enable operations like loading dictionaries, looking up words, retrieving the current hypothesis, and managing speech recognition tasks.

Uploaded by

Abhishek Jain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 5

Main pocketsphinx package — PocketSphinx 5.0.

1 documentation 06/08/23, 12:16 AM

that will always be followed.

Returns: Newly created finite-state grammar.

Return type: FsgModel

Raises: ValueError – On invalid input.

current_search(self)

Get the name of the current search (LM, grammar, etc).

Returns: Name of currently ac!ve search module.

Return type: str

sta!c default_config()

Get the default configura!on.

DEPRECATED: This does the same thing as simply crea!ng a Config and is
here for historical reasons.

Returns: Default configura!on.

Return type: Config

end_utt(self)

Finish processing raw audio input.

This method must be called at the end of each separate “u"erance” of raw
audio input. It takes care of flushing any internal buffers and finalizing
recogni!on results.

sta!c file_config(unicode path)

Parse configura!on from a file.

DEPRECATED: This simply calls Config.parse_file and is here for historical


reasons.

Parameters: path (str) – Path to arguments file.

Returns: Configura!on parsed from path .


https://pocketsphinx.readthedocs.io/en/latest/pocketsphinx.html Page 6 of 32
Main pocketsphinx package — PocketSphinx 5.0.1 documentation 06/08/23, 12:16 AM

Returns: Configura!on parsed from path .

Return type: Config

get_alignment(self)

Get the current sub-word alignment, if any.

This will return something if ps_set_alignment has been called, but it will not
contain an actual alignment (i.e. phone and state dura!ons) unless a second
pass of decoding has been run.

If the decoder is not in sub-word alignment mode then it will return None.

Returns: Alignment - if an alignment exists.

get_cmn(self, update=False)

Get current cepstral mean.

Parameters: update (boolean) – Update the mean based on current


u"erance.

Returns: Cepstral mean as a comma-separated list of numbers.

Return type: str

get_config(self)

Get current configura!on.

DEPRECATED: This does the same thing as simply accessing config and is
here for historical reasons.

Returns: Current configura!on.

Return type: Config

get_fsg(self, unicode name=None)

Get the currently ac!ve FsgModel or the model for a specific search module.

Parameters: name (str) – Name of search module for this FSG. If this is
None (the default), the currently ac!ve FSG will be
returned.
https://pocketsphinx.readthedocs.io/en/latest/pocketsphinx.html Page 7 of 32
Main pocketsphinx package — PocketSphinx 5.0.1 documentation 06/08/23, 12:16 AM

returned.

Returns: FSG corresponding to name , or None if not found.

Return type: FsgModel

get_in_speech(self)

Return speech status.

This method is retained for compa!bility, but it will always return True as long
as ps_start_utt has been previously called.

get_kws(self, unicode name=None)

Get keyphrases as text from current or specified search module.

Parameters: name (str) – Search module name for keywords. If this is


None –
if (the currently ac!ve keywords are returned) –
ac!ve. (keyword search is) –

Returns: List of keywords as lines (i.e. separated by ‘\n’), or None if


the specified search could not be found, or if name is None
and keyword search is not currently ac!ve.

Return type: str

get_lattice(self)

Get word la$ce from current recogni!on result.

Returns: Word la$ce from current result.

Return type: La$ce

get_lm(self, unicode name=None)

Get the current N-Gram language model or the one associated with a search
module.

Parameters: name (str) – Name of search module for this language


model. If this is None (default) the current LM will be
returned.
https://pocketsphinx.readthedocs.io/en/latest/pocketsphinx.html Page 8 of 32
Main pocketsphinx package — PocketSphinx 5.0.1 documentation 06/08/23, 12:16 AM

returned.

Returns: Model corresponding to name , or None if not found.

Return type: NGramModel

get_logmath(self)

Get the LogMath object for this decoder.

DEPRECATED: This does the same thing as simply accessing logmath and is
here for historical reasons.

Returns: Current log-math computa!on object.

Return type: LogMath

get_prob(self)

Posterior probability of current recogn!on hypothesis.

Returns: Posterior probability of current hypothesis. This will be 1.0


unless the bestpath configura!on op!on is enabled.

Return type: float

get_search(self)

hyp(self)

Get current recogni!on hypothesis.

Returns: Current recogni!on output.

Return type: Hypothesis

load_dict(self, unicode dict_path, unicode fdict_path=None, unicode _format=None)

Load dic!onary (and possibly noise dic!onary) from a file.

Note that the format argument does nothing, never has done anything, and
never will. It’s only here for historical reasons.

Parameters: dict_path (str) – Path to pronuncia!on dic!onary file.


https://pocketsphinx.readthedocs.io/en/latest/pocketsphinx.html Page 9 of 32
Main pocketsphinx package — PocketSphinx 5.0.1 documentation 06/08/23, 12:16 AM

Parameters: dict_path (str) – Path to pronuncia!on dic!onary file.


fdict_path (str) – Path to noise dic!onary file, or None to
keep exis!ng one (default is None)
_format (str) – Useless argument that does nothing.

Raises: Run!meError – If dic!onary loading failed for some reason.

logmath

Read-only property containing LogMath object for this decoder.

lookup_word(self, unicode word)

Look up a word in the dic!onary and return phone transcrip!on for it.

Parameters: word (str) – Text of word to search for.

Returns: Space-separated list of phones, or None if not found.

Return type: str

n_frames(self)

Get the number of frames processed up to this point.

Returns: Like it says.

Return type: int

nbest(self)

Get N-Best hypotheses.

Returns: Generator over N-Best recogni!on results

Return type: Iterable[Hypothesis]

parse_jsgf(self, jsgf_string, toprule=None)

Parse a JSGF grammar from bytes or string.

Because PocketSphinx uses UTF-8 internally, it is more efficient to parse from


bytes, as a string will get encoded and subsequently decoded.

Parameters: jsgf_string (bytes|str) – JSGF grammar as string or UTF-8


https://pocketsphinx.readthedocs.io/en/latest/pocketsphinx.html Page 10 of 32

You might also like