ArrayList<Element> words=new ArrayList<Element>();
for(Element word:xml.getDescendants(new ElementFilter("wf")))
words.add(word);
for(int w=0;w<words.size();w++)
{
Element word=words.get(w);
if(word.getAttribute("ot")!=null)
{
word.setAttribute("cmd", "ignore");
}
if((word.getAttribute("cmd").getValue().equals("done"))||(tag&&(word.getAttribute("cmd").getValue().equals("tag"))))
{
String lemma=word.getValue();
String pos=word.getAttribute("pos").getValue().substring(0,1);
String lem;
Lemma l=null;
if(word.getAttribute("cmd").getValue().equals("done"))
{
if(word.getAttribute("lemma")!=null)
{
lemma=word.getAttribute("lemma").getValue();
pos=word.getAttribute("pos").getValue().substring(0,1);
lem=lemma+"_"+pos;
l=dic.getLemma(lem);
}
else
{
lemma="";
pos="X";
}
}
lem=lemma+"_"+pos;
if(l==null)//lemma may not be in normal form
{
SemCorCleaner.displayWindow(words, w);
SemCorCleaner.readLemma(dic, lemma, word, pos);
l=dic.getLemma(word.getAttributeValue("lemma")+"_"+word.getAttributeValue("pos").substring(0,1));
}
if(l!=null)
{
if(!SemCorCleaner.isValidWNSN(word.getAttributeValue("wnsn"), l.getSenses().size()))
{
SemCorCleaner.displayWindow(words, w);
SemCorCleaner.checkSenses(word, l);
}
}