1. Michael Granger
  2. Linguistics

Commits

Michael Granger  committed 221d313

Checkpoint commit

  • Participants
  • Parent commits 4e41be3
  • Branches default

Comments (0)

Files changed (23)

File .gemspec

View file
  • Ignore whitespace
 
 spec = Gem::Specification.new do |s|
 	s.name = 'Linguistics'
-	s.version = "1.0.3"
+	s.version = "1.1.0"
 	s.platform = Gem::Platform::RUBY
 	s.summary = "A generic, language-neutral framework for extending Ruby " +
 		"objects with linguistic methods."

File .irbrc

View file
  • Ignore whitespace
  	:PROMPT_C => colored( "%N(%m):%03n:%i*", %w{white on_blue} ) + " ",
     :RETURN => "    ==> %s\n\n"      # format to return value
 }
-IRB.conf[:PROMPT_MODE] = :MUES
+#IRB.conf[:PROMPT_MODE] = :MUES
 
 # Try to require the 'mues' library
 begin

File ChangeLog

View file
  • Ignore whitespace
 
 - Touched up the file description a bit.
 
-- @lpError now intitialized: bug spotted by Martin Chase.
+- @lp_error now intitialized: bug spotted by Martin Chase.
 
 - Calls to #linkParse no longer trap parse errors. This was done for two
   reasons:
 - Added support for MyClass::extend( Linguistics ) and class MyClass; include
   Linguistics; end.
 
-- Modified code in #loadLanguage to minimize the number of requires.
+- Modified code in #load_language to minimize the number of requires.
 
 ------------------------------------------------------------------------
 r36 | deveiant | 2003-09-11 00:52:32 -0400 (Thu, 11 Sep 2003) | 2 lines

File Linguistics.tmproj

View file
  • Ignore whitespace
 <plist version="1.0">
 <dict>
 	<key>currentDocument</key>
-	<string>lib/linguistics/en/linkparser.rb</string>
+	<string>lib/linguistics.rb</string>
 	<key>documents</key>
 	<array>
 		<dict>
