diff --git a/kramdown.py b/kramdown.py index d072832..d696015 100644 --- a/kramdown.py +++ b/kramdown.py @@ -26,7 +26,7 @@ with codecs.open('table.txt', encoding='utf-8', mode='w+') as table_file: -class Pages: +class Pages(object): """Create a page for each pattern containing exception and example nouns.""" @@ -47,7 +47,8 @@ def print_file(): correct = list_nouns(pattern, 'Correct') wrong = list_nouns(pattern, 'Wrong') - post.write(u'---\nlayout: post\ntitle: {0}\npermalink: genutiv/{0}\n---\n'.format(pattern_file)) + post.write(u'---\nlayout: post\ntitle: {0}\n + permalink: genutiv/{0}\n---\n'.format(pattern_file)) post.write('## Examples ## {#examples}\n') for noun in correct: post.write(noun + ' ') @@ -67,7 +68,7 @@ def list_nouns(pattern, verity): return verity_list -class PrintTables: +class PrintTables(object): def __init__(self): @@ -156,7 +157,9 @@ def exception(self, gender, pattern): else: noun = exception.split(' ') noun = noun[1] - exception = u'[{}](http://www.dict.cc/?s={})'.format(exception, noun) + exception = u'[{}](http://www.dict.cc/?s={})'.format( + exception, noun + ) return exception diff --git a/wiktionary.py b/wiktionary.py index e17020e..bbfea4b 100644 --- a/wiktionary.py +++ b/wiktionary.py @@ -13,13 +13,14 @@ # e.g. list=categorymembers from http://en.wikipedia.org/w/api.php # # TODO: -# - Store date and time with data # - Only load necessary data from web page # - Compare to other crawling programs # - Patterns on page have relatively consistent line number # - Backup data structure while crawling # - Store pertinent information (e.g. date, time, source) # - Filter out Kategorie:Fremdwort +# - Use MediaWiki API prop module to find relevant templates (i.e. {{m}}, +# {{f}}, {{n}}) # import urllib2 @@ -28,7 +29,7 @@ import json from BeautifulSoup import BeautifulSoup -class WikiNounList: +class WikiNounList(object): """Create a list of nouns and filter false items.""" def __init__(sef, username, password): @@ -81,7 +82,7 @@ def save(self): with open('dirty.json', 'w') as store: json.dump(dirty, store) -class WikiGender: +class WikiGender(object): user_agent = 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30\ Chrome/12.0.742.112 Safari/534.30'