summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew W Elble <aweits@rit.edu>2020-09-02 21:27:56 -0400
committerGitHub <noreply@github.com>2020-09-02 20:27:56 -0500
commit879bb063f74bccaacb6a2dc9ba34c3fccfc89ef5 (patch)
treefffa96fc1fc58ecba72b1ace58cc5151331d430d
parent638f44d842d14d776fc78633f5c32e4dab808264 (diff)
downloadspack-879bb063f74bccaacb6a2dc9ba34c3fccfc89ef5.tar.gz
spack-879bb063f74bccaacb6a2dc9ba34c3fccfc89ef5.tar.bz2
spack-879bb063f74bccaacb6a2dc9ba34c3fccfc89ef5.tar.xz
spack-879bb063f74bccaacb6a2dc9ba34c3fccfc89ef5.zip
new package: corenlp (#18467)
* new package: corenlp * import os, not os.path
-rw-r--r--var/spack/repos/builtin/packages/corenlp/corenlp.sh3
-rw-r--r--var/spack/repos/builtin/packages/corenlp/package.py67
2 files changed, 70 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/corenlp/corenlp.sh b/var/spack/repos/builtin/packages/corenlp/corenlp.sh
new file mode 100644
index 0000000000..3b37cec1fe
--- /dev/null
+++ b/var/spack/repos/builtin/packages/corenlp/corenlp.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+# convenience wrapper for corenlp
+java edu.stanford.nlp.pipeline.StanfordCoreNLP "$@"
diff --git a/var/spack/repos/builtin/packages/corenlp/package.py b/var/spack/repos/builtin/packages/corenlp/package.py
new file mode 100644
index 0000000000..6cb1325e92
--- /dev/null
+++ b/var/spack/repos/builtin/packages/corenlp/package.py
@@ -0,0 +1,67 @@
+# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+import os
+
+
+class Corenlp(Package):
+ """Stanford CoreNLP provides a set of human language technology
+ tools. It can give the base forms of words, their parts of speech,
+ whether they are names of companies, people, etc., normalize
+ dates, times, and numeric quantities, mark up the structure of
+ sentences in terms of phrases and syntactic dependencies, indicate
+ which noun phrases refer to the same entities, indicate sentiment,
+ extract particular or open-class relations between entity
+ mentions, get the quotes people said, etc."""
+
+ homepage = "https://stanfordnlp.github.io/CoreNLP/index.html"
+ url = "https://github.com/stanfordnlp/CoreNLP/archive/v4.0.0.tar.gz"
+
+ version('4.0.0', sha256='07195eed46dd39bdc364d3988da8ec6a5fc9fed8c17613cfe5a8b84d649c8f0f')
+
+ resources = [
+ ('4.0.0', 'f45bde062fb368d72f7d3c7ac1ddc6cfb61d3badc1152572bde17f1a5ed9ec94'),
+ ]
+ for ver, checksum in resources:
+ jarfile = 'stanford-corenlp-{0}-models.jar'.format(ver)
+ resource(when='@{0}'.format(ver),
+ name=jarfile,
+ url='https://repo1.maven.org/maven2/edu/stanford/nlp/stanford-corenlp/{0}/{1}'.format(ver, jarfile),
+ expand=False,
+ destination='',
+ placement=jarfile,
+ sha256=checksum)
+
+ depends_on('ant', type='build')
+
+ def install(self, spec, prefix):
+ ant = self.spec['ant'].command
+ ant()
+
+ with working_dir('classes'):
+ jar = Executable('jar')
+ jar('-cf', '../stanford-corenlp.jar', 'edu')
+
+ install_tree('.', prefix.lib)
+
+ # Set up a helper script to call java on the jar file,
+ # explicitly codes the path for java and the jar file.
+ mkdirp(prefix.bin)
+ script_sh = join_path(os.path.dirname(__file__), "corenlp.sh")
+ script = prefix.bin.corenlp
+ install(script_sh, script)
+ set_executable(script)
+
+ # Munge the helper script to explicitly point to java and the
+ # jar file.
+ java = self.spec['java'].prefix.bin.java
+ kwargs = {'ignore_absent': False, 'backup': False, 'string': False}
+ filter_file('^java', java, script, **kwargs)
+
+ def setup_run_environment(self, run_env):
+ class_paths = []
+ class_paths.extend(find(prefix.lib, '*.jar'))
+ classpath = os.pathsep.join(class_paths)
+ run_env.prepend_path('CLASSPATH', classpath)