linkparser 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/ruby -w
2
+ #
3
+ # Specification for the LinkParser::Sentence class
4
+ # $Id: mixins_spec.rb,v a5e7d9e3cf5c 2010/11/25 00:50:55 ged $
5
+ #
6
+ # See the LICENSE file in the distribution for information about copyright and licensing.
7
+ #
8
+
9
+ BEGIN {
10
+ require 'pathname'
11
+ basedir = Pathname.new( __FILE__ ).dirname.parent.parent
12
+
13
+ libdir = basedir + 'lib'
14
+ extdir = basedir + 'ext'
15
+
16
+ $LOAD_PATH.unshift( basedir.to_s ) unless $LOAD_PATH.include?( basedir.to_s )
17
+ $LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
18
+ $LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
19
+ }
20
+
21
+ require 'rspec'
22
+ require 'linkparser/mixins'
23
+
24
+
25
+ describe LinkParser, "mixins" do
26
+
27
+ describe LinkParser::DeprecationUtilities do
28
+
29
+ before( :all ) do
30
+ @class = Class.new do
31
+ extend LinkParser::DeprecationUtilities
32
+ def no_args
33
+ return :no_args_result
34
+ end
35
+ def two_args( arg1, arg2 )
36
+ return [arg1, arg2]
37
+ end
38
+ def splat_args( *args )
39
+ return args
40
+ end
41
+
42
+ deprecated_method :no_args
43
+ deprecated_method :two_args, :splat_args
44
+ end
45
+ @object = @class.new
46
+ end
47
+
48
+ it "provides a function for marking a method as deprecated" do
49
+ @object.should_receive( :warn ).with( /deprecated/i )
50
+ @object.no_args.should == :no_args_result
51
+ end
52
+
53
+ it "provides a function for marking a method that takes arguments as deprecated" do
54
+ @object.should_receive( :warn ).with( /deprecated/i )
55
+ @object.two_args( :arg_one, :arg_two ).should == [ :arg_one, :arg_two ]
56
+ end
57
+
58
+ it "provides a function for marking a method with splatted arguments as deprecated" do
59
+ @object.should_receive( :warn ).with( /deprecated/i )
60
+ @object.splat_args( :arg_one, :arg_two ).should == [ :arg_one, :arg_two ]
61
+ end
62
+
63
+
64
+ end
65
+
66
+ end
67
+
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/ruby -w
2
2
  #
3
3
  # Specification for the LinkParser::ParseOptions class
4
- # $Id: parseoptions_spec.rb 53 2009-06-03 12:52:13Z deveiant $
4
+ # $Id: parseoptions_spec.rb,v a5e7d9e3cf5c 2010/11/25 00:50:55 ged $
5
5
  #
6
6
  # See the LICENSE file in the distribution for information about copyright and licensing.
7
7
  #
@@ -9,24 +9,30 @@
9
9
  BEGIN {
10
10
  require 'pathname'
11
11
  basedir = Pathname.new( __FILE__ ).dirname.parent.parent
12
-
12
+
13
13
  libdir = basedir + 'lib'
14
14
  extdir = basedir + 'ext'
15
-
15
+
16
+ $LOAD_PATH.unshift( basedir.to_s ) unless $LOAD_PATH.include?( basedir.to_s )
16
17
  $LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
17
18
  $LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
18
19
  }
19
20
 
20
- require 'spec/runner'
21
+ require 'rspec'
22
+
21
23
  require 'linkparser'
22
24
 
23
25
 
24
26
  describe LinkParser::ParseOptions do
25
27
 
28
+ before( :all ) do
29
+ $DEBUG = true if ENV['DEBUG']
30
+ end
31
+
26
32
  before( :each ) do
27
33
  @opts = LinkParser::ParseOptions.new
28
34
  end
29
-
35
+
30
36
 
31
37
  it "starts out with documented defaults" do
32
38
  @opts.verbosity.should == 1 # Docs say this is 0
@@ -51,19 +57,20 @@ describe LinkParser::ParseOptions do
51
57
  end
52
58
 
53
59
  it "supports all the members mentioned in the documentation" do
54
- pending "some of them aren't implemented in the link-grammar library"
55
- @opts.display_short?.should == true # Not in the API
60
+ pending "some of them aren't implemented in the link-grammar library" do
61
+ @opts.display_short?.should == true # Not in the API
62
+ end
56
63
  end
