for(ArrayList<String> lemmas:parsedGloss)
for(String lemma:lemmas)
{
//String lemma=lemmas.get(0);
lineout+=lemma+" ";
int j=gcounts.indexOf(new KeyString(lemma));
if(j<0)
{
gcounts.add(new KeyString(lemma,"1"));
}
else
{
KeyString ks=gcounts.get(j);
ks.setString(String.valueOf(Integer.parseInt(ks.getString())+1));
}
}
lineout=lineout.substring(0,lineout.length()-1)+"\n";
outg.write(lineout);
for(int k=1;k<samples.length;k++)
{
if(samples[k].split(" ").length>2)
{
String sample=samples[k];
lineout=sid+"|"+sample+"|";
ArrayList<ArrayList<String>> parsedSample=lemmatize(sample);
for(ArrayList<String> lemmas:parsedSample)
for(String lemma:lemmas)
{
lineout+=lemma+" ";
int j=scounts.indexOf(new KeyString(lemma));
if(j<0)
{
scounts.add(new KeyString(lemma,"1"));
}
else
{
KeyString ks=scounts.get(j);
ks.setString(String.valueOf(Integer.parseInt(ks.getString())+1));
}
}
lineout=lineout.substring(0,lineout.length()-1)+"\n";
outs.write(lineout);
}
}
//Parsing the gloss or the samples
}
line=in.readLine();
}
in.close();
inf.close();
i++;
}
for(KeyString ks:gcounts)
{
outcg.write(ks.getKey()+"|"+ks.getString()+"\n");
}
for(KeyString ks:scounts)
{
outcs.write(ks.getKey()+"|"+ks.getString()+"\n");
}
outcg.close();
outcs.close();
writecs.close();
writecg.close();