<commit_before>var _ = require('lodash/fp')

module.exports.parse = function parse (data) {
  const track1Start = data.indexOf('%')
  const track2Start = data.indexOf(';')
  const track3Start = data.indexOf('_%')

  if (track1Start === -1 || !track2Start === -1 || !track3Start === -1) return null

  return parseRaw(data)
}

function parseRaw (data) {
  const track1Start = data.indexOf('%')
  const track2Start = data.indexOf(';')
  const track3Start = data.indexOf('_%')

  const track1 = data.substring(track1Start, track2Start)
  const track2 = data.substring(track2Start, track3Start)
  const track3 = data.substring(track3Start, data.length)

  const province = data.substring(track1Start + 1, track1Start + 3)

  const cityIndex = track1Start + 3
  const cityFinishIndex =
    data.substring(cityIndex, cityIndex + 13).indexOf('^') === -1
      ? cityIndex + 13
      : data.substring(cityIndex, cityIndex + 13).indexOf('^') + cityIndex
  const city = data.substring(cityIndex, cityFinishIndex)

  const nameIndex = cityFinishIndex + 1
  const nameFinishIndex =
    data.substring(nameIndex, nameIndex + 35).indexOf('^') === -1
      ? nameIndex + 35
      : data.substring(nameIndex, nameIndex + 35).indexOf('^') + nameIndex
  const name = data.substring(nameIndex, nameFinishIndex)
  const firstName = name.substring(name.indexOf('$') + 1, name.length)
  const lastName = name.substring(0, name.indexOf(','))<commit_msg>fix: merge parse and parseRaw<commit_after>var _ = require('lodash/fp')

module.exports.parse = function parse (data) {
  const track1Start = data.indexOf('%')
  const track2Start = data.indexOf(';')
  const track3Start = data.indexOf('_%')

  if (track1Start === -1 || !track2Start === -1 || !track3Start === -1) return null

  const track1 = data.substring(track1Start, track2Start)
  const track2 = data.substring(track2Start, track3Start)
  const track3 = data.substring(track3Start, data.length)

  const province = data.substring(track1Start + 1, track1Start + 3)

  const cityIndex = track1Start + 3
  const cityFinishIndex =
    data.substring(cityIndex, cityIndex + 13).indexOf('^') === -1
      ? cityIndex + 13
      : data.substring(cityIndex, cityIndex + 13).indexOf('^') + cityIndex
  const city = data.substring(cityIndex, cityFinishIndex)

  const nameIndex = cityFinishIndex + 1
  const nameFinishIndex =
    data.substring(nameIndex, nameIndex + 35).indexOf('^') === -1
      ? nameIndex + 35
      : data.substring(nameIndex, nameIndex + 35).indexOf('^') + nameIndex
  const name = data.substring(nameIndex, nameFinishIndex)
  const firstName = name.substring(name.indexOf('$') + 1, name.length)
  const lastName = name.substring(0, name.indexOf(','))
{'fraction_non_alphanumeric': 0.14296296296296296, 'fraction_numerical': 0.030740740740740742, 'mean_word_length': 4.348514851485149, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4494505', 'n_tokens_mistral': 893, 'n_tokens_neox': 835, 'n_words': 199}