Run the console app with python3 generator.py
. When prompted for a target, try entering SENTENCE
. If everything goes well, you should see the following output appear.
Valid symbols: SENTENCE NOUNP PROPNOUN ADJS ADJ DET NOUN VERBP TRANSVERB INTRANSVERB
Target: SENTENCE
the big child hit a big man
John laughed
the pretentious dog laughed
Elmo kissed Jane
the big mother laughed
the faulty wonderful man died
Jane laughed
the pretentious faulty wonderful subliminal man hit Spot
Sally laughed
a subliminal big father helped Sally
Target:
Now, let’s fill in step 1 and 2 for the Random Sentence Generator. This app should generate English sentences when given the target SENTENCE
. Modify the server.py
file to implement step 1 and 2.
random.sample
to pick one random element from a set of elements.Run the web app with python3 server.py
. In a web browser, navigate the following address: localhost:8000
.
Then, try clicking on the ⚡ (lightning bolt) icon and see what happens.
When you’re done demoing the web app, stop the Python terminal process with Ctrl+C.