english
Class EnglishWord

java.lang.Object
  extended by english.EnglishWord

public class EnglishWord
extends java.lang.Object

An experimental class that provides static methods for testing and computing various properties of strings that are presumed to be English words.

Author:
James A. Mason

Constructor Summary
EnglishWord()
           
 
Method Summary
static boolean isPreposition(java.lang.String word)
          Tests whether a given String can be an English preposition.
static java.util.ArrayList processApostrophe(java.lang.String givenWord)
          Tests and processes a given String (assumed to be a word with no space in it) which may have apostrophes in it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnglishWord

public EnglishWord()
Method Detail

isPreposition

public static boolean isPreposition(java.lang.String word)
Tests whether a given String can be an English preposition.


processApostrophe

public static java.util.ArrayList processApostrophe(java.lang.String givenWord)
Tests and processes a given String (assumed to be a word with no space in it) which may have apostrophes in it. If the string has an apostrophe, the method tries to expand the string into a string of one or more lexical items, separated by spaces, and identifies the string, to the extent possible, as one or more of "C", "L", "P" or "U" for "Contraction", "pLural", "Possessive", or "Unknown".  If the identifying string has length 2 or more, the given string is ambiguous among the types indicated in the identifying string.  Examples are:
   "car's" -> ("car APOSTROPHEs", "CP")
               's could be possessive or "is" or "has"
               (as in "the car's been in the shop")
   "cars'" -> ("cars APOSTROPHE", "P")
   "a's" -> ("a APOSTROPHEs", "CLP")
             's could be possessive or "is" or "has" or
             plural ending
   "I'm" -> ("I am", "C")
   "it's" -> ("it is", "C")
   "'t's" -> ("it is", "C")
   "they'll" -> ("they will", "C")
   "goin'" -> ("going", "C")
   "we're" -> ("we are", "C")
   "'til" -> ("until", "C")
   "'tis" -> ("it is", "C")
   "'tisn't" -> ("it is not", "C")
   "'taint" -> ("it aint", "C")
   "'twill" -> ("it will", "C")
   "'twould" -> ("it would", "C")
   "'twouldn't" -> ("it would not", "C")
   "girl'd" -> ("girl 'd", "C")
                Note: "'d" could represent "had" or "would".
   "you'd" -> ("you 'd", "C")
   "you'ld" -> ("you would", "C")
   "can't" -> ("cannot", "C")
   "don't" -> ("do not", "C")

If there is no apostrophe in the given String, the method returns null. If the string (e.g. "o'clock", "O'Reilly") has an apostrophe but is not one of the types that the method recognizes, the "expanded" String in the returned value is the same as the given String, and the description in the returned value is "U" for Unknown.

Note: This method retains the initial capitalization of the first letter of the given string.

Parameters:
givenWord - a presumed English word that may have apostrophes in it.
Returns:
an ArrayList containing the expanded String and a String that describes it; the returned value is null if the given word has no apostrophes.