<commit_before>package ast

import (
  "encoding/json"
  "regexp"
  "strings"
  "testing"
)

func assertEquals(t *testing.T, got interface{}, expected interface{}) {
  if got != expected {
    t.Errorf("not equals: expected %q, got %q", expected, got)
  }
}

func trimSpace(s string) string {
  re := regexp.MustCompile("\\s+")
  return re.ReplaceAllString(strings.TrimSpace(s), " ")
}

func loc(lineNumber int, lineOffset int) Location {
  return Location { "", lineNumber, lineOffset }
}

func jsonString(x interface{}) string {
  cs, err := json.Marshal(x)
  if err != nil {
    panic(err)
  }
  return string(cs)
}<commit_msg>Generae indented JSON for tests<commit_after>package ast

import (
  "bytes"
  "encoding/json"
  "regexp"
  "strings"
  "testing"
)

func assertEquals(t *testing.T, got interface{}, expected interface{}) {
  if got != expected {
    t.Errorf("not equals: expected %q, got %q", expected, got)
  }
}

func trimSpace(s string) string {
  re := regexp.MustCompile("\\s+")
  return re.ReplaceAllString(strings.TrimSpace(s), " ")
}

func loc(lineNumber int, lineOffset int) Location {
  return Location { "", lineNumber, lineOffset }
}

func jsonString(x interface{}) string {
  src, err := json.Marshal(x)
  if err != nil {
    panic(err)
  }
  var dst bytes.Buffer
  err = json.Indent(&dst, src, "", "  ")
  if err != nil {
    panic(err)
  }
  return dst.String()
}
{'fraction_non_alphanumeric': 0.15229885057471265, 'fraction_numerical': 0.0, 'mean_word_length': 3.7542662116040955, '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': '5786979', 'n_tokens_mistral': 480, 'n_tokens_neox': 474, 'n_words': 127}