Skip to content

Commit

Permalink
New-style classes with top-level type
Browse files Browse the repository at this point in the history
  • Loading branch information
pamolloy committed Dec 7, 2011
1 parent 4dfbac4 commit 7d0fbf9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
11 changes: 7 additions & 4 deletions kramdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""

Expand All @@ -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 + ' ')
Expand All @@ -67,7 +68,7 @@ def list_nouns(pattern, verity):

return verity_list

class PrintTables:
class PrintTables(object):

def __init__(self):

Expand Down Expand Up @@ -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

7 changes: 4 additions & 3 deletions wiktionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down Expand Up @@ -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'

Expand Down

0 comments on commit 7d0fbf9

Please sign in to comment.