
Political Speech Generator - magoghm
https://github.com/valentin012/conspeech
======
huac
From the paper:

Good examples – cut republican billion will pay percent benefit cost – program
fund educ cut provid health help million – economi job see need percent
continu import now – job make work compani busi right american good – iraq war
us presid support vote administr congress

These don't really look that great to me (and the 'bad examples' are worse)
but I'm not an NLP expert

~~~
drostie
The stuff that you're quoting is not the stuff that the `demo.py` script
generates, but "latent dirichlet allocation" (whereas this project appears to
generate based on a different alternate algorithm, the sentence-based one).

The sentence-based one has a major flaw: it mostly "settles into" a given
speech from its training set for a few paragraphs, then transitions to a
paragraph from another speech whenever the statements become sufficiently
generic.

Another bug: it can sometimes lapse into an infinite loop. Here's the tail end
of one of my runs:

    
    
        accordingly , the committee rose ; and the speaker pro tempore ( mrs. drake ) 
        having assumed the chair , mr. gilchrest , acting chairman of the committee of
        jurisdiction would ask the counsel to explain it ; and if it is a drafting 
        error , then that could be corrected .
        if it is not a drafting error , then that could be corrected .
        if it is not a drafting error , then that could be corrected .
        if it is not a drafting error , then that could be corrected .
        if it is not a drafting error , then that could be corrected .
        if it is not a drafting error , then that could be corrected .
        if it is not a drafting error , then that could be corrected .
        if it is not a drafting error , then that could be corrected .
        if it is not a drafting error , then that could be corrected .
        if it is not a drafting error , then that could be corrected .
        [... continues for many, many more lines before ending ...]

~~~
gkya
> Another bug: it can sometimes lapse into an infinite loop.

That might be a bug that propagated from the politicians themselves...

------
mattgibson
Why spoil an awesome project with a poor README? Compare with
[https://github.com/rails/rails#getting-
started](https://github.com/rails/rails#getting-started)

* What are the system prerequisites? * What are the optional command line params? * What is an example of the expected output? * How does it (roughly) work? * Why not use actual markdown to highlight the code in the README.md file.

I feel bad highlighting this as it looks really interesting, but as Python is
not one of my main languages I don't feel much enthusiasm for spending an
unknown amount of time just trying to make sense of the demo, which is a
shame.

~~~
leeny
I had to do the following to get this working:

\- install scikit-learn ([http://scikit-
learn.org/stable/install.html](http://scikit-learn.org/stable/install.html))

\- install nltk
([http://www.nltk.org/install.html](http://www.nltk.org/install.html))

\- download data set:
[http://www.cs.cornell.edu/home/llee/data/convote.html](http://www.cs.cornell.edu/home/llee/data/convote.html)

\- put data set in convote_v1.1/

\- fix the path in demo.py to point to the data set (you might have to change
backslash to forward slash depending on your environment)

------
johnhenry
If you have "say" installed (Mac OS Users), try the command "python demo.py |
say" and wait a few minutes... :)

------
rwc
Would love to see an example speech or two!

~~~
Ao7bei3s
Then run the script (and post the results), instead of trying to make others
work for you and not putting in any effort yourself.

I just got myself a nice speech about medicare and border security (!?).

PS: Thanks for the downvotes. But life is easier when you don't care about
imaginary internet points :P

~~~
Retr0spectrum
Then why not take 2 extra seconds to paste the speech into your comment?

Not everyone has immediate access to a python interpreter.

~~~
drostie
And especially in this case, you have to install a few extra packages to make
it work, then download the data set and (if you're on Linux) adjust the path
to that data set so that it doesn't use backslashes.

~~~
vippy
The worst part was dealing with scipy / pyenv / debian, I had to install scipy
from its sources.

------
dvt
Basically a glorified Markov Chain (with "topic tagging"). Not particularly
interesting and the results are actually not very great. The sentence-based
approach (discussed in section 5) would've been more meaningful I think.

------
supportme
i suck. after installing nltk and sklearn, I get this:

$ python demo.py RY 0.25 [constructing dataset...] Traceback (most recent call
last): File "demo.py", line 37, in <module> (dataset,vocab) =
construct_dataset([TRAIN_DIR,TEST_DIR,DEV_DIR]) File
"/Users/asdf/workspace/github/conspeech/con_util.py", line 48, in
construct_dataset for f in sorted(os.listdir(p)): OSError: [Errno 2] No such
file or directory: 'convote_v1.1\\\data_stage_three/training_set'

~~~
vippy
If you're on Linux, you have to change the slash on demo.py:32 from '\\\' to
'/', and also download and place the convote data from cornell in the
convote_v1.1 directory.

~~~
supportme
thanks man!

$ wget
[http://www.cs.cornell.edu/home/llee/data/convote/convote_v1....](http://www.cs.cornell.edu/home/llee/data/convote/convote_v1.1.tar.gz)

$ python demo.py RY 0.25 [constructing dataset...] [dataset constructed.] #
Class: RY, Lambda: 0.25 # __START__ mr. speaker , i yield back the balance of
my time , and i want to commend the gentleman from california ( mr. pombo )
and myself were the republicans , and , unfortunately , it took us literally 6
months to finally agree what time to meet and where . the difficulty with the
endangered species act . i also would like to thank the chairman for
supporting the green brook flood control project is saving homes and
businesses and lives . it is equally vital that our senators from new jersey
take up the fight for this important project and finish the work that we have
asked them to do . i have heard friends across the aisle say that americans
have journeyed freely in the past and that this goes against the very freedoms
which this nation was founded on . but the truth is , try getting on an
airplane . what the motion to recommit does is force the states to do
something , or not do something ; and that goes directly against the notion of
federalism that is contained in this bill and which was drafted by the
committee on government reform . __END__

------
kmeade
Here's an example: __START__ mr. speaker, for years, honest but unfortunate
consumers have had the ability to plead their case to come under bankruptcy
protection and have their reasonable and valid debts discharged. the way the
system is supposed to work, the bankruptcy court evaluates various factors
including income , assets and debt to determine what debts can be paid and how
consumers can get back on their feet. stand up for growth and opportunity.
pass this legislation . __END__

------
shirman
ImportError: cannot import name futil :((

"pip install futil" have not help

------
j-c-h-e-n-g
for folks with macs and have boot2docker or docker-machine running, turn on
your volume to MAX and do this:

docker run -it jcheng/docker-conspeech:latest python /opt/conspeech/demo.py RY
0.25 | say

