I ran into this question earlier today:
Example Input: I ran into Joe and Jill and then we went shopping
Example Output: [TOP [S [S [NP [PRP I]] [VP [VBD ran] [PP [IN into] [NP [NNP Joe] [CC and] [NNP Jill]]]]] [CC and] [S [ADVP [RB then]] [NP [PRP we]] [VP [VBD went] [NP [NN shopping]]]]]]
I was about to suggest simply parsing the expected output (as it looks like an s-expression) into an object (in our case a tree) and then using simple LINQ methods to process it. However, to my surprise, I was unable to find a C# s-expression parser.
The only thing I could think of is using Clojure to parse it since it compiles to the clr, I'm not sure it's a good solution though.
By the way, I don't mind the answer to output of type dynamic
. Only answers I've found here were for deserializing into a specific schema.
To sum up my question: I need to deserialize s-expressions in C# (serialization would be nice for future readers of this question)