I am working on Natural Language Generation project. Now I have bags of keywords and I am trying to generate sentence of pattern Subject+verb+object. Is there any tool or package or library to get sentences when i give bag of subject,bag of verb and bag of object? Example: subject=[teacher,student] verb=[teach] object=[book] answer: teacher teaching student from books.
Asked
Active
Viewed 5,402 times
2
-
1Train a language model on large collection of english text. Then create a list of candidates by going through permutations of words you are given. Use your language model to assign each candidate a probability. Most probably the likeliest candidate is also a correct english sentence... – user3639557 Apr 20 '16 at 10:55
1 Answers
2
Assuming the words in your bag of words are tagged with word categories such as verb or noun, you could use a realiser such as SimpleNLG.
Effectively you would write a bunch of sentence specification templates and a script to look into your bag of words and use your templates.
For example, for your sentence "teacher teaching students from books" you could have the following sentence specification template:
- Subject = a noun, e.g. teacher
- Verb = a verb, e.g. teach (form = present participle)
- Object = a noun, e.g. student (number = plural)
- Postmodifier = { preposition = from , noun = books (number = plural) }
Note this approach will give you morphologically and syntacticly valid sentences, even though some may sound funny such as "books teaching teachers from students".

Rodrigo
- 321
- 2
- 11