Set<String> skipPaths = new HashSet<String>();
String line, ontoPath = "", semPath = "";
int i, treeId, predId, prevId = -1;
CTTree tree1 = null, tree2 = null;
IntArrayList[] lists;
IntArrayList list;
String[] tmp;
while ((line = fin.readLine()) != null)
{
tmp = line.split(" ");
if (skipPaths.contains(tmp[0])) continue;
if (!semPath.equals(tmp[0]))
{
ontoPath = UTFile.replaceExtension("nw"+File.separator+tmp[0], "parse");
if (!new File(ontoDir+File.separator+ontoPath).exists())
{
skipPaths.add(tmp[0]);
continue;
}
semPath = tmp[0];
prevId = -1;
reader1.close();
reader2.close();
reader1.open(UTInput.createBufferedFileReader(ontoDir+File.separator+ontoPath));
reader2.open(UTInput.createBufferedFileReader(semDir +File.separator+semPath));
}
treeId = Integer.parseInt(tmp[1]);
predId = Integer.parseInt(tmp[2]);
for (i=0; i<treeId-prevId; i++)
{
tree1 = reader1.nextTree();
tree2 = reader2.nextTree();
}
prevId = treeId;
lists = CTLib.getTokenMapList(tree2, tree1);
if (lists == null)
{
skipPaths.add(tmp[0]);
continue;
}
list = lists[tree2.getTerminal(predId).getTokenId()];
if (list.size() > 1)
{
skipPaths.add(tmp[0]);
continue;
}
predId = tree1.getToken(list.get(0)).getTerminalId();
map.put(getKey(ontoPath, treeId, predId), tmp[4]);
}
return map;
}