2014-11-10 17:26:08 +00:00
|
|
|
class Mitie < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Library and tools for information extraction"
|
2014-11-10 17:26:08 +00:00
|
|
|
homepage "https://github.com/mit-nlp/MITIE/"
|
2015-05-01 15:58:30 +00:00
|
|
|
url "https://github.com/mit-nlp/MITIE/archive/v0.4.tar.gz"
|
|
|
|
sha256 "3902c9a6332354fb23f1cbdc4ef9631fa1477b69e37e4b7822d3c18a8bbefdc9"
|
|
|
|
|
|
|
|
head "https://github.com/mit-nlp/MITIE.git"
|
2014-11-10 17:26:08 +00:00
|
|
|
|
2014-11-10 17:41:22 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
2015-09-23 20:36:13 +00:00
|
|
|
sha256 "107bc6325dc1404d1bfe09d400db80b8892e268626d52152c004e79642ee6421" => :el_capitan
|
2015-05-02 12:11:11 +00:00
|
|
|
sha256 "4570f1e2ac9721e5f53beda0d3e6be2ab88604e490641273b2959424fdf095a2" => :yosemite
|
|
|
|
sha256 "55220ba374b6b03316fd757d2731e8745aa8be50ddc983e0fd28e04bdf5f26da" => :mavericks
|
|
|
|
sha256 "25a3ca7c81987f46cb52f4cc8b8c8de674db5c232d9b6e8383d376fad00ae3ea" => :mountain_lion
|
2014-11-10 17:41:22 +00:00
|
|
|
end
|
|
|
|
|
2014-11-10 17:26:08 +00:00
|
|
|
depends_on :python if MacOS.version <= :snow_leopard
|
|
|
|
|
2015-05-01 15:58:30 +00:00
|
|
|
option "without-models", "Don't download the v0.2 models (~415MB)"
|
|
|
|
|
2014-11-10 17:26:08 +00:00
|
|
|
resource "models-english" do
|
2015-05-01 15:58:30 +00:00
|
|
|
url "https://downloads.sourceforge.net/project/mitie/binaries/MITIE-models-v0.2.tar.bz2"
|
|
|
|
sha256 "dc073eaef980e65d68d18c7193d94b9b727beb254a0c2978f39918f158d91b31"
|
2014-11-10 17:26:08 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
2015-05-01 15:58:30 +00:00
|
|
|
if build.with? "models"
|
|
|
|
(share/"MITIE-models").install resource("models-english")
|
|
|
|
end
|
|
|
|
|
2014-11-10 17:26:08 +00:00
|
|
|
inreplace "mitielib/makefile" do |s|
|
2015-05-01 15:58:30 +00:00
|
|
|
s.gsub!(/libmitie.so/, "libmitie.dylib")
|
2014-11-10 17:26:08 +00:00
|
|
|
end
|
|
|
|
system "make", "mitielib"
|
|
|
|
system "make"
|
2015-05-01 15:58:30 +00:00
|
|
|
|
|
|
|
include.install Dir["mitielib/include/*"]
|
2014-11-10 17:26:08 +00:00
|
|
|
lib.install "mitielib/libmitie.dylib", "mitielib/libmitie.a"
|
2015-05-01 15:58:30 +00:00
|
|
|
(lib/"python2.7/site-packages").install "mitielib/mitie.py"
|
|
|
|
(share/"mitie").install "examples", "sample_text.txt",
|
2014-11-10 17:26:08 +00:00
|
|
|
"sample_text.reference-output", "sample_text.reference-output-relations"
|
|
|
|
bin.install "ner_example", "ner_stream", "relation_extraction_example"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2015-05-01 15:58:30 +00:00
|
|
|
system ENV.cc, "-I#{include}", "-L#{lib}", "-lmitie",
|
|
|
|
share/"mitie/examples/C/ner/ner_example.c",
|
|
|
|
"-o", testpath/"ner_example"
|
|
|
|
system "./ner_example", share/"MITIE-models/english/ner_model.dat",
|
|
|
|
share/"mitie/sample_text.txt"
|
2014-11-10 17:26:08 +00:00
|
|
|
end
|
|
|
|
end
|