Permalink
Browse files

Ukraine tutor. Also completed advanced level for ru and uk tutors

  • Loading branch information...
1 parent 78df7af commit b97acd069eb008db709acd3047028764278973ab @baverman committed Feb 14, 2011
View
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: typetrainer\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-02-14 16:25+1000\n"
+"POT-Creation-Date: 2011-02-14 17:15+1000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -40,14 +40,20 @@ msgstr ""
msgid "English"
msgstr ""
-#: ../typetrainer/tutors/en.py:10 ../typetrainer/tutors/ru.py:11
+#: ../typetrainer/tutors/en.py:10 ../typetrainer/tutors/uk.py:11
+#: ../typetrainer/tutors/ru.py:11
msgid "Basic"
msgstr ""
-#: ../typetrainer/tutors/en.py:11
+#: ../typetrainer/tutors/en.py:11 ../typetrainer/tutors/uk.py:12
+#: ../typetrainer/tutors/ru.py:12
msgid "Advanced"
msgstr ""
+#: ../typetrainer/tutors/uk.py:8
+msgid "Ukraine"
+msgstr ""
+
#: ../typetrainer/tutors/help.py:8
msgid ""
"Expand misc panel and open file with words. Press Ctrl+O and choose file "
View
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: typetrainer\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-02-14 16:25+1000\n"
+"POT-Creation-Date: 2011-02-14 17:15+1000\n"
"PO-Revision-Date: 2011-01-30 19:31+1000\n"
"Last-Translator: <bobrov@vl.ru>\n"
"Language-Team: Russian\n"
@@ -43,19 +43,27 @@ msgstr "Нельзя прочитать [%s]"
msgid "English"
msgstr "Английский"
-#: ../typetrainer/tutors/en.py:10 ../typetrainer/tutors/ru.py:11
+#: ../typetrainer/tutors/en.py:10 ../typetrainer/tutors/uk.py:11
+#: ../typetrainer/tutors/ru.py:11
msgid "Basic"
msgstr "Простой"
-#: ../typetrainer/tutors/en.py:11
+#: ../typetrainer/tutors/en.py:11 ../typetrainer/tutors/uk.py:12
+#: ../typetrainer/tutors/ru.py:12
msgid "Advanced"
msgstr "Сложный"
+#: ../typetrainer/tutors/uk.py:8
+msgid "Ukraine"
+msgstr "Украинский"
+
#: ../typetrainer/tutors/help.py:8
msgid ""
"Expand misc panel and open file with words. Press Ctrl+O and choose file "
"with words."
-msgstr "Разверните дополнительную панель и откройте файл со словами. Нажмите Контрол+О и выберите файл."
+msgstr ""
+"Разверните дополнительную панель и откройте файл со словами. Нажмите Контрол"
+"+О и выберите файл."
#: ../typetrainer/tutors/__init__.py:20
msgid "Choose file with words."
@@ -119,4 +127,4 @@ msgstr "Точность:"
#: tmp/stat.glade.h:2
msgid "Statistic"
-msgstr "Статистика"
+msgstr "Статистика"
Binary file not shown.
@@ -2,9 +2,9 @@
from typetrainer.i18n import _
-from . import en, ru
+from . import en, ru, uk
-available_tutors = (en, ru)
+available_tutors = (en, ru, uk)
def get_filler(tutor, filename):
fullname = tutor
View
@@ -9,7 +9,7 @@
levels = (
('basic', _('Basic')),
-# ('advanced', _('Advanced')),
+ ('advanced', _('Advanced')),
# ('superb', _('Superb')),
)
@@ -21,24 +21,40 @@ def make_lengths_seq(words):
else:
yield t, w
-def split_to_words(text):
- for word in re.findall(u'(?iu)[а-я]+', text.lower()):
- syms = []
- if word.endswith(','):
- syms.append(',')
+def split_to_words(text, level):
+ filter_non_word = re.compile(u'(?iu)[^а-я]+')
- word = word.strip(',')
+ charsets = {
+ 'basic': u'(?iu)[а-я]+',
+ 'advanced': u'(?iu)[а-я,.:;"!]+'
+ }
+
+ if level == 'basic':
+ text = text.lower()
+
+ for word in re.findall(charsets[level], text):
+ non_word_cars = ',.:;"!'
+ esym = None
+ for c in non_word_cars:
+ if word.endswith(c):
+ esym = c
+ break
+
+ ssym = '"' if word.startswith('"') else None
+
+ word = filter_non_word.sub('', word).strip("'")
if word:
+ if ssym:
+ yield 's', ssym
yield 'w', word
- if syms:
- for s in syms:
- yield 's', s
+ if esym:
+ yield 's', esym
yield 's', ' '
def get_filler(text, level):
- words = list(split_to_words(text))
+ words = list(split_to_words(text, level))
if not words:
words = list(split_to_words(u'Пустое упражнение. Выберите другое или загрузите '
- u'соответствующий файл'))
+ u'соответствующий файл', level))
return Filler(words, make_lengths_seq)
View
@@ -0,0 +1,60 @@
+# -*- coding: utf-8 -*-
+import re
+from .common import Filler
+
+from typetrainer.i18n import _
+
+name = 'uk'
+label = _('Ukraine')
+
+levels = (
+ ('basic', _('Basic')),
+ ('advanced', _('Advanced')),
+# ('superb', _('Superb')),
+)
+
+def make_lengths_seq(words):
+ for t, w in words:
+ if t == 'w':
+ wlen = len(w)
+ yield 'w', wlen
+ else:
+ yield t, w
+
+def split_to_words(text, level):
+ filter_non_word = re.compile(u'(?iu)[^а-я\'ієї]+')
+
+ charsets = {
+ 'basic': u'(?iu)[а-я\'ієї]+',
+ 'advanced': u'(?iu)[а-я\'ієї,.:;"!]+'
+ }
+
+ if level == 'basic':
+ text = text.lower()
+
+ for word in re.findall(charsets[level], text):
+ non_word_cars = ',.:;"!'
+ esym = None
+ for c in non_word_cars:
+ if word.endswith(c):
+ esym = c
+ break
+
+ ssym = '"' if word.startswith('"') else None
+
+ word = filter_non_word.sub('', word).strip("'")
+ if word:
+ if ssym:
+ yield 's', ssym
+ yield 'w', word
+ if esym:
+ yield 's', esym
+
+ yield 's', ' '
+
+def get_filler(text, level):
+ words = list(split_to_words(text, level))
+ if not words:
+ words = list(split_to_words(u'Порожня вправа. Оберіть іншу та завантажте '
+ u'відповідний файл', level))
+ return Filler(words, make_lengths_seq)

0 comments on commit b97acd0

Please sign in to comment.