class_docstr: The G2P model evaluation wrapper
  
  Arguments
  ---------
  hparams: dict
      the dictionary from a parsed hyperparameter file
  device: str
      the device identifier
  model_state: dict
      a pre-loaded model state for a "warm start" if applicable
      - could be useful if hyperparameters have changed, but
      the same model can be reused from one run to the next
docstr: Flattens an array of scores, using a weighted average of the scores of
  individual words, by word length
  
  Arguments
  ---------
  hyps: list
      the hypotheses (the beam search result)
  scores: list
      the scores corresponding to the hypotheses
  
  Results
  -------
  scores: list
      the scores corresponding to the hypotheses,
      merged
docstr_tok: ["Flattens","an","array","of","scores",",","using","a","weighted","average","of","the","scores","of","individual","words",",","by","word","length","Arguments","--","--","--","--","-","hyps",":","list","the","hypotheses","(","the","beam","search","result",")","scores",":","list","the","scores","corresponding","to","the","hypotheses","Results","--","--","--","-","scores",":","list","the","scores","corresponding","to","the","hypotheses",",","merged"]
code: def _flatten_scores(self, hyps, scores):
      """Flattens an array of scores, using a weighted average of the scores of
      individual words, by word length
  
      Arguments
      ---------
      hyps: list
          the hypotheses (the beam search result)
      scores: list
          the scores corresponding to the hypotheses
  
      Results
      -------
      scores: list
          the scores corresponding to the hypotheses,
          merged
      """
      seq_len = sum(len(word_hyp) for word_hyp in hyps)
      return (
          sum(
              word_score * len(word_hyp)
              for word_hyp, word_score in zip(hyps, scores)
          )
          / seq_len
      )
  
imports: from hyperpyyaml import load_hyperpyyaml
  from speechbrain.dataio.batch import PaddedBatch
  from speechbrain.lobes.models.g2p.dataio import get_sequence_key
  from speechbrain.utils import hpopt
  from speechbrain.wordemb.util import expand_to_chars
  from train import dataio_prep, load_dependencies
  from types import SimpleNamespace
  from tqdm.auto import tqdm
  import math
  import itertools
  import speechbrain
  import torch
  import sys
  import logging
label_desc: Use image node_id 9 for calling the G2PEvaluator obj's underlying member method code with example usage: obj._flatten_scores(hyps, scores) and returns: unknown