}
}
public void process(JCas jcas) {
JFSIndexRepository indexes = jcas.getJFSIndexRepository();
Iterator<?> tokenItr = indexes.getAnnotationIndex(WordToken.type)
.iterator();
/*
* some cases there is no word token for a given jcas So, if initial
* classVal is "null" this null is assigned for class value and cause
* error.
*/
String classVal = Const.CLASS_UNKNOWN;
while (tokenItr.hasNext()) {
WordToken token = (WordToken) tokenItr.next();
String strToken = token.getCoveredText();
// System.out.println("***word:" + strToken);
if (strToken == null)
continue;
if (!caseSensitive)
strToken = strToken.toLowerCase();
if (smokingWords.contains(strToken)) {
classVal = Const.CLASS_KNOWN;
// System.out.println("***smoking word found");
break;
}
}
// This is to check if there is unknown indication words when found
// smoking related word
// e.g.: Smoke Detector in-Home------ Yes
if (classVal.equals(Const.CLASS_KNOWN)) {
String sen = jcas.getDocumentText(); // This is sentence here!!
Iterator<String> itr = unknownWords.iterator();
while (itr.hasNext()) {
String s = (String) itr.next();
if (sen.toLowerCase().trim().matches(".*" + s + ".*")) { // need
// trim()!!
// System.out.println("***UnknownWords|"+s+"|");
classVal = Const.CLASS_UNKNOWN;
break;
}
}
}
// ---
//
Iterator<?> neItr = indexes.getAnnotationIndex(
UnknownSmokerNamedEntityAnnotation.type).iterator();
while (neItr.hasNext()) {
UnknownSmokerNamedEntityAnnotation neAnn = (UnknownSmokerNamedEntityAnnotation) neItr
.next();
System.out.println("***UnknownNamedEntity|"