Parsing a Query string to build expression tree C++
I Did manage to find someone who asked a similar question but the answer was not complete enough for me. I am trying to parse a command such as
QUERY ((((fire)&(forest))|((ocean)&(boat)))&(water))
The problem is the result in RPN that I get if I use the Shuntin开发者_JAVA百科g-Yard algorithm. For instance if I type:
QUERY (apple)&(sauce)
the result I get is:
applesauce&
I want to be able to compare the containing lines that have the word apple in them with the containing lines that have sauce in them.
well the thing is, I want to be able to search through my BST of words for apple then again for sauce and then find all lines of text where they occur together. I have the functions set up that return a set with each line, so thats not the problem. The problem is that rpn is little better than what i started with. I cant find a good way to parse the new "string" I get.
I hope I am making myself clear.
精彩评论