Java 类org.apache.lucene.analysis.icu.tokenattributes.ScriptAttribute 实例源码

项目:search    文件:TestICUTokenizer.java   
public void testTokenAttributes() throws Exception {
  TokenStream ts = a.tokenStream("dummy", "This is a test");
  try {
    ScriptAttribute scriptAtt = ts.addAttribute(ScriptAttribute.class);
    ts.reset();
    while (ts.incrementToken()) {
      assertEquals(UScript.LATIN, scriptAtt.getCode());
      assertEquals(UScript.getName(UScript.LATIN), scriptAtt.getName());
      assertEquals(UScript.getShortName(UScript.LATIN), scriptAtt.getShortName());
      assertTrue(ts.reflectAsString(false).contains("script=Latin"));
    }
    ts.end();
  } finally {
    IOUtils.closeWhileHandlingException(ts);
  }
}
项目:Maskana-Gestor-de-Conocimiento    文件:TestICUTokenizer.java   
public void testTokenAttributes() throws Exception {
  TokenStream ts = a.tokenStream("dummy", "This is a test");
  try {
    ScriptAttribute scriptAtt = ts.addAttribute(ScriptAttribute.class);
    ts.reset();
    while (ts.incrementToken()) {
      assertEquals(UScript.LATIN, scriptAtt.getCode());
      assertEquals(UScript.getName(UScript.LATIN), scriptAtt.getName());
      assertEquals(UScript.getShortName(UScript.LATIN), scriptAtt.getShortName());
      assertTrue(ts.reflectAsString(false).contains("script=Latin"));
    }
    ts.end();
  } finally {
    IOUtils.closeWhileHandlingException(ts);
  }
}
项目:NYBC    文件:TestICUTokenizer.java   
public void testTokenAttributes() throws Exception {
  TokenStream ts = a.tokenStream("dummy", new StringReader("This is a test"));
  ScriptAttribute scriptAtt = ts.addAttribute(ScriptAttribute.class);
  ts.reset();
  while (ts.incrementToken()) {
    assertEquals(UScript.LATIN, scriptAtt.getCode());
    assertEquals(UScript.getName(UScript.LATIN), scriptAtt.getName());
    assertEquals(UScript.getShortName(UScript.LATIN), scriptAtt.getShortName());
    assertTrue(ts.reflectAsString(false).contains("script=Latin"));
  }
  ts.end();
  ts.close();
}