Ask HN: Trying to Extract Roll Call Votes of Cambridge City Council
Any ideas, hints, tips, pointers?...
Trying to extract Roll Call Votes of Cambridge City Council. The challenge is that Roll Call Votes are embedded in Council Documents, for example
http://www2.cambridgema.gov/CityOfCambridge_Content/documents/councilor_votes/CMA_4380_20150622_20150622_letter.PDF
at
http://www2.cambridgema.gov/cityclerk/cmLetter.cfm?item_id=34162
8 comments
[ 1.8 ms ] story [ 30.2 ms ] threadLooks like there's a lot of manual work there, unfortunately.
Most of the gov.uk info is the same, scans, pdfs, poorly formatted word and excel spreadsheets. :(
OpenCV should be able to do all these things.
I hacked together something in python (because I had laundry to do :) ) and it seems to work pretty well.
[1] http://www.fmwconcepts.com/imagemagick/textcleaner/
Effectively what you have here is a bitmap in a PDF which happens to contain a scan of text. So in order to even begin to extract it, you'll have to extract the bitmap, then OCR it, but while you OCR it you'll have to try to keep the location of the different blocks somehow...
You'd need to look at several of these to see how consistent they are. If they're laid on a flatbed scanner manually, they won't be very consistent. However if they're scanned via a feeder then it should be extremely similar each time, and you could hard code in the coordinates of the data you want (which is extremely fragile, but is the least amount of work).
Then you just OCR the names only, while looking in other boxes for any content at all.
I'd suggest you set up a job on Mechanical Turk or similar, and pay a small amount per page to have them re-entered in a format you can more easily read.