Creating meaningful sentences from a given set of words

I am working on a program that is supposed to create a sentence that is grammatically correct from a given set of words. Here I will pass the input of the list of lines to the program, and my output should be a meaningful sentence made up of these words and several other necessary words. For example.

Input: {'You' , 'House' , 'Beautiful'}
Output: 'Your house is beautiful' (or) 'you house is beautiful' 
Input: {'Father' , 'Love' , 'Child'}
Output: 'The father loves the child'

How do I implement this using NLTK and / or machine learning?

Any suggestions on how I should go about this? I am ready for even the most daring ideas. Thanks! :)

+6
source share
1 answer

n-gram. ,

.

3 :

  • <s> I like
  • I like NLP
  • like NLP very
  • NLP very much
  • very much </s>

P(word3 | word1 word2).

, :

:

  • n 3
  • n , , " ", ( n-gram )
  • n = 5
+7

Source: https://habr.com/ru/post/1621451/


All Articles