Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Generating all simple sentence possibilities
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.

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 -
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures

the natural language processing tool NLTK: 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
-Thanks for the replies everyone!

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  More Efficent Way of Generating Permutations/ w Rep ClassicalSoul 2 205 Yesterday, 05:22 AM
Last Post: perfringo
  how to get all the possible permutation and combination of a sentence in python sodmzs 1 174 Jun-13-2019, 07:02 AM
Last Post: perfringo
  Generating number of objects for a game kom2 3 259 Apr-18-2019, 02:04 PM
Last Post: dan789
  Generating a polynomial equation BinaryStar 3 384 Mar-18-2019, 12:53 AM
Last Post: scidam
  Made a simple script for android (really simple) but it is not running anddontyoucomebacknomore 2 281 Mar-06-2019, 12:19 AM
Last Post: anddontyoucomebacknomore
  Sentence maker help bidoofis 2 300 Feb-08-2019, 03:59 AM
Last Post: bidoofis
  wont print last sentence.. mitmit293 2 241 Jan-27-2019, 05:38 PM
Last Post: aakashjha001
  Generating web page from argparse parameters gontajones 3 472 Nov-13-2018, 08:04 PM
Last Post: nilamo
  generating ctypes wrapper for a c library? brighteningeyes 9 810 Nov-04-2018, 02:31 AM
Last Post: brighteningeyes
  Python - Limit Sentence Length to 10 Words - Text file dj99 2 992 Jul-21-2018, 02:24 PM
Last Post: dj99

Forum Jump:

Users browsing this thread: 1 Guest(s)