I am trying to make a script that can dissect an English sentence.
Problem is, I have no idea how to dissect an English when the words are not familiar. I know what the nouns, verbs, etc are, because I reconize the words. I can give the script a large set of words so it can reconize them as well, but surely there are certain "patterns" that one can check to see what part of a sentence the noun or verb is, even though the noun or verb is not known at the moment.
Are there such patterns for the English language? Can one dissect a sentence by only "recognizing" a few words?
Thanks to the comments. I can specify this question a bit better.
Understanding the whole language is not necesary, seeing how nobody really understands everything of a natural language.
Having simple patterns and "rules" should be enough, I understand that, because English is a natural language, about every rule or pattern would have some kind of exception and mapping each one of those would probably take forever. But ignoring those exceptions (apart for the most common), I could make the script understand quite a lot.
If necessary, I could theoretically then add exceptions until done (read: forever).
Thanks to the feedback on this question, I've managed to find a few examples of patterns. (not sure if these are exactly what I need, but as an example they should be fine)
- Subject + Verb (S-V)
- Verb + Subject (V-S)
- Subject + Verb + Direct Object (S-V-DO)
- Subject + Verb + Complement (S-V-SC)
- Subject + Verb + Indirect Object + Direct Object (S-V-IO-DO)
- Subject + Verb + Direct Object + Object Complement (S-V-DO-OC)
Reconizing in what pattern a sentence falls, is probably first thing I should aim for. Of course, this is much easier said then done, also, fo every pattern I find, questions seem to be missing for it, but that is another issue I can deal with later.
From what I can tell, the best course of action is to match the verb in the sentence, then check if the words before it match as a the subject, then check the words behind it. Etc.
While finding the verb should not be that big an issue, matching a subject seems quite hard, it can't come from a database since, thanks to names, there are infinite possibilities. Still.. shouldn't a subject follow a pattern just aswell?
Also, if I were to go this route, wouldn't it end up being a maze of patterns? (not that thats necesarily a bad thing)