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.sampleto 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:
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.