I need to make a sentence generator for a limited set of vocabulary (about 600 words). The requirements are:
- It must use only the words that are on the list, and never go beyond that;
- It must produce sentences of varying syntactic structures, including complex sentences, relative clauses, tenses etc (not just the basic "SVO" sentences or whatever);
- The sentences must be at reasonably meaningful and make sense at least most of the time (meaning that the sentences like "Colourless green ideas sleep furiously" shouldn't be generated).
I'd like to ask what's the best way to go about it.
The "varying sentence structures" part is the easy one: I can do the grammar.
The issue, however, is the "meaningfullness" part. So far, I reckon that in order to implement it, I would need to generate a collocations database for each word: other words can it govern, and as what arguments specifically (e.g., the verb "give" can govern animate nouns as agents and recipients, and inanimate nouns as patients; while the verb can generally only govern some speech-related nouns like "story", "words" or "truth" as patients). I should probably be able to extract this information from a corpus: I would need to use something like deeppavlov to parse the sentence structures (in order to extract the exact relationship between words), and some tool to account for irregular verbs and inflections (I would want for all forms of the same word to be treated as the same word, obviously).
However, collocations alone aren't enough to ensure meaningful sentences: even if every clause consists of only meaningful collocations, it still doesn't prevent, say, unrelated clauses to co-occur in the same complex sentence ("I have to go to school because my dog is brown", or whatever). So in addition to a collocations database, I think I would also need a co-occurrence database, essentially telling how likely is each of the 600 words to co-occur with each of the other 599 words in the same sentence, regardless of their syntactic relationship. Basically, a total of 360000 probability values.
I'd like to ask for advice. Am I missing anything, is there perhaps an easier way to go about what I want to do?
Also, are there perhaps any existing solutions for my requirements? I briefly tried tweaking with the ChatGPT for a while, but getting it to stick to the list of words and at the same time produce diverse sentences had driven me insane pretty quickly.
P.S. So far, I'm kinda leaning towards a non-neural-network solution because of the small vocabulary list.
I'll appreciate any help or advice.