<commit_before>import { parse, IGitProgress } from './parser'

export interface IProgressStep {
  title: string
  weight: number
}

export interface ICombinedProgress {
  percent: number
  details: IGitProgress
}

export class StepProgress {
  private readonly steps: ReadonlyArray<IProgressStep>
  private stepIndex = 0

  public constructor(steps: ReadonlyArray<IProgressStep>) {

    // Scale the step weight so that they're all a percentage
    // adjusted to the total weight of all steps.
    const totalStepWeight = steps.reduce((sum, step) => sum + step.weight, 0)

    this.steps = steps.map(step => ({
      title: step.title,
      weight: step.weight / totalStepWeight,
    }))
  }

  public parse(line: string): ICombinedProgress | null {
    const progress = parse(line)

    if (!progress) {
      return null
    }

    let percent = 0

    for (let i = this.stepIndex; i < this.steps.length; i++) {
      const step = this.steps[i]

      if (progress.title === step.title) {<commit_msg>:art: rename<commit_after>import { parse, IGitProgress } from './parser'

export interface IProgressStep {
  title: string
  weight: number
}

export interface ICombinedProgress {
  percent: number
  details: IGitProgress
}

export class StepProgressParser {
  private readonly steps: ReadonlyArray<IProgressStep>
  private stepIndex = 0

  public constructor(steps: ReadonlyArray<IProgressStep>) {

    // Scale the step weight so that they're all a percentage
    // adjusted to the total weight of all steps.
    const totalStepWeight = steps.reduce((sum, step) => sum + step.weight, 0)

    this.steps = steps.map(step => ({
      title: step.title,
      weight: step.weight / totalStepWeight,
    }))
  }

  public parse(line: string): ICombinedProgress | null {
    const progress = parse(line)

    if (!progress) {
      return null
    }

    let percent = 0

    for (let i = this.stepIndex; i < this.steps.length; i++) {
      const step = this.steps[i]

      if (progress.title === step.title) {
{'fraction_non_alphanumeric': 0.10531544957774466, 'fraction_numerical': 0.0029806259314456036, 'mean_word_length': 3.1440329218106995, 'pattern_counts': {'":': 0, '<': 9, '<?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': '655082', 'n_tokens_mistral': 613, 'n_tokens_neox': 579, 'n_words': 185}