@Test public void testTag() { System.out.println("tag"); assertEquals(PennTreebankPOS.CD, RegexPOSTagger.tag("123")); assertEquals(PennTreebankPOS.CD, RegexPOSTagger.tag("1234567890")); assertEquals(PennTreebankPOS.CD, RegexPOSTagger.tag("123.45")); assertEquals(PennTreebankPOS.CD, RegexPOSTagger.tag("1,234")); assertEquals(PennTreebankPOS.CD, RegexPOSTagger.tag("1,234.5678")); assertEquals(PennTreebankPOS.NN, RegexPOSTagger.tag("914-544-3333")); assertEquals(PennTreebankPOS.NN, RegexPOSTagger.tag("544-3333")); assertEquals(PennTreebankPOS.NN, RegexPOSTagger.tag("x123")); assertEquals(PennTreebankPOS.NN, RegexPOSTagger.tag("x123")); assertEquals(PennTreebankPOS.NN, RegexPOSTagger.tag("http: assertEquals(PennTreebankPOS.NN, RegexPOSTagger.tag("ftp: assertEquals(PennTreebankPOS.NN, RegexPOSTagger.tag("nobody@usc.edu")); assertEquals(PennTreebankPOS.NN, RegexPOSTagger.tag("no.body@usc.edu.cn")); assertEquals(PennTreebankPOS.NN, RegexPOSTagger.tag("no_body@usc.edu.cn")); }
public static PennTreebankPOS tag(String word) { for (int i = 0; i < REGEX.length; i++) { if (REGEX[i].matcher(word).matches()) { return REGEX_POS[i]; } } return null; }
RegexPOSTagger { public static PennTreebankPOS tag(String word) { for (int i = 0; i < REGEX.length; i++) { if (REGEX[i].matcher(word).matches()) { return REGEX_POS[i]; } } return null; } }
RegexPOSTagger { public static PennTreebankPOS tag(String word) { for (int i = 0; i < REGEX.length; i++) { if (REGEX[i].matcher(word).matches()) { return REGEX_POS[i]; } } return null; } private  RegexPOSTagger(); }
RegexPOSTagger { public static PennTreebankPOS tag(String word) { for (int i = 0; i < REGEX.length; i++) { if (REGEX[i].matcher(word).matches()) { return REGEX_POS[i]; } } return null; } private  RegexPOSTagger(); static PennTreebankPOS tag(String word); }
RegexPOSTagger { public static PennTreebankPOS tag(String word) { for (int i = 0; i < REGEX.length; i++) { if (REGEX[i].matcher(word).matches()) { return REGEX_POS[i]; } } return null; } private  RegexPOSTagger(); static PennTreebankPOS tag(String word);  }