Skip to content

Commit

Permalink
added adjective + preposition
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio95 committed Feb 24, 2019
1 parent a4ed3f2 commit aa4b3d3
Show file tree
Hide file tree
Showing 8 changed files with 4,858 additions and 454 deletions.
2 changes: 2 additions & 0 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ I believe the code is pretty much self explanatory and can be used for various l
For any questions on how to run the application, issues or offers to contribute (the list of intended upgrades is long), just send a message to **[email protected]**, I'm always happy to help (and be helped!).

Note: this is a **python 3** application
Installation:

19 changes: 12 additions & 7 deletions exercises.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
import collections
import readline
import shutil

import os
import json

from colorama import init, Fore, Back, Style
import numpy

Expand Down Expand Up @@ -50,8 +51,10 @@
# GLOBALS #
###########

MATERIAL_PATH = '/home/antonio/Desktop/cpe/python/material.json'
RECORDS_PATH = '/home/antonio/Desktop/cpe/python/records.json'

BASE_DIR = os.path.dirname(os.path.abspath(__file__))
MATERIAL_PATH = os.path.join(BASE_DIR, 'material.json')
RECORDS_PATH = os.path.join(BASE_DIR, 'records.json')

ACCEPT_NEW = False

Expand Down Expand Up @@ -220,7 +223,7 @@ def ask(self, mode=1):
print(Fore.YELLOW + '[*] {} ({} words stored)'.format(self.prompt, len(self.field)), Fore.RESET)

ans = input(' Enter any number of comma-separated words: ')
answers = ans.lower().replace(' ', '').split(',')
answers = [a.lstrip().rstrip() for a in ans.lower().split(',')]
right, wrong = [], []

# taking care of potentially repeated answers
Expand All @@ -230,8 +233,10 @@ def ask(self, mode=1):
if a not in self.field and a not in wrong:
wrong.append(a)

print(' Expected synonyms ({}): '.format(len(self.field)), ', '.join(self.field))
missing = [a for a in self.field if a not in answers]

print(' Correct answers ({}): '.format(len(right)), ', '.join(right))
print(' Missing answers ({}): '.format(len(missing)), ', '.join(missing))
print(' Wrong answers ({}): '.format(len(wrong)), ', '.join(wrong))

s, r = len(self.field), len(right)
Expand Down Expand Up @@ -356,7 +361,7 @@ def ask(self, mode=0):
print(" Ouch, it was:", right)
outcome = 0

print(Fore.YELLOW + ' You can practise by saying the following sentence out loud:\n' + self.example, Fore.RESET)
print(Fore.YELLOW + ' You can practise by saying the following sentence out loud:\n ' + self.example, Fore.RESET)
return outcome


Expand Down Expand Up @@ -553,7 +558,7 @@ def drill(n=10, review=False):
with open(RECORDS_PATH, 'w') as rf:
json.dump(records, rf, indent=' ')

print('Saving records...')
print('Records saved')


def reset_records(filename=RECORDS_PATH):
Expand Down
Empty file modified material.backup
100644 → 100755
Empty file.
273 changes: 243 additions & 30 deletions material.json
100644 → 100755

Large diffs are not rendered by default.

Empty file modified records.backup
100644 → 100755
Empty file.
Loading

0 comments on commit aa4b3d3

Please sign in to comment.