int c_id = en_words[c];
if(p_symbol.isNonterminal(c_id)==true){
//## get the left and right context
int index= p_symbol.getTargetNonterminalIndex(c_id);
HGNode ant_item = (HGNode) dt.getAntNodes().get(index);
NgramDPState state = (NgramDPState) ant_item.getDPState(this.ngramStateID);
List<Integer> l_context = state.getLeftLMStateWords();
List<Integer> r_context = state.getRightLMStateWords();
if (l_context.size() != r_context.size()) {
System.out.println("LMModel>>lookup_words1_equv_state: left and right contexts have unequal lengths");
System.exit(1);
}
for(int t : l_context)//always have l_context
words.add(t);
if(r_context.size()>=baseline_lm_order-1){//the right and left are NOT overlapping
if(match_a_span(words)==false)//no match
return true;//filter out
words.clear();//start a new chunk; the sequence stops whenever the right-lm-state jumps in (i.e., having eclipsed words)
for(int t : r_context)
words.add(t);
}
}else{
words.add(c_id);
}
}
if(words.size()>0){
if(match_a_span(words)==false)//no match
return true;//filter out
}
}else{//hyperedges under goal item
if(dt.getAntNodes().size()!=1){System.out.println("error deduction under goal item have more than one item"); System.exit(0);}
HGNode ant_item = (HGNode) dt.getAntNodes().get(0);
NgramDPState state = (NgramDPState) ant_item.getDPState(this.ngramStateID);
List<Integer> l_context = state.getLeftLMStateWords();
List<Integer> r_context = state.getRightLMStateWords();
if(matchLeftOrRightMostSpan(l_context, true)==false ||
matchLeftOrRightMostSpan(r_context, false)==false )//the left-most or right-most word does not match
return true;
}
return false;