<commit_before>require 'spec_helper'
require 'helpers/wordlist'

shared_examples_for "a wordlist Builder" do
  before(:all) do
    @words = ['dog', 'cat', 'catx', 'dat', 'dog', 'cat']
    @sentence = 'dog cat catx, dog dat.'
    @text = 'dog cat: catx. dog cat dat dog.'
    @file = File.expand_path(File.join(File.dirname(__FILE__),'text','sample.txt'))
  end

  it "should build a unique wordlist from words" do
    Builder.build(@path) do |wordlist|
      wordlist += @words
    end

    should_contain_words(@path,@expected)
  end

  it "should build a unique wordlist from a sentence" do
    Builder.build(@path) do |wordlist|
      wordlist.parse_sentence(@sentence)
    end

    should_contain_words(@path,@expected)<commit_msg>Use the text/ helper constants.<commit_after>require 'spec_helper'
require 'helpers/text'
require 'helpers/wordlist'

shared_examples_for "a wordlist Builder" do
  before(:all) do
    @words = ['dog', 'cat', 'catx', 'dat', 'dog', 'cat']
    @sentence = 'dog cat catx, dog dat.'
    @text = 'dog cat: catx. dog cat dat dog.'
    @file = SAMPLE_TEXT
  end

  it "should build a unique wordlist from words" do
    Builder.build(@path) do |wordlist|
      wordlist += @words
    end

    should_contain_words(@path,@expected)
  end

  it "should build a unique wordlist from a sentence" do
    Builder.build(@path) do |wordlist|
      wordlist.parse_sentence(@sentence)
    end

    should_contain_words(@path,@expected)
{'fraction_non_alphanumeric': 0.12749827705031014, 'fraction_numerical': 0.0, 'mean_word_length': 3.7450980392156863, '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': '2099081', 'n_tokens_mistral': 490, 'n_tokens_neox': 474, 'n_words': 141}