-			<key>filename</key>
-			<string>Artistic</string>
-		</dict>
-		<dict>
-			<key>filename</key>
-			<string>ChangeLog</string>
-		</dict>
-		<dict>
-			<key>name</key>
-			<string>docs</string>
-			<key>regexFileFilter</key>
-			<string>!(/\.(?!htaccess)[^/]*|\.(tmproj|o|pyc)|/Icon\r)$</string>
-			<key>regexFolderFilter</key>
-			<string>!.*/(\.[^/]*|CVS|\{arch\}|build|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
-			<key>sourceDirectory</key>
-			<string>docs</string>
-		</dict>
-		<dict>
-			<key>name</key>
-			<string>experiments</string>
-			<key>regexFileFilter</key>
-			<string>!(/\.(?!htaccess)[^/]*|\.(tmproj|o|pyc)|/Icon\r)$</string>
-			<key>regexFolderFilter</key>
-			<string>!.*/(\.[^/]*|CVS|\{arch\}|build|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
-			<key>sourceDirectory</key>
-			<string>experiments</string>
-		</dict>
-		<dict>
-			<key>filename</key>
-			<string>install.rb</string>
-		</dict>
-		<dict>
 			<key>expanded</key>
 			<true/>
 			<key>name</key>
-			<string>lib</string>
-			<key>regexFileFilter</key>
-			<string>!(/\.(?!htaccess)[^/]*|\.(tmproj|o|pyc)|/Icon\r)$</string>
+			<string>Linguistics</string>
 			<key>regexFolderFilter</key>
-			<string>!.*/(\.[^/]*|CVS|\{arch\}|build|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
+			<string>!.*/(\.[^/]*|CVS|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
 			<key>sourceDirectory</key>
-			<string>lib</string>
-		</dict>
-		<dict>
-			<key>filename</key>
-			<string>makedist.rb</string>
-		</dict>
-		<dict>
-			<key>filename</key>
-			<string>MANIFEST</string>
-		</dict>
-		<dict>
-			<key>filename</key>
-			<string>README</string>
-		</dict>
-		<dict>
-			<key>filename</key>
-			<string>README.english</string>
-		</dict>
-		<dict>
-			<key>name</key>
-			<string>redist</string>
-			<key>regexFileFilter</key>
-			<string>!(/\.(?!htaccess)[^/]*|\.(tmproj|o|pyc)|/Icon\r)$</string>
-			<key>regexFolderFilter</key>
-			<string>!.*/(\.[^/]*|CVS|\{arch\}|build|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
-			<key>sourceDirectory</key>
-			<string>redist</string>
-		</dict>
-		<dict>
-			<key>filename</key>
-			<string>test.rb</string>
-		</dict>
-		<dict>
-			<key>name</key>
-			<string>tests</string>
-			<key>regexFileFilter</key>
-			<string>!(/\.(?!htaccess)[^/]*|\.(tmproj|o|pyc)|/Icon\r)$</string>
-			<key>regexFolderFilter</key>
-			<string>!.*/(\.[^/]*|CVS|\{arch\}|build|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
-			<key>sourceDirectory</key>
-			<string>tests</string>
-		</dict>
-		<dict>
-			<key>filename</key>
-			<string>TODO</string>
-		</dict>
-		<dict>
-			<key>filename</key>
-			<string>utils.rb</string>
+			<string></string>
 		</dict>
 	</array>
 	<key>fileHierarchyDrawerWidth</key>
-	<integer>200</integer>
+	<integer>317</integer>
 	<key>metaData</key>
 	<dict>
-		<key>lib/linguistics.rb</key>
+		<key>.irbrc</key>
+		<dict>
+			<key>caret</key>
+			<dict>
+				<key>column</key>
+				<integer>24</integer>
+				<key>line</key>
+				<integer>30</integer>
+			</dict>
+			<key>columnSelection</key>
+			<false/>
+			<key>firstVisibleColumn</key>
+			<integer>0</integer>
+			<key>firstVisibleLine</key>
+			<integer>0</integer>
+			<key>selectFrom</key>
+			<dict>
+				<key>column</key>
+				<integer>45</integer>
+				<key>line</key>
+				<integer>30</integer>
+			</dict>
+			<key>selectTo</key>
+			<dict>
+				<key>column</key>
+				<integer>24</integer>
+				<key>line</key>
+				<integer>30</integer>
+			</dict>
+		</dict>
+		<key>README</key>
+		<dict>
+			<key>caret</key>
+			<dict>
+				<key>column</key>
+				<integer>44</integer>
+				<key>line</key>
+				<integer>34</integer>
+			</dict>
+			<key>columnSelection</key>
+			<false/>
+			<key>firstVisibleColumn</key>
+			<integer>0</integer>
+			<key>firstVisibleLine</key>
+			<integer>23</integer>
+			<key>selectFrom</key>
+			<dict>
+				<key>column</key>
+				<integer>17</integer>
+				<key>line</key>
+				<integer>32</integer>
+			</dict>
+			<key>selectTo</key>
+			<dict>
+				<key>column</key>
+				<integer>44</integer>
+				<key>line</key>
+				<integer>34</integer>
+			</dict>
+		</dict>
+		<key>examples/generalize_sentence.rb</key>
+		<dict>
+			<key>caret</key>
+			<dict>
+				<key>column</key>
+				<integer>0</integer>
+				<key>line</key>
+				<integer>9</integer>
+			</dict>
+			<key>firstVisibleColumn</key>
+			<integer>0</integer>
+			<key>firstVisibleLine</key>
+			<integer>0</integer>
+		</dict>
+		<key>experiments/farmobjs.rb</key>
 		<dict>
 			<key>caret</key>
 			<dict>
 			<key>firstVisibleLine</key>
 			<integer>0</integer>
 		</dict>
+		<key>lib/linguistics.rb</key>
+		<dict>
+			<key>caret</key>
+			<dict>
+				<key>column</key>
+				<integer>0</integer>
+				<key>line</key>
+				<integer>272</integer>
+			</dict>
+			<key>firstVisibleColumn</key>
+			<integer>0</integer>
+			<key>firstVisibleLine</key>
+			<integer>246</integer>
+		</dict>
 		<key>lib/linguistics/en.rb</key>
 		<dict>
 			<key>caret</key>
 			<key>firstVisibleColumn</key>
 			<integer>0</integer>
 			<key>firstVisibleLine</key>
+			<integer>23</integer>
+		</dict>
+		<key>lib/linguistics/en/linkparser.rb</key>
+		<dict>
+			<key>caret</key>
+			<dict>
+				<key>column</key>
+				<integer>0</integer>
+				<key>line</key>
+				<integer>0</integer>
+			</dict>
+			<key>firstVisibleColumn</key>
+			<integer>0</integer>
+			<key>firstVisibleLine</key>
 			<integer>0</integer>
 		</dict>
-		<key>lib/linguistics/en/infinitive.rb</key>
+		<key>tests/en/linkparser.tests.rb</key>
 		<dict>
 			<key>caret</key>
 			<dict>
 				<key>column</key>
 				<integer>0</integer>
 				<key>line</key>
-				<integer>0</integer>
+				<integer>30</integer>
 			</dict>
 			<key>firstVisibleColumn</key>
 			<integer>0</integer>
 			<key>firstVisibleLine</key>
 			<integer>0</integer>
 		</dict>
-		<key>lib/linguistics/en/linkparser.rb</key>
+		<key>tests/en/lprintf.tests.rb</key>
 		<dict>
 			<key>caret</key>
 			<dict>
 				<key>column</key>
-				<integer>0</integer>
+				<integer>44</integer>
 				<key>line</key>
-				<integer>84</integer>
+				<integer>73</integer>
 			</dict>
 			<key>firstVisibleColumn</key>
 			<integer>0</integer>
 			<key>firstVisibleLine</key>
-			<integer>71</integer>
-		</dict>
-		<key>lib/linguistics/en/wordnet.rb</key>
-		<dict>
-			<key>caret</key>
-			<dict>
-				<key>column</key>
-				<integer>30</integer>
-				<key>line</key>
-				<integer>231</integer>
-			</dict>
-			<key>firstVisibleColumn</key>
-			<integer>0</integer>
-			<key>firstVisibleLine</key>
-			<integer>200</integer>
+			<integer>19</integer>
 		</dict>
 	</dict>
 	<key>openDocuments</key>
 	<array>
+		<string>tests/en/lprintf.tests.rb</string>
 		<string>lib/linguistics/en.rb</string>
-		<string>lib/linguistics/en/infinitive.rb</string>
+		<string>README</string>
+		<string>experiments/farmobjs.rb</string>
+		<string>.irbrc</string>
+		<string>tests/en/linkparser.tests.rb</string>
+		<string>examples/generalize_sentence.rb</string>
+		<string>lib/linguistics.rb</string>
 		<string>lib/linguistics/en/linkparser.rb</string>
-		<string>lib/linguistics/en/wordnet.rb</string>
-		<string>lib/linguistics.rb</string>
 	</array>
 	<key>showFileHierarchyDrawer</key>
 	<true/>
 	<key>windowFrame</key>
-	<string>{{234, 8}, {993, 1020}}</string>
+	<string>{{302, 28}, {837, 1000}}</string>
 </dict>
 </plist>

File README

View file
  • Ignore whitespace
 
 == Requirements
 
-* Ruby >= 1.8.0
-
-The following libraries are required, but are included in the redist/
-directory. The installer script should install these for you if you don't
-already have them.
-
-* HashSlice - Adds slicing to the builtin Hash class
+* Ruby >= 1.8.4
 
 
 == Optional
 
-* CrossCase - Provide auto-aliasing of camelCase to under_barred methods and
-  vice-versa. (Included in redist/)
-
 * Ruby-WordNet (>= 0.02) - adds integration for the Ruby binding for the WordNet� lexical
   reference system.
 
-  URL: http://www.deveiate.org/code/Ruby-WordNet.html
-  Download: http://www.deveiate.org/code/Ruby-WordNet-0.02.tar.gz
+  URL: http://deveiate.org/projects/Ruby-WordNet
+  Download: http://deveiate.org/code/Ruby-WordNet-0.02.tar.gz
 
 * LinkParser (>= 0.0.4) - adds integration for the Ruby Link Grammar Parser by
   Martin Chase.
 
 == General Information
 
-This module is a framework for building linguistic utilities for Ruby objects in
-any language. It includes a generic language-independant front end, a module for
-mapping language codes into language names, and a module which contains various
-English-language utilities.
+This module is a framework for building linguistic utilities for Ruby objects
+in any language. It includes a generic language-independant front end, a
+module for mapping language codes into language names, and a module which
+contains various English-language utilities.
 
 
 === Method Interface
 
-The Linguistics module comes with a language-independant mechanism for extending
-core Ruby classes with linguistic methods. 
+The Linguistics module comes with a language-independant mechanism for
+extending core Ruby classes with linguistic methods.
 
 It consists of three parts: a core linguistics module which contains the
 class-extension framework for languages, a generic inflector class that serves
 interface or risking collision between them, albeit at the cost of three or four
 more characters per method invocation.
 
-If you don't like extending core Ruby classes, the language modules should also
-allow you to use them as a function library as well.
+If you don't like extending core Ruby classes, the language modules should
+also allow you to use them as a function library as well.
 
 For example, the English-language module contains a #plural function which can
 be accessed via a method on a core class:
   plural( "goose" )
   # => "geese"
 
-The class-extension mechanism actually uses the functional interface behind the
-scenes.
+The class-extension mechanism actually uses the functional interface behind
+the scenes.
 
 A new feature with the 0.02 release: You can now omit the language-code method
 for unambiguous methods by calling Linguistics::use with the +:installProxy+
 To add a new language to the framework, create a file named the same as the
 ISO639 2- or 3-letter language code for the language you're adding. It must be
 placed under lib/linguistics/ to be recognized by the linguistics module, but
-you can also just require it yourself prior to calling Linguistics::use(). This
-file should define a module under Linguistics that is an all-caps version of the
-code used in the filename. Any methods you wish to be exposed to users should be
-declared as module functions (ie., using Module#module_function).
+you can also just require it yourself prior to calling Linguistics::use().
+This file should define a module under Linguistics that is an all-caps version
+of the code used in the filename. Any methods you wish to be exposed to users
+should be declared as module functions (ie., using Module#module_function).
 
-You may also wish to add your module to the list of default languages by adding
-the appropriate symbol to the Linguistics::DefaultLanguages array.
+You may also wish to add your module to the list of default languages by
+adding the appropriate symbol to the Linguistics::DefaultLanguages array.
 
 For example, to create a Portuguese-language module, create a file called
 'lib/linguistics/pt.rb' which contains the following:
 
 See the README.english file for a synopsis.
 
-The English-language module currently contains linguistic functions ported from
-a few excellent Perl modules:
+The English-language module currently contains linguistic functions ported
+from a few excellent Perl modules:
 
   Lingua::EN::Inflect
   Lingua::Conjunction
 
 See the lib/linguistics/en.rb file for specific attributions.
 
-New with version 0.02: integration with the Ruby WordNet� and LinkParser modules
-(which must be installed separately).
+New with version 0.02: integration with the Ruby WordNet� and LinkParser
+modules (which must be installed separately).
 
 
 == To Do
   additional stemming functions and some other strategies are ongoing.
 
 * Martin Chase <stillflame at FaerieMUD dot org> is working on an integration
-  module for his excellent work on a Ruby interface to the CMU Link Grammar (an
-  english-sentence parser). This will make writing fairly accurate natural
+  module for his excellent work on a Ruby interface to the CMU Link Grammar
+  (an english-sentence parser). This will make writing fairly accurate natural
   language parsers in Ruby much easier.
 
 * Suggestions (and patches) for any of these items or additional features are
 
 == Legal
 
-This module is Open Source Software which is Copyright (c) 2003 by The FaerieMUD
-Consortium. All rights reserved.
+This module is Open Source Software which is Copyright (c) 2003 by The
+FaerieMUD Consortium. All rights reserved.
 
 You may use, modify, and/or redistribute this software under the terms of the
 Perl Artistic License, a copy of which should have been included in this
 obtained from http://language.perl.com/misc/Artistic.html or
 http://www.faeriemud.org/artistic.html).
 
-THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
-INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
-FITNESS FOR A PARTICULAR PURPOSE.
+THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
 
  $Id: README,v 1.6 2003/10/09 13:21:48 deveiant Exp $

File docs/makedocs.rb

View file
  • Ignore whitespace
 include UtilityFunctions
 
 def makeDocs( docsdir, template='html', diagrams=false, upload=nil, ridocs=false )
-	debugMsg "docsdir = %p, template = %p, diagrams = %p, upload = %p, ridocs = %p" %
+	debug_msg "docsdir = %p, template = %p, diagrams = %p, upload = %p, ridocs = %p" %
 		[docsdir, template, diagrams, upload, ridocs]
 
 	title = findRdocTitle()
 
 		oparser.on( "--debug", "-d", TrueClass, "Output debugging information" ) do
 			$VERBOSE = true
-			debugMsg "Turned debugging on."
+			debug_msg "Turned debugging on."
 		end
 
 		oparser.on( "--verbose", "-v", TrueClass, "Make progress verbose" ) do
 			$VERBOSE = true
-			debugMsg "Turned verbose on."
+			debug_msg "Turned verbose on."
 		end
 
 		# Handle the 'help' option

File install.rb

View file
  • Ignore whitespace
 
 		oparser.on( "--verbose", "-v", TrueClass, "Make progress verbose" ) {
 			$VERBOSE = true
-			debugMsg "Turned verbose on."
+			debug_msg "Turned verbose on."
 		}
 
 		oparser.on( "--dry-run", "-n", TrueClass, "Don't really install anything" ) {
-			debugMsg "Turned dry-run on."
+			debug_msg "Turned dry-run on."
 			dryrun = true
 		}
 
 	end
 
 	if ARGV.empty? || ARGV.include?( "install" )
-		debugMsg "Sitelibdir = '#{CONFIG['sitelibdir']}'"
+		debug_msg "Sitelibdir = '#{CONFIG['sitelibdir']}'"
 		sitelibdir = CONFIG['sitelibdir']
-		debugMsg "Sitearchdir = '#{CONFIG['sitearchdir']}'"
+		debug_msg "Sitearchdir = '#{CONFIG['sitearchdir']}'"
 		sitearchdir = CONFIG['sitearchdir']
 
 		message "Installing..."

File lib/linguistics.rb

View file
  • Ignore whitespace
 		case obj
 		when Class
 			# $stderr.puts "Extending %p" % obj if $DEBUG
-			self::installLanguageProxy( obj )
+			self::install_language_proxy( obj )
 		else
 			sclass = (class << obj; self; end)
 			# $stderr.puts "Extending a object's metaclass: %p" % obj if $DEBUG
-			self::installLanguageProxy( sclass )
+			self::install_language_proxy( sclass )
 		end
 
 		super
 
 	### Make an languageProxy class that encapsulates all of the inflect operations
 	### using the given language module.
-	def self::makeLanguageProxy( mod )
+	def self::make_language_proxy( mod )
 		# $stderr.puts "Making language proxy for mod %p" % [mod]
 		Class::new( LanguageProxyClass ) {
 			@langmod = mod
 
 
 	### Install the language proxy
-	def self::installLanguageProxy( klass, languages=DefaultLanguages )
+	def self::install_language_proxy( klass, languages=DefaultLanguages )
 		languages.replace( DefaultLanguages ) if languages.empty?
 
 		# Create an languageProxy class for each language specified
-		languages.each {|lang|
+		languages.each do |lang|
 			# $stderr.puts "Extending the %p class with %p" %
 			#	[ klass, lang ] if $DEBUG
 
 			# Load the language module (skipping to the next if it's already
 			# loaded), make a languageProxy class that delegates to it, and
 			# figure out what the languageProxy method will be called.
-			mod = loadLanguage( lang.to_s.downcase )
+			mod = load_language( lang.to_s.downcase )
 			ifaceMeth = mod.name.downcase.sub( /.*:/, '' )
-			languageProxyClass = makeLanguageProxy( mod )
+			languageProxyClass = make_language_proxy( mod )
 
 			# Install a hash for languageProxy classes and an accessor for the
 			# hash if it's not already present.
 					end
 				}, __FILE__, __LINE__
 			end
-		}
+		end
 	end
 
 
 
 	### Install a regular proxy method in the given klass that will delegate
 	### calls to missing method to the languageProxy for the given +language+.
-	def self::installDelegatorProxy( klass, langcode )
+	def self::install_delegator_proxy( klass, langcode )
 		raise ArgumentError, "Missing langcode" if langcode.nil?
 
 		# Alias any currently-extant
 
 	### Handle auto-magic usage
 	def self::const_missing( sym )
-		loadLanguage( sym.to_s.downcase )
+		load_language( sym.to_s.downcase )
 	end
 
 
 		classes.each {|klass|
 
 			# Create an languageProxy class for each installed language
-			installLanguageProxy( klass, languages )
+			install_language_proxy( klass, languages )
 
 			# Install the delegator proxy if configured
 			if config[:installProxy]
 						config[:installProxy]
 				end
 
-				installDelegatorProxy( klass, langcode )
+				install_delegator_proxy( klass, langcode )
 			end
 		}
 	end
 
 	### Try to load the module that implements the given language, returning
 	### the Module object if successful.
-	def self::loadLanguage( lang )
+	def self::load_language( lang )
 		raise "Unknown language code '#{lang}'" unless
 			LanguageCodes.key?( lang )
 
 		mod = LanguageCodes[ lang ][:codes].sort {|a,b|
 			(a.length <=> b.length).nonzero? ||
 			(a <=> b)
-		}.each {|code|
+		}.each do |code|
 			unless Linguistics::const_defined?( code.upcase )
 				begin
 					require "linguistics/#{code}"
 
 			break Linguistics::const_get( code.upcase ) if
 				Linguistics::const_defined?( code.upcase )
-		}
+		end
 
 		if mod.is_a?( Array )
 			raise LoadError,

File lib/linguistics/en.rb

View file
  • Ignore whitespace
 		re = parts.flatten.join("|")
 		"(?:#{re})"
 	end
+	
+	
+	@lprintf_formatters = {}
+	class << self
+		attr_accessor :lprintf_formatters
+	end
+	
+	### Add the specified method (which can be either a Method object or a
+	### Symbol for looking up a method)
+	def self::def_lprintf_formatter( name, meth )
+		meth = self.method( meth ) unless meth.is_a?( Method )
+		self.lprintf_formatters[ name ] = meth
+	end
+	
 
 
 	#################################################################
 	###############
 
 	### Debugging output
-	def debugMsg( *msgs ) # :nodoc:
+	def debug_msg( *msgs ) # :nodoc:
 		$stderr.puts msgs.join(" ") if $DEBUG
 	end
 
 
 	### Normalize a count to either 1 or 2 (singular or plural)
-	def normalizeCount( count, default=2 )
+	def normalize_count( count, default=2 )
 		return default if count.nil? # Default to plural
 		if /^(#{PL_count_one})$/i =~ count.to_s ||
 				Linguistics::classical? &&
 	def pluralize_noun( word, count=nil )
 		value = nil
 		count ||= Linguistics::num
-		count = normalizeCount( count )
+		count = normalize_count( count )
 
 		return word if count == 1
 
 	### Pluralize special verbs
 	def pluralize_special_verb( word, count )
 		count ||= Linguistics::num
-		count = normalizeCount( count )
+		count = normalize_count( count )
 		
 		return nil if /^(#{PL_count_one})$/i =~ count.to_s
 
 	### Pluralize regular verbs
 	def pluralize_general_verb( word, count )
 		count ||= Linguistics::num
-		count = normalizeCount( count )
+		count = normalize_count( count )
 		
 		return word if /^(#{PL_count_one})$/i =~ count.to_s
 
 	### Handle special adjectives
 	def pluralize_special_adjective( word, count )
 		count ||= Linguistics::num
-		count = normalizeCount( count )
+		count = normalize_count( count )
 
 		return word if /^(#{PL_count_one})$/i =~ count.to_s
 
 			# Scan the string, and call the word-chunk function that deals with
 			# chunks of the found number of digits.
 			num.to_s.scan( re ) {|digits|
-				debugMsg "   digits = #{digits.inspect}"
+				debug_msg "   digits = #{digits.inspect}"
 				fn = NumberToWordsFunctions[ digits.nitems ]
 				numerals = digits.flatten.compact.collect {|i| i.to_i}
-				debugMsg "   numerals = #{numerals.inspect}"
+				debug_msg "   numerals = #{numerals.inspect}"
 				chunks.push fn.call( config[:zero], *numerals ).strip
 			}
 		else
 
 		return pre + plural + post
 	end
-	alias_method :PL, :plural
+	def_lprintf_formatter :PL, :plural
 
 
 	### Return the plural of the given noun +phrase+ if +count+ indicates it
 		plural = postprocess( word, pluralize_noun(word, count) )
 		return pre + plural + post
 	end
-	alias_method :PL_N, :plural_noun
+	def_lprintf_formatter :PL_N, :plural_noun
 
 
 	### Return the plural of the given verb +phrase+ if +count+ indicates it
 			pluralize_general_verb(word, count) )
 		return pre + plural + post
 	end
-	alias_method :PL_V, :plural_verb
+	def_lprintf_formatter :PL_V, :plural_verb
 
 
 	### Return the plural of the given adjectival +phrase+ if +count+ indicates
 		return pre + plural + post
 	end
 	alias_method :plural_adj, :plural_adjective
-	alias_method :PL_ADJ, :plural_adjective
+	def_lprintf_formatter :PL_ADJ, :plural_adjective
 
 
 	### Return the given phrase with the appropriate indefinite article ("a" or
 		return pre + result + post
 	end
 	alias_method :an, :a
-	alias_method :A, :a
-	alias_method :AN, :a
+	def_lprintf_formatter :A, :a
+	def_lprintf_formatter :AN, :a
 
 
 	### Translate zero-quantified +phrase+ to "no +phrase.plural+"
 			return "#{pre}no " + plural( word, 0 ) + post
 		end
 	end
-	alias_method :NO, :no
+	def_lprintf_formatter :NO, :no
 
 
 	### Participles
         return "#{plural}ing"
 	end
 	alias_method :part_pres, :present_participle
-	alias_method :PART_PRES, :present_participle
+	def_lprintf_formatter :PART_PRES, :present_participle
 
 
 
 			end					
 		}
 
-		debugMsg "Parts => #{parts.inspect}"
+		debug_msg "Parts => #{parts.inspect}"
 		
 		# Turn the last word of the whole-number part back into an ordinal if
 		# the original number came in that way.
 			end
 			decimals = parts[1..-1].collect {|part| part.join(" ")}
 
-			debugMsg "Wholenum: #{wholenum.inspect}; decimals: #{decimals.inspect}"
+			debug_msg "Wholenum: #{wholenum.inspect}; decimals: #{decimals.inspect}"
 
 			# Join with the configured decimal; if it's empty, just join with
 			# spaces.
 				strip
 		end
 	end
-	alias_method :NUMWORDS, :numwords
+	def_lprintf_formatter :NUMWORDS, :numwords
 
 
 	### Transform the given +number+ into an ordinal word. The +number+ object
 			return number.to_s.sub( /(#{OrdinalSuffixes})\Z/ ) { Ordinals[$1] }
 		end
 	end
-	alias_method :ORD, :ordinal
+	def_lprintf_formatter :ORD, :ordinal
 
 
+	### Transform the given +number+ into an ordinate word.
+	def ordinate( number )
+		numwords( number ).ordinal
+	end
+	
+
 	### Return a phrase describing the specified +number+ of objects in the
-	### given +phrase+. The following options can be used to control the makeup
-	### of the returned quantity String:
+	### given +phrase+ in general terms. The following options can be used to 
+	### control the makeup of the returned quantity String:
 	### 
     ### [<b>:joinword</b>]
     ###   Sets the word (and any surrounding spaces) used as the word separating the
 			].compact.join( config[:joinword] )
 		end
 	end
-	alias_method :QUANT, :quantify
+	def_lprintf_formatter :QUANT, :quantify
 
 
+	# :TODO: Needs refactoring
+
     ### Return the specified +obj+ (which must support the <tt>#collect</tt>
     ### method) as a conjunction. Each item is converted to a String if it is
     ### not already (using #to_s) unless a block is given, in which case it is
 
 		return phrases.join( sep )
 	end
-	alias_method :CONJUNCT, :conjunction
+	def_lprintf_formatter :CONJUNCT, :conjunction
 
 
 	### Turns a camel-case +string+ ("camelCaseToEnglish") to plain English
 	### ("camel case to english"). Each word is decapitalized.
 	def camel_case_to_english( string )
-		string.to_s.gsub( /([a-z])([A-Z])/ ) { "#$1 #$2" }.downcase
+		string.to_s.
+			gsub( /([A-Z])([A-Z])/ ) { "#$1 #$2" }.
+			gsub( /([a-z])([A-Z])/ ) { "#$1 #$2" }.downcase
 	end
 
 
 	###   Prepend indefinite article.
 	### %NO::
 	###   Zero-quantified phrase.
+	### %NUMWORDS::
+	###   Convert a number into the corresponding words.
 	### %CONJUNCT::
 	###   Conjunction.
 	def lprintf( fmt, *args )
 		fmt.to_s.gsub( /%([A-Z_]+)/ ) do |match|
-			op = $1
-			case op
-			when 'PL'
-				args.shift.plural
-			when 'A', 'AN'
-				args.shift.a
-			when 'NO'
-				args.shift.no
-			when 'CONJUNCT'
-				args.shift.conjunction
+			op = $1.to_s.upcase.to_sym
+			if self.lprintf_formatters.key?( op )
+				arg = args.shift
+				self.lprintf_formatters[ op ].call( arg )
 			else
 				raise "no such formatter %p" % op
 			end

File lib/linguistics/en/linkparser.rb

View file
  • Ignore whitespace
 #   "he is a big dog".en.sentence.object.to_s
 #   # => "dog"
 # 
-#   # Look at the raw LinkParser::Word for the direct object of the sentence.
-#   "he is a big dog".en.sentence.object     
-#   # => #<LinkParser::Word:0x403da0a0 @definition=[[{@A-}, Ds-, {@M+}, J-], [{@A-},
-#   Ds-, {@M+}, Os-], [{@A-}, Ds-, {@M+}, Ss+, {@CO-}, {C-}], [{@A-}, Ds-, {@M+},
-#   Ss+, R-], [{@A-}, Ds-, {@M+}, SIs-], [{@A-}, Ds-, {R+}, {Bs+}, J-], [{@A-}, Ds-,
-#   {R+}, {Bs+}, Os-], [{@A-}, Ds-, {R+}, {Bs+}, Ss+, {@CO-}, {C-}], [{@A-}, Ds-,
-#   {R+}, {Bs+}, Ss+, R-], [{@A-}, Ds-, {R+}, {Bs+}, SIs-]], @right=[], @suffix="",
-#   @left=[#<LinkParser::Connection:0x403da028 @rword=#<LinkParser::Word:0x403da0a0
-#   ...>, @lword=#<LinkParser::Word:0x403da0b4 @definition=[[Ss-, O+, {@MV+}], [Ss-,
-#   B-, {@MV+}], [Ss-, P+], [Ss-, AF-], [RS-, Bs-, O+, {@MV+}], [RS-, Bs-, B-,
-#   {@MV+}], [RS-, Bs-, P+], [RS-, Bs-, AF-], [{Q-}, SIs+, O+, {@MV+}], [{Q-}, SIs+,
-#   B-, {@MV+}], [{Q-}, SIs+, P+], [{Q-}, SIs+, AF-]],
-#   @right=[#<LinkParser::Connection:0x403da028 ...>], @suffix="", @left=[],
-#   @name="is", @position=1>, @subName="*", @name="O", @length=3>], @name="dog",
-#   @position=4>
-# 
 #   # Combine WordNet + LinkParser to find the definition of the direct object of
 #   # the sentence
 #   "he is a big dog".en.sentence.object.gloss
 
 module Linguistics::EN
 
-	@hasLinkParser	= false
-	@lpParser		= nil
-	@lpError		= nil
+	@has_link_parser	= false
+	@lp_dict			= nil
+	@lp_error			= nil
 
 	begin
 		require "linkparser"
-		@hasLinkParser = true
+		@has_link_parser = true
 	rescue LoadError => err
-		@lpError = err
+		@lp_error = err
 	end
 
 
 	class << self
 
 		### Returns +true+ if LinkParser was loaded okay
-		def hasLinkParser? ; @hasLinkParser ; end
+		def has_link_parser? ; @has_link_parser ; end
 
-		### If #hasLinkParser? returns +false+, this can be called to fetch the
+		### If #has_link_parser? returns +false+, this can be called to fetch the
 		### exception which was raised when trying to load LinkParser.
-		def lpError ; @lpError ; end
+		def lp_error ; @lp_error ; end
 
 		### The instance of LinkParser used for all Linguistics LinkParser
 		### functions.
-		def linkParser
-			if @lpError
+		def lp_dict
+			if @lp_error
 				raise NotImplementedError, 
 					"LinkParser functions are not loaded: %s" %
-					@lpError.message
+					@lp_error.message
 			end
 
-			return @lpParser if ! @lpParser.nil?
-
-			LinkParser::Word::extend( Linguistics )
-			Linguistics::installDelegatorProxy( LinkParser::Word, :en )
-
-			dictOpts = Hash.new('')
-			dictOpts['datadir'] = '/usr/lib/ruby/site_ruby/1.8/linkparser/data'
-			dictOpts['dict'] = 'tiny.dict'
-			parseOpts = Hash.new
-
-			@lpParser = LinkParser.new( dictOpts, parseOpts )
+			return @lp_dict ||= LinkParser::Dictionary.new( :verbosity => 0 )
 		end
 	end
 
 	module_function
 	###############
 
-	### Return a LinkParser::Sentence, with or without a sentence in it.
-	def linkParse( sent )
-		return Linguistics::EN::linkParser.parse( sent.to_s )
+	### Return a LinkParser::Sentence for the stringified +obj+.
+	def sentence( obj )
+		return Linguistics::EN::lp_dict.parse( obj.to_s )
 	end
-	alias_method :sentence, :linkParse
 	module_function :sentence
 
 end

File lib/linguistics/en/wordnet.rb

View file
  • Ignore whitespace
 
 module Linguistics::EN
 
-	@hasWordnet		= false
-	@wnError		= nil
-	@wnLexicon		= nil
+	@has_wordnet		= false
+	@wn_error		= nil
+	@wn_lexicon		= nil
 
 	# Load WordNet and open the lexicon if possible, saving the error that
 	# occurs if anything goes wrong.
 	begin
 		require 'wordnet'
-		@hasWordnet = true
+		@has_wordnet = true
 	rescue LoadError => err
-		@wnError = err
+		@wn_error = err
 	end
 
 
 	class << self
 
 		### Returns +true+ if WordNet was loaded okay
-		def hasWordnet? ; @hasWordnet; end
+		def has_wordnet? ; @has_wordnet; end
 
 		### If #haveWordnet? returns +false+, this can be called to fetch the
 		### exception which was raised when WordNet was loaded.
-		def wnError ; @wnError; end
+		def wn_error ; @wn_error; end
 
 		### The instance of the WordNet::Lexicon used for all Linguistics WordNet
 		### functions.
-		def wnLexicon
-			if @wnError
+		def wn_lexicon
+			if @wn_error
 				raise NotImplementedError,
 					"WordNet functions are not loaded: %s" %
-					@wnError.message
+					@wn_error.message
 			end
 
-			@wnLexicon ||= WordNet::Lexicon::new
+			@wn_lexicon ||= WordNet::Lexicon::new
 		end
 
 		### Make a function that calls the method +meth+ on the synset of an input
 	### Look up the synset associated with the given word or collocation in the
 	### WordNet lexicon and return a WordNet::Synset object.
 	def synset( word, pos=nil, sense=1 )
-		lex = Linguistics::EN::wnLexicon
+		lex = Linguistics::EN::wn_lexicon
 		if pos.is_a?( Fixnum )
 			sense = pos
 			pos = nil
 		postries = pos ? [pos] : [:noun, :verb, :adjective, :adverb, :other]
 		syn = nil
 
-		postries.each {|pos|
+		postries.each do |pos|
 			break if syn = lex.lookupSynsets( word.to_s, pos, sense )
-		}
+		end
 
 		return syn
 	end
 	### the WordNet lexicon and return an Array of WordNet::Synset objects. If
 	### +pos+ is +nil+, return synsets for all parts of speech.
 	def synsets( word, pos=nil )
-		lex = Linguistics::EN::wnLexicon
+		lex = Linguistics::EN::wn_lexicon
 		postries = pos ? [pos] : [:noun, :verb, :adjective, :adverb, :other]
 		syns = []
 
 
 	# Returns the name of the lexicographer file that contains the raw data for
 	# the receiver.
-	def_synset_function :lexInfo
+	def_synset_function :lex_info
 
 	# :TODO: Finish these comments, and figure out how the hell to get the
 	# methods to show up in RDoc.

File makedist.rb

View file
  • Ignore whitespace
 
 		oparser.on( "--verbose", "-v", TrueClass, "Make progress verbose" ) do
 			$VERBOSE = true
-			debugMsg "Turned verbose on."
+			debug_msg "Turned verbose on."
 		end
 
 		oparser.on( "--snapshot", "-s", TrueClass,
 			"Make a snapshot distribution instead of a versioned release" ) do
 			snapshot = true
-			debugMsg "Making snapshot instead of release."
+			debug_msg "Making snapshot instead of release."
 		end
 
 		oparser.on( "--no-tag", "-n", TrueClass, "Don't tag the release." ) do

File test.rb

View file
  • Ignore whitespace
 
 	oparser.on( "--debug", "-d", TrueClass, "Turn debugging on" ) {
 		$DEBUG = true
-		debugMsg "Turned debugging on."
+		debug_msg "Turned debugging on."
 	}
 
 	oparser.on( "--verbose", "-v", TrueClass, "Make progress verbose" ) {
 		$VERBOSE = true
-		debugMsg "Turned verbose on."
+		debug_msg "Turned verbose on."
 	}
 
 	# Handle the 'help' option
  		Find.prune unless patterns.find {|pat| pat =~ file}
  	end
 
-	debugMsg "Considering '%s': " % file
+	debug_msg "Considering '%s': " % file
 	next unless file =~ /\.tests.rb$/
-	debugMsg "Requiring '%s'..." % file
+	debug_msg "Requiring '%s'..." % file
 	require "#{file}"
 	requires << file
 }

File tests/en/conjunction.tests.rb

View file
  • Ignore whitespace
 			"a chair; a wooden chest; and a hat rack", rval
 	end
 
-	def test_lprintf_with_conjunct_tag_should_conjunctionize_the_corresponding_argument
-		rval = nil
-		
-		assert_nothing_raised do
-			rval = "I have %CONJUNCT in my pocket".lprintf( Items )
-		end
-		
-		assert_equal "I have a cow, a chicken, a blancmange, and a cyclist in my pocket",
-			rval
-	end
-
 end
 

File tests/en/inflect.tests.rb

View file
  • Ignore whitespace
 
 				methodCounter += 1
 			else
-				debugMsg "Skipped test data line '#{line.chomp}'"
+				debug_msg "Skipped test data line '#{line.chomp}'"
 			end
 		end
 	end

File tests/en/lafcadio.tests.rb

View file
  • Ignore whitespace
 		["ProductCategory", 	"product category"],
 		["catalogOrder",		"catalog order"],
 		["product",				"product"],
+		["theNameOfAMethod",	"the name of a method"],
 	]
 
 	ProperNouns = {
 	###	T E S T S
 	#################################################################
 
-	def test_camelCaseToEnglish
+	def test_camel_case_to_english_should_transform_to_english
 		printTestHeader "Lafcadio Additions: CamelCase to English"
 		res = nil
 
 
 
 	### String#proper_noun
-	def test_properNoun
+	def test_proper_noun_should_return_caseified_string
 		printTestHeader "Lafcadio Additions: Proper Nouns"
 
 		ProperNouns.each do |key,expected|
 			input = key.dup # Get around hash keys being frozen
-			debugMsg "Trying %p, expect: %p" % [input, expected]
+			debug_msg "Trying %p, expect: %p" % [input, expected]
 			assert_equal expected, input.en.proper_noun
 		end
 	end

File tests/en/linkparser.tests.rb

View file
  • Ignore whitespace
 
 	### Overridden to skip tests if WordNet isn't installed.
 	def run( result )
-		return super if Linguistics::EN::hasLinkParser?
+		return super if Linguistics::EN::has_link_parser?
 		yield( STARTED, name )
 		result.add_run
 		yield( FINISHED, name )
 	end
 
 
-	def test_010_functions 
-		sent = "he is a dog"
-		test = test2 = nil
-		assert_nothing_raised			{test = sent.en.linkParse}
-		assert_equal					sent, test.to_str
-		assert_kind_of					LinkParser::Sentence, test
-		assert_nothing_raised			{test2 = sent.en.sentence}
-		assert_equal					sent, test2.to_str
-		assert_kind_of					LinkParser::Sentence, test2
-		assert_equal					test, test2
+	def test_sentence_should_return_a_parsed_linkparser_sentence
+		rval = nil
+
+		assert_nothing_raised do
+			rval = "He is a dog.".en.sentence
+		end
+		
+		assert_instance_of LinkParser::Sentence, rval
 	end
 
-	def test_030_grammatically_correct 
-		test = nil
-		sent = "he is a dog"
-		assert_nothing_raised			{test = sent.en.sentence.sentence?}
-		assert							test
-		sent = "dog a he is"
-		assert_nothing_raised			{test = sent.en.linkParse.sentence?}
-		assert							! test
-		sent = ""
-		errclass = LinkParser::ParseError
-		assert_raises( errclass)		{test = sent.en.sentence}
-		assert							! test
-	end
-
-	def test_050_parts_of_speech 
-		test = nil
-		sent = "he is a dog"
-		assert_nothing_raised			{test = sent.en.linkParse.verb}
-		assert_equal					test, "is"
-		assert_nothing_raised			{test = sent.en.linkParse.subject}
-		assert_equal					test, "he"
-		assert_nothing_raised			{test = sent.en.linkParse.object}
-		assert_equal					test, "dog"
-		sent = ""
-		errclass = LinkParser::ParseError
-		assert_raises( errclass )		{test = sent.en.linkParse}
-	end
 end

File tests/en/lprintf.tests.rb

View file
  • Ignore whitespace
+#!/usr/bin/ruby -w
+#
+# Unit test for Linguistics::EN#lprintf
+# $Id$
+#
+# Copyright (c) 2006 The FaerieMUD Consortium.
+# 
+
+unless defined?( Linguistics::TestCase )
+	require 'pathname'
+	basedir = Pathname.new( __FILE__ ).dirname.parent.parent.expand_path
+	
+	libdir = basedir + "lib"
+	testsdir = basedir + "tests"
+	$LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
+	$LOAD_PATH.unshift( testsdir ) unless $LOAD_PATH.include?( testsdir )
+	
+	require 'lingtestcase'
+end
+
+require 'linguistics/en'
+
+### This test case tests the lprintf method of the Linguistics English module
+class Linguistics::LPrintfTestCase < Linguistics::TestCase
+
+	Items = %w{ruby moose mouse nexus}
+	
+	def initialize( *args )
+		Linguistics::use( :en )
+		super
+	end
+
+	def test_lprintf_with_conjunct_tag_should_conjunctionize_the_corresponding_argument
+		rval = nil
+		
+		assert_nothing_raised do
+			rval = "I have %CONJUNCT in my pocket".en.lprintf( Items )
+		end
+		
+		assert_equal "I have a ruby, a moose, a mouse, and a nexus in my pocket",
+			rval
+	end
+
+	
+	def test_lprintf_with_plural_tag_should_pluralize_the_corresponding_argument
+		rval = nil
+		
+		assert_nothing_raised do
+			rval = "What's with all the %PL?".en.lprintf( "llama" )
+		end
+		
+		assert_equal "What's with all the llamas?", rval
+	end
+
+	
+	def test_lprintf_with_indef_article_tag_should_use_an_for_umbrella
+		rval = nil
+		
+		assert_nothing_raised do
+			rval = "You pick up %A.".en.lprintf( "umbrella" )
+		end
+		
+		assert_equal "You pick up an umbrella.", rval
+	end
+
+	
+	def test_lprintf_with_indef_article_tag_should_use_a_for_flagon_of_mead
+		rval = nil
+		
+		assert_nothing_raised do
+			rval = "You pick up %A.".en.lprintf( "flagon of mead" )
+		end
+		
+		assert_equal "You pick up a flagon of mead.", rval
+	end
+	
+end

File tests/en/titlecase.tests.rb

View file
  • Ignore whitespace
 	Titles = File::open(__FILE__).read.split("__END__").last.split("\n")
 
 	def test_nothing
-		debugMsg "Not tested, as the functionality it tests hasn't been released yet."
+		debug_msg "Not tested, as the functionality it tests hasn't been released yet."
 	end
 
 	def dont_test_titles
 		printTestHeader "TitleCase: Titles"
 		rval = nil
 
-		debugMsg "Titles = %p" % [Titles]
+		debug_msg "Titles = %p" % [Titles]
 
 		Titles.each do |title|
 			next if !/\w/.match( title )

File tests/en/wordnet.tests.rb

View file
  • Ignore whitespace
 
 	### Overridden to skip tests if WordNet isn't installed.
 	def run( result )
-		return super if Linguistics::EN::hasWordnet?
+		return super if Linguistics::EN::has_wordnet?
 		yield( STARTED, name )
 		result.add_run
 		yield( FINISHED, name )
 	###	T E S T S
 	#################################################################
 
-	### Test the wnLexicon method of the EN module
+	### Test the wn_lexicon method of the EN module
 	def test_00_Lexicon
 		printTestHeader "English: WordNet: Lexicon"
 
-		assert_respond_to Linguistics::EN, :wnLexicon
+		assert_respond_to Linguistics::EN, :wn_lexicon
 		assert_nothing_raised {
-			lex = Linguistics::EN::wnLexicon
+			lex = Linguistics::EN::wn_lexicon
 			assert_instance_of WordNet::Lexicon, lex
 		}
 	end

File tests/lingtestcase.rb

View file
  • Ignore whitespace
 
 		### Output the specified <tt>msgs</tt> joined together to
 		### <tt>STDERR</tt> if <tt>$DEBUG</tt> is set.
-		def self::debugMsg( *msgs )
+		def self::debug_msg( *msgs )
 			return unless $DEBUG
 			self.message "DEBUG>>> %s" % msgs.join('')
 		end
 		### Forward-compatibility method for namechange in Test::Unit
 		def setup( *args )
 			self.class.setupBlocks.each {|sblock|
-				debugMsg "Calling setup block method #{sblock}"
+				debug_msg "Calling setup block method #{sblock}"
 				self.send( sblock )
 			}
 			super( *args )
 		def teardown( *args )
 			super( *args )
 			self.class.teardownBlocks.each {|tblock|
-				debugMsg "Calling teardown block method #{tblock}"
+				debug_msg "Calling teardown block method #{tblock}"
 				self.send( tblock )
 			}
 		end
 
 
 		### Instance alias for the like-named class method
-		def debugMsg( *msgs )
-			self.class.debugMsg( *msgs )
+		def debug_msg( *msgs )
+			self.class.debug_msg( *msgs )
 		end
 
 

File tests/use.tests.rb

View file
  • Ignore whitespace
 		Linguistics::use( :en )
 
 		[ TestArray, TestString, TestNumber ].each do |obj|
-			debugMsg "obj.class.instance_variables = %s" %
+			debug_msg "obj.class.instance_variables = %s" %
 				obj.class.instance_variables.inspect
 
 			assert_respond_to obj, :en

File utils.rb

View file
  • Ignore whitespace
 
 	### Output the specified <tt>msg</tt> as an ANSI-colored debugging message
 	### (yellow on blue).
-	def debugMsg( msg )
+	def debug_msg( msg )
 		return unless $DEBUG
 		msg.chomp!
 		$stderr.puts ansiCode( 'bold', 'yellow', 'on_blue' ) + ">>> #{msg}" + ansiCode( 'reset' )
 
 		Dir::chdir( directory ) do
 			output = %x{svn info}
-			debugMsg( "Using info: %p" % output )
+			debug_msg( "Using info: %p" % output )
 
 			if /^URL: \s* ( .* )/xi.match( output )
 				uri = URI::parse( $1 )
 		if File::exists? catalogFile
 			verboseMsg "Extracting '#{keyword}' from CATALOG file (%s).\n" % catalogFile
 			File::foreach( catalogFile ) {|line|
-				debugMsg( "Examining line #{line.inspect}..." )
+				debug_msg( "Examining line #{line.inspect}..." )
 				val = $1.strip and break if /^#\s*#{keyword}:\s*(.*)$/i =~ line
 			}
 		end