Created
January 16, 2014 17:49
-
-
Save pscollins/8459832 to your computer and use it in GitHub Desktop.
ML scanning
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
| import requests | |
| from bs4 import BeautifulSoup | |
| BASE_URL = "http://en.wiktionary.org/wiki/{}#Danish" | |
| WORDS = ['foo', 'bar', 'baz'] | |
| def main(): | |
| ans = [] | |
| for word in WORDS: | |
| soup = BeautifulSoup(requests.get(BASE_URL.format(word)).text) | |
| ans += \ | |
| [el.contents for el in | |
| soup.select('a[href=/wiki/Appendix:Danish_pronunciation] ~ .IPA' if el] | |
| return ans | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment