<commit_before>package com.nhlreplay.parser.playbyplay

import util.matching.Regex
import xml.NodeSeq

class GameEventGoal(columns: NodeSeq, description: String)
  extends GameEvent(columns: NodeSeq) with GameEventGoalAttemptValues
{
  val (team, shooter, goalCount, assist1st, assist1stCount, assist2nd, assist2ndCount) = parseDescription(description)

  private def parseDescription(description: String) = {
    val goalPattern = new Regex(PATTERN_TEAM + PATTERN_PLAYER_COUNT, "team", "scorer", "count")
    val firstAssistPattern = new Regex(""".+Assists?:\s""" + PATTERN_PLAYER_COUNT, "assist", "count")
    val secondAssistPattern = new Regex(""";\s""" + PATTERN_PLAYER_COUNT, "assist", "count")

    goalPattern.findFirstMatchIn(description) match {

      case Some(scorerMatch) => {
        val (team, scorer, scorerCount) = (Team.trimAbbreviation(scorerMatch.group("team")),
                                           trim(scorerMatch.group("scorer")),
                                           scorerMatch.group("count"))
        val goalCount = if (scorerCount != null) scorerCount else ""

        firstAssistPattern.findFirstMatchIn(scorerMatch.after) match {

          case Some(assist1stMatch) => {
            val (assist1st, assist1stCount) = (trim(assist1stMatch.group("assist")), assist1stMatch.group("count"))
            secondAssistPattern.findFirstMatchIn(assist1stMatch.after) match {

              case Some(assist2ndMatch) => {
                val (assist2nd, assist2ndCount) = (trim(assist2ndMatch.group("assist")), assist2ndMatch.group("count"))
                (team, scorer, goalCount, assist1st, assist1stCount, assist2nd, assist2ndCount)
              }

              case None => (team, scorer, goalCount, assist1st, assist1stCount, "", "")<commit_msg>Ignore Scalastyle null checker warning<commit_after>package com.nhlreplay.parser.playbyplay

import util.matching.Regex
import xml.NodeSeq

class GameEventGoal(columns: NodeSeq, description: String)
  extends GameEvent(columns: NodeSeq) with GameEventGoalAttemptValues
{
  val (team, shooter, goalCount, assist1st, assist1stCount, assist2nd, assist2ndCount) = parseDescription(description)

  private def parseDescription(description: String) = {
    val goalPattern = new Regex(PATTERN_TEAM + PATTERN_PLAYER_COUNT, "team", "scorer", "count")
    val firstAssistPattern = new Regex(""".+Assists?:\s""" + PATTERN_PLAYER_COUNT, "assist", "count")
    val secondAssistPattern = new Regex(""";\s""" + PATTERN_PLAYER_COUNT, "assist", "count")

    goalPattern.findFirstMatchIn(description) match {

      case Some(scorerMatch) => {
        val (team, scorer, scorerCount) = (Team.trimAbbreviation(scorerMatch.group("team")),
                                           trim(scorerMatch.group("scorer")),
                                           scorerMatch.group("count"))
        // scalastyle:off null
        val goalCount = if (scorerCount != null) scorerCount else ""

        firstAssistPattern.findFirstMatchIn(scorerMatch.after) match {

          case Some(assist1stMatch) => {
            val (assist1st, assist1stCount) = (trim(assist1stMatch.group("assist")), assist1stMatch.group("count"))
            secondAssistPattern.findFirstMatchIn(assist1stMatch.after) match {

              case Some(assist2ndMatch) => {
                val (assist2nd, assist2ndCount) = (trim(assist2ndMatch.group("assist")), assist2ndMatch.group("count"))
                (team, scorer, goalCount, assist1st, assist1stCount, assist2nd, assist2ndCount)
              }

              case None => (team, scorer, goalCount, assist1st, assist1stCount, "", "")
{'fraction_non_alphanumeric': 0.11750137589433131, 'fraction_numerical': 0.011557512383048982, 'mean_word_length': 3.3795180722891565, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5938085', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1066, 'n_words': 208}