<commit_before>require 'minitest/autorun'
require_relative '../lib/bwt'

describe Bwt do
  include Bwt

  it "rotates a string" do
    rotate("banana").must_equal "ananab"
  end

  it "sorts permutations" do
    sorted_permutations("banana").first.must_equal "abanan"
  end

  it "encodes correctly" do
    result = encode("banana")
    result.first.must_equal "nnbaaa"
    result.last.must_equal 3
  end

  it "encodes and decodes" do
    decode(encode("banana")).must_equal "banana"
  end

  it "encodes and decodes UTF-8" do
    decode(encode("åßç∂")).must_equal "åßç∂"
  end
end
<commit_msg>Adds a slight improvemnt to the BWT spec implementation<commit_after>require 'minitest/autorun'
require_relative '../lib/bwt'

describe Bwt do
  include Bwt

  it "rotates a string" do
    rotate("banana").must_equal "ananab"
  end

  it "sorts permutations" do
    sorted_permutations("banana").first.must_equal "abanan"
  end

  it "encodes correctly" do
    result = encode("banana")
    result.must_equal ["nnbaaa", 3]
  end

  it "encodes and decodes" do
    decode(encode("banana")).must_equal "banana"
  end

  it "encodes and decodes UTF-8" do
    decode(encode("åßç∂")).must_equal "åßç∂"
  end
end

{'fraction_non_alphanumeric': 0.11480865224625623, 'fraction_numerical': 0.0033277870216306157, 'mean_word_length': 3.7928286852589643, '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': '2308408', 'n_tokens_mistral': 455, 'n_tokens_neox': 438, 'n_words': 113}