<commit_before>import React, { createClass } from 'react'
import { hyphenate } from '../utils/helpers'
import notes from '../notes'
import specs from '../specs'
import components from '../components'
import Pattern from '../components/Pattern'

const childRoutes = specs.map(({group, page, component, propTypes, presets}) => {
  const path = hyphenate(page.toLowerCase())

  const note = notes.reduce((acc, note) => {
    const componentName = component.toLowerCase()

    if (note[componentName] && componentName)
      acc += note[componentName]

    return acc
  }, '')

  const ChildComponent = () => {
    return <Pattern
      patternName={pageName}
      propTypes={propTypes}
      notes={note}
      presets={presets}
      Component={components[component]} />
  }

  return {
    path, group, pageName,
    component: ChildComponent
  }
})

export default childRoutes
<commit_msg>tidy how notes are generated<commit_after>import React, { createClass } from 'react'
import { hyphenate } from '../utils/helpers'
import notes from '../notes'
import specs from '../specs'
import components from '../components'
import Pattern from '../components/Pattern'

const childRoutes = specs.map(({group, pageName, notesRef, component, propTypes, presets}) => {
  const path = hyphenate(pageName.toLowerCase())

  const note = notes.reduce((acc, note) => {
    if (note[notesRef])
      acc += note[notesRef]

    return acc
  }, '')

  const ChildComponent = () => {
    return <Pattern
      patternName={pageName}
      propTypes={propTypes}
      notes={note}
      presets={presets}
      Component={components[component]} />
  }

  return {
    path, group, pageName,
    component: ChildComponent
  }
})

export default childRoutes

{'fraction_non_alphanumeric': 0.13544668587896252, 'fraction_numerical': 0.0, 'mean_word_length': 3.5208333333333335, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '7011471', 'n_tokens_mistral': 500, 'n_tokens_neox': 494, 'n_words': 135}