Linguistics 1.0.3 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +2 -2
- data/README +30 -39
- data/install.rb +59 -28
- data/lib/linguistics.rb +41 -31
- data/lib/linguistics/en.rb +106 -50
- data/lib/linguistics/en/linkparser.rb +15 -42
- data/lib/linguistics/en/wordnet.rb +30 -21
- data/test.rb +4 -4
- data/tests/en/conjunction.tests.rb +88 -2
- data/tests/en/inflect.tests.rb +16 -5
- data/tests/lingtestcase.rb +6 -6
- data/tests/use.tests.rb +2 -2
- data/utils.rb +7 -7
- metadata +42 -34
data/ChangeLog
CHANGED
@@ -186,7 +186,7 @@ r47 | deveiant | 2003-09-14 05:29:15 -0400 (Sun, 14 Sep 2003) | 13 lines
|
|
186
186
|
|
187
187
|
- Touched up the file description a bit.
|
188
188
|
|
189
|
-
- @
|
189
|
+
- @lp_error now intitialized: bug spotted by Martin Chase.
|
190
190
|
|
191
191
|
- Calls to #linkParse no longer trap parse errors. This was done for two
|
192
192
|
reasons:
|
@@ -266,7 +266,7 @@ r37 | deveiant | 2003-09-11 00:55:11 -0400 (Thu, 11 Sep 2003) | 10 lines
|
|
266
266
|
- Added support for MyClass::extend( Linguistics ) and class MyClass; include
|
267
267
|
Linguistics; end.
|
268
268
|
|
269
|
-
- Modified code in #
|
269
|
+
- Modified code in #load_language to minimize the number of requires.
|
270
270
|
|
271
271
|
------------------------------------------------------------------------
|
272
272
|
r36 | deveiant | 2003-09-11 00:52:32 -0400 (Thu, 11 Sep 2003) | 2 lines
|
data/README
CHANGED
@@ -9,25 +9,16 @@
|
|
9
9
|
|
10
10
|
== Requirements
|
11
11
|
|
12
|
-
* Ruby >= 1.8.
|
13
|
-
|
14
|
-
The following libraries are required, but are included in the redist/
|
15
|
-
directory. The installer script should install these for you if you don't
|
16
|
-
already have them.
|
17
|
-
|
18
|
-
* HashSlice - Adds slicing to the builtin Hash class
|
12
|
+
* Ruby >= 1.8.4
|
19
13
|
|
20
14
|
|
21
15
|
== Optional
|
22
16
|
|
23
|
-
* CrossCase - Provide auto-aliasing of camelCase to under_barred methods and
|
24
|
-
vice-versa. (Included in redist/)
|
25
|
-
|
26
17
|
* Ruby-WordNet (>= 0.02) - adds integration for the Ruby binding for the WordNet� lexical
|
27
18
|
reference system.
|
28
19
|
|
29
|
-
URL: http://
|
30
|
-
Download: http://
|
20
|
+
URL: http://deveiate.org/projects/Ruby-WordNet
|
21
|
+
Download: http://deveiate.org/code/Ruby-WordNet-0.02.tar.gz
|
31
22
|
|
32
23
|
* LinkParser (>= 0.0.4) - adds integration for the Ruby Link Grammar Parser by
|
33
24
|
Martin Chase.
|
@@ -38,16 +29,16 @@ already have them.
|
|
38
29
|
|
39
30
|
== General Information
|
40
31
|
|
41
|
-
This module is a framework for building linguistic utilities for Ruby objects
|
42
|
-
any language. It includes a generic language-independant front end, a
|
43
|
-
mapping language codes into language names, and a module which
|
44
|
-
English-language utilities.
|
32
|
+
This module is a framework for building linguistic utilities for Ruby objects
|
33
|
+
in any language. It includes a generic language-independant front end, a
|
34
|
+
module for mapping language codes into language names, and a module which
|
35
|
+
contains various English-language utilities.
|
45
36
|
|
46
37
|
|
47
38
|
=== Method Interface
|
48
39
|
|
49
|
-
The Linguistics module comes with a language-independant mechanism for
|
50
|
-
core Ruby classes with linguistic methods.
|
40
|
+
The Linguistics module comes with a language-independant mechanism for
|
41
|
+
extending core Ruby classes with linguistic methods.
|
51
42
|
|
52
43
|
It consists of three parts: a core linguistics module which contains the
|
53
44
|
class-extension framework for languages, a generic inflector class that serves
|
@@ -61,8 +52,8 @@ language-specific methods to be added to objects without cluttering up the
|
|
61
52
|
interface or risking collision between them, albeit at the cost of three or four
|
62
53
|
more characters per method invocation.
|
63
54
|
|
64
|
-
If you don't like extending core Ruby classes, the language modules should
|
65
|
-
allow you to use them as a function library as well.
|
55
|
+
If you don't like extending core Ruby classes, the language modules should
|
56
|
+
also allow you to use them as a function library as well.
|
66
57
|
|
67
58
|
For example, the English-language module contains a #plural function which can
|
68
59
|
be accessed via a method on a core class:
|
@@ -77,8 +68,8 @@ or via the Linguistics::EN::plural function directly:
|
|
77
68
|
plural( "goose" )
|
78
69
|
# => "geese"
|
79
70
|
|
80
|
-
The class-extension mechanism actually uses the functional interface behind
|
81
|
-
scenes.
|
71
|
+
The class-extension mechanism actually uses the functional interface behind
|
72
|
+
the scenes.
|
82
73
|
|
83
74
|
A new feature with the 0.02 release: You can now omit the language-code method
|
84
75
|
for unambiguous methods by calling Linguistics::use with the +:installProxy+
|
@@ -101,13 +92,13 @@ More about how this works in the documentation for Linguistics::use.
|
|
101
92
|
To add a new language to the framework, create a file named the same as the
|
102
93
|
ISO639 2- or 3-letter language code for the language you're adding. It must be
|
103
94
|
placed under lib/linguistics/ to be recognized by the linguistics module, but
|
104
|
-
you can also just require it yourself prior to calling Linguistics::use().
|
105
|
-
file should define a module under Linguistics that is an all-caps version
|
106
|
-
code used in the filename. Any methods you wish to be exposed to users
|
107
|
-
declared as module functions (ie., using Module#module_function).
|
95
|
+
you can also just require it yourself prior to calling Linguistics::use().
|
96
|
+
This file should define a module under Linguistics that is an all-caps version
|
97
|
+
of the code used in the filename. Any methods you wish to be exposed to users
|
98
|
+
should be declared as module functions (ie., using Module#module_function).
|
108
99
|
|
109
|
-
You may also wish to add your module to the list of default languages by
|
110
|
-
the appropriate symbol to the Linguistics::DefaultLanguages array.
|
100
|
+
You may also wish to add your module to the list of default languages by
|
101
|
+
adding the appropriate symbol to the Linguistics::DefaultLanguages array.
|
111
102
|
|
112
103
|
For example, to create a Portuguese-language module, create a file called
|
113
104
|
'lib/linguistics/pt.rb' which contains the following:
|
@@ -128,8 +119,8 @@ See the English language module (lib/linguistics/en.rb) for an example.
|
|
128
119
|
|
129
120
|
See the README.english file for a synopsis.
|
130
121
|
|
131
|
-
The English-language module currently contains linguistic functions ported
|
132
|
-
a few excellent Perl modules:
|
122
|
+
The English-language module currently contains linguistic functions ported
|
123
|
+
from a few excellent Perl modules:
|
133
124
|
|
134
125
|
Lingua::EN::Inflect
|
135
126
|
Lingua::Conjunction
|
@@ -137,8 +128,8 @@ a few excellent Perl modules:
|
|
137
128
|
|
138
129
|
See the lib/linguistics/en.rb file for specific attributions.
|
139
130
|
|
140
|
-
New with version 0.02: integration with the Ruby WordNet� and LinkParser
|
141
|
-
(which must be installed separately).
|
131
|
+
New with version 0.02: integration with the Ruby WordNet� and LinkParser
|
132
|
+
modules (which must be installed separately).
|
142
133
|
|
143
134
|
|
144
135
|
== To Do
|
@@ -148,8 +139,8 @@ New with version 0.02: integration with the Ruby WordNet
|
|
148
139
|
additional stemming functions and some other strategies are ongoing.
|
149
140
|
|
150
141
|
* Martin Chase <stillflame at FaerieMUD dot org> is working on an integration
|
151
|
-
module for his excellent work on a Ruby interface to the CMU Link Grammar
|
152
|
-
english-sentence parser). This will make writing fairly accurate natural
|
142
|
+
module for his excellent work on a Ruby interface to the CMU Link Grammar
|
143
|
+
(an english-sentence parser). This will make writing fairly accurate natural
|
153
144
|
language parsers in Ruby much easier.
|
154
145
|
|
155
146
|
* Suggestions (and patches) for any of these items or additional features are
|
@@ -159,8 +150,8 @@ New with version 0.02: integration with the Ruby WordNet
|
|
159
150
|
|
160
151
|
== Legal
|
161
152
|
|
162
|
-
This module is Open Source Software which is Copyright (c) 2003 by The
|
163
|
-
Consortium. All rights reserved.
|
153
|
+
This module is Open Source Software which is Copyright (c) 2003 by The
|
154
|
+
FaerieMUD Consortium. All rights reserved.
|
164
155
|
|
165
156
|
You may use, modify, and/or redistribute this software under the terms of the
|
166
157
|
Perl Artistic License, a copy of which should have been included in this
|
@@ -168,9 +159,9 @@ distribution (See the file Artistic). If it was not, a copy of it may be
|
|
168
159
|
obtained from http://language.perl.com/misc/Artistic.html or
|
169
160
|
http://www.faeriemud.org/artistic.html).
|
170
161
|
|
171
|
-
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
|
172
|
-
INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
173
|
-
FITNESS FOR A PARTICULAR PURPOSE.
|
162
|
+
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
|
163
|
+
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
164
|
+
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
174
165
|
|
175
166
|
|
176
167
|
$Id: README,v 1.6 2003/10/09 13:21:48 deveiant Exp $
|
data/install.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
#
|
3
|
-
#
|
4
|
-
# $Id: install.rb
|
3
|
+
# Module Install Script
|
4
|
+
# $Id: install.rb 11 2005-08-07 03:30:22Z ged $
|
5
5
|
#
|
6
6
|
# Thanks to Masatoshi SEKI for ideas found in his install.rb.
|
7
7
|
#
|
8
|
-
# Copyright (c) 2001-
|
8
|
+
# Copyright (c) 2001-2005 The FaerieMUD Consortium.
|
9
9
|
#
|
10
10
|
# This is free software. You may use, modify, and/or redistribute this
|
11
11
|
# software under the terms of the Perl Artistic License. (See
|
@@ -20,17 +20,18 @@ include Config
|
|
20
20
|
|
21
21
|
require 'find'
|
22
22
|
require 'ftools'
|
23
|
+
require 'optparse'
|
23
24
|
|
24
|
-
|
25
|
-
$
|
26
|
-
$rcsId = %q$Id: install.rb,v 1.3 2003/10/09 13:23:09 deveiant Exp $
|
25
|
+
$version = %q$Revision: 11 $
|
26
|
+
$rcsId = %q$Id: install.rb 11 2005-08-07 03:30:22Z ged $
|
27
27
|
|
28
28
|
# Define required libraries
|
29
29
|
RequiredLibraries = [
|
30
|
-
# libraryname, nice name, RAA URL, Download URL
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
30
|
+
# libraryname, nice name, RAA URL, Download URL, e.g.,
|
31
|
+
#[ 'strscan', "Strscan",
|
32
|
+
# 'http://www.ruby-lang.org/en/raa-list.rhtml?name=strscan',
|
33
|
+
# 'http://i.loveruby.net/archive/strscan/strscan-0.6.7.tar.gz',
|
34
|
+
#],
|
34
35
|
]
|
35
36
|
|
36
37
|
class Installer
|
@@ -122,31 +123,61 @@ class Installer
|
|
122
123
|
|
123
124
|
end
|
124
125
|
|
126
|
+
|
125
127
|
if $0 == __FILE__
|
126
|
-
|
128
|
+
dryrun = false
|
127
129
|
|
128
|
-
|
129
|
-
|
130
|
-
|
130
|
+
# Parse command-line switches
|
131
|
+
ARGV.options {|oparser|
|
132
|
+
oparser.banner = "Usage: #$0 [options]\n"
|
131
133
|
|
132
|
-
|
133
|
-
|
134
|
+
oparser.on( "--verbose", "-v", TrueClass, "Make progress verbose" ) {
|
135
|
+
$VERBOSE = true
|
136
|
+
debug_msg "Turned verbose on."
|
137
|
+
}
|
134
138
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
+
oparser.on( "--dry-run", "-n", TrueClass, "Don't really install anything" ) {
|
140
|
+
debug_msg "Turned dry-run on."
|
141
|
+
dryrun = true
|
142
|
+
}
|
143
|
+
|
144
|
+
# Handle the 'help' option
|
145
|
+
oparser.on( "--help", "-h", "Display this text." ) {
|
146
|
+
$stderr.puts oparser
|
147
|
+
exit!(0)
|
148
|
+
}
|
149
|
+
|
150
|
+
oparser.parse!
|
151
|
+
}
|
152
|
+
|
153
|
+
# Don't do anything if they expect this to be the three-step install script
|
154
|
+
# and they aren't doing the 'install' step.
|
155
|
+
if ARGV.include?( "config" )
|
156
|
+
for lib in RequiredLibraries
|
157
|
+
testForRequiredLibrary( *lib )
|
158
|
+
end
|
159
|
+
puts "Done."
|
160
|
+
elsif ARGV.include?( "setup" )
|
161
|
+
puts "Done."
|
162
|
+
elsif ARGV.empty?
|
163
|
+
for lib in RequiredLibraries
|
164
|
+
testForRequiredLibrary( *lib )
|
165
|
+
end
|
139
166
|
end
|
140
167
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
168
|
+
if ARGV.empty? || ARGV.include?( "install" )
|
169
|
+
debug_msg "Sitelibdir = '#{CONFIG['sitelibdir']}'"
|
170
|
+
sitelibdir = CONFIG['sitelibdir']
|
171
|
+
debug_msg "Sitearchdir = '#{CONFIG['sitearchdir']}'"
|
172
|
+
sitearchdir = CONFIG['sitearchdir']
|
173
|
+
|
174
|
+
message "Installing..."
|
175
|
+
i = Installer.new( dryrun )
|
176
|
+
#i.installFiles( "redist", sitelibdir, 0444, verbose )
|
177
|
+
i.installFiles( "lib", sitelibdir, 0444, $VERBOSE )
|
145
178
|
|
146
|
-
|
147
|
-
|
148
|
-
i.installFiles( "redist", sitelibdir, 0444, verbose )
|
149
|
-
i.installFiles( "lib", sitelibdir, 0444, verbose )
|
179
|
+
message "done.\n"
|
180
|
+
end
|
150
181
|
end
|
151
182
|
|
152
183
|
|
data/lib/linguistics.rb
CHANGED
@@ -23,7 +23,7 @@
|
|
23
23
|
#
|
24
24
|
# == Version
|
25
25
|
#
|
26
|
-
# $Id: linguistics.rb
|
26
|
+
# $Id: linguistics.rb 95 2007-06-13 05:25:38Z deveiant $
|
27
27
|
#
|
28
28
|
|
29
29
|
require 'linguistics/iso639'
|
@@ -35,10 +35,10 @@ module Linguistics
|
|
35
35
|
### Class constants
|
36
36
|
|
37
37
|
# Subversion revision
|
38
|
-
SVNRev = %q$Rev:
|
38
|
+
SVNRev = %q$Rev: 95 $
|
39
39
|
|
40
40
|
# Subversion ID
|
41
|
-
SVNid = %q$Id: linguistics.rb
|
41
|
+
SVNid = %q$Id: linguistics.rb 95 2007-06-13 05:25:38Z deveiant $
|
42
42
|
|
43
43
|
# Language module implementors should do something like:
|
44
44
|
# Linguistics::DefaultLanguages.push( :ja ) # or whatever
|
@@ -86,7 +86,7 @@ module Linguistics
|
|
86
86
|
|
87
87
|
### Autoload linguistic methods defined in the module this object's
|
88
88
|
### class uses for inflection.
|
89
|
-
def method_missing( sym, *args )
|
89
|
+
def method_missing( sym, *args, &block )
|
90
90
|
return super unless self.class.langmod.respond_to?( sym )
|
91
91
|
|
92
92
|
self.class.module_eval %{
|
@@ -95,7 +95,7 @@ module Linguistics
|
|
95
95
|
end
|
96
96
|
}, "{Autoloaded: " + __FILE__ + "}", __LINE__
|
97
97
|
|
98
|
-
self.method( sym ).call( *args )
|
98
|
+
self.method( sym ).call( *args, &block )
|
99
99
|
end
|
100
100
|
|
101
101
|
|
@@ -119,11 +119,11 @@ module Linguistics
|
|
119
119
|
case obj
|
120
120
|
when Class
|
121
121
|
# $stderr.puts "Extending %p" % obj if $DEBUG
|
122
|
-
self::
|
122
|
+
self::install_language_proxy( obj )
|
123
123
|
else
|
124
124
|
sclass = (class << obj; self; end)
|
125
125
|
# $stderr.puts "Extending a object's metaclass: %p" % obj if $DEBUG
|
126
|
-
self::
|
126
|
+
self::install_language_proxy( sclass )
|
127
127
|
end
|
128
128
|
|
129
129
|
super
|
@@ -139,7 +139,7 @@ module Linguistics
|
|
139
139
|
|
140
140
|
### Make an languageProxy class that encapsulates all of the inflect operations
|
141
141
|
### using the given language module.
|
142
|
-
def self::
|
142
|
+
def self::make_language_proxy( mod )
|
143
143
|
# $stderr.puts "Making language proxy for mod %p" % [mod]
|
144
144
|
Class::new( LanguageProxyClass ) {
|
145
145
|
@langmod = mod
|
@@ -148,20 +148,20 @@ module Linguistics
|
|
148
148
|
|
149
149
|
|
150
150
|
### Install the language proxy
|
151
|
-
def self::
|
151
|
+
def self::install_language_proxy( klass, languages=DefaultLanguages )
|
152
152
|
languages.replace( DefaultLanguages ) if languages.empty?
|
153
153
|
|
154
154
|
# Create an languageProxy class for each language specified
|
155
|
-
languages.each
|
155
|
+
languages.each do |lang|
|
156
156
|
# $stderr.puts "Extending the %p class with %p" %
|
157
157
|
# [ klass, lang ] if $DEBUG
|
158
158
|
|
159
159
|
# Load the language module (skipping to the next if it's already
|
160
|
-
# loaded), make
|
161
|
-
# out what the languageProxy method will be called.
|
162
|
-
mod =
|
160
|
+
# loaded), make a languageProxy class that delegates to it, and
|
161
|
+
# figure out what the languageProxy method will be called.
|
162
|
+
mod = load_language( lang.to_s.downcase )
|
163
163
|
ifaceMeth = mod.name.downcase.sub( /.*:/, '' )
|
164
|
-
languageProxyClass =
|
164
|
+
languageProxyClass = make_language_proxy( mod )
|
165
165
|
|
166
166
|
# Install a hash for languageProxy classes and an accessor for the
|
167
167
|
# hash if it's not already present.
|
@@ -186,14 +186,15 @@ module Linguistics
|
|
186
186
|
end
|
187
187
|
}, __FILE__, __LINE__
|
188
188
|
end
|
189
|
-
|
189
|
+
end
|
190
190
|
end
|
191
191
|
|
192
192
|
|
193
193
|
|
194
194
|
### Install a regular proxy method in the given klass that will delegate
|
195
195
|
### calls to missing method to the languageProxy for the given +language+.
|
196
|
-
def self::
|
196
|
+
def self::install_delegator_proxy( klass, langcode )
|
197
|
+
raise ArgumentError, "Missing langcode" if langcode.nil?
|
197
198
|
|
198
199
|
# Alias any currently-extant
|
199
200
|
if klass.instance_methods( false ).include?( "method_missing" )
|
@@ -204,27 +205,29 @@ module Linguistics
|
|
204
205
|
|
205
206
|
# Add the #method_missing method that auto-installs delegator methods
|
206
207
|
# for methods supported by the linguistic proxy objects.
|
207
|
-
klass.module_eval {
|
208
|
-
|
208
|
+
klass.module_eval %{
|
209
|
+
def method_missing( sym, *args, &block )
|
209
210
|
|
210
|
-
|
211
|
+
# If the linguistic delegator answers the message, install a
|
212
|
+
# delegator method and call it.
|
213
|
+
if self.send( :#{langcode} ).respond_to?( sym )
|
211
214
|
|
212
|
-
# $stderr.puts "Installing linguistic delegator method
|
215
|
+
# $stderr.puts "Installing linguistic delegator method \#{sym} " \
|
213
216
|
# "for the '#{langcode}' proxy"
|
214
217
|
self.class.module_eval %{
|
215
|
-
def
|
216
|
-
self.#{langcode}
|
218
|
+
def \#{sym}( *args, &block )
|
219
|
+
self.#{langcode}.\#{sym}( *args, &block )
|
217
220
|
end
|
218
221
|
}
|
219
|
-
self.method( sym ).call( *args )
|
222
|
+
self.method( sym ).call( *args, &block )
|
220
223
|
|
221
224
|
# Otherwise either call the overridden proxy method if there is
|
222
225
|
# one, or just let our parent deal with it.
|
223
226
|
else
|
224
227
|
if self.respond_to?( :__orig_method_missing )
|
225
|
-
return self.__orig_method_missing( sym, *args )
|
228
|
+
return self.__orig_method_missing( sym, *args, &block )
|
226
229
|
else
|
227
|
-
super( sym, *args )
|
230
|
+
super( sym, *args, &block )
|
228
231
|
end
|
229
232
|
end
|
230
233
|
end
|
@@ -237,6 +240,13 @@ module Linguistics
|
|
237
240
|
### L A N G U A G E - I N D E P E N D E N T F U N C T I O N S
|
238
241
|
#################################################################
|
239
242
|
|
243
|
+
|
244
|
+
### Handle auto-magic usage
|
245
|
+
def self::const_missing( sym )
|
246
|
+
load_language( sym.to_s.downcase )
|
247
|
+
end
|
248
|
+
|
249
|
+
|
240
250
|
###############
|
241
251
|
module_function
|
242
252
|
###############
|
@@ -271,7 +281,7 @@ module Linguistics
|
|
271
281
|
classes.each {|klass|
|
272
282
|
|
273
283
|
# Create an languageProxy class for each installed language
|
274
|
-
|
284
|
+
install_language_proxy( klass, languages )
|
275
285
|
|
276
286
|
# Install the delegator proxy if configured
|
277
287
|
if config[:installProxy]
|
@@ -281,14 +291,14 @@ module Linguistics
|
|
281
291
|
when String
|
282
292
|
langcode = config[:installProxy].intern
|
283
293
|
when TrueClass
|
284
|
-
langcode = DefaultLanguages[0]
|
294
|
+
langcode = languages[0] || DefaultLanguages[0] || :en
|
285
295
|
else
|
286
296
|
raise ArgumentError,
|
287
297
|
"Unexpected value %p for :installProxy" %
|
288
298
|
config[:installProxy]
|
289
299
|
end
|
290
300
|
|
291
|
-
|
301
|
+
install_delegator_proxy( klass, langcode )
|
292
302
|
end
|
293
303
|
}
|
294
304
|
end
|
@@ -332,7 +342,7 @@ module Linguistics
|
|
332
342
|
|
333
343
|
### Try to load the module that implements the given language, returning
|
334
344
|
### the Module object if successful.
|
335
|
-
def self::
|
345
|
+
def self::load_language( lang )
|
336
346
|
raise "Unknown language code '#{lang}'" unless
|
337
347
|
LanguageCodes.key?( lang )
|
338
348
|
|
@@ -342,7 +352,7 @@ module Linguistics
|
|
342
352
|
mod = LanguageCodes[ lang ][:codes].sort {|a,b|
|
343
353
|
(a.length <=> b.length).nonzero? ||
|
344
354
|
(a <=> b)
|
345
|
-
}.each
|
355
|
+
}.each do |code|
|
346
356
|
unless Linguistics::const_defined?( code.upcase )
|
347
357
|
begin
|
348
358
|
require "linguistics/#{code}"
|
@@ -354,7 +364,7 @@ module Linguistics
|
|
354
364
|
|
355
365
|
break Linguistics::const_get( code.upcase ) if
|
356
366
|
Linguistics::const_defined?( code.upcase )
|
357
|
-
|
367
|
+
end
|
358
368
|
|
359
369
|
if mod.is_a?( Array )
|
360
370
|
raise LoadError,
|