pythonnlpnlg

Sentence generation from Keywords.Each keyword have bag of related words


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.


Solution

  • 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:

    Note this approach will give you morphologically and syntacticly valid sentences, even though some may sound funny such as "books teaching teachers from students".