Exemplo n.º 1
0
 def test_create_card(self):
     book = 'the golden bough'
     with open('../data/source/the golden bough.txt', 'r') as reader:
         for line in reader.readlines():
             text = line.strip('\n')
             card = Card()
             card.book = book
             card.word = text.lower()
Exemplo n.º 2
0
def load_word_list():
    srcdir = '../data/source'
    files = [f for f in listdir(srcdir) if isfile(join(srcdir, f))]
    cards = {}
    for file in files:
        bookname = splitext(file)[0]
        with open(join(srcdir, file), 'r') as reader:
            for line in reader.readlines():
                text = line.strip('\n')
                card = Card()
                card.book = bookname
                card.word = text.lower()
                cards[card.word] = card
    cardbox = CardBox()
    cardbox.cards = cards