Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Generating all simple sentence possibilities
#1
Hello all,

I am using Python 3.7.0 on Windows 7. I am trying to make a program that can generate all possible simple sentences. Here is the problem.

"Aaa aaa aaa." - is a message received and only lets you know about the capitalization and grammar of the sentence. Make a program that generates all possibilities in English.
The answer to the problem is: "The dog ran."

Any thoughts or pointers on how to start this problem or where to look would be great! The only go to reference source I have found is: Natural Language Processing in Python.


-Thanks!
Quote
#2
You are going to need a word list. You are going to need to load that word list and store the words by length. Then you will need to combine them with product from the itertools library.

That will give you all the sentences, but a lot of them will not be grammatical (like 'ran dog the'). For weeding out the bad sentences, you are going to need serious natural language processing.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures

Quote
#3
the natural language processing tool NLTK: http://www.nltk.org/ comes with a huge set of copora. It's quite easy to use, and is worth spending an hour or so looking at to see if it will fulfill your needs.
ichabod801 likes this post
Quote
#4
-Thanks for the replies everyone!
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  how to get all the possible permutation and combination of a sentence in python sodmzs 1 296 Jun-13-2019, 07:02 AM
Last Post: perfringo
  Sentence maker help bidoofis 2 424 Feb-08-2019, 03:59 AM
Last Post: bidoofis
  wont print last sentence.. mitmit293 2 324 Jan-27-2019, 05:38 PM
Last Post: aakashjha001
  PigLatin Sentence Translator Help 2skywalkers 7 1,498 Jun-23-2018, 12:46 AM
Last Post: 2skywalkers

Forum Jump:


Users browsing this thread: 1 Guest(s)