homebrew-core/Formula/freeling.rb

76 lines
3.2 KiB
Ruby

class Freeling < Formula
desc "Suite of language analyzers"
homepage "http://nlp.lsi.upc.edu/freeling/"
url "https://github.com/TALP-UPC/FreeLing/releases/download/4.2/FreeLing-src-4.2.tar.gz"
sha256 "f96afbdb000d7375426644fb2f25baff9a63136dddce6551ea0fd20059bfce3b"
license "AGPL-3.0-only"
revision 5
bottle do
sha256 cellar: :any, arm64_monterey: "b8d17a21a303a81e602c55b280ae2faad62b0096e33d536d9282bd55b96398ab"
sha256 cellar: :any, arm64_big_sur: "3afa5c7621f49858902ecc79870c43fa3096c8ecaabda5aba9944d6d8c7cfb89"
sha256 cellar: :any, monterey: "b0ac115a4e4354b6493f846bcef24db50d20fef9e71b2e139ab582a48c7941cd"
sha256 cellar: :any, big_sur: "73891677a3843b9c57129dd369472cf609771c2cdba051b8cef0d566a3446e12"
sha256 cellar: :any, catalina: "de94326810d5ed9d52ea484ab99d5e2946fbe8f514cc2c3a38fa29ea703ef3d1"
sha256 cellar: :any, mojave: "1167a27ff5bf29c27c24d8e08f30e64b33834cb8a662cc2e71ddc6ec06ae1ece"
end
depends_on "cmake" => :build
depends_on "boost"
depends_on "icu4c"
conflicts_with "dynet", because: "freeling ships its own copy of dynet"
conflicts_with "eigen", because: "freeling ships its own copy of eigen"
conflicts_with "foma", because: "freeling ships its own copy of foma"
conflicts_with "hunspell", because: "both install 'analyze' binary"
# Fixes `error: use of undeclared identifier 'log'`
# https://github.com/TALP-UPC/FreeLing/issues/114
patch do
url "https://github.com/TALP-UPC/FreeLing/commit/e052981e93e0a663784b04391471a5aa9c37718f.patch?full_index=1"
sha256 "02c8b9636413182df420cb2f855a96de8760202a28abeff2ea7bdbe5f95deabc"
end
# Fixes `error: use of undeclared identifier 'fabs'`
# Also reported in issue linked above
patch do
url "https://github.com/TALP-UPC/FreeLing/commit/36e267b453c4f2bce88014382c7e661657d1b234.patch?full_index=1"
sha256 "6cf1d4dfa381d7d43978cde194599ffadf7596bab10ff48cdb214c39363b55a0"
end
# Also fixes `error: use of undeclared identifier 'fabs'`
# See issue in first patch
patch do
url "https://github.com/TALP-UPC/FreeLing/commit/34a1a78545fb6a4ca31ee70e59fd46211fd3f651.patch?full_index=1"
sha256 "8f7f87a630a9d13ea6daebf210b557a095b5cb8747605eb90925a3aecab97e18"
end
def install
# Allow compilation without extra data (more than 1 GB), should be fixed
# in next release
# https://github.com/TALP-UPC/FreeLing/issues/112
inreplace "CMakeLists.txt", "SET(languages \"as;ca;cs;cy;de;en;es;fr;gl;hr;it;nb;pt;ru;sl\")",
"SET(languages \"en;es;pt\")"
inreplace "CMakeLists.txt", "SET(variants \"es/es-old;es/es-ar;es/es-cl;ca/balear;ca/valencia\")",
"SET(variants \"es/es-old;es/es-ar;es/es-cl\")"
mkdir "build" do
system "cmake", "..", *std_cmake_args
system "make", "install"
end
libexec.install "#{bin}/fl_initialize"
inreplace "#{bin}/analyze",
". $(cd $(dirname $0) && echo $PWD)/fl_initialize",
". #{libexec}/fl_initialize"
end
test do
expected = <<~EOS
Hello hello NN 1
world world NN 1
EOS
assert_equal expected, pipe_output("#{bin}/analyze -f #{pkgshare}/config/en.cfg", "Hello world").chomp
end
end