class_docstr: This class handle the CTC beam informations during decoding.
  
  Arguments
  ---------
  text : str
      The current text of the beam.
  full_text : str
      The full text of the beam.
  next_word : str
      The next word to be added to the beam.
  partial_word : str
      The partial word being added to the beam.
  last_token : str, optional
      The last token of the beam.
  last_token_index : int, optional
      The index of the last token of the beam.
  text_frames : List[Tuple[int, int]]
      The start and end frame of the text.
  partial_frames : Tuple[int, int]
      The start and end frame of the partial word.
  p : float
      The probability of the beam.
  p_b : float
      The probability of the beam ending in a blank.
  p_nb : float
      The probability of the beam not ending in a blank.
  n_p_b : float
      The previous probability of the beam ending in a blank.
  n_p_nb : float
      The previous probability of the beam not ending in a blank.
  score : float
      The score of the beam (LM + CTC)
  score_ctc : float
      The CTC score computed.
  
  Example
  -------
  >>> beam = CTCBeam(
  ...     text="",
  ...     full_text="",
  ...     next_word="",
  ...     partial_word="",
  ...     last_token=None,
  ...     last_token_index=None,
  ...     text_frames=[(0, 0)],
  ...     partial_frames=(0, 0),
  ...     p=-math.inf,
  ...     p_b=-math.inf,
  ...     p_nb=-math.inf,
  ...     n_p_b=-math.inf,
  ...     n_p_nb=-math.inf,
  ...     score=-math.inf,
  ...     score_ctc=-math.inf,
  ... )
class_docstr_tok: ["This","class","handle","the","CTC","beam","informations","during","decoding",".","Arguments","--","--","--","--","-","text",":","str","The","current","text","of","the","beam",".","full_text",":","str","The","full","text","of","the","beam",".","next_word",":","str","The","next","word","to","be","added","to","the","beam",".","partial_word",":","str","The","partial","word","being","added","to","the","beam",".","last_token",":","str",",","optional","The","last","token","of","the","beam",".","last_token_index",":","int",",","optional","The","index","of","the","last","token","of","the","beam",".","text_frames",":","List","[","Tuple","[","int",",","int","]","]","The","start","and","end","frame","of","the","text",".","partial_frames",":","Tuple","[","int",",","int","]","The","start","and","end","frame","of","the","partial","word",".","p",":","float","The","probability","of","the","beam",".","p_b",":","float","The","probability","of","the","beam","ending","in","a","blank",".","p_nb",":","float","The","probability","of","the","beam","not","ending","in","a","blank",".","n_p_b",":","float","The","previous","probability","of","the","beam","ending","in","a","blank",".","n_p_nb",":","float","The","previous","probability","of","the","beam","not","ending","in","a","blank",".","score",":","float","The","score","of","the","beam","(","LM","+","CTC",")","score_ctc",":","float","The","CTC","score","computed",".","Example","--","--","--","-",">",">",">","beam","=","CTCBeam","(","...","text=","''","''",",","...","full_text=","''","''",",","...","next_word=","''","''",",","...","partial_word=","''","''",",","...","last_token=None",",","...","last_token_index=None",",","...","text_frames=","[","(","0",",","0",")","]",",","...","partial_frames=","(","0",",","0",")",",","...","p=-math.inf",",","...","p_b=-math.inf",",","...","p_nb=-math.inf",",","...","n_p_b=-math.inf",",","...","n_p_nb=-math.inf",",","...","score=-math.inf",",","...","score_ctc=-math.inf",",","...",")"]
docstr: Create a CTCBeam from a LMCTCBeam
  
  Arguments
  ---------
  lm_beam : LMCTCBeam
      The LMCTCBeam to convert.
  
  Returns
  -------
  CTCBeam
      The CTCBeam converted.
docstr_tok: ["Create","a","CTCBeam","from","a","LMCTCBeam","Arguments","--","--","--","--","-","lm_beam",":","LMCTCBeam","The","LMCTCBeam","to","convert",".","Returns","--","--","--","-","CTCBeam","The","CTCBeam","converted","."]
code: def from_lm_beam(self, lm_beam: "LMCTCBeam") -> "CTCBeam":
      """Create a CTCBeam from a LMCTCBeam
  
      Arguments
      ---------
      lm_beam : LMCTCBeam
          The LMCTCBeam to convert.
  
      Returns
      -------
      CTCBeam
          The CTCBeam converted.
      """
      return CTCBeam(
          text=lm_beam.text,
          full_text=lm_beam.full_text,
          next_word=lm_beam.next_word,
          partial_word=lm_beam.partial_word,
          last_token=lm_beam.last_token,
          last_token_index=lm_beam.last_token_index,
          text_frames=lm_beam.text_frames,
          partial_frames=lm_beam.partial_frames,
          p=lm_beam.p,
          p_b=lm_beam.p_b,
          p_nb=lm_beam.p_nb,
          n_p_b=lm_beam.n_p_b,
          n_p_nb=lm_beam.n_p_nb,
          score=lm_beam.score,
          score_ctc=lm_beam.score_ctc,
      )
  
imports: from itertools import groupby
  from speechbrain.dataio.dataio import length_to_mask
  import math
  import dataclasses
  import numpy
  import heapq
  import logging
  import torch
  import warnings
  from typing import Dict, List, Optional, Union, Any, Tuple
label_desc: Use image node_id 1 for calling the CTCBeam obj's underlying member method code with example usage: obj.from_lm_beam(lm_beam) and returns: CTCBeam