Commits

Michael Granger committed 2640c84

Fixes for 1.9.1 and license consistency update.

  • Participants
  • Parent commits 5608e79

Comments (0)

Files changed (6)

File lib/linguistics.rb

 #!/usr/bin/ruby
-# 
-# linguistics.rb -- provides an interface for extending core Ruby classes with
-# linguistic methods.
+
+require 'linguistics/iso639'
+
+# A language-independent framework for adding linguistics functions to Ruby
+# classes.
 # 
 # == Synopsis
 # 
 # 
 # * Michael Granger <ged@FaerieMUD.org>
 # 
-# == Copyright
+# :include: LICENSE
 #
-# Copyright (c) 2003-2005 The FaerieMUD Consortium. All rights reserved.
-# 
-# This module is free software. You may use, modify, and/or redistribute this
-# software under the terms of the Perl Artistic License. (See
-# http://language.perl.com/misc/Artistic.html)
-# 
-# == Version
+#--
 #
-#  $Id$
-# 
-
-require 'linguistics/iso639'
-
-### A language-independent framework for adding linguistics functions to Ruby
-### classes.
-module Linguistics 
+# Please see the file LICENSE in the base directory for licensing details.
+#
+module Linguistics
 
 	### Class constants
 
-	# Subversion revision
-	SVNRev = %q$Rev$
-
-	# Subversion ID
-	SVNid = %q$Id$
-
 	# Release version
 	VERSION = '1.0.7'
 

File lib/linguistics/en.rb

 # 
 # * Michael Granger <ged@FaerieMUD.org>
 # 
-# == Copyright
+# == Acknowledgements
 #
-# This module is copyright (c) 2003-2005 The FaerieMUD Consortium. All rights
-# reserved.
-# 
-# This module is free software. You may use, modify, and/or redistribute this
-# software under the terms of the Perl Artistic License. (See
-# http://language.perl.com/misc/Artistic.html)
-# 
 # The inflection functions of this module were adapted from Damien Conway's
 # Lingua::EN::Inflect Perl module:
 #
 # written by Robert Rothenberg and Damian Conway, which has no copyright
 # statement included.
 #
-# == Version
+# :include: LICENSE
 #
-#  $Id$
-# 
-
-
-### This module contains English-language linguistics functions accessible from
-### the Linguistics module, or as a standalone function library.
+#--
+#
+# Please see the file LICENSE in the base directory for licensing details.
+#
 module Linguistics::EN
 
-	begin
-		require 'crosscase'
-	rescue LoadError
-	else
-		include CrossCase
-	end
-
 	# Load in the secondary modules and add them to Linguistics::EN.
 	require 'linguistics/en/infinitive'
 	require 'linguistics/en/wordnet'
 	require 'linguistics/en/linkparser'
 
-	# Subversion revision
-	SVNRev = %q$Rev$
-
-	# Subversion revision tag
-	SVNId = %q$Id$
-
 	# Add 'english' to the list of default languages
 	Linguistics::DefaultLanguages.push( :en )
 
 		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
-	
+
 
 
 	#################################################################
 	# (in, of, to), and coordinating conjunctions (and, but). These rules apply
 	# to titles of long, short, and partial works as well as your own papers"
 	# (Anson, Schwegler, and Muth. The Longman Writer's Companion 240).
-	
+
 	# Build the list of exceptions to title-capitalization
 	Articles = %w[a and the]
 	ShortPrepositions = ["amid", "at", "but", "by", "down", "from", "in",
 	def pluralize_special_verb( word, count )
 		count ||= Linguistics::num
 		count = normalize_count( count )
-		
+
 		return nil if /^(#{PL_count_one})$/i =~ count.to_s
 
 		# Handle user-defined verbs
 	def pluralize_general_verb( word, count )
 		count ||= Linguistics::num
 		count = normalize_count( count )
-		
+
 		return word if /^(#{PL_count_one})$/i =~ count.to_s
 
 		case word
 			return "an #{word}"
 		when /^[aefhilmnorsx][.-]/i
 			return "an #{word}"
-		when /^[a-z][.-]/i	
+		when /^[a-z][.-]/i
 			return "a #{word}"
 
 		# Handle consonants
 			return "a #{word}"
 
 		# Handle special vowel-forms
-		when /^e[uw]/i	
+		when /^e[uw]/i
 			return "a #{word}"
-		when /^onc?e\b/i	
+		when /^onc?e\b/i
 			return "a #{word}"
 		when /^uni([^nmd]|mo)/i
 			return "a #{word}"
 										 config[:and] )
 					chunks.unshift words.strip.squeeze(' ') unless words.nil?
 					''
-				}				
+				}
 
 			phrase.sub!( /(\d)(\d)(?=\D*\Z)/ ) {
 				chunks.unshift to_tens( $1.to_i, $2.to_i, mill ).strip.squeeze(' ')
 	### Participles
 	def present_participle( word )
         plural = plural_verb( word.to_s, 2 )
-		
+
 		plural.sub!( /ie$/, 'y' ) or
 			plural.sub!( /ue$/, 'u' ) or
 			plural.sub!( /([auy])e$/, '$1' ) or
 		}
 
 		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.
 		if ord && !parts[0].empty?
 		# post-decimal parts. If grouping is turned on, all sub-parts get joined
 		# with commas, otherwise just the whole-number part is.
 		if config[:group].zero?
