Ulf Dittmer wrote:My first question would be: why store the parse tree when you can store the document (from which you can regenerate the parse tree any time you please) ?
They have given requirement like this. I am trying and trying. I think by using following code we can generate parse tree.
InputStream is = new FileInputStream("en-parser-chunking.bin");
ParserModel model = new ParserModel(is);
Parser parser = ParserFactory.create(model);
String sentence ="An Inverted Index is a data structure used to create full text search.";
Parse topParses = ParserTool.parseLine(sentence, parser, 1);
for (Parse p : topParses)
t sathya narayana wrote:They have given requirement like this...
Then I think you need to ask them why, because it sounds to me like they are not only telling you what to do, but how to do it; and that's almost always a recipe for disaster (too many 'cooks'...).
If this is part of a course, then they might be trying to see how you solve the problem; but if they are paying you to program, then my response would be to tell them to mind their own business (but I was never much of a diplomat ).
If it's the former, then you might want to look at Serializable (java.io.Serializable); but I warn you: there's quite a lot to know.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
There are different things you might do here, and which one is the best depends on the requirements about which we know very little. I still think you'd do best to ask "them" -whoever "they" are- what they're trying to accomplish, and then you can implement the best way to do that.
You could store the entire output as one record in the database (which i suspect is not part of your assignment). Or, you could look up any data structure book and see how a parse tree is stored (there will be a data structure for each node, and this node info can constitute one record in your database). I also suspect that it is a requirement that your program should be able to read the info "from the database", and be able to reconstruct the sentence/para.
Get out of my mind! Look! A tiny ad!
Free, earth friendly heat - from the CodeRanch trailboss