paddlespeech.s2t.decoders.ctcdecoder.decoders_deprecated module

Contains various CTC decoders.

paddlespeech.s2t.decoders.ctcdecoder.decoders_deprecated.ctc_beam_search_decoder(probs_seq, beam_size, vocabulary, cutoff_prob=1.0, cutoff_top_n=40, ext_scoring_func=None, nproc=False)[source]

CTC Beam search decoder.

It utilizes beam search to approximately select top best decoding labels and returning results in the descending order. The implementation is based on Prefix Beam Search (https://arxiv.org/abs/1408.2873), and the unclear part is redesigned. Two important modifications: 1) in the iterative computation of probabilities, the assignment operation is changed to accumulation for one prefix may comes from different paths; 2) the if condition "if l^+ not in A_prev then" after probabilities' computation is deprecated for it is hard to understand and seems unnecessary.

Parameters:
  • probs_seq (2-D list) -- 2-D list of probability distributions over each time step, with each element being a list of normalized probabilities over vocabulary and blank.

  • beam_size (int) -- Width for beam search.

  • vocabulary (list) -- Vocabulary list.

  • cutoff_prob (float) -- Cutoff probability in pruning, default 1.0, no pruning.

  • ext_scoring_func -- External scoring function for partially decoded sentence, e.g. word count or language model.

  • nproc (bool) -- Whether the decoder used in multiprocesses.

Returns:

List of tuples of log probability and sentence as decoding results, in descending order of the probability.

Return type:

list

paddlespeech.s2t.decoders.ctcdecoder.decoders_deprecated.ctc_beam_search_decoder_batch(probs_split, beam_size, vocabulary, num_processes, cutoff_prob=1.0, cutoff_top_n=40, ext_scoring_func=None)[source]

CTC beam search decoder using multiple processes.

Parameters:
  • probs_seq (3-D list) -- 3-D list with each element as an instance of 2-D list of probabilities used by ctc_beam_search_decoder().

  • beam_size (int) -- Width for beam search.

  • vocabulary (list) -- Vocabulary list.

  • num_processes (int) -- Number of parallel processes.

  • cutoff_prob (float) -- Cutoff probability in pruning, default 1.0, no pruning.

  • num_processes -- Number of parallel processes.

  • ext_scoring_func -- External scoring function for partially decoded sentence, e.g. word count or language model.

Returns:

List of tuples of log probability and sentence as decoding results, in descending order of the probability.

Return type:

list

paddlespeech.s2t.decoders.ctcdecoder.decoders_deprecated.ctc_greedy_decoder(probs_seq, vocabulary)[source]

CTC greedy (best path) decoder.

Path consisting of the most probable tokens are further post-processed to remove consecutive repetitions and all blanks.

Parameters:
  • probs_seq (list) -- 2-D list of probabilities over the vocabulary for each character. Each element is a list of float probabilities for one character.

  • vocabulary (list) -- Vocabulary list.

Returns:

Decoding result string.

Return type:

baseline