stanfordparser 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -43,6 +43,12 @@ Use the StanfordParser::DocumentPreprocessor class to tokenize text and files in
43
43
  For complete details about the use of these classes, see the documentation on the Stanford Natural Language Parser website.
44
44
 
45
45
 
46
+ = History
47
+
48
+ 1.0.0:: Initial release
49
+ 1.1.0:: Make module initialization function private
50
+
51
+
46
52
  = Copyright
47
53
 
48
54
  Copyright 2007, William Patrick McNeill
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #--
4
+
5
+ # Copyright 2007 William Patrick McNeill
6
+ #
7
+ # This file is part of the Stanford Parser Ruby Wrapper.
8
+ #
9
+ # The Stanford Parser Ruby Wrapper is free software; you can redistribute it
10
+ # and/or modify it under the terms of the GNU General Public License as
11
+ # published by the Free Software Foundation; either version 2 of the License,
12
+ # or (at your option) any later version.
13
+ #
14
+ # The Stanford Parser Ruby Wrapper is distributed in the hope that it will be
15
+ # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
17
+ # Public License for more details.
18
+ #
19
+ # You should have received a copy of the GNU General Public License along with
20
+ # editalign; if not, write to the Free Software Foundation, Inc., 51 Franklin
21
+ # St, Fifth Floor, Boston, MA 02110-1301 USA
22
+ #
23
+ #++
24
+
25
+ # == Synopsis
26
+ #
27
+ # Parse a sentence passed in on the command line.
28
+ #
29
+ # == Usage
30
+ #
31
+ # stanford-sentence-parser.rb [options] sentence
32
+ #
33
+ # options::
34
+ # See the Java Stanford Parser documentation for details
35
+ #
36
+ # sentence::
37
+ # A sentence to parse. This must be quoted.
38
+
39
+
40
+ require "stanfordparser"
41
+
42
+ # The last argument is the sentence. The rest of the command line is passed
43
+ # along to the parser object.
44
+ sentence = ARGV.pop
45
+ parser = StanfordParser::LexicalizedParser.new("$(ROOT)/englishPCFG.ser.gz", ARGV)
46
+ puts parser.apply(sentence)
@@ -131,7 +131,7 @@ end # Rjb
131
131
  # Parser}[http://nlp.stanford.edu/downloads/lex-parser.shtml].
132
132
  module StanfordParser
133
133
 
134
- VERSION = "1.0.0"
134
+ VERSION = "1.1.0"
135
135
 
136
136
  # This function is executed once when the module is loaded. It adds the
137
137
  # Stanford parser jarfile to the JVM classpath and return the root of the
@@ -152,8 +152,10 @@ module StanfordParser
152
152
  root
153
153
  end
154
154
 
155
+ private_class_method :initialize_on_load
156
+
155
157
  # The root directory of the Stanford parser installation.
156
- ROOT = StanfordParser.initialize_on_load
158
+ ROOT = initialize_on_load
157
159
 
158
160
 
159
161
  # Extension of the generic Ruby-Java Bridge wrapper object for the
@@ -210,8 +212,6 @@ module StanfordParser
210
212
  # This is a wrapper for the
211
213
  # <tt>edu.stanford.nlp.trees.Tree</tt> objects.
212
214
  class Tree < JavaObjectWrapper
213
- include Enumerable
214
-
215
215
  def initialize(obj = "edu.stanford.nlp.trees.Tree")
216
216
  super(obj)
217
217
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
2
+ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: stanfordparser
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.0
7
- date: 2007-11-04 00:00:00 -07:00
6
+ version: 1.1.0
7
+ date: 2007-11-05 00:00:00 -08:00
8
8
  summary: Ruby wrapper for the Stanford Natural Language Parser
9
9
  require_paths:
10
10
  - lib
@@ -31,6 +31,7 @@ authors:
31
31
  files:
32
32
  - test/test_stanfordparser.rb
33
33
  - lib/stanfordparser.rb
34
+ - examples/stanford-sentence-parser.rb
34
35
  - README
35
36
  test_files:
36
37
  - test/test_stanfordparser.rb