57
64
 
58
65
 
59
66
  it "knows whether the timer constraints were exceeded or not" do
60
67
  @opts.timer_expired?.should == false
61
68
  end
62
-
69
+
63
70
  it "knows whether the memory constraints were exceeded or not" do
64
71
  @opts.memory_exhausted?.should == false
65
72
  end
66
-
73
+
67
74
  it "knows whether the timer constraints were exceeded or not" do
68
75
  @opts.resources_exhausted?.should == false
69
76
  end
@@ -74,19 +81,9 @@ describe LinkParser::ParseOptions do
74
81
  }.should_not raise_error()
75
82
  end
76
83
 
77
-
78
- describe "in versions of link-grammar >= 4.5.0" do
79
-
80
- before( :each ) do
81
- version_vec = LinkParser.link_grammar_version[/(\d+\.\d+\.\d+)/, 1].
82
- split('.').collect {|v| v.to_i }.pack('n*')
83
- pending "the underlying library is %s" unless version_vec >= [4,5,0].pack('n*')
84
- end
85
-
86
- it "knows whether spell_guessing is enabled or not" do
87
- @opts.spell_guessing_enabled?.should == true
88
- end
84
+ it "knows whether spell_guessing is enabled or not" do
85
+ @opts.spell_guessing_enabled?.should == true
89
86
  end
90
-
87
+
91
88
  end
92
89
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/ruby -w
2
2
  #
3
3
  # Specification for the LinkParser::Sentence class
4
- # $Id: sentence_spec.rb 53 2009-06-03 12:52:13Z deveiant $
4
+ # $Id: sentence_spec.rb,v 6c597e731a87 2010/11/22 15:59:36 ged $
5
5
  #
6
6
  # See the LICENSE file in the distribution for information about copyright and licensing.
7
7
  #
@@ -9,30 +9,32 @@
9
9
  BEGIN {
10
10
  require 'pathname'
11
11
  basedir = Pathname.new( __FILE__ ).dirname.parent.parent
12
-
12
+
13
13
  libdir = basedir + 'lib'
14
14
  extdir = basedir + 'ext'
15
-
15
+
16
+ $LOAD_PATH.unshift( basedir.to_s ) unless $LOAD_PATH.include?( basedir.to_s )
16
17
  $LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
17
18
  $LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
18
19
  }
19
20
 
20
- require 'spec/runner'
21
+ require 'rspec'
22
+
21
23
  require 'linkparser'
22
24
 
23
25
 
24
26
  describe LinkParser::Sentence do
25
27
 
26
-
27
28
  before( :all ) do
28
- @dict = LinkParser::Dictionary.new( :verbosity => 0 )
29
+ @dict = LinkParser::Dictionary.new( 'en', :verbosity => 0 )
30
+ $DEBUG = true if ENV['DEBUG']
29
31
  end
30
-
31
32
 
32
33
  before( :each ) do
33
34
  @sentence = LinkParser::Sentence.new( "The cat runs.", @dict )
34
35
  end
35
-
36
+
37
+
36
38
  it "returns an informational string when inspected before it's been parsed" do
