def author_helpfulness(
  scoredNotes: pd.DataFrame,
  noteInterceptKey: str,
  CRNHMultiplier: float = 5.0,
) -> pd.DataFrame:
  """Computes author helpfulness scores as described in:
  https://twitter.github.io/communitynotes/contributor-scores/#author-helpfulness-scores

  Args:
    scoredNotes (pd.DataFrame): one row per note, containing preliminary note statuses
    noteInterceptKey: str dictating column containing note intercept
    CRNHMultiplier (float): how much more to penalize CRNH notes written vs. reward CRH notes

  Returns:
    pd.DataFrame: one row per author, containing columns for author helpfulness scores
  """

  scoredNotes.loc[:, c.noteCountKey] = 1
  authorCounts = scoredNotes.groupby(c.noteAuthorParticipantIdKey).sum(numeric_only=True)[
    [
      c.currentlyRatedHelpfulBoolKey,
      c.currentlyRatedNotHelpfulBoolKey,
      c.noteCountKey,
      noteInterceptKey,
    ]
  ]
  authorCounts[c.crhRatioKey] = (
    authorCounts[c.currentlyRatedHelpfulBoolKey] / authorCounts[c.noteCountKey]
  )
  authorCounts[c.crnhRatioKey] = (
    authorCounts[c.currentlyRatedNotHelpfulBoolKey] / authorCounts[c.noteCountKey]
  )
  authorCounts[c.crhCrnhRatioDifferenceKey] = authorCounts[c.crhRatioKey] - (
    authorCounts[c.crnhRatioKey] * CRNHMultiplier
  )
  authorCounts[c.meanNoteScoreKey] = authorCounts[noteInterceptKey] / authorCounts[c.noteCountKey]

  return authorCounts
Computes author helpfulness scores as described in:
  https://twitter.github.io/communitynotes/contributor-scores/#author-helpfulness-scores

  Args:
    scoredNotes (pd.DataFrame): one row per note, containing preliminary note statuses
    noteInterceptKey: str dictating column containing note intercept
    CRNHMultiplier (float): how much more to penalize CRNH notes written vs. reward CRH notes

  Returns:
    pd.DataFrame: one row per author, containing columns for author helpfulness scores
  
sourcecode/scoring/helpfulness_scores.py