Skip to content

Instantly share code, notes, and snippets.

@drcjar
drcjar / README.md
Last active December 23, 2015 10:19
Asthma Choropleth

Let's make an Asthma Choropleth using open data, ogr2ogr, folium and pandas (and indirectly leaflet.js, d3.js, GeoJSON, open street maps and moar) and talk about using gist and blocks..

  1. get UK Asthma data http://customer.instantatlas.com/INHALE/dataviews/ for this example I use dataView12_17.csv

  2. get some CCG map boundaries

    wget 'https://geoportal.statistics.gov.uk/Docs/Boundaries/Clinical_commissioning_groups_(Eng)_Apr_2013_Boundaries_(Generalised_Clipped).zip'
    
  3. make CCG map boundaries into GeoJSON format

import nltk
with open('sample.txt', 'r') as f:
sample = f.read()
sentences = nltk.sent_tokenize(sample)
tokenized_sentences = [nltk.word_tokenize(sentence) for sentence in sentences]
tagged_sentences = [nltk.pos_tag(sentence) for sentence in tokenized_sentences]
chunked_sentences = nltk.batch_ne_chunk(tagged_sentences, binary=True)