homebrew-core/Formula/freeling.rb

76 lines
3.3 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 6
bottle do
sha256 cellar: :any, arm64_monterey: "94090947438855cf6331ad2e63187b91ff781e94af7c5845a782af6a9aa66f76"
sha256 cellar: :any, arm64_big_sur: "1b390fdcce145ad6a1c2308ffa5e0466469f7495273edc130e7ff20abeeea92b"
sha256 cellar: :any, monterey: "bdbd930df421b027d61ad93043aec8b51c1adb46ac746d82fc5e7db6bf969b22"
sha256 cellar: :any, big_sur: "315ffab8559e7ea8bf88a7c730c355f1b84b00dcc7f75d919b6503e83c1e0b14"
sha256 cellar: :any, catalina: "6a6a115c50379449b08ae8d564823975041a2718d513a8744cbaac1f8a7ac24c"
sha256 cellar: :any_skip_relocation, x86_64_linux: "8686efb54ab3853fc7ade7a6467fa48aa4ecf20ceec7846e3a0114f4dc3ded0e"
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