-			if parts[0].nitems > 1
+			if parts[0].length > 1
 
 				# Join all but the last part together with commas
 				wholenum = parts[0][0...-1].join( config[:comma] )
 	def ordinate( number )
 		numwords( number ).ordinal
 	end
-	
+
 
 	### Return a phrase describing the specified +number+ of objects in the
 	### given +phrase+ in general terms. The following options can be used to 
 	def quantify( phrase, number=0, args={} )
 		num = number.to_i
 		config = QuantifyDefaults.merge( args )
-		
+
 		case num
 		when 0
 			no( phrase )
 			else
 				proc {|key| key.strip}
 			end
-		
+
 		# Count and delete phrases that hash the same when the keyfunc munges
 		# them into the same thing if we're combining (:combine => true).
 		collector = {}
 		if config[:combine]
-		
+
 			phrases.each_index do |i|
 				# Stop when reaching the end of a truncated list
 				break if phrases[i].nil?
 
 		# Split on word-boundaries
 		words = string.split( /\b/ )
- 		
+
 		# Always capitalize the first and last words
 		words.first.capitalize!
 		words.last.capitalize!
 		end
 		self
 	end
-		
+
 end
 

File lib/linguistics/en/infinitive.rb

 # 
 # * Michael Granger <ged@FaerieMUD.org>
 # 
-# == Copyright
+# == Acknowledgments
 #
-# Copyright (c) 2003-2005 The FaerieMUD Consortium. All rights reserved.
-# 
-# This module is free software. You may use, modify, and/or redistribute this
-# software under the terms of the Perl Artistic License. (See
-# http://language.perl.com/misc/Artistic.html)
-# 
 # This code was ported from the excellent 'Lingua::EN::Infinitive' Perl module
 # by Ron Savage, which is distributed under the following license:
 #
 #    	The Artistic License, a copy of which is available at:
 #    	http://www.opensource.org/licenses/index.html
 #    
-#  # == Version
 #
-#  $Id$
-# 
-
+# :include: LICENSE
+#
+#--
+#
+# Please see the file LICENSE in the base directory for licensing details.
+#
 module Linguistics::EN
 
 	# :stopdoc:

File lib/linguistics/en/linkparser.rb

 #!/usr/bin/ruby
+
+require 'linguistics/en'
+
 # 
 # This file contains the extensions to the Linguistics::EN module which provide
 # support for the Ruby LinkParser module. LinkParser enables grammatic queries
 # * Martin Chase <stillflame@FaerieMUD.org>
 # * Michael Granger <ged@FaerieMUD.org>
 # 
-# == Copyright
+# :include: LICENSE
 #
-# Copyright (c) 2003 The FaerieMUD Consortium. All rights reserved.
-# 
-# This module is free software. You may use, modify, and/or redistribute this
-# software under the terms of the Perl Artistic License. (See
-# http://language.perl.com/misc/Artistic.html)
-# 
-#  # == Version
+#--
 #
-#  $Id$
-# 
-
-require 'linguistics/en'
-
+# Please see the file LICENSE in the base directory for licensing details.
+#
 module Linguistics::EN
 
 	@has_link_parser	= false

File lib/linguistics/en/wordnet.rb

 # 
 # * Michael Granger <ged@FaerieMUD.org>
 # 
-# == Copyright
-# 
 # :include: LICENSE
 # 
 # == Version

File lib/linguistics/iso639.rb

 #!/usr/bin/ruby
+#coding: utf-8
+
 #
 # linguistics/iso639.rb - A hash of International 2- and 3-letter 
 # ISO639-1 and ISO639-2 language codes. Each entry has two keys:
 # [<tt>:desc</tt>]
 #   The English-language description of the language.
 #
-
-### A language-independent framework for adding linguistics functions to Ruby
-### classes.
+# :include: LICENSE
+#
+#--
+#
+# Please see the file LICENSE in the base directory for licensing details.
+#
 module Linguistics
 
 	# Hash of ISO639 2- and 3-letter language codes
 		when /^__END_DATA__$/
 			in_data_section = false
 			false
-			
+
 		when /^__END__$/
 			in_data_section = true
 			false
-			
+
 		else
 			if in_data_section
 				codes, desc = line[0,15].split(%r{/|\s+}), line[15...-1]
 vai            Vai
 ven            Venda
 vie      vi    Vietnamese
-vol      vo    Volap�k
+vol      vo    Volap�k
 vot            Votic
 wak            Wakashan languages
 wal            Walamo