Disclaimer, I have no formal background in linguistics so I'm really asking in the dark here.
Problem: I'm trying to write a program that, given a grammatically correct (this is assumed) sentence, lists out all the grammatical patterns used in the sentence. My goal is to do this for multiple languages but I'll focus only on English for now.
Example:
Input: I have been studying for the exam but I am still nervous.
Output:
- Present perfect continuous (S + have been + v)
- Clause conjunction (C1 + but + C2)
- Present be verb + adjective (S + be + adj.)
My hunch on the solution:
- Create tree traversal algorithm for each grammar pattern
- Tokenize the sentence and generate the (most likely) syntax tree and PoS of each token
- Run each traversal algorithm on the tree and save matching patterns
I honestly can't gauge how easy / difficult this question is. Some points that bug me are:
- How practical is it to list out all the grammatical patterns of a language?
- Will the running time be within reasonable bounds? (< 5s?)
- Are there any intractable edge cases?