linkparser 1.0.4 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Binary file
data/README DELETED
@@ -1,61 +0,0 @@
1
- = Ruby-LinkParser
2
-
3
- This module is a Ruby binding for the link-grammar library, a syntactic parser
4
- of English.
5
-
6
- == Authors
7
-
8
- * Michael Granger <ged@FaerieMUD.org>
9
- * Martin Chase <stillflame@FaerieMUD.org>
10
-
11
-
12
- == Requirements
13
-
14
- * Ruby 1.8.6
15
- * link-grammar (version 4.5.6 or later) from the AbiWord project
16
- (http://www.abisource.com/projects/link-grammar/)
17
-
18
-
19
- === Example Usage
20
-
21
- require 'linkparser'
22
-
23
- dict = LinkParser::Dictionary.new( :screen_width => 100 )
24
- sent = dict.parse( "People use Ruby for all kinds of nifty things." )
25
- # => #<LinkParser::Sentence:0xcf8eb "LEFT-WALL people use Ruby for all kinds
26
- # of nifty things . RIGHT-WALL"/2 linkages/0 nulls>
27
-
28
- sent.subject # => "people"
29
- sent.verb # => "use"
30
- sent.object # => "Ruby"
31
-
32
- puts sent.constituent_tree_string
33
- # =>
34
- # (S (NP People)
35
- # (VP use
36
- # (NP Ruby)
37
- # (PP for
38
- # (NP (NP all kinds)
39
- # (PP of
40
- # (NP nifty things)))))
41
- # .)
42
-
43
- puts sent.diagram
44
- # =>
45
- # +-------------------------------Xp------------------------------+
46
- # | +----MVp---+----Jp----+ +------Jp-----+ |
47
- # +----Wd---+--Sp--+--Os-+ | +-Dmc-+--Mp-+ +----A---+ |
48
- # | | | | | | | | | | |
49
- # LEFT-WALL people.p use.v Ruby for.p all kinds.n of nifty.a things.n .
50
-
51
-
52
- == Legal
53
-
54
- For licensing information, see the LICENSE file.
55
-
56
- For copyright and licensing information for link-grammar itself, see the
57
- LICENSE file in that distribution.
58
-
59
- $Id: README 55 2009-06-09 06:21:42Z deveiant $
60
-
61
-
@@ -1,40 +0,0 @@
1
- #
2
- # RDoc Rake tasks
3
- # $Id: rdoc.rb 93 2009-03-20 13:02:30Z deveiant $
4
- #
5
-
6
- gem 'rdoc', '>= 2.4.1'
7
-
8
- require 'rubygems'
9
- require 'rdoc/rdoc'
10
- require 'rake/clean'
11
-
12
-
13
- # Append docs/lib to the load path if it exists for a locally-installed Darkfish
14
- DOCSLIB = DOCSDIR + 'lib'
15
- $LOAD_PATH.unshift( DOCSLIB.to_s ) if DOCSLIB.exist?
16
-
17
- # Make relative string paths of all the stuff we need to generate docs for
18
- DOCFILES = LIB_FILES + EXT_FILES + GEMSPEC.extra_rdoc_files
19
-
20
-
21
- directory RDOCDIR.to_s
22
- CLOBBER.include( RDOCDIR )
23
-
24
- desc "Build API documentation in #{RDOCDIR}"
25
- task :rdoc => [ Rake.application.rakefile, *DOCFILES ] do
26
- args = RDOC_OPTIONS
27
- args += [ '-o', RDOCDIR.to_s ]
28
- args += [ '-f', 'darkfish' ]
29
- args += DOCFILES.collect {|pn| pn.to_s }
30
-
31
- trace "Building docs with arguments: %s" % [ args.join(' ') ]
32
- RDoc::RDoc.new.document( args ) rescue nil
33
- end
34
-
35
- desc "Rebuild API documentation in #{RDOCDIR}"
36
- task :rerdoc do
37
- rm_r( RDOCDIR ) if RDOCDIR.exist?
38
- Rake::Task[ :rdoc ].invoke
39
- end
40
-
@@ -1,186 +0,0 @@
1
- #
2
- # Win32-specific tasks (cross-compiling, etc.)
3
- #
4
- # Thanks to some people that understand this stuff better than me for
5
- # posting helpful blog posts. This stuff is an amalgam of stuff they did:
6
- #
7
- # * Mauricio Fernandez
8
- # http://eigenclass.org/hiki/cross+compiling+rcovrt
9
- #
10
- # * Jeremy Hinegardner
11
- # http://www.copiousfreetime.org/articles/2008/10/12/building-gems-for-windows.html
12
- #
13
- # * Aaron Patterson
14
- # http://tenderlovemaking.com/2008/11/21/cross-compiling-ruby-gems-for-win32/
15
-
16
- require 'rake'
17
- require 'pathname'
18
- require 'rubygems/platform'
19
- require 'rbconfig'
20
- require 'uri'
21
- require 'net/ftp'
22
-
23
- HOMEDIR = Pathname( '~' ).expand_path
24
- RUBYVERSION = '1.8.6-p287'
25
- RUBYVERSION_MAJORMINOR = RUBYVERSION[/^\d+\.\d+/]
26
-
27
- RUBY_DL_BASE = "ftp://ftp.ruby-lang.org/pub/ruby/#{RUBYVERSION_MAJORMINOR}/"
28
- RUBY_DL_URI = URI( RUBY_DL_BASE + "ruby-#{RUBYVERSION}.tar.gz" )
29
-
30
- XCOMPILER_DIR = HOMEDIR + '.ruby_mingw32'
31
-
32
- XCOMPILER_DL = XCOMPILER_DIR + "ruby-#{RUBYVERSION}.tar.gz"
33
- XCOMPILER_SRC = XCOMPILER_DIR + "ruby-#{RUBYVERSION}"
34
-
35
- XCOMPILER_BIN = XCOMPILER_DIR + 'bin'
36
- XCOMPILER_LIB = XCOMPILER_DIR + 'lib'
37
- XCOMPILER_RUBY = XCOMPILER_BIN + 'ruby.exe'
38
-
39
- XCOMPILER_LOAD_PATH = XCOMPILER_LIB + "ruby/#{RUBYVERSION_MAJORMINOR}/i386-mingw32"
40
-
41
- TAR_OPTS = { :compression => :gzip }
42
-
43
- WIN32_GEMSPEC = GEMSPEC.dup
44
- WIN32_GEMSPEC.files += FileList[ EXTDIR + '**.{dll,so}' ]
45
- WIN32_GEMSPEC.platform = Gem::Platform.new( 'i386-mingw32' )
46
- WIN32_GEMSPEC.extensions = []
47
-
48
-
49
- CONFIGURE_CMD = %W[
50
- env
51
- ac_cv_func_getpgrp_void=no
52
- ac_cv_func_setpgrp_void=yes
53
- rb_cv_negative_time_t=no
54
- ac_cv_func_memcmp_working=yes
55
- rb_cv_binary_elf=no
56
- ./configure
57
- --host=i386-mingw32
58
- --target=i386-mingw32
59
- --build=#{Config::CONFIG['build']}
60
- --prefix=#{XCOMPILER_DIR}
61
- ]
62
-
63
- ### Archive::Tar::Reader#extract (as of 0.9.0) is broken w.r.t.
64
- ### permissions, so we have to do this ourselves.
65
- def untar( tarfile, targetdir )
66
- targetdir = Pathname( targetdir )
67
- raise "No such directory: #{targetdir}" unless targetdir.directory?
68
-
69
- reader = Archive::Tar::Reader.new( tarfile.to_s, TAR_OPTS )
70
-
71
- mkdir_p( targetdir )
72
- reader.each( true ) do |header, body|
73
- path = targetdir + header[:path]
74
- # trace "Header is: %p" % [ header ]
75
-
76
- case header[:type]
77
- when :file
78
- trace " #{path}"
79
- path.open( File::WRONLY|File::EXCL|File::CREAT|File::TRUNC, header[:mode] ) do |fio|
80
- bytesize = header[:size]
81
- fio.write( body[0,bytesize] )
82
- end
83
-
84
- when :directory
85
- trace " #{path}"
86
- path.mkpath
87
-
88
- when :link
89
- linktarget = targetdir + header[:dest]
90
- trace " #{path} => #{linktarget}"
91
- path.make_link( linktarget.to_s )
92
-
93
- when :symlink
94
- linktarget = targetdir + header[:dest]
95
- trace " #{path} -> #{linktarget}"
96
- path.make_symlink( linktarget )
97
- end
98
- end
99
-
100
- end
101
-
102
-
103
- begin
104
- require 'archive/tar'
105
-
106
- namespace :win32 do
107
- directory XCOMPILER_DIR.to_s
108
-
109
- file XCOMPILER_DL => XCOMPILER_DIR do
110
- # openuri can't handle this -- passive ftp required?
111
- # run 'wget', '-O', XCOMPILER_DL, RUBY_DL_URI
112
- log "Downloading ruby distro from %s" % [ RUBY_DL_URI ]
113
- ftp = Net::FTP.new( RUBY_DL_URI.host )
114
- ftp.login
115
- ftp.getbinaryfile( RUBY_DL_URI.path, XCOMPILER_DL, 4096 )
116
- ftp.close
117
- end
118
-
119
- directory XCOMPILER_SRC.to_s
120
- task XCOMPILER_SRC => [ XCOMPILER_DIR, XCOMPILER_DL ] do
121
- if XCOMPILER_SRC.exist?
122
- trace "Rake fails. #{XCOMPILER_SRC} already exists."
123
- else
124
- untar( XCOMPILER_DL, XCOMPILER_DIR )
125
- end
126
- end
127
-
128
- file XCOMPILER_RUBY => XCOMPILER_SRC do
129
- Dir.chdir( XCOMPILER_SRC ) do
130
- unless File.exist?( 'Makefile.in.orig' )
131
- File.open( 'Makefile.in.new', IO::CREAT|IO::WRONLY|IO::EXCL ) do |ofh|
132
- IO.readlines( 'Makefile.in' ).each do |line|
133
- next if line.include?( 0.chr )
134
- trace " copying line: %p" % [ line ]
135
- line.sub!( /ALT_SEPARATOR = ".*?"/, "ALT_SEPARATOR = 92.chr" )
136
- ofh.write( line )
137
- end
138
- end
139
-
140
- mv 'Makefile.in', 'Makefile.in.orig'
141
- mv 'Makefile.in.new', 'Makefile.in'
142
- end
143
-
144
- run *CONFIGURE_CMD
145
- run 'make', 'ruby'
146
- run 'make', 'rubyw.exe'
147
- run 'make', 'install'
148
- end
149
- end
150
-
151
- file XCOMPILER_LOAD_PATH => XCOMPILER_RUBY
152
-
153
- desc "Cross-compile the library for Win32 systems, installing a cross-" +
154
- "compiled Ruby if necessary"
155
- task :build => [ EXTDIR, XCOMPILER_LOAD_PATH.to_s ] do
156
- in_subdirectory( EXTDIR ) do
157
- ruby "-I#{XCOMPILER_LOAD_PATH}", 'extconf.rb'
158
- sh 'make'
159
- end
160
- end
161
-
162
- desc "Build a binary gem for win32 systems"
163
- task :gem => ['win32:build', PKGDIR.to_s] + WIN32_GEMSPEC.files do
164
- when_writing( "Creating win32 GEM" ) do
165
- pkgname = WIN32_GEMSPEC.file_name
166
- builder = Gem::Builder.new( WIN32_GEMSPEC )
167
- builder.build
168
- mv pkgname, PKGDIR + pkgname, :verbose => $trace
169
- end
170
- end
171
- end
172
-
173
- rescue LoadError => err
174
- task :no_win32_build do
175
- abort "No win32 build: %s: %s" % [ err.class.name, err.message ]
176
- end
177
-
178
- namespace :win32 do
179
- desc "Build a binary Gem for Win32 systems, installing a cross " +
180
- "compiled Ruby if necessary"
181
- task :build => :no_win32_build
182
- end
183
-
184
- end
185
-
186
-