stanford-core-nlp 0.4.3 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +5 -5
- data/bin/AnnotationBridge.java +14 -4
- data/bin/bridge.jar +0 -0
- data/lib/stanford-core-nlp.rb +11 -7
- data/lib/stanford-core-nlp/bridge.rb +0 -4
- metadata +30 -34
data/README.md
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
+
[](http://travis-ci.org/louismullie/stanford-core-nlp)
|
2
|
+
|
1
3
|
**About**
|
2
4
|
|
3
|
-
This gem provides high-level Ruby bindings to the [Stanford Core NLP package](http://nlp.stanford.edu/software/corenlp.shtml), a set natural language processing tools for tokenization, sentence segmentation, part-of-speech tagging, lemmatization, and parsing of English, French and German. The package also provides named entity recognition and coreference resolution for English.
|
5
|
+
This gem provides high-level Ruby bindings to the [Stanford Core NLP package](http://nlp.stanford.edu/software/corenlp.shtml), a set natural language processing tools for tokenization, sentence segmentation, part-of-speech tagging, lemmatization, and parsing of English, French and German. The package also provides named entity recognition and coreference resolution for English.
|
4
6
|
|
5
|
-
This gem
|
7
|
+
This gem is compatible with Ruby 1.9.2 and 1.9.3 as well as JRuby 1.7.1. It is tested on both Java 6 and Java 7.
|
6
8
|
|
7
9
|
**Installing**
|
8
10
|
|
9
|
-
_Note: If you are running on MRI, this gem will use the Ruby-Java Bridge (Rjb), which currently does not support Java 7. Therefore, if you have installed Java 7, you should set your JAVA_HOME to point to your old Java 6 install before installing Rjb; for example, `export "JAVA_HOME=/usr/lib/jvm/java-6-openjdk/"`._
|
10
|
-
|
11
11
|
First, install the gem: `gem install stanford-core-nlp`. Then, download the Stanford Core NLP JAR and model files. Three different packages are available:
|
12
12
|
|
13
13
|
* A [minimal package](http://louismullie.com/treat/stanford-core-nlp-minimal.zip) with the default tagger and parser models for English, French and German.
|
14
|
-
* A [full package](http://louismullie.com/treat/stanford-core-nlp-
|
14
|
+
* A [full package](http://louismullie.com/treat/stanford-core-nlp-full.zip), with all of the tagger and parser models for English, French and German, as well as named entity and coreference resolution models for English.
|
15
15
|
|
16
16
|
Place the contents of the extracted archive inside the /bin/ folder of the stanford-core-nlp gem (e.g. [...]/gems/stanford-core-nlp-0.x/bin/).
|
17
17
|
|
data/bin/AnnotationBridge.java
CHANGED
@@ -1,12 +1,22 @@
|
|
1
1
|
import edu.stanford.nlp.ling.CoreAnnotation;
|
2
2
|
import edu.stanford.nlp.util.ArrayCoreMap;
|
3
|
+
import java.util.Properties;
|
4
|
+
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
|
3
5
|
|
6
|
+
// export JAVA_HOME='/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home'
|
7
|
+
// javac -cp '.:stanford-corenlp.jar' AnnotationBridge.java
|
8
|
+
// jar cf bridge.jar AnnotationBridge.class
|
4
9
|
public class AnnotationBridge {
|
5
10
|
|
6
11
|
public static Object getAnnotation(Object entity, String name) throws ClassNotFoundException {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
12
|
+
Class<CoreAnnotation> klass;
|
13
|
+
klass = (Class<CoreAnnotation>) Class.forName(name);
|
14
|
+
Object object = ((ArrayCoreMap) entity).get(klass);
|
15
|
+
return object;
|
16
|
+
}
|
17
|
+
|
18
|
+
public static Object getPipelineWithProperties(Properties properties) {
|
19
|
+
StanfordCoreNLP pipeline = new StanfordCoreNLP(properties);
|
20
|
+
return pipeline;
|
11
21
|
}
|
12
22
|
}
|
data/bin/bridge.jar
CHANGED
Binary file
|
data/lib/stanford-core-nlp.rb
CHANGED
@@ -2,7 +2,7 @@ require 'stanford-core-nlp/config'
|
|
2
2
|
|
3
3
|
module StanfordCoreNLP
|
4
4
|
|
5
|
-
VERSION = '0.
|
5
|
+
VERSION = '0.5.0'
|
6
6
|
|
7
7
|
require 'bind-it'
|
8
8
|
extend BindIt::Binding
|
@@ -45,7 +45,8 @@ module StanfordCoreNLP
|
|
45
45
|
['MaxentTagger', 'edu.stanford.nlp.tagger.maxent'],
|
46
46
|
['CRFClassifier', 'edu.stanford.nlp.ie.crf'],
|
47
47
|
['Properties', 'java.util'],
|
48
|
-
['ArrayList', 'java.util']
|
48
|
+
['ArrayList', 'java.util'],
|
49
|
+
['AnnotationBridge', '']
|
49
50
|
]
|
50
51
|
|
51
52
|
# ########################### #
|
@@ -168,12 +169,15 @@ module StanfordCoreNLP
|
|
168
169
|
# Manually include SUTime models.
|
169
170
|
if annotators.include?(:ner)
|
170
171
|
properties['sutime.rules'] =
|
171
|
-
self.
|
172
|
-
self.
|
172
|
+
self.model_path + 'sutime/defs.sutime.txt, ' +
|
173
|
+
self.model_path + 'sutime/english.sutime.txt'
|
173
174
|
end
|
174
|
-
|
175
|
-
|
176
|
-
|
175
|
+
|
176
|
+
props = get_properties(properties)
|
177
|
+
|
178
|
+
# Hack for Java7 compatibility.
|
179
|
+
bridge = const_get(:AnnotationBridge)
|
180
|
+
bridge.getPipelineWithProperties(props)
|
177
181
|
|
178
182
|
end
|
179
183
|
|
metadata
CHANGED
@@ -1,91 +1,87 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stanford-core-nlp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
version: 0.5.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Louis Mullie
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bind-it
|
16
|
-
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
17
18
|
requirements:
|
18
19
|
- - ~>
|
19
20
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.2.
|
21
|
+
version: 0.2.5
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
25
|
none: false
|
22
|
-
requirement: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - ~>
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.2.
|
27
|
-
none: false
|
28
|
-
prerelease: false
|
29
|
-
type: :runtime
|
29
|
+
version: 0.2.5
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rspec
|
32
|
-
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
33
34
|
requirements:
|
34
35
|
- - ! '>='
|
35
36
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
37
|
-
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
41
|
none: false
|
39
|
-
requirement: !ruby/object:Gem::Requirement
|
40
42
|
requirements:
|
41
43
|
- - ! '>='
|
42
44
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
description: " High-level Ruby bindings to the Stanford CoreNLP package, a set natural\
|
49
|
-
\ language processing \ntools that provides tokenization, part-of-speech tagging\
|
50
|
-
\ and parsing for several languages, as well as named entity \nrecognition and coreference\
|
51
|
-
\ resolution for English. "
|
45
|
+
version: '0'
|
46
|
+
description: ! " High-level Ruby bindings to the Stanford CoreNLP package, a set natural
|
47
|
+
language processing \ntools that provides tokenization, part-of-speech tagging and
|
48
|
+
parsing for several languages, as well as named entity \nrecognition and coreference
|
49
|
+
resolution for English. "
|
52
50
|
email:
|
53
51
|
- louis.mullie@gmail.com
|
54
52
|
executables: []
|
55
53
|
extensions: []
|
56
54
|
extra_rdoc_files: []
|
57
55
|
files:
|
58
|
-
- lib/stanford-core-nlp.rb
|
59
56
|
- lib/stanford-core-nlp/bridge.rb
|
60
57
|
- lib/stanford-core-nlp/config.rb
|
58
|
+
- lib/stanford-core-nlp.rb
|
61
59
|
- bin/AnnotationBridge.java
|
62
60
|
- bin/bridge.jar
|
63
61
|
- README.md
|
64
62
|
- LICENSE
|
65
63
|
homepage: https://github.com/louismullie/stanford-core-nlp
|
66
64
|
licenses: []
|
67
|
-
post_install_message:
|
65
|
+
post_install_message:
|
68
66
|
rdoc_options: []
|
69
67
|
require_paths:
|
70
68
|
- lib
|
71
69
|
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
72
71
|
requirements:
|
73
72
|
- - ! '>='
|
74
73
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
76
|
-
MA==
|
77
|
-
none: false
|
74
|
+
version: '0'
|
78
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
79
77
|
requirements:
|
80
78
|
- - ! '>='
|
81
79
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
83
|
-
MA==
|
84
|
-
none: false
|
80
|
+
version: '0'
|
85
81
|
requirements: []
|
86
|
-
rubyforge_project:
|
82
|
+
rubyforge_project:
|
87
83
|
rubygems_version: 1.8.24
|
88
|
-
signing_key:
|
84
|
+
signing_key:
|
89
85
|
specification_version: 3
|
90
86
|
summary: Ruby bindings to the Stanford Core NLP tools.
|
91
87
|
test_files: []
|