code: def _get_fbeta_score(true_positives, selected, relevant, beta=1):
    
    precision = 1
    if selected > 0:
      precision = true_positives / selected
    if beta == 0:
      return precision
    recall = 1
    if relevant > 0:
      recall = true_positives / relevant
    if precision > 0 and recall > 0:
      beta2 = beta * beta
      return (1 + beta2) * precision * recall / (beta2 * precision + recall)
    else:
      return 0
docs: Compute Fbeta score.
  
    Args:
      true_positives: Number of true positive ngrams.
      selected: Number of selected ngrams.
      relevant: Number of relevant ngrams.
      beta: 0 gives precision only, 1 gives F1 score, and Inf gives recall only.
  
    Returns:
      Fbeta score.