Skip to content

Instantly share code, notes, and snippets.

@pscollins
Created January 16, 2014 17:49
Show Gist options
  • Select an option

  • Save pscollins/8459832 to your computer and use it in GitHub Desktop.

Select an option

Save pscollins/8459832 to your computer and use it in GitHub Desktop.
ML scanning
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