StandardBgramAnalyzer analyzer = new StandardBgramAnalyzer(); analyzer.setExtractEntities(true);
TokenStream stream = analyzer.tokenStream("contents", new StringReader(question));
ArrayList<Token> tokenList = new ArrayList<Token>(); Token token = null;
entities = new ArrayList<String>(); //*-- list of entities in the question
while ( (token = stream.next()) != null)
{ tokenList.add(token); if (token.type().equals("<ENTITY>")) entities.add(token.termText()); }
//*-------------------------------------------------------------------
//*-- build the query with the five components
//*--
//*-- 1. First identify the entity types for the query