<commit_before>require "formula"

class MecabKo < Formula
  homepage "https://bitbucket.org/eunjeon/mecab-ko"
  url "https://bitbucket.org/eunjeon/mecab-ko/downloads/mecab-0.996-ko-0.9.2.tar.gz"
  version "0.996-ko-0.9.2"
  sha1 "4947620429dea49a69be84efc17736c4875c7180"

  # https://bitbucket.org/eunjeon/mecab-ko/pull-request/1/mecab-ko-ipadic-ipadic/diff
  # Upstream decided not to comment out the dicdir path but replaced
  # 'ipadic' with 'mecab-ko-dic' instead in mecabrc file.
  # Though the change resolves the error of mecab-ko-dic path by source
  # installation, it still doesn't fit with Homebrew as it's expected
  # installed under /usr/local/ with mecab-ko-dic regardless of version.

  def install
    inreplace "mecabrc.in", "@prefix@/lib/mecab/dic/mecab-ko-dic", "#{HOMEBREW_PREFIX}/opt/mecab-ko-dic"

    system "./configure", "--disable-dependency-tracking",
                          "--prefix=#{prefix}"
    system "make install"
  end
end<commit_msg>mecab-ko: use opt_prefix<commit_after>require "formula"

class MecabKo < Formula
  homepage "https://bitbucket.org/eunjeon/mecab-ko"
  url "https://bitbucket.org/eunjeon/mecab-ko/downloads/mecab-0.996-ko-0.9.2.tar.gz"
  version "0.996-ko-0.9.2"
  sha1 "4947620429dea49a69be84efc17736c4875c7180"

  def install
    # https://bitbucket.org/eunjeon/mecab-ko/pull-request/1/mecab-ko-ipadic-ipadic/diff
    # Upstream decided not to comment out the dicdir path but replaced 'ipadic'
    # with 'mecab-ko-dic' instead in mecabrc file. Though the change resolves
    # the error of mecab-ko-dic path by source installation, it still doesn't
    # fit with Homebrew as it's expected installed under /usr/local/ with
    # mecab-ko-dic regardless of version.
    inreplace "mecabrc.in",
      "@prefix@/lib/mecab/dic/mecab-ko-dic",
      Formula["mecab-ko-dic"].opt_prefix

    system "./configure", "--disable-dependency-tracking",
                          "--prefix=#{prefix}"
    system "make install"
  end
end
{'fraction_non_alphanumeric': 0.1292276627965674, 'fraction_numerical': 0.04543160020191822, 'mean_word_length': 3.271551724137931, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3597173', 'n_tokens_mistral': 807, 'n_tokens_neox': 744, 'n_words': 153}