Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 19 lines (14 sloc) 659 Bytes
#!/usr/bin env python
# mapping from votesmart IDs to congressperson names
import yaml
import os
# open the author info from yaml data.
# this is only data for congresspeople with votesmart IDs.
stream = open('/var/www/talk-like-a-congressperson/static/author-mapping/votesmart.yml', 'rb')
data = yaml.load(stream)
# create dictionary of Name -> VoteSmart ID
mapping = [(' '.join([author['name']['first'],
author['name']['last']]),
author['id']['votesmart'],) for author in data]
mapping = [(k,v) for (k,v) in mapping if str(v) in os.listdir('/var/www/talk-like-a-congressperson/static/corpora')]
mapping = dict(mapping)