class_docstr: Time synchronous beam search algorithm.
class_docstr_tok: ["Time","synchronous","beam","search","algorithm","."]
docstr: Calculate joint score for hyps.
docstr_tok: ["Calculate","joint","score","for","hyps","."]
code: def joint_score(
      self, hyps: Any, ctc_score_dp: Any, recompute_cache: bool = False
  ) -> Any:
      """Calculate joint score for hyps."""
      scores = dict()
      for h in hyps:
          score = self.ctc_weight * np.logaddexp(
              *ctc_score_dp[h]
          )  # ctc score
          logging.debug("len: " + str(len(h)))
          logging.debug("ctc score: " + str(score))
          if (
              len(h) > 1
              and self.decoder_weight > 0
              and self.decoder is not None
          ):
              score += (
                  self.cached_score(
                      h, self.attn_cache, self.decoder, recompute_cache
                  )
                  * self.decoder_weight
              )  # attn score
          if len(h) > 1 and self.lm is not None and self.lm_weight > 0:
              score += (
                  self.cached_score(h, self.lm_cache, self.lm)
                  * self.lm_weight
              )  # lm score
          score += self.penalty * (len(h) - 1)  # penalty score
          scores[h] = score
          logging.debug("total score: " + str(score))
      return scores
  
file_path: espnet/espnet/nets/beam_search_timesync_streaming.py
imports: import logging
  from collections import defaultdict
  from dataclasses import dataclass
  from typing import Any, Dict, List, Tuple
  import numpy
  import torch
  from espnet.nets.beam_search import Hypothesis
  from espnet.nets.scorer_interface import ScorerInterface
label_desc: Use image node_id 4 for calling the BeamSearchTimeSyncStreaming obj's underlying member method code with example usage: obj.joint_score(hyps, ctc_score_dp, recompute_cache) and returns: scores