linkparser 2.1.0.pre20160901165018 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.gemtest +0 -0
- data/ChangeLog +118 -1
- data/History.md +14 -0
- data/README.md +15 -15
- data/Rakefile +16 -9
- data/ext/dictionary.c +2 -2
- data/ext/linkage.c +16 -2
- data/ext/linkparser.c +3 -3
- data/ext/sentence.c +4 -3
- data/lib/linkparser.rb +1 -1
- data/lib/linkparser/linkage.rb +0 -6
- data/lib/linkparser/sentence.rb +0 -4
- data/spec/helpers.rb +4 -0
- data/spec/linkparser/linkage_spec.rb +19 -12
- data/spec/linkparser/parseoptions_spec.rb +4 -2
- metadata +33 -31
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe7be4a20ae19bb237f43e9f2458f6652ab9e468d01c8b77b9851881bfc0a792
|
4
|
+
data.tar.gz: 47dec2c2c30e8aaafe3111942eb65d8f756fdc848113f180db4c0a19b4d934db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 335a182462b0ad75056b98a2a7ec7b82fabaa5a8e7e1b8e6b3a369a598cd6df8b255031d21643c77346f4266c9f60f4f6ed7fccdeb1115ba6b309f1fba4ddc76
|
7
|
+
data.tar.gz: 458569a866e76cab02ef4049761b2c2888c100d6edec6df4fc67ca83c7288237ad239749e1e8a44dd6ff1ca387a6241220d0ad5e12a405f61c25fb4c7780d13f
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/.gemtest
ADDED
File without changes
|
data/ChangeLog
CHANGED
@@ -1,8 +1,125 @@
|
|
1
|
+
2017-12-31 Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
* .hgignore, experiments/diagram_hang.c, ext/sentence.c,
|
4
|
+
linkparser.gemspec, spec/linkparser/linkage_spec.rb,
|
5
|
+
spec/linkparser/parseoptions_spec.rb:
|
6
|
+
Fix some stuff for the latest version of link-grammar.
|
7
|
+
|
8
|
+
- Bump testing Ruby to 2.5
|
9
|
+
- Add a workaround and minimal test case for opencog/link-grammar#626
|
10
|
+
- Fix a double-free in sentence
|
11
|
+
- Fix specs for link-grammar built without hunspell
|
12
|
+
[ba2931648b42] [tip]
|
13
|
+
|
14
|
+
2017-12-11 Michael Granger <ged@FaerieMUD.org>
|
15
|
+
|
16
|
+
* README.md, Rakefile, linkparser.gemspec:
|
17
|
+
Fix docs task, update URLs and copyright date.
|
18
|
+
[4c5ba924dbbc] [github/master]
|
19
|
+
|
20
|
+
* .ruby-version, README.md, Rakefile, ext/dictionary.c, ext/linkage.c,
|
21
|
+
ext/linkparser.c, ext/sentence.c, lib/linkparser/linkage.rb,
|
22
|
+
lib/linkparser/sentence.rb, linkparser.gemspec,
|
23
|
+
spec/linkparser/linkage_spec.rb,
|
24
|
+
spec/linkparser/parseoptions_spec.rb:
|
25
|
+
Fix a bunch of small issues and update it.
|
26
|
+
|
27
|
+
- Bump testing Ruby to 2.5.
|
28
|
+
- Convert documents to Markdown
|
29
|
+
- Eliminate weird calls to rb_funcall with explicit null pointers.
|
30
|
+
- Move class docs to the C source.
|
31
|
+
- Eliminate use of deprecated Fixnum constant
|
32
|
+
- Fix an empty raise_error in the specs
|
33
|
+
[b3d1301b7235]
|
34
|
+
|
35
|
+
* certs/ged.pem:
|
36
|
+
Update gem-signing cert
|
37
|
+
[ea3465a0ea85]
|
38
|
+
|
39
|
+
2016-09-01 Michael Granger <ged@FaerieMUD.org>
|
40
|
+
|
41
|
+
* LICENSE, README.md:
|
42
|
+
Update copyright dates.
|
43
|
+
[822f4274757d]
|
44
|
+
|
45
|
+
* Rakefile, certs/ged.pem, linkparser.gemspec:
|
46
|
+
Add my public cert.
|
47
|
+
[256829f8b5b8]
|
48
|
+
|
49
|
+
* spec/linkparser/linkage_spec.rb:
|
50
|
+
Fix a spec that just required a bit of whitespace-stripping.
|
51
|
+
[50d0ec0db277]
|
52
|
+
|
53
|
+
* spec/linkparser/linkage_spec.rb:
|
54
|
+
Update specs for Link Grammar 5.3.0 and later.
|
55
|
+
[b0a38a25b55d]
|
56
|
+
|
57
|
+
* ext/extconf.rb:
|
58
|
+
Fix LinkParser.link_grammar_version
|
59
|
+
|
60
|
+
This previously always reported "link-grammar-4.3.9-or-earlier"
|
61
|
+
because I forgot to actually check for the required function in
|
62
|
+
extconf.rb.
|
63
|
+
[c44cab6fee00]
|
64
|
+
|
65
|
+
* .gems, .ruby-gemset, .ruby-version, .rvm.gems, .rvmrc,
|
66
|
+
linkparser.gemspec:
|
67
|
+
Change rvm-specific env files to generic ones, and update to Ruby
|
68
|
+
2.3
|
69
|
+
[844186d04685]
|
70
|
+
|
71
|
+
2015-03-12 Michael Granger <ged@FaerieMUD.org>
|
72
|
+
|
73
|
+
* .hgtags:
|
74
|
+
Added tag v2.0.0 for changeset d8bf03d36ab3
|
75
|
+
[83fca2c2956c]
|
76
|
+
|
77
|
+
* .hgsigs:
|
78
|
+
Added signature for changeset 2d792b205a62
|
79
|
+
[d8bf03d36ab3] [v2.0.0]
|
80
|
+
|
81
|
+
* README.md:
|
82
|
+
Made a note of the license of link-grammar in the README
|
83
|
+
[2d792b205a62]
|
84
|
+
|
85
|
+
* History.md, linkparser.gemspec:
|
86
|
+
Updated the history file in preparation for release.
|
87
|
+
[fdc841eae602]
|
88
|
+
|
89
|
+
2015-03-02 Michael Granger <ged@FaerieMUD.org>
|
90
|
+
|
91
|
+
* .travis.yml:
|
92
|
+
Use the default rake script for the Travis build
|
93
|
+
[d717e0ff8649]
|
94
|
+
|
95
|
+
* Gemfile, History.md, README.md, Rakefile,
|
96
|
+
experiments/diagram_sentences.rb, ext/dictionary.c,
|
97
|
+
ext/linkparser.c, ext/linkparser.h, linkparser.gemspec:
|
98
|
+
Update/fix build files.
|
99
|
+
[85300de8d84c]
|
100
|
+
|
101
|
+
* .pryrc, .rvm.gems, .rvmrc, .simplecov, .tm_properties, .travis.yml,
|
102
|
+
History.md, History.rdoc, Manifest.txt, README.md, README.rdoc,
|
103
|
+
Rakefile, examples/basic-api.rb, examples/readme-example.rb,
|
104
|
+
experiments/build_linktype_hash.rb,
|
105
|
+
experiments/diagram_sentences.rb, ext/dictionary.c, ext/extconf.rb,
|
106
|
+
ext/linkage.c, ext/linkparser.c, ext/linkparser.h,
|
107
|
+
ext/parseoptions.c, ext/sentence.c, lib/linkparser.rb,
|
108
|
+
lib/linkparser/dictionary.rb, lib/linkparser/linkage.rb,
|
109
|
+
lib/linkparser/mixins.rb, lib/linkparser/parseoptions.rb,
|
110
|
+
lib/linkparser/sentence.rb, spec/bugfixes_spec.rb, spec/helpers.rb,
|
111
|
+
spec/linkparser/dictionary_spec.rb, spec/linkparser/linkage_spec.rb,
|
112
|
+
spec/linkparser/mixins_spec.rb,
|
113
|
+
spec/linkparser/parseoptions_spec.rb,
|
114
|
+
spec/linkparser/sentence_spec.rb, spec/linkparser_spec.rb:
|
115
|
+
Update for latest Ruby and link-grammar
|
116
|
+
[92228378be38]
|
117
|
+
|
1
118
|
2013-02-25 Michael Granger <ged@FaerieMUD.org>
|
2
119
|
|
3
120
|
* .rvmrc:
|
4
121
|
Test under Ruby 2 by default.
|
5
|
-
[9f95dae5c1a0]
|
122
|
+
[9f95dae5c1a0]
|
6
123
|
|
7
124
|
* Rakefile:
|
8
125
|
Use RbConfig instead of deprecated Config module
|
data/History.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## v2.1.0 [2018-01-10] Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
Enhancements:
|
4
|
+
|
5
|
+
- Update for the latest link-grammar (5.4.3)
|
6
|
+
|
7
|
+
Bugfixes:
|
8
|
+
|
9
|
+
- Fix LinkParser.link_grammar_version
|
10
|
+
- Eliminate weird calls to rb_funcall with explicit null pointers (Ruby 2.5)
|
11
|
+
- Eliminate use of deprecated Fixnum constant (Ruby 2.5)
|
12
|
+
- Add a workaround and minimal test case for diagrams with very small widths
|
13
|
+
|
14
|
+
|
1
15
|
## v2.0.0 [2015-03-02] Michael Granger <ged@FaerieMUD.org>
|
2
16
|
|
3
17
|
Updated for the latest Ruby and link-grammar.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# linkparser
|
2
2
|
|
3
|
-
* http://
|
3
|
+
* http://bitbucket.org/ged/linkparser
|
4
4
|
|
5
5
|
## Description
|
6
6
|
|
@@ -12,12 +12,12 @@ This module is a Ruby binding for
|
|
12
12
|
### Example Usage
|
13
13
|
|
14
14
|
dict = LinkParser::Dictionary.new
|
15
|
-
=> #<LinkParser::Dictionary:
|
15
|
+
=> #<LinkParser::Dictionary:0x007fc56b480d18 @options={}>
|
16
16
|
|
17
17
|
sent = dict.parse( "People use Ruby for all kinds of nifty things." )
|
18
|
-
=> #<LinkParser::Sentence:
|
19
|
-
|
20
|
-
|
18
|
+
=> #<LinkParser::Sentence:0x1ff15b42eeda
|
19
|
+
"LEFT-WALL people.p use.v Ruby.f for.p all.a kinds.n of nifty.a things.n . RIGHT-WALL"/
|
20
|
+
15 linkages/0 nulls>
|
21
21
|
|
22
22
|
sent.subject
|
23
23
|
=> "people"
|
@@ -26,17 +26,17 @@ This module is a Ruby binding for
|
|
26
26
|
=> "use"
|
27
27
|
|
28
28
|
sent.object
|
29
|
-
=> "Ruby
|
29
|
+
=> "Ruby"
|
30
30
|
|
31
31
|
puts sent.diagram( max_width: 200 )
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
32
|
+
|
33
|
+
+---------------------------------Xp--------------------------------+
|
34
|
+
| +---------------Jp---------------+ |
|
35
|
+
| | +--------Dmc--------+ |
|
36
|
+
+------>WV------>+-----MVp----+ | +------Jd-----+ |
|
37
|
+
+----Wd---+--Sp--+--Os--+ | +-Dmcn-+-OFd-+ +----A---+ +--RW--+
|
38
|
+
| | | | | | | | | | | |
|
39
|
+
LEFT-WALL people.p use.v Ruby.f for.p all.a kinds.n of nifty.a things.n . RIGHT-WALL
|
40
40
|
|
41
41
|
|
42
42
|
## Installation
|
@@ -79,7 +79,7 @@ https://www.gnu.org/licenses/lgpl-2.1.html
|
|
79
79
|
|
80
80
|
The gem itself is licensed under the BSD license:
|
81
81
|
|
82
|
-
Copyright (c) 2006-
|
82
|
+
Copyright (c) 2006-2017, The FaerieMUD Consortium
|
83
83
|
All rights reserved.
|
84
84
|
|
85
85
|
Redistribution and use in source and binary forms, with or without
|
data/Rakefile
CHANGED
@@ -41,18 +41,25 @@ hoespec = Hoe.spec 'linkparser' do
|
|
41
41
|
self.readme_file = 'README.md'
|
42
42
|
self.history_file = 'History.md'
|
43
43
|
self.extra_rdoc_files = FileList[ '*.md', 'ext/*.[ch]' ]
|
44
|
+
self.license 'BSD-3-Clause'
|
45
|
+
self.urls = {
|
46
|
+
home: 'http://bitbucket.org/ged/linkparser',
|
47
|
+
code: 'http://bitbucket.org/ged/linkparser',
|
48
|
+
docs: 'http://deveiate.org/code/linkparser',
|
49
|
+
github: 'http://github.com/ged/linkparser',
|
50
|
+
}
|
44
51
|
|
45
52
|
self.developer 'Michael Granger', 'ged@FaerieMUD.org'
|
46
53
|
self.developer 'Martin Chase', 'stillflame@FaerieMUD.org'
|
47
54
|
|
48
55
|
self.dependency 'loggability', '~> 0.11'
|
49
|
-
self.dependency 'rake-compiler', '~> 0', :development
|
50
|
-
self.dependency 'hoe-deveiate', '~> 0.
|
51
|
-
self.dependency 'rdoc-generator-fivefish', '~> 0', :development
|
56
|
+
self.dependency 'rake-compiler', '~> 1.0', :development
|
57
|
+
self.dependency 'hoe-deveiate', '~> 0.9', :development
|
58
|
+
self.dependency 'rdoc-generator-fivefish', '~> 0.3', :development
|
52
59
|
|
53
60
|
self.spec_extras[:extensions] = [ EXTCONF.to_s ]
|
54
61
|
|
55
|
-
self.require_ruby_version( '>=2.
|
62
|
+
self.require_ruby_version( '>=2.3.0' )
|
56
63
|
self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
|
57
64
|
self.check_history_on_release = true if self.respond_to?( :check_history_on_release= )
|
58
65
|
self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
|
@@ -99,11 +106,11 @@ if File.directory?( '.hg' )
|
|
99
106
|
|
100
107
|
Rake::Task[ 'docs' ].clear
|
101
108
|
RDoc::Task.new( 'docs' ) do |rdoc|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
109
|
+
rdoc.main = "README.md"
|
110
|
+
rdoc.rdoc_files.include( "*.md", "ChangeLog", "lib/**/*.rb", "ext/**/*.c" )
|
111
|
+
rdoc.generator = :fivefish
|
112
|
+
rdoc.title = "Ruby LinkParser"
|
113
|
+
rdoc.rdoc_dir = 'doc'
|
107
114
|
end
|
108
115
|
end
|
109
116
|
|
data/ext/dictionary.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* dict.c - Ruby LinkParser - Dictionary Class
|
3
|
-
* $Id: dictionary.c,v
|
3
|
+
* $Id: dictionary.c,v b3d1301b7235 2017/12/12 01:12:42 ged $
|
4
4
|
*
|
5
5
|
* Authors:
|
6
6
|
* * Michael Granger <ged@FaerieMUD.org>
|
@@ -291,7 +291,7 @@ rlink_parse( int argc, VALUE *argv, VALUE self )
|
|
291
291
|
|
292
292
|
/* Now call #parse on it */
|
293
293
|
if ( i == 1 )
|
294
|
-
rb_funcall( sentence, rb_intern("parse"), 0
|
294
|
+
rb_funcall( sentence, rb_intern("parse"), 0 );
|
295
295
|
else
|
296
296
|
rb_funcall( sentence, rb_intern("parse"), 1, options );
|
297
297
|
|
data/ext/linkage.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* linkage.c - Ruby LinkParser Linkage class
|
3
|
-
* $Id: linkage.c,v
|
3
|
+
* $Id: linkage.c,v d90624702800 2018/01/10 22:38:26 ged $
|
4
4
|
*
|
5
5
|
* Authors:
|
6
6
|
* * Michael Granger <ged@FaerieMUD.org>
|
@@ -223,7 +223,10 @@ rlink_linkage_diagram( int argc, VALUE *argv, VALUE self )
|
|
223
223
|
|
224
224
|
rlink_log_obj( self, "debug", "Display walls: %d, screen_width: %d", display_walls, screen_width );
|
225
225
|
|
226
|
-
diagram_cstr = linkage_print_diagram(
|
226
|
+
if ( !(diagram_cstr = linkage_print_diagram((Linkage)ptr->linkage, display_walls, screen_width)) ) {
|
227
|
+
rb_raise( rb_eRuntimeError, "Can't create a diagram of width %zu", screen_width );
|
228
|
+
}
|
229
|
+
|
227
230
|
diagram = rb_str_new2( diagram_cstr );
|
228
231
|
linkage_free_diagram( diagram_cstr );
|
229
232
|
|
@@ -636,6 +639,17 @@ rlink_linkage_get_violation_name( VALUE self )
|
|
636
639
|
}
|
637
640
|
|
638
641
|
|
642
|
+
/*
|
643
|
+
* Document-class: LinkParser::Linkage
|
644
|
+
*
|
645
|
+
* This is the API's representation of a parse. A LinkParser::Sentence may have one or more
|
646
|
+
* of LinkParser::Linkages, each of which represents one possible structure of the sentence.
|
647
|
+
* It can be thought of as a Sentence together with a collection of links. If the parse
|
648
|
+
* has a conjunction, then the Linkage is made up of at least two "sublinkages". A
|
649
|
+
* Linkage can be pretty printed in either ASCII or Postscript format, and individual
|
650
|
+
* links can be extracted.
|
651
|
+
*
|
652
|
+
*/
|
639
653
|
void
|
640
654
|
rlink_init_linkage()
|
641
655
|
{
|
data/ext/linkparser.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* linkparser.c - Ruby LinkParser
|
3
|
-
* $Id: linkparser.c,v
|
3
|
+
* $Id: linkparser.c,v b3d1301b7235 2017/12/12 01:12:42 ged $
|
4
4
|
*
|
5
5
|
* Authors:
|
6
6
|
* * Michael Granger <ged@FaerieMUD.org>
|
@@ -50,7 +50,7 @@ rlink_log_obj( VALUE context, const char *level, const char *fmt, va_dcl )
|
|
50
50
|
vsnprintf( buf, BUFSIZ, fmt, args );
|
51
51
|
message = rb_str_new2( buf );
|
52
52
|
|
53
|
-
logger = rb_funcall( context, rb_intern("log"), 0
|
53
|
+
logger = rb_funcall( context, rb_intern("log"), 0 );
|
54
54
|
rb_funcall( logger, rb_intern(level), 1, message );
|
55
55
|
|
56
56
|
va_end( args );
|
@@ -76,7 +76,7 @@ rlink_log( const char *level, const char *fmt, va_dcl )
|
|
76
76
|
vsnprintf( buf, BUFSIZ, fmt, args );
|
77
77
|
message = rb_str_new2( buf );
|
78
78
|
|
79
|
-
logger = rb_funcall( rlink_mLinkParser, rb_intern("logger"), 0
|
79
|
+
logger = rb_funcall( rlink_mLinkParser, rb_intern("logger"), 0 );
|
80
80
|
rb_funcall( logger, rb_intern(level), 1, message );
|
81
81
|
|
82
82
|
va_end( args );
|
data/ext/sentence.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* sentence.c - Ruby LinkParser
|
3
|
-
* $Id: sentence.c,v
|
3
|
+
* $Id: sentence.c,v d90624702800 2018/01/10 22:38:26 ged $
|
4
4
|
*
|
5
5
|
* Authors:
|
6
6
|
* * Michael Granger <ged@FaerieMUD.org>
|
@@ -69,7 +69,8 @@ rlink_sentence_gc_free( struct rlink_sentence *ptr )
|
|
69
69
|
|
70
70
|
/* Freeing the dictionary automatically frees the sentences it belongs to, so
|
71
71
|
don't double-free if the dictionary struct or its pointer is done. */
|
72
|
-
if ( dictionary->dict ) {
|
72
|
+
if ( dictionary->dict && ptr->sentence ) {
|
73
|
+
rlink_log( "Deleting sentence %p", "debug", ptr->sentence );
|
73
74
|
sentence_delete( (Sentence)ptr->sentence );
|
74
75
|
}
|
75
76
|
}
|
@@ -155,7 +156,7 @@ rlink_sentence_s_alloc( VALUE klass )
|
|
155
156
|
* LinkParser::Sentence.new( str, dict ) -> sentence
|
156
157
|
*
|
157
158
|
* Create a new LinkParser::Sentence object from the given input string
|
158
|
-
|
159
|
+
* using the specified LinkParser::Dictionary.
|
159
160
|
*
|
160
161
|
* dict = LinkParser::Dictionary.new
|
161
162
|
* LinkParser::Sentence.new( "The boy runs", dict ) #=> #<LinkParser::Sentence:0x5481ac>
|
data/lib/linkparser.rb
CHANGED
data/lib/linkparser/linkage.rb
CHANGED
@@ -6,12 +6,6 @@ require 'yaml'
|
|
6
6
|
require 'linkparser' unless defined?( LinkParser )
|
7
7
|
require 'linkparser/mixins'
|
8
8
|
|
9
|
-
# This is the API's representation of a parse. A LinkParser::Sentence may have one or more
|
10
|
-
# of LinkParser::Linkages, each of which represents one possible structure of the sentence.
|
11
|
-
# It can be thought of as a Sentence together with a collection of links. If the parse
|
12
|
-
# has a conjunction, then the Linkage is made up of at least two "sublinkages". A
|
13
|
-
# Linkage can be pretty printed in either ASCII or Postscript format, and individual
|
14
|
-
# links can be extracted.
|
15
9
|
class LinkParser::Linkage
|
16
10
|
extend Loggability,
|
17
11
|
LinkParser::DeprecationUtilities
|
data/lib/linkparser/sentence.rb
CHANGED
@@ -3,10 +3,6 @@
|
|
3
3
|
|
4
4
|
require 'linkparser' unless defined?( LinkParser )
|
5
5
|
|
6
|
-
# A Sentence is the API's representation of an input string, tokenized
|
7
|
-
# and interpreted according to a specific Dictionary. After a Sentence
|
8
|
-
# is created and parsed, various attributes of the resulting set of
|
9
|
-
# linkages can be obtained.
|
10
6
|
class LinkParser::Sentence
|
11
7
|
extend Loggability,
|
12
8
|
LinkParser::DeprecationUtilities
|
data/spec/helpers.rb
CHANGED
@@ -27,6 +27,10 @@ RSpec.configure do |config|
|
|
27
27
|
mock.syntax = :expect
|
28
28
|
end
|
29
29
|
|
30
|
+
lg_version = LinkParser.link_grammar_version[ /(\d+(\.\d+)+)$/, 1 ]
|
31
|
+
config.filter_run_excluding( skip_version: lg_version )
|
32
|
+
config.filter_run_including( only_version: lg_version )
|
33
|
+
|
30
34
|
config.include( Loggability::SpecHelpers )
|
31
35
|
config.include( LinkParser::SpecHelpers )
|
32
36
|
end
|
@@ -23,19 +23,19 @@ describe LinkParser::Linkage do
|
|
23
23
|
|
24
24
|
it "can build a diagram string for a sentence" do
|
25
25
|
expect( linkage.diagram.each_line.to_a ).to include(
|
26
|
-
" +--------------Xp
|
27
|
-
" +-------->WV------->+
|
28
|
-
"
|
26
|
+
" +--------------Xp--------------+\n",
|
27
|
+
" +-------->WV------->+ |\n",
|
28
|
+
" +---->Wd-----+ | |\n",
|
29
29
|
" | +Ds**c+--Ss--+--Pa--+ +--RW--+\n",
|
30
30
|
" | | | | | | |\n",
|
31
|
-
"LEFT-WALL the flag.n was.v-d wet.a . RIGHT-WALL
|
31
|
+
"LEFT-WALL the flag.n was.v-d wet.a . RIGHT-WALL\n",
|
32
32
|
)
|
33
33
|
end
|
34
34
|
|
35
35
|
|
36
36
|
it "can build a diagram string for a sentence wrapped to a screen width" do
|
37
|
-
diagram = linkage.diagram( max_width:
|
38
|
-
expect( diagram.each_line.map(&:strip).map(&:length) ).to all( be <=
|
37
|
+
diagram = linkage.diagram( max_width: 20 )
|
38
|
+
expect( diagram.each_line.map(&:strip).map(&:length) ).to all( be <= 20 )
|
39
39
|
end
|
40
40
|
|
41
41
|
|
@@ -45,10 +45,10 @@ describe LinkParser::Linkage do
|
|
45
45
|
|
46
46
|
|
47
47
|
it "can build a 'links and domains' diagram" do
|
48
|
-
expect( linkage.links_and_domains.each_line ).to include(
|
48
|
+
expect( linkage.links_and_domains.each_line.to_a ).to include(
|
49
49
|
" LEFT-WALL Xp ----Xp----- Xp .\n",
|
50
50
|
" (m) LEFT-WALL hWV >---WV----> dWV was.v-d\n",
|
51
|
-
" (m) LEFT-WALL Wd
|
51
|
+
" (m) LEFT-WALL hWd >---Wd----- Wd flag.n\n",
|
52
52
|
" (m) flag.n Ss ----Ss----- Ss was.v-d\n",
|
53
53
|
" (m) the D ----Ds**c-- Ds**c flag.n\n",
|
54
54
|
" (m) was.v-d Pa ----Pa----- Pa wet.a\n",
|
@@ -145,7 +145,7 @@ describe LinkParser::Linkage do
|
|
145
145
|
it "can return left labels for any of its links" do
|
146
146
|
expect( linkage.link_llabel(0) ).to eq( "Xp" )
|
147
147
|
expect( linkage.link_llabel(1) ).to eq( "hWV" )
|
148
|
-
expect( linkage.link_llabel(2) ).to eq( "
|
148
|
+
expect( linkage.link_llabel(2) ).to eq( "hWd" )
|
149
149
|
expect( linkage.link_llabel(3) ).to eq( "Ss" )
|
150
150
|
expect( linkage.link_llabel(4) ).to eq( "D" )
|
151
151
|
expect( linkage.link_llabel(5) ).to eq( "Pa" )
|
@@ -219,9 +219,9 @@ describe LinkParser::Linkage do
|
|
219
219
|
|
220
220
|
|
221
221
|
it "can report on the various cost metrics of the parse" do
|
222
|
-
expect( linkage.unused_word_cost ).to be_an_instance_of(
|
223
|
-
expect( linkage.disjunct_cost ).to be_an_instance_of(
|
224
|
-
expect( linkage.link_cost ).to be_an_instance_of(
|
222
|
+
expect( linkage.unused_word_cost ).to be_an_instance_of( Integer )
|
223
|
+
expect( linkage.disjunct_cost ).to be_an_instance_of( Integer )
|
224
|
+
expect( linkage.link_cost ).to be_an_instance_of( Integer )
|
225
225
|
end
|
226
226
|
|
227
227
|
|
@@ -356,6 +356,13 @@ describe LinkParser::Linkage do
|
|
356
356
|
expect( sent.object ).to_not match( /goats\.p/i )
|
357
357
|
end
|
358
358
|
|
359
|
+
|
360
|
+
it "raises an exception if the diagram screen_width is too small", skip_version: '5.4.2' do
|
361
|
+
expect {
|
362
|
+
linkage.diagram( max_width: 2 )
|
363
|
+
}.to raise_error( /can't create a diagram/i )
|
364
|
+
end
|
365
|
+
|
359
366
|
end
|
360
367
|
|
361
368
|
end
|
@@ -50,7 +50,7 @@ describe LinkParser::ParseOptions do
|
|
50
50
|
|
51
51
|
|
52
52
|
it "knows whether spell_guessing is enabled or not" do
|
53
|
-
expect( opts.spell_guessing_enabled? ).to
|
53
|
+
expect( opts.spell_guessing_enabled? ).to be( true ).or( be false )
|
54
54
|
end
|
55
55
|
|
56
56
|
|
@@ -68,7 +68,9 @@ describe LinkParser::ParseOptions do
|
|
68
68
|
|
69
69
|
|
70
70
|
it "doesn't allow the cost model to be set to an invalid value" do
|
71
|
-
expect {
|
71
|
+
expect {
|
72
|
+
opts.cost_model_type = :rafferty
|
73
|
+
}.to raise_error( ArgumentError, /unknown cost model/i )
|
72
74
|
end
|
73
75
|
|
74
76
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linkparser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
@@ -11,9 +11,9 @@ bindir: bin
|
|
11
11
|
cert_chain:
|
12
12
|
- |
|
13
13
|
-----BEGIN CERTIFICATE-----
|
14
|
-
|
14
|
+
MIIEbDCCAtSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA+MQwwCgYDVQQDDANnZWQx
|
15
15
|
GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
|
16
|
-
|
16
|
+
HhcNMTcwOTI3MDAzMDQ0WhcNMTgwOTI3MDAzMDQ0WjA+MQwwCgYDVQQDDANnZWQx
|
17
17
|
GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
|
18
18
|
ggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC/JWGRHO+USzR97vXjkFgt
|
19
19
|
83qeNf2KHkcvrRTSnR64i6um/ziin0I0oX23H7VYrDJC9A/uoUa5nGRJS5Zw/+wW
|
@@ -26,17 +26,17 @@ cert_chain:
|
|
26
26
|
/D+K9JW9DDs3Yjgv9k4h7YMhW5gftosd+NkNC/+Y2CkCAwEAAaN1MHMwCQYDVR0T
|
27
27
|
BAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFHKN/nkRusdqCJEuq3lgB3fJvyTg
|
28
28
|
MBwGA1UdEQQVMBOBEWdlZEBGYWVyaWVNVUQub3JnMBwGA1UdEgQVMBOBEWdlZEBG
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
29
|
+
YWVyaWVNVUQub3JnMA0GCSqGSIb3DQEBBQUAA4IBgQB/qyi5pCjK8ceoKalfVAjS
|
30
|
+
vG64FEnLnD1bm39T5UaFIRmo+abZtfpg2QhwKvPbPjOicau2+m+MDQ2Cc3tgyaC3
|
31
|
+
dZxcP6w8APFg4AId09uWAZKf0xajvBMS2aOz8Bbmag6fwqRRkTMqsNYnmqcF7aRT
|
32
|
+
DuEzbEMfaOUYjU9RuB48vr4q8yRft0ww+3jq5iwNkrX1buL2pwBbyvgms6D/BV41
|
33
|
+
MaTVMjsHqJUwU2xVfhGtxGAWAer5S1HGYHkbio6mGVtiie0uWjmnzi7ppIlMr48a
|
34
|
+
7BNTsoZ+/JRk3iQWmmNsyFT7xfqBKye7cH11BX8V8P4MeGB5YWlMI+Myj5DZY3fQ
|
35
|
+
st2AGD4rb1l0ia7PfubcBThSIdz61eCb8gRi/RiZZwb3/7+eyEncLJzt2Ob9fGSF
|
36
|
+
X0qdrKi+2aZZ0NGuFj9AItBsVmAvkBGIpX4TEKQp5haEbPpmaqO5nIIhV26PXmyT
|
37
|
+
OMKv6pWsoS81vw5KAGBmfX8nht/Py90DQrbRvakATGI=
|
38
38
|
-----END CERTIFICATE-----
|
39
|
-
date:
|
39
|
+
date: 2018-01-10 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: loggability
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
75
|
+
version: '0.9'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
82
|
+
version: '0.9'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: hoe-highline
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,61 +95,61 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.2'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: rake-compiler
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '1.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '1.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: rdoc-generator-fivefish
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
117
|
+
version: '0.3'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
124
|
+
version: '0.3'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name: rdoc
|
126
|
+
name: rdoc
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
131
|
+
version: '4.0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
138
|
+
version: '4.0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: hoe
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '3.
|
145
|
+
version: '3.16'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '3.
|
152
|
+
version: '3.16'
|
153
153
|
description: |-
|
154
154
|
This module is a Ruby binding for
|
155
155
|
[the Abiword version](http://www.abisource.com/projects/link-grammar/) of CMU's
|
@@ -171,6 +171,7 @@ extra_rdoc_files:
|
|
171
171
|
- ext/parseoptions.c
|
172
172
|
- ext/sentence.c
|
173
173
|
files:
|
174
|
+
- ".gemtest"
|
174
175
|
- ".simplecov"
|
175
176
|
- ChangeLog
|
176
177
|
- History.md
|
@@ -199,9 +200,10 @@ files:
|
|
199
200
|
- spec/linkparser/parseoptions_spec.rb
|
200
201
|
- spec/linkparser/sentence_spec.rb
|
201
202
|
- spec/linkparser_spec.rb
|
202
|
-
homepage: http://
|
203
|
+
homepage: http://bitbucket.org/ged/linkparser
|
203
204
|
licenses:
|
204
205
|
- BSD
|
206
|
+
- BSD-3-Clause
|
205
207
|
metadata: {}
|
206
208
|
post_install_message:
|
207
209
|
rdoc_options:
|
@@ -213,15 +215,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
213
215
|
requirements:
|
214
216
|
- - ">="
|
215
217
|
- !ruby/object:Gem::Version
|
216
|
-
version: 2.
|
218
|
+
version: 2.3.0
|
217
219
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
220
|
requirements:
|
219
|
-
- - "
|
221
|
+
- - ">="
|
220
222
|
- !ruby/object:Gem::Version
|
221
|
-
version:
|
223
|
+
version: '0'
|
222
224
|
requirements: []
|
223
225
|
rubyforge_project:
|
224
|
-
rubygems_version: 2.
|
226
|
+
rubygems_version: 2.7.3
|
225
227
|
signing_key:
|
226
228
|
specification_version: 4
|
227
229
|
summary: This module is a Ruby binding for [the Abiword version](http://www.abisource.com/projects/link-grammar/)
|
metadata.gz.sig
ADDED
Binary file
|