Created
July 6, 2011 09:23
-
-
Save acrymble/1066900 to your computer and use it in GitHub Desktop.
Python HTML to Pretty Print
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # html-to-pretty-print.py | |
| import obo | |
| # create dictionary of n-grams | |
| n = 7 | |
| url = 'http://www.oldbaileyonline.org/print.jsp?div=t17800628-33' | |
| text = obo.webPageToText(url) | |
| fullwordlist = obo.stripNonAlphaNum(text) | |
| ngrams = obo.getNGrams(fullwordlist, n) | |
| worddict = obo.nGramsToKWICDict(ngrams) | |
| print worddict["black"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment