/** * Americanize and print the command line arguments. * This main method is just for debugging. * * @param args Command line arguments: a list of words */ public static void main(String[] args) throws IOException { log.info(new Americanize()); if (args.length == 0) { // stdin -> stdout: try (BufferedReader buf = new BufferedReader(new InputStreamReader(System.in))) { for (String line; (line = buf.readLine()) != null; ) { for (String w : line.split("\\s+")) { System.out.print(Americanize.americanize(w)); System.out.print(' '); } System.out.println(); } } } for (String arg : args) { System.out.print(arg); System.out.print(" --> "); System.out.println(americanize(arg)); } }
public String apply(String input) { if (input == null) { return null; } return Americanize.americanize(input); }
/** * Convert the spelling of a word from British to American English. * This is deterministic spelling conversion, 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. * * @param str The String to be Americanized * @return The American spelling of the word. */ public static String americanize(String str) { return americanize(str, true); }
@Override public String apply(String input) { if (input == null) { return null; } return Americanize.americanize(input.toLowerCase()); }
/** * Americanize and print the command line arguments. * This main method is just for debugging. * * @param args Command line arguments: a list of words */ public static void main(String[] args) throws IOException { System.err.println(new Americanize()); System.err.println(); if (args.length == 0) { // stdin -> stdout: BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); String line; while((line = buf.readLine()) != null) { for(String w : line.split("\\s+")) { System.out.print(Americanize.americanize(w)+" "); } System.out.println(); } buf.close(); } for (String arg : args) { System.out.print(arg); System.out.print(" --> "); System.out.println(americanize(arg)); } }
private String fix(String word) { if (flags.normalizeTerms || flags.normalizeTimex) { // Same case for days/months: map to lowercase if (monthDayPattern.matcher(word).matches()) { return word.toLowerCase(); } } if (flags.normalizeTerms) { return Americanize.americanize(word, false); } return word; }
/** * Americanize and print the command line arguments. * This main method is just for debugging. * * @param args Command line arguments: a list of words */ public static void main(String[] args) throws IOException { log.info(new Americanize()); if (args.length == 0) { // stdin -> stdout: try (BufferedReader buf = new BufferedReader(new InputStreamReader(System.in))) { for (String line; (line = buf.readLine()) != null; ) { for (String w : line.split("\\s+")) { System.out.print(Americanize.americanize(w)); System.out.print(' '); } System.out.println(); } } } for (String arg : args) { System.out.print(arg); System.out.print(" --> "); System.out.println(americanize(arg)); } }
/** * Americanize the HasWord or String coming in. * * @param w A HasWord or String to covert to American if needed. * @return Either the input or an Americanized version of it. */ @Override public HasWord apply(HasWord w) { String str = w.word(); String outStr = americanize(str, capitalizeTimex); if (!outStr.equals(str)) { w.setWord(outStr); } return w; }
/** * Americanize and print the command line arguments. * This main method is just for debugging. * * @param args Command line arguments: a list of words */ public static void main(String[] args) throws IOException { System.err.println(new Americanize()); System.err.println(); if (args.length == 0) { // stdin -> stdout: BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); String line; while((line = buf.readLine()) != null) { for(String w : line.split("\\s+")) { System.out.print(Americanize.americanize(w)); System.out.print(' '); } System.out.println(); } buf.close(); } for (String arg : args) { System.out.print(arg); System.out.print(" --> "); System.out.println(americanize(arg)); } }
public String apply(String input) { if (input == null) { return null; } return Americanize.americanize(input); }
/** * Americanize and print the command line arguments. * This main method is just for debugging. * * @param args Command line arguments: a list of words */ public static void main(String[] args) throws IOException { log.info(new Americanize()); if (args.length == 0) { // stdin -> stdout: try (BufferedReader buf = new BufferedReader(new InputStreamReader(System.in))) { for (String line; (line = buf.readLine()) != null; ) { for (String w : line.split("\\s+")) { System.out.print(Americanize.americanize(w)); System.out.print(' '); } System.out.println(); } } } for (String arg : args) { System.out.print(arg); System.out.print(" --> "); System.out.println(americanize(arg)); } }
public String apply(String input) { if (input == null) { return null; } return Americanize.americanize(input); }
/** * Convert the spelling of a word from British to American English. * This is deterministic spelling conversion, 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. * * @param str The String to be Americanized * @return The American spelling of the word. */ public static String americanize(String str) { return americanize(str, true); }
public String apply(String input) { if (input == null) { return null; } return Americanize.americanize(input); }
/** * Convert the spelling of a word from British to American English. * This is deterministic spelling conversion, 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. * * @param str The String to be Americanized * @return The American spelling of the word. */ public static String americanize(String str) { return americanize(str, true); }
/** * Convert the spelling of a word from British to American English. * This is deterministic spelling conversion, 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. * * @param str The String to be Americanized * @return The American spelling of the word. */ public static String americanize(String str) { return americanize(str, DEFAULT_CAPITALIZE_TIMEX); }
/** * Convert the spelling of a word from British to American English. * This is deterministic spelling conversion, 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. * * @param str The String to be Americanized * @return The American spelling of the word. */ public static String americanize(String str) { return americanize(str, true); }
@Override public String apply(String input) { if (input == null) { return null; } return Americanize.americanize(input.toLowerCase()); }
@Override public String apply(String input) { if (input == null) { return null; } return Americanize.americanize(input.toLowerCase()); }
public String apply(String input) { if (input == null) { return null; } return Americanize.americanize(input.toLowerCase()); }