code: def _compute_metrics(
      hits_or_lcs: int, pred_len: int, target_len: int
  ) -> Dict[str, Tensor]:
      """Compute overall metrics.
  
      This function computes precision, recall and F1 score based on hits/lcs, the length of lists of tokenizer
      predicted and target sentences.
  
      Args:
          hits_or_lcs: A number of matches or a length of the longest common subsequence.
          pred_len: A length of a tokenized predicted sentence.
          target_len: A length of a tokenized target sentence.
  
      """
      precision = hits_or_lcs / pred_len
      recall = hits_or_lcs / target_len
      if precision == recall == 0.0:
          return {
              "precision": tensor(0.0),
              "recall": tensor(0.0),
              "fmeasure": tensor(0.0),
          }
  
      fmeasure = 2 * precision * recall / (precision + recall)
      return {
          "precision": tensor(precision),
          "recall": tensor(recall),
          "fmeasure": tensor(fmeasure),
      }
  
file_path: torchmetrics/src/torchmetrics/functional/text/rouge.py
imports: import re
  from collections import Counter
  from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
  import torch
  from torch import Tensor, tensor
  from typing_extensions import Literal
  from torchmetrics.utilities.imports import _NLTK_AVAILABLE
label_desc: Use image node_id 3 for calling a global function with example usage: _compute_metrics(hits_or_lcs, pred_len, target_len) and returns: dict, dict