37
39
  @sentence.inspect.should =~ %r{
38
40
  <
@@ -59,7 +61,7 @@ describe LinkParser::Sentence do
59
61
  it "can return itself as a tokenized string" do
60
62
  @sentence.to_s.should == "LEFT-WALL the cat runs . RIGHT-WALL"
61
63
  end
62
-
64
+
63
65
 
64
66
  it "returns the linkage count as the result of parsing the sentence" do
65
67
  @sentence.parse.should == 1
@@ -79,7 +81,7 @@ describe LinkParser::Sentence do
79
81
  it "delegates linkage methods to its first linkage" do
80
82
  @sentence.num_links.should == 5
81
83
  end
82
-
84
+
83
85
 
84
86
  it "knows whether or not it's been parsed" do
85
87
  @sentence.should_not be_parsed()
@@ -97,26 +99,26 @@ describe LinkParser::Sentence do
97
99
  @sentence.word( 0 ).should == 'LEFT-WALL'
98
100
  @sentence[ -1 ].should == 'RIGHT-WALL'
99
101
  end
100
-
102
+
101
103
  it "can return an Array of all tokenized words" do
102
104
  @sentence.words.should == [
103
105
  'LEFT-WALL', 'the', 'cat', 'runs', '.', 'RIGHT-WALL'
104
106
  ]
105
107
  end
106
-
108
+
107
109
 
108
110
  it "knows that it doesn't have any superfluous words in it" do
109
111
  @sentence.null_count == 0
110
112
  end
111
-
112
-
113
+
114
+
113
115
 
114
116
  describe "parsed from a sentence with a superfluous word in it" do
115
117
 
116
118
  before( :each ) do
117
119
  @sentence = @dict.parse( "This sentence contains a gravel superfluous word.")
118
120
  end
119
-
121
+
120
122
 
121
123
  it "knows how many null links it has" do
122
124
  @sentence.null_count == 1
@@ -125,11 +127,11 @@ describe LinkParser::Sentence do
125
127
 
126
128
 
127
129
  describe "parsed from a sentence that yields no linkages" do
128
-
130
+
129
131
  before( :each ) do
130
132
  @sentence = @dict.parse( "The event that he smiled at me gives me hope" )
131
133
  end
132
-
134
+
133
135
  it "raises a descriptive exception if a delegated method is called" do
134
136
  expect {
135
137
  @sentence.constituent_tree_string
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/ruby -w
2
2
  #
3
3
  # Specification for the LinkParser library
4
- # $Id: linkparser_spec.rb 48 2008-12-19 18:30:33Z deveiant $
4
+ # $Id: linkparser_spec.rb,v 6c597e731a87 2010/11/22 15:59:36 ged $
5
5
  #
6
6
  # See the LICENSE file in the distribution for information about copyright and licensing.
7
7
  #
@@ -9,22 +9,28 @@
9
9
  BEGIN {
10
10
  require 'pathname'
11
11
  basedir = Pathname.new( __FILE__ ).dirname.parent
12
-
12
+
13
13
  libdir = basedir + 'lib'
14
14
  extdir = basedir + 'ext'
15
-
15
+
16
+ $LOAD_PATH.unshift( basedir.to_s ) unless $LOAD_PATH.include?( basedir.to_s )
16
17
  $LOAD_PATH.unshift( libdir.to_s ) unless $LOAD_PATH.include?( libdir.to_s )
17
18
  $LOAD_PATH.unshift( extdir.to_s ) unless $LOAD_PATH.include?( extdir.to_s )
18
19
  }
19
20
 
20
- require 'spec/runner'
21
+ require 'rspec'
22
+
21
23
  require 'linkparser'
22
24
 
23
25
 
24
26
  describe LinkParser do
25
27
 
28
+ before( :all ) do
29
+ $DEBUG = true if ENV['DEBUG']
30
+ end
31
+
26
32
  it "knows what version of the link-grammar library it was built against" do
27
33
  LinkParser.link_grammar_version.should =~ /link-grammar-\d+\.\d+\.\d+/i
28
34
  end
29
-
35
+
30
36
  end
metadata CHANGED
@@ -1,164 +1,76 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linkparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ hash: 19
5
+ prerelease: false
6
+ segments:
7
+ - 1
8
+ - 1
9
+ - 0
10
+ version: 1.1.0
5
11
  platform: ruby
6
12
  authors:
13
+ - Martin Chase
7
14
  - Michael Granger
8
15
  autorequire:
9
16
  bindir: bin
10
- cert_chain: []
17
+ cert_chain:
18
+ - |
19
+ -----BEGIN CERTIFICATE-----
20
+ MIIDLDCCAhSgAwIBAgIBADANBgkqhkiG9w0BAQUFADA8MQwwCgYDVQQDDANnZWQx
21
+ FzAVBgoJkiaJk/IsZAEZFgdfYWVyaWVfMRMwEQYKCZImiZPyLGQBGRYDb3JnMB4X
22
+ DTEwMDkxNjE0NDg1MVoXDTExMDkxNjE0NDg1MVowPDEMMAoGA1UEAwwDZ2VkMRcw
23
+ FQYKCZImiZPyLGQBGRYHX2FlcmllXzETMBEGCgmSJomT8ixkARkWA29yZzCCASIw
24
+ DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALy//BFxC1f/cPSnwtJBWoFiFrir
25
+ h7RicI+joq/ocVXQqI4TDWPyF/8tqkvt+rD99X9qs2YeR8CU/YiIpLWrQOYST70J
26
+ vDn7Uvhb2muFVqq6+vobeTkILBEO6pionWDG8jSbo3qKm1RjKJDwg9p4wNKhPuu8
27
+ KGue/BFb67KflqyApPmPeb3Vdd9clspzqeFqp7cUBMEpFS6LWxy4Gk+qvFFJBJLB
28
+ BUHE/LZVJMVzfpC5Uq+QmY7B+FH/QqNndn3tOHgsPadLTNimuB1sCuL1a4z3Pepd
29
+ TeLBEFmEao5Dk3K/Q8o8vlbIB/jBDTUx6Djbgxw77909x6gI9doU4LD5XMcCAwEA
30
+ AaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFJeoGkOr9l4B
31
+ +saMkW/ZXT4UeSvVMA0GCSqGSIb3DQEBBQUAA4IBAQBG2KObvYI2eHyyBUJSJ3jN
32
+ vEnU3d60znAXbrSd2qb3r1lY1EPDD3bcy0MggCfGdg3Xu54z21oqyIdk8uGtWBPL
33
+ HIa9EgfFGSUEgvcIvaYqiN4jTUtidfEFw+Ltjs8AP9gWgSIYS6Gr38V0WGFFNzIH
34
+ aOD2wmu9oo/RffW4hS/8GuvfMzcw7CQ355wFR4KB/nyze+EsZ1Y5DerCAagMVuDQ
35
+ U0BLmWDFzPGGWlPeQCrYHCr+AcJz+NRnaHCKLZdSKj/RHuTOt+gblRex8FAh8NeA
36
+ cmlhXe46pZNJgWKbxZah85jIjx95hR8vOI+NAM5iH9kOqK13DrxacTKPhqj5PjwF
37
+ -----END CERTIFICATE-----
11
38
 
12
- date: 2009-06-09 00:00:00 -07:00
39
+ date: 2010-11-30 00:00:00 -08:00
13
40
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: text-format
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.0.0
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: termios
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: "0"
34
- version:
35
- - !ruby/object:Gem::Dependency
36
- name: rubyforge
37
- type: :development
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: "0"
44
- version:
45
- - !ruby/object:Gem::Dependency
46
- name: rspec
47
- type: :development
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: "0"
54
- version:
55
- - !ruby/object:Gem::Dependency
56
- name: rake
57
- type: :development
58
- version_requirement:
59
- version_requirements: !ruby/object:Gem::Requirement
60
- requirements:
61
- - - ">="
62
- - !ruby/object:Gem::Version
63
- version: 0.8.1
64
- version:
65
- - !ruby/object:Gem::Dependency
66
- name: libxml-ruby
67
- type: :development
68
- version_requirement:
69
- version_requirements: !ruby/object:Gem::Requirement
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- version: 0.8.3
74
- version:
75
- - !ruby/object:Gem::Dependency
76
- name: ultraviolet
77
- type: :development
78
- version_requirement:
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: 0.10.2
84
- version:
85
- - !ruby/object:Gem::Dependency
86
- name: tmail
87
- type: :development
88
- version_requirement:
89
- version_requirements: !ruby/object:Gem::Requirement
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- version: 1.2.3.1
94
- version:
95
- - !ruby/object:Gem::Dependency
96
- name: amatch
97
- type: :development
98
- version_requirement:
99
- version_requirements: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: 0.2.3
104
- version:
105
- - !ruby/object:Gem::Dependency
106
- name: rcov
107
- type: :development
108
- version_requirement:
109
- version_requirements: !ruby/object:Gem::Requirement
110
- requirements:
111
- - - ">="
112
- - !ruby/object:Gem::Version
113
- version: "0"
114
- version:
115
- - !ruby/object:Gem::Dependency
116
- name: RedCloth
117
- type: :development
118
- version_requirement:
119
- version_requirements: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - ">="
122
- - !ruby/object:Gem::Version
123
- version: 4.0.3
124
- version:
125
- - !ruby/object:Gem::Dependency
126
- name: rcodetools
127
- type: :development
128
- version_requirement:
129
- version_requirements: !ruby/object:Gem::Requirement
130
- requirements:
131
- - - ">="
132
- - !ruby/object:Gem::Version
133
- version: 0.7.0.0
134
- version:
41
+ dependencies: []
42
+
135
43
  description: |-
136
44
  A Ruby binding for the link-grammar library, a syntactic parser
137
45
  of English. See http://www.link.cs.cmu.edu/link/ for more
138
46
  information about the Link Grammar, and
139
47
  http://www.abisource.org/projects/link-grammar/ for information
140
48
  about the link-grammar library.
141
- email: ged@FaerieMUD.org
49
+ email:
50
+ - stillflame@FaerieMUD.org
51
+ - ged@FaerieMUD.org
142
52
  executables: []
143
53
 
144
54
  extensions:
145
55
  - ext/extconf.rb
146
56
  extra_rdoc_files:
147
57
  - ChangeLog
148
- - README
58
+ - README.md
149
59
  - LICENSE
150
60
  files:
151
61
  - Rakefile
152
62
  - ChangeLog
153
- - README
63
+ - README.md
154
64
  - LICENSE
155
65
  - spec/bugfixes_spec.rb
156
66
  - spec/linkparser/dictionary_spec.rb
157
67
  - spec/linkparser/linkage_spec.rb
68
+ - spec/linkparser/mixins_spec.rb
158
69
  - spec/linkparser/parseoptions_spec.rb
159
70
  - spec/linkparser/sentence_spec.rb
160
71
  - spec/linkparser_spec.rb
161
72
  - lib/linkparser/linkage.rb
73
+ - lib/linkparser/mixins.rb
162
74
  - lib/linkparser/sentence.rb
163
75
  - lib/linkparser.rb
164
76
  - ext/dictionary.c
@@ -170,52 +82,56 @@ files:
170
82
  - ext/extconf.rb
171
83
  - rake/191_compat.rb
172
84
  - rake/dependencies.rb
85
+ - rake/documentation.rb
173
86
  - rake/helpers.rb
87
+ - rake/hg.rb
174
88
  - rake/manual.rb
175
89
  - rake/packaging.rb
176
90
  - rake/publishing.rb
177
- - rake/rdoc.rb
178
91
  - rake/style.rb
179
92
  - rake/svn.rb
180
93
  - rake/testing.rb
181
94
  - rake/verifytask.rb
182
- - rake/win32.rb
183
95
  - Rakefile.local
184
96
  has_rdoc: true
185
97
  homepage: http://deveiate.org/projects/Ruby-LinkParser/
186
- licenses: []
187
-
98
+ licenses:
99
+ - BSD
188
100
  post_install_message:
189
101
  rdoc_options:
190
- - -w
191
- - "4"
192
- - -SHN
193
- - -i
102
+ - --tab-width=4
103
+ - --show-hash
104
+ - --include
194
105
  - .
195
- - -m
196
- - README
197
- - -t
198
- - linkparser
199
- - -W
200
- - http://deveiate.org/projects/Ruby-LinkParser/browser/trunk/
106
+ - --main=README.md
107
+ - --title=linkparser
201
108
  require_paths:
202
109
  - lib
110
+ - ext
203
111
  required_ruby_version: !ruby/object:Gem::Requirement
112
+ none: false
204
113
  requirements:
205
114
  - - ">="
206
115
  - !ruby/object:Gem::Version
207
- version: "0"
208
- version:
116
+ hash: 57
117
+ segments:
118
+ - 1
119
+ - 8
120
+ - 7
121
+ version: 1.8.7
209
122
  required_rubygems_version: !ruby/object:Gem::Requirement
123
+ none: false
210
124
  requirements:
211
125
  - - ">="
212
126
  - !ruby/object:Gem::Version
127
+ hash: 3
128
+ segments:
129
+ - 0
213
130
  version: "0"
214
- version:
215
131
  requirements:
216
- - link-grammar >= 4.4.2
217
- rubyforge_project: linkparser
218
- rubygems_version: 1.3.4
132
+ - link-grammar >= 4.7.0
133
+ rubyforge_project:
134
+ rubygems_version: 1.3.7
219
135
  signing_key:
220
136
  specification_version: 3
221
137
  summary: a Ruby binding for the link-grammar library
@@ -223,6 +139,7 @@ test_files:
223
139
  - spec/bugfixes_spec.rb
224
140
  - spec/linkparser/dictionary_spec.rb
225
141
  - spec/linkparser/linkage_spec.rb
142
+ - spec/linkparser/mixins_spec.rb
226
143
  - spec/linkparser/parseoptions_spec.rb
227
144
  - spec/linkparser/sentence_spec.rb
228
145
  - spec/linkparser_spec.rb