Lemma l=null;
int iidx=this.badSearches.indexOf(lemma);
if(iidx<0)
{
Document xml=this.loadURL(url);
String text="";
if(xml!=null)
text=xml.getRootElement().getValue();
if(xml!=null&&!text.contains(this.missingMSG)&&!text.contains(this.wikiErrorMSG))
{
ArrayList<URL> urls=new ArrayList<URL>();
ArrayList<Integer> levels=new ArrayList<Integer>();
ArrayList<Integer> hindex=new ArrayList<Integer>();
ArrayList<String> heads=new ArrayList<String>();
for(Element div:xml.getDescendants(new ElementFilter("div")))
{
if(div.getAttributeValue("id")!=null&&div.getAttributeValue("id").equals("content"))
{
ElementFilter f=new ElementFilter("a");
Filter<? extends Content> or=f.or(new ElementFilter("span"));
for(Content c:div.getDescendants(or))
{
if(c.getCType()==CType.Element)
{
Element word=(Element)c;
if(word.getName().equals("a"))
{
String href=word.getAttributeValue("href");
if(href!=null&&href.startsWith("/wiki"))
{
urls.add(new URL(this.path+href));
hindex.add(new Integer(heads.size()-1));
}
}
else
{
if(word.getAttributeValue("class")!=null && word.getAttributeValue("class").equals("mw-headline"))
{
heads.add(word.getAttributeValue("id"));
Element e=word.getParentElement();
levels.add(new Integer(Integer.parseInt(e.getName().substring(1))-2));
}
}
}
}
break;
}
}
ArrayList<Sense> senses=new ArrayList<Sense>(urls.size());
for(int i=0;i<urls.size();i++)
{
String urlx=urls.get(i).getFile().replace("/wiki/", "");
if(!this.isNotAnArticle(urlx))//it is a sense
{
senses.add(this.getSense(urlx.replace("/", "")));
}
}
ArrayList<Count> counts=new ArrayList<Count>();
counts.add(this.getWikiCounts(lemma)); ;
l=new Lemma(lemma,"",senses,counts,this.name);
}
else
{
url=new URL(this.path+"wiki/"+lemma.replace(" ", "_"));
xml=this.loadURL(url);
if(xml!=null)
text=xml.getRootElement().getValue();
if(xml!=null&&!text.contains(this.missingMSG)&&!text.contains(this.wikiErrorMSG))
{
if(text.contains(this.disambiguationMSG)&&!this.jump)
{
this.jump=true;