My sentence is "ram is going to school"
after giving input it will give an parse tree as:
2|TYPE| nx0-VPadjn-VPx1 0|NOUN| NXN 1|AUX| Vvx 3|PREP| Pnx 4|NOUN| NXN
I want to reorder it to
0|NOUN| NXN 1|AUX| Vvx 2|TYPE| nx0-VPadjn-VPx1 3|PREP| Pnx 4|NOUN| NXN
I wrote this code. What should I do to make it work?
Please tell me whether it is possible with HashMap
. If possible then please tell me how?
for(int j=1;j<2;j++) //when multiple parsing is to be done then change the limit to ---parsedderived.length
{
parsedderived[j] = parsedderived[j].replaceAll("\\^|\\(|\\)|\\~|\\.|\"", " ");
parsedderived[j] = parsedderived[j].replaceAll("\\{\\S+\\}", "");
parsedderived[j] = parsedderived[j].replaceAll("[ ]+", " ");
parsedderived[j] = parsedderived[j].replaceAll("(\\d+)\\s+(\\S+)\\s+(\\S+)", "$1-$2@@$3");
preparedStatement.setString(4, parsedderived[j]);
//String[] x=objSentenceStatusImpl.getStrSourceSen().split("");
String[] derivedsen=parsedderived[j].split(" ");
// for(int k=1;k<derivedsen.length;k++)
// {
// String[] derivedsen1=derivedsen[k].split("");
// System.out.println(derivedsen);
// }
String[]Senwords=objSentenceStatusImpl.getStrSourceSen().split("\\s+");//original sentence ram is going to school
Map<Integer, String> entriesMap = new LinkedHashMap<Integer, String>();
for(int i = 0; i < Senwords.length; i++) {//for iterration of sen
parsedderived[j]=parsedderived[j].replaceFirst(" ","");
parsedderived[j]=parsedderived[j].replaceAll(" ", "##");
System.out.println(parsedderived[j]);
}
}