<commit_before>// @flow
import {toLaxTitleCase} from 'titlecase'

export function trimStationName(stationName: string) {
  return stationName.replace(/<strong>@(.*)<\/strong>/, '$1')
}

export function trimItemLabel(label: string) {
  // remove extraneous whitespace and title-case the bonapp titles
  return toLaxTitleCase(label.replace(/\s+/g, ' '))
}<commit_msg>Trim carleton menu icons (#779)<commit_after>// @flow
import {toLaxTitleCase} from 'titlecase'

export function trimStationName(stationName: string) {
  return stationName.replace(/<strong>@(.*)<\/strong>/, '$1')
}

function removeParenTags(str: string) {
  const parensRegex = / \([^)]*?\)$/
  while (str.match(parensRegex)) {
    str = str.replace(parensRegex, '')
  }
  return str
}

export function trimItemLabel(label: string) {
  // remove extraneous whitespace and title-case the bonapp titles
  const evenedWhitespace = label.replace(/\s+/g, ' ')
  const noParens = removeParenTags(evenedWhitespace)
  return toLaxTitleCase(noParens)
}
{'fraction_non_alphanumeric': 0.1488095238095238, 'fraction_numerical': 0.00496031746031746, 'mean_word_length': 5.005952380952381, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '507795', 'n_tokens_mistral': 342, 'n_tokens_neox': 331, 'n_words': 75}