<commit_before>import {Parser, Node} from 'commonmark'

class Chapter {
  title: string
  alias: string
  subchapters: Subchapter[]

  constructor(title: string, alias: string, subchaptersData: SubchapterData[]) {
    this.title = title
    this.alias = alias
    this.subchapters = subchaptersData.map((d) => new Subchapter(d.title, d.alias, this))
  }
}

interface SubchapterData {
  title: string
  alias: string
}

const parser = new Parser()

class Subchapter {
  title: string
  alias: string
  chapter: Chapter

  constructor(title: string, alias: string, chapter: Chapter) {
    this.title = title
    this.alias = alias
    this.chapter = chapter
  }

  ast(): Node {
    return parser.parse(require(`../../content/${this.chapter.alias}/${this.alias}.md`))
  }
}

export const chapters: Chapter[] = [
  new Chapter('Overview', 'overview', [{
    title: 'Brief Introduction',
    alias: 'intro',
  }, {
    title: 'Prerequisites',
    alias: 'prerequisites',
  }]),
  new Chapter('Introduction To Apollo', 'introduction', [{
    title: 'Get Started',
    alias: 'get-started',
  }]),
  new Chapter('Tutorial', 'exercises', [{
    title: 'Apollo Client on React/RN/Angular 2',
    alias: 'all-00',
  }, {
    title: 'React Track 01 - Getting Started',
    alias: 'react-01',
  }, {
    title: 'React Track 02 - Basic Queries',
    alias: 'react-02',
  }, {
    title: 'React Track 03 - Nested Queries',
    alias: 'react-03',
  }]),
]

export const subchapters: Subchapter[] = chapters.map((c) => c.subchapters).reduce((acc, s) => acc.concat(s), [])

export function neighboorSubchapter(currentSubchapterAlias: string, forward: boolean): Subchapter | null {
  const currentIndex = subchapters.findIndex((s) => s.alias === currentSubchapterAlias)

  if (forward && currentIndex + 1 <= subchapters.length) {
    return subchapters[currentIndex + 1]
  } else if (!forward && currentIndex >= 1) {
    return subchapters[currentIndex - 1]
  }
<commit_msg>adjust track 03 title<commit_after>import {Parser, Node} from 'commonmark'

class Chapter {
  title: string
  alias: string
  subchapters: Subchapter[]

  constructor(title: string, alias: string, subchaptersData: SubchapterData[]) {
    this.title = title
    this.alias = alias
    this.subchapters = subchaptersData.map((d) => new Subchapter(d.title, d.alias, this))
  }
}

interface SubchapterData {
  title: string
  alias: string
}

const parser = new Parser()

class Subchapter {
  title: string
  alias: string
  chapter: Chapter

  constructor(title: string, alias: string, chapter: Chapter) {
    this.title = title
    this.alias = alias
    this.chapter = chapter
  }

  ast(): Node {
    return parser.parse(require(`../../content/${this.chapter.alias}/${this.alias}.md`))
  }
}

export const chapters: Chapter[] = [
  new Chapter('Overview', 'overview', [{
    title: 'Brief Introduction',
    alias: 'intro',
  }, {
    title: 'Prerequisites',
    alias: 'prerequisites',
  }]),
  new Chapter('Introduction To Apollo', 'introduction', [{
    title: 'Get Started',
    alias: 'get-started',
  }]),
  new Chapter('Tutorial', 'exercises', [{
    title: 'Apollo Client on React/RN/Angular 2',
    alias: 'all-00',
  }, {
    title: 'React Track 01 - Getting Started',
    alias: 'react-01',
  }, {
    title: 'React Track 02 - Basic Queries',
    alias: 'react-02',
  }, {
    title: 'React Track 03 - Advanced Queries',
    alias: 'react-03',
  }]),
]

export const subchapters: Subchapter[] = chapters.map((c) => c.subchapters).reduce((acc, s) => acc.concat(s), [])

export function neighboorSubchapter(currentSubchapterAlias: string, forward: boolean): Subchapter | null {
  const currentIndex = subchapters.findIndex((s) => s.alias === currentSubchapterAlias)

  if (forward && currentIndex + 1 <= subchapters.length) {
    return subchapters[currentIndex + 1]
  } else if (!forward && currentIndex >= 1) {
    return subchapters[currentIndex - 1]
  }

{'fraction_non_alphanumeric': 0.15086646279306828, 'fraction_numerical': 0.010193679918450561, 'mean_word_length': 3.6504739336492893, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '3058949', 'n_tokens_mistral': 1325, 'n_tokens_neox': 1242, 'n_words': 325}