edu.stanford.nlp.process
Class Americanize

java.lang.Object
  extended by edu.stanford.nlp.process.Americanize
All Implemented Interfaces:
Function, Serializable

public class Americanize
extends Object
implements Function

Takes a HasWord or String and returns a lowercase version of it. This is deterministic spelling coversion, and so cannot deal with certain cases involving complex ambiguities, but it can do most of the simple case of English to American conversion. This list is still quite incomplete, but does some of the commenest cases found when running our parser or doing biomedical processing.

Author:
Christopher Manning
See Also:
Serialized Form

Field Summary
static int DONT_CAPITALIZE_TIMEX
           
 
Constructor Summary
Americanize()
           
Americanize(int flags)
          Make an object for Americanizing spelling.
 
Method Summary
static String americanize(String str)
          Convert the spelling of a word from British to American English.
static String americanize(String str, boolean capitalizeTimex)
          Convert the spelling of a word from British to American English.
 Object apply(Object in)
          Americanize the HasWord or String coming in.
static void main(String[] args)
          Americanize and print the command line arguments.
 void setStaticCapitalizeTimex(boolean capitalizeTimex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DONT_CAPITALIZE_TIMEX

public static final int DONT_CAPITALIZE_TIMEX
See Also:
Constant Field Values
Constructor Detail

Americanize

public Americanize()

Americanize

public Americanize(int flags)
Make an object for Americanizing spelling.

Parameters:
flags - An integer representing bit flags. At present the only recognized flag is DONT_CAPITALIZE_TIMEX = 1 which suppresses capitalization of days of the week and months
Method Detail

apply

public Object apply(Object in)
Americanize the HasWord or String coming in.

Specified by:
apply in interface Function
Parameters:
in - A HasWord or String to covert to American if needed.
Returns:
Either the input or an Americanized version of it.

americanize

public static String americanize(String str)
Convert the spelling of a word from British to American English. This is deterministic spelling coversion, and so cannot deal with certain cases involving complex ambiguities, but it can do most of the simple cases of English to American conversion. Month and day names will be capitalized unless you have changed the default setting.

Parameters:
str - The String to be Americanized
Returns:
The American spelling of the word.

americanize

public static String americanize(String str,
                                 boolean capitalizeTimex)
Convert the spelling of a word from British to American English. This is deterministic spelling coversion, and so cannot deal with certain cases involving complex ambiguities, but it can do most of the simple cases of English to American conversion.


setStaticCapitalizeTimex

public void setStaticCapitalizeTimex(boolean capitalizeTimex)

main

public static void main(String[] args)
Americanize and print the command line arguments. This main method is just for debugging.



Stanford NLP Group