<commit_before>require_relative "pig-latin/version"

module Pig
  module Latin

    def self.pigLatinWord(word)
      i = 0
      noVowel = true
      numbers = /[1234567890]/
      punctuation = ""

      if !/\W+\z/.match(word).nil?
        punctuation = word.slice(-1,word.length)
        word = word.slice(0,word.length-1)
      end


      if !numbers.match(word).nil?
        return word + punctuation
      elsif word[0] == "y"
        word = word.slice(1,word.length) + "yay"
      elsif !/\A[aeiou]+/.match(word).nil?
        word = word + "way"
      elsif /\A[^aeoiu]/.match(word)
        consonants = /[^aeoiuy]+/.match(word).to_s
        word = word.slice(consonants.length,word.length) + consonants + "ay"
      end

      return word + punctuation

    end

    def self.translate(string)
      output = []
      string.split.each { |word|
        output << Pig::Latin.pigLatinWord(word)
      }

      return output.join(" ")
    end

  end
end<commit_msg>strip punctuation in the middle of words<commit_after>require_relative "pig-latin/version"

module Pig
  module Latin

    def self.pigLatinWord(word)
      i = 0
      noVowel = true
      numbers = /[1234567890]/
      punctuation = ""

      if !/\W+\z/.match(word).nil?
        punctuation = word.slice(-1,word.length)
        word = word.slice(0,word.length-1)
      end

      word = word.gsub(/[\W _]/, '')

      if !numbers.match(word).nil?
        return word + punctuation
      elsif word[0] == "y"
        word = word.slice(1,word.length) + "yay"
      elsif !/\A[aeiou]+/.match(word).nil?
        word = word + "way"
      elsif /\A[^aeoiu]/.match(word)
        consonants = /[^aeoiuy]+/.match(word).to_s
        word = word.slice(consonants.length,word.length) + consonants + "ay"
      end

      return word + punctuation

    end

    def self.translate(string)
      output = []
      string.split.each { |word|
        output << Pig::Latin.pigLatinWord(word)
      }

      return output.join(" ")
    end

  end
end
{'fraction_non_alphanumeric': 0.14442231075697212, 'fraction_numerical': 0.01593625498007968, 'mean_word_length': 2.0531914893617023, 'pattern_counts': {'":': 0, '<': 7, '<?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': '459030', 'n_tokens_mistral': 735, 'n_tokens_neox': 686, 'n_words': 133}