mirror of
https://github.com/ankitects/anki.git
synced 2025-11-07 13:17:12 -05:00
add supermemo importer from Petr Michalec
This commit is contained in:
parent
fdb9327864
commit
fe99ff7518
7 changed files with 4095 additions and 1 deletions
|
|
@ -260,10 +260,12 @@ from anki.importing.csvfile import TextImporter
|
||||||
from anki.importing.anki10 import Anki10Importer
|
from anki.importing.anki10 import Anki10Importer
|
||||||
from anki.importing.mnemosyne10 import Mnemosyne10Importer
|
from anki.importing.mnemosyne10 import Mnemosyne10Importer
|
||||||
from anki.importing.wcu import WCUImporter
|
from anki.importing.wcu import WCUImporter
|
||||||
|
from anki.importing.supermemo_xml import SupermemoXmlImporter
|
||||||
|
|
||||||
Importers = (
|
Importers = (
|
||||||
(_("Text separated by tabs or semicolons (*)"), TextImporter),
|
(_("Text separated by tabs or semicolons (*)"), TextImporter),
|
||||||
(_("Anki Deck (*.anki)"), Anki10Importer),
|
(_("Anki Deck (*.anki)"), Anki10Importer),
|
||||||
(_("Mnemosyne Deck (*.mem)"), Mnemosyne10Importer),
|
(_("Mnemosyne Deck (*.mem)"), Mnemosyne10Importer),
|
||||||
(_("CueCard Deck (*.wcu)"), WCUImporter),
|
(_("CueCard Deck (*.wcu)"), WCUImporter),
|
||||||
|
(_("Supermemo XML export (*.xml)"), SupermemoXmlImporter),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
486
anki/importing/supermemo_xml.py
Normal file
486
anki/importing/supermemo_xml.py
Normal file
|
|
@ -0,0 +1,486 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright: petr.michalec@gmail.com
|
||||||
|
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
|
||||||
|
|
||||||
|
"""\
|
||||||
|
Importing Supermemo XML decks
|
||||||
|
==============================
|
||||||
|
"""
|
||||||
|
__docformat__ = 'restructuredtext'
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from anki.importing import Importer, ForeignCard
|
||||||
|
from anki.lang import _
|
||||||
|
from anki.errors import *
|
||||||
|
|
||||||
|
from xml.dom import minidom, Node
|
||||||
|
from types import DictType, InstanceType
|
||||||
|
from string import capwords, maketrans
|
||||||
|
import re, unicodedata, time
|
||||||
|
from BeautifulSoup import BeautifulStoneSoup
|
||||||
|
#import chardet
|
||||||
|
|
||||||
|
|
||||||
|
from anki.deck import Deck
|
||||||
|
|
||||||
|
class SmartDict(dict):
|
||||||
|
"""
|
||||||
|
See http://www.peterbe.com/plog/SmartDict
|
||||||
|
Copyright 2005, Peter Bengtsson, peter@fry-it.com
|
||||||
|
|
||||||
|
A smart dict can be instanciated either from a pythonic dict
|
||||||
|
or an instance object (eg. SQL recordsets) but it ensures that you can
|
||||||
|
do all the convenient lookups such as x.first_name, x['first_name'] or
|
||||||
|
x.get('first_name').
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, *a, **kw):
|
||||||
|
if a:
|
||||||
|
if type(a[0]) is DictType:
|
||||||
|
kw.update(a[0])
|
||||||
|
elif type(a[0]) is InstanceType:
|
||||||
|
kw.update(a[0].__dict__)
|
||||||
|
elif hasattr(a[0], '__class__') and a[0].__class__.__name__=='SmartDict':
|
||||||
|
kw.update(a[0].__dict__)
|
||||||
|
|
||||||
|
dict.__init__(self, **kw)
|
||||||
|
self.__dict__ = self
|
||||||
|
|
||||||
|
class SuperMemoElement(SmartDict):
|
||||||
|
"SmartDict wrapper to store SM Element data"
|
||||||
|
|
||||||
|
def __init__(self, *a, **kw):
|
||||||
|
SmartDict.__init__(self, *a, **kw)
|
||||||
|
#default content
|
||||||
|
self.__dict__['lTitle'] = None
|
||||||
|
self.__dict__['Title'] = None
|
||||||
|
self.__dict__['Question'] = None
|
||||||
|
self.__dict__['Answer'] = None
|
||||||
|
self.__dict__['Count'] = None
|
||||||
|
self.__dict__['Type'] = None
|
||||||
|
self.__dict__['ID'] = None
|
||||||
|
self.__dict__['Interval'] = None
|
||||||
|
self.__dict__['Lapses'] = None
|
||||||
|
self.__dict__['Repetitions'] = None
|
||||||
|
self.__dict__['LastRepetiton'] = None
|
||||||
|
self.__dict__['AFactor'] = None
|
||||||
|
self.__dict__['UFactor'] = None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# This is an AnkiImporter
|
||||||
|
class SupermemoXmlImporter(Importer):
|
||||||
|
"""
|
||||||
|
Supermemo XML export's to Anki parser.
|
||||||
|
Goes through a SM collection and fetch all elements.
|
||||||
|
|
||||||
|
My SM collection was a big mess where topics and items were mixed.
|
||||||
|
I was unable to parse my content in a regular way like for loop on
|
||||||
|
minidom.getElementsByTagName() etc. My collection had also an
|
||||||
|
limitation, topics were splited into branches with max 100 items
|
||||||
|
on each. Learning themes were in deep structure. I wanted to have
|
||||||
|
full title on each element to be stored in tags.
|
||||||
|
|
||||||
|
Code should be upgrade to support importing of SM2006 exports.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, *args):
|
||||||
|
"""Initialize internal varables.
|
||||||
|
Pameters to be exposed to GUI are stored in self.META"""
|
||||||
|
|
||||||
|
Importer.__init__(self, *args)
|
||||||
|
self.lines = None
|
||||||
|
self.numFields=int(2)
|
||||||
|
|
||||||
|
# SmXmlParse VARIABLES
|
||||||
|
self.xmldoc = None
|
||||||
|
self.pieces = []
|
||||||
|
self.cntBuf = [] #to store last parsed data
|
||||||
|
self.cntElm = [] #to store SM Elements data
|
||||||
|
self.cntCol = [] #to store SM Colections data
|
||||||
|
|
||||||
|
# store some meta info related to parse algorithm
|
||||||
|
# SmartDict works like dict / class wrapper
|
||||||
|
self.cntMeta = SmartDict()
|
||||||
|
self.cntMeta.popTitles = False
|
||||||
|
self.cntMeta.title = []
|
||||||
|
|
||||||
|
# META stores controls of import scritp, should be
|
||||||
|
# exposed to import dialog. These are default values.
|
||||||
|
self.META = SmartDict()
|
||||||
|
self.META.resetLearningData = False # implemented
|
||||||
|
self.META.onlyMemorizedItems = False # implemented
|
||||||
|
self.META.loggerLevel = 2 # implemented 0no,1info,2error,3debug
|
||||||
|
self.META.tagAllTopics = False
|
||||||
|
self.META.pathsToBeTagged = ['English for begginers', 'Advanced English 97', 'Phrasal Verbs'] # path patterns to be tagged - in gui entered like 'Advanced English 97|My Vocablary'
|
||||||
|
self.META.tagMemorizedItems = True # implemented
|
||||||
|
self.META.logToStdOutput = False # implemented
|
||||||
|
|
||||||
|
self.cards = []
|
||||||
|
|
||||||
|
## TOOLS
|
||||||
|
|
||||||
|
def _fudgeText(self, text):
|
||||||
|
"Replace sm syntax to Anki syntax"
|
||||||
|
text = text.replace("\n\r", u"<br>")
|
||||||
|
text = text.replace("\n", u"<br>")
|
||||||
|
return text
|
||||||
|
|
||||||
|
def _unicode2ascii(self,str):
|
||||||
|
"Remove diacritic punctuation from strings (titles)"
|
||||||
|
return u"".join([ c for c in unicodedata.normalize('NFKD', str) if not unicodedata.combining(c)])
|
||||||
|
|
||||||
|
def _decode_htmlescapes(self,s):
|
||||||
|
"""Unescape HTML code."""
|
||||||
|
|
||||||
|
#my sm2004 also ecaped & chars in escaped sequences.
|
||||||
|
s = re.sub(u'&',u'&',s)
|
||||||
|
return unicode(BeautifulStoneSoup(s,convertEntities=BeautifulStoneSoup.HTML_ENTITIES ))
|
||||||
|
|
||||||
|
|
||||||
|
def _unescape(self,s,initilize):
|
||||||
|
"""Note: This method is not used, BeautifulSoup does better job.
|
||||||
|
"""
|
||||||
|
|
||||||
|
if self._unescape_trtable == None:
|
||||||
|
self._unescape_trtable = (
|
||||||
|
('€',u'€'), (' ',u' '), ('!',u'!'), ('"',u'"'), ('#',u'#'), ('$',u'$'), ('%',u'%'), ('&',u'&'), (''',u"'"),
|
||||||
|
('(',u'('), (')',u')'), ('*',u'*'), ('+',u'+'), (',',u','), ('-',u'-'), ('.',u'.'), ('/',u'/'), ('0',u'0'),
|
||||||
|
('1',u'1'), ('2',u'2'), ('3',u'3'), ('4',u'4'), ('5',u'5'), ('6',u'6'), ('7',u'7'), ('8',u'8'), ('9',u'9'),
|
||||||
|
(':',u':'), (';',u';'), ('<',u'<'), ('=',u'='), ('>',u'>'), ('?',u'?'), ('@',u'@'), ('A',u'A'), ('B',u'B'),
|
||||||
|
('C',u'C'), ('D',u'D'), ('E',u'E'), ('F',u'F'), ('G',u'G'), ('H',u'H'), ('I',u'I'), ('J',u'J'), ('K',u'K'),
|
||||||
|
('L',u'L'), ('M',u'M'), ('N',u'N'), ('O',u'O'), ('P',u'P'), ('Q',u'Q'), ('R',u'R'), ('S',u'S'), ('T',u'T'),
|
||||||
|
('U',u'U'), ('V',u'V'), ('W',u'W'), ('X',u'X'), ('Y',u'Y'), ('Z',u'Z'), ('[',u'['), ('\',u'\\'), (']',u']'),
|
||||||
|
('^',u'^'), ('_',u'_'), ('`',u'`'), ('a',u'a'), ('b',u'b'), ('c',u'c'), ('d',u'd'), ('e',u'e'), ('f',u'f'),
|
||||||
|
('g',u'g'), ('h',u'h'), ('i',u'i'), ('j',u'j'), ('k',u'k'), ('l',u'l'), ('m',u'm'), ('n',u'n'),
|
||||||
|
('o',u'o'), ('p',u'p'), ('q',u'q'), ('r',u'r'), ('s',u's'), ('t',u't'), ('u',u'u'), ('v',u'v'),
|
||||||
|
('w',u'w'), ('x',u'x'), ('y',u'y'), ('z',u'z'), ('{',u'{'), ('|',u'|'), ('}',u'}'), ('~',u'~'),
|
||||||
|
(' ',u' '), ('¡',u'¡'), ('¢',u'¢'), ('£',u'£'), ('¤',u'¤'), ('¥',u'¥'), ('¦',u'¦'), ('§',u'§'),
|
||||||
|
('¨',u'¨'), ('©',u'©'), ('ª',u'ª'), ('«',u'«'), ('¬',u'¬'), ('­',u''), ('®',u'®'), ('¯',u'¯'),
|
||||||
|
('°',u'°'), ('±',u'±'), ('²',u'²'), ('³',u'³'), ('´',u'´'), ('µ',u'µ'), ('¶',u'¶'), ('·',u'·'),
|
||||||
|
('¸',u'¸'), ('¹',u'¹'), ('º',u'º'), ('»',u'»'), ('¼',u'¼'), ('½',u'½'), ('¾',u'¾'), ('¿',u'¿'),
|
||||||
|
('À',u'À'), ('Á',u'Á'), ('Â',u'Â'), ('Ã',u'Ã'), ('Ä',u'Ä'), ('Å',u'Å'), ('Å',u'Å'), ('Æ',u'Æ'),
|
||||||
|
('Ç',u'Ç'), ('È',u'È'), ('É',u'É'), ('Ê',u'Ê'), ('Ë',u'Ë'), ('Ì',u'Ì'), ('Í',u'Í'), ('Î',u'Î'),
|
||||||
|
('Ï',u'Ï'), ('Ð',u'Ð'), ('Ñ',u'Ñ'), ('Ò',u'Ò'), ('Ó',u'Ó'), ('Ô',u'Ô'), ('Õ',u'Õ'), ('Ö',u'Ö'),
|
||||||
|
('×',u'×'), ('Ø',u'Ø'), ('Ù',u'Ù'), ('Ú',u'Ú'), ('Û',u'Û'), ('Ü',u'Ü'), ('Ý',u'Ý'), ('Þ',u'Þ'),
|
||||||
|
('ß',u'ß'), ('à',u'à'), ('á',u'á'), ('â',u'â'), ('ã',u'ã'), ('ä',u'ä'), ('å',u'å'), ('æ',u'æ'),
|
||||||
|
('ç',u'ç'), ('è',u'è'), ('é',u'é'), ('ê',u'ê'), ('ë',u'ë'), ('ì',u'ì'), ('í',u'í'), ('í',u'í'),
|
||||||
|
('î',u'î'), ('ï',u'ï'), ('ð',u'ð'), ('ñ',u'ñ'), ('ò',u'ò'), ('ó',u'ó'), ('ô',u'ô'), ('õ',u'õ'),
|
||||||
|
('ö',u'ö'), ('÷',u'÷'), ('ø',u'ø'), ('ù',u'ù'), ('ú',u'ú'), ('û',u'û'), ('ü',u'ü'), ('ý',u'ý'),
|
||||||
|
('þ',u'þ'), ('ÿ',u'ÿ'), ('Ā',u'Ā'), ('ā',u'ā'), ('Ă',u'Ă'), ('ă',u'ă'), ('Ą',u'Ą'), ('ą',u'ą'),
|
||||||
|
('Ć',u'Ć'), ('ć',u'ć'), ('Ĉ',u'Ĉ'), ('ĉ',u'ĉ'), ('Ċ',u'Ċ'), ('ċ',u'ċ'), ('Č',u'Č'), ('č',u'č'),
|
||||||
|
('Ď',u'Ď'), ('ď',u'ď'), ('Đ',u'Đ'), ('đ',u'đ'), ('Ē',u'Ē'), ('ē',u'ē'), ('Ĕ',u'Ĕ'), ('ĕ',u'ĕ'),
|
||||||
|
('Ė',u'Ė'), ('ė',u'ė'), ('Ę',u'Ę'), ('ę',u'ę'), ('Ě',u'Ě'), ('ě',u'ě'), ('Ĝ',u'Ĝ'), ('ĝ',u'ĝ'),
|
||||||
|
('Ğ',u'Ğ'), ('ğ',u'ğ'), ('Ġ',u'Ġ'), ('ġ',u'ġ'), ('Ģ',u'Ģ'), ('ģ',u'ģ'), ('Ĥ',u'Ĥ'), ('ĥ',u'ĥ'),
|
||||||
|
('Ħ',u'Ħ'), ('ħ',u'ħ'), ('Ĩ',u'Ĩ'), ('ĩ',u'ĩ'), ('Ī',u'Ī'), ('ī',u'ī'), ('Ĭ',u'Ĭ'), ('ĭ',u'ĭ'),
|
||||||
|
('Į',u'Į'), ('į',u'į'), ('İ',u'İ'), ('ı',u'ı'), ('IJ',u'IJ'), ('ij',u'ij'), ('Ĵ',u'Ĵ'), ('ĵ',u'ĵ'),
|
||||||
|
('Ķ',u'Ķ'), ('ķ',u'ķ'), ('ĸ',u'ĸ'), ('Ĺ',u'Ĺ'), ('ĺ',u'ĺ'), ('Ļ',u'Ļ'), ('ļ',u'ļ'), ('Ľ',u'Ľ'),
|
||||||
|
('ľ',u'ľ'), ('Ŀ',u'Ŀ'), ('ŀ',u'ŀ'), ('Ł',u'Ł'), ('ł',u'ł'), ('Ń',u'Ń'), ('ń',u'ń'), ('Ņ',u'Ņ'),
|
||||||
|
('ņ',u'ņ'), ('Ň',u'Ň'), ('ň',u'ň'), ('ʼn',u'ʼn'), ('Ŋ',u'Ŋ'), ('ŋ',u'ŋ'), ('Ō',u'Ō'), ('ō',u'ō'),
|
||||||
|
('Ŏ',u'Ŏ'), ('ŏ',u'ŏ'), ('Ő',u'Ő'), ('ő',u'ő'), ('Œ',u'Œ'), ('œ',u'œ'), ('Ŕ',u'Ŕ'), ('ŕ',u'ŕ'),
|
||||||
|
('Ŗ',u'Ŗ'), ('ŗ',u'ŗ'), ('Ř',u'Ř'), ('ř',u'ř'), ('Ś',u'Ś'), ('ś',u'ś'), ('Ŝ',u'Ŝ'), ('ŝ',u'ŝ'),
|
||||||
|
('Ş',u'Ş'), ('ş',u'ş'), ('Š',u'Š'), ('š',u'š'), ('Ţ',u'Ţ'), ('ţ',u'ţ'), ('Ť',u'Ť'), ('ť',u'ť'),
|
||||||
|
('Ŧ',u'Ŧ'), ('ŧ',u'ŧ'), ('Ũ',u'Ũ'), ('ũ',u'ũ'), ('Ū',u'Ū'), ('ū',u'ū'), ('Ŭ',u'Ŭ'), ('ŭ',u'ŭ'),
|
||||||
|
('Ů',u'Ů'), ('ů',u'ů'), ('Ű',u'Ű'), ('ű',u'ű'), ('Ų',u'Ų'), ('ų',u'ų'), ('Ŵ',u'Ŵ'), ('ŵ',u'ŵ'),
|
||||||
|
('Ŷ',u'Ŷ'), ('ŷ',u'ŷ'), ('Ÿ',u'Ÿ'), ('Ź',u'Ź'), ('ź',u'ź'), ('Ż',u'Ż'), ('ż',u'ż'), ('Ž',u'Ž'),
|
||||||
|
('ž',u'ž'), ('ſ',u'ſ'), ('Ŕ',u'Ŕ'), ('ŕ',u'ŕ'), ('Ŗ',u'Ŗ'), ('ŗ',u'ŗ'), ('Ř',u'Ř'), ('ř',u'ř'),
|
||||||
|
('Ś',u'Ś'), ('ś',u'ś'), ('Ŝ',u'Ŝ'), ('ŝ',u'ŝ'), ('Ş',u'Ş'), ('ş',u'ş'), ('Š',u'Š'), ('š',u'š'),
|
||||||
|
('Ţ',u'Ţ'), ('ţ',u'ţ'), ('Ť',u'Ť'), ('Ɂ',u'ť'), ('Ŧ',u'Ŧ'), ('ŧ',u'ŧ'), ('Ũ',u'Ũ'), ('ũ',u'ũ'),
|
||||||
|
('Ū',u'Ū'), ('ū',u'ū'), ('Ŭ',u'Ŭ'), ('ŭ',u'ŭ'), ('Ů',u'Ů'), ('ů',u'ů'), ('Ű',u'Ű'), ('ű',u'ű'),
|
||||||
|
('Ų',u'Ų'), ('ų',u'ų'), ('Ŵ',u'Ŵ'), ('ŵ',u'ŵ'), ('Ŷ',u'Ŷ'), ('ŷ',u'ŷ'), ('Ÿ',u'Ÿ'), ('Ź',u'Ź'),
|
||||||
|
('ź',u'ź'), ('Ż',u'Ż'), ('ż',u'ż'), ('Ž',u'Ž'), ('ž',u'ž'), ('ſ',u'ſ'),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
#m = re.match()
|
||||||
|
#s = s.replace(code[0], code[1])
|
||||||
|
|
||||||
|
## DEFAULT IMPORTER METHODS
|
||||||
|
|
||||||
|
def foreignCards(self):
|
||||||
|
|
||||||
|
# Load file and parse it by minidom
|
||||||
|
self.loadSource(self.file)
|
||||||
|
|
||||||
|
# Migrating content / time consuming part
|
||||||
|
# addItemToCards is called for each sm element
|
||||||
|
self.logger(u'Parsing started.')
|
||||||
|
self.parse()
|
||||||
|
self.logger(u'Parsing done.')
|
||||||
|
|
||||||
|
# Return imported cards
|
||||||
|
return self.cards
|
||||||
|
|
||||||
|
def fields(self):
|
||||||
|
return 2
|
||||||
|
|
||||||
|
## PARSER METHODS
|
||||||
|
|
||||||
|
def addItemToCards(self,item):
|
||||||
|
"This method actually do conversion"
|
||||||
|
|
||||||
|
# new anki card
|
||||||
|
card = ForeignCard()
|
||||||
|
|
||||||
|
# clean Q and A
|
||||||
|
card.fields.append(self._fudgeText(self._decode_htmlescapes(item.Question)))
|
||||||
|
card.fields.append(self._fudgeText(self._decode_htmlescapes(item.Answer)))
|
||||||
|
card.tags = u""
|
||||||
|
|
||||||
|
# pre-process scheduling data
|
||||||
|
tLastrep = time.mktime(time.strptime(item.LastRepetition, '%d.%m.%Y'))
|
||||||
|
tToday = time.time()
|
||||||
|
|
||||||
|
# convert learning data
|
||||||
|
if not self.META.resetLearningData:
|
||||||
|
# migration of LearningData algorithm
|
||||||
|
card.interval = item.Interval
|
||||||
|
card.successive = item.Repetitions
|
||||||
|
##card.due = tToday + (float(item.Interval) * 86400.0) - tLastrep
|
||||||
|
card.due = tLastrep + (float(item.Interval) * 86400.0)
|
||||||
|
card.lastDue = 0
|
||||||
|
|
||||||
|
card.factor = float(item.AFactor.replace(',','.'))
|
||||||
|
card.lastFactor = float(item.AFactor.replace(',','.'))
|
||||||
|
|
||||||
|
# SM is not exporting all the information Anki keeps track off, so it
|
||||||
|
# needs to be fudged
|
||||||
|
card.youngEase0 = item.Lapses
|
||||||
|
card.youngEase3 = item.Repetitions + item.Lapses
|
||||||
|
card.yesCount = item.Repetitions
|
||||||
|
card.noCount = item.Lapses
|
||||||
|
card.reps = card.yesCount + card.noCount
|
||||||
|
card.spaceUntil = card.due
|
||||||
|
card.combinedDue = card.due
|
||||||
|
|
||||||
|
# categories & tags
|
||||||
|
# it's worth to have every theme (tree structure of sm collection) stored in tags, but sometimes not
|
||||||
|
# you can deceide if you are going to tag all toppics or just that containing some pattern
|
||||||
|
tTaggTitle = False
|
||||||
|
for pattern in self.META.pathsToBeTagged:
|
||||||
|
if item.lTitle != None and pattern.lower() in u" ".join(item.lTitle).lower():
|
||||||
|
tTaggTitle = True
|
||||||
|
break
|
||||||
|
if tTaggTitle or self.META.tagAllTopics:
|
||||||
|
# normalize - remove diacritic punctuation from unicode chars to ascii
|
||||||
|
item.lTitle = [ self._unicode2ascii(topic) for topic in item.lTitle]
|
||||||
|
|
||||||
|
# Transfrom xyz / aaa / bbb / ccc on Title path to Tag xyzAaaBbbCcc
|
||||||
|
# clean things like [999] or [111-2222] from title path, example: xyz / [1000-1200] zyx / xyz
|
||||||
|
# clean whitespaces
|
||||||
|
# set Capital letters for first char of the word
|
||||||
|
tmp = list(set([ re.sub('(\[[0-9]+\])' , ' ' , i ).replace('_',' ') for i in item.lTitle ]))
|
||||||
|
tmp = list(set([ re.sub('(\W)',' ', i ) for i in tmp ]))
|
||||||
|
tmp = list(set([ re.sub( '^[0-9 ]+$','',i) for i in tmp ]))
|
||||||
|
tmp = list(set([ capwords(i).replace(' ','') for i in tmp ]))
|
||||||
|
tags = [ j[0].lower() + j[1:] for j in tmp if j.strip() <> '']
|
||||||
|
|
||||||
|
card.tags += u" ".join(tags)
|
||||||
|
|
||||||
|
if self.META.tagMemorizedItems and item.Interval >0:
|
||||||
|
card.tags += " Memorized"
|
||||||
|
|
||||||
|
self.logger(u'Element tags\t- ' + card.tags, level=3)
|
||||||
|
|
||||||
|
self.cards.append(card)
|
||||||
|
|
||||||
|
def logger(self,text,level=1):
|
||||||
|
"Wrapper for Anki logger"
|
||||||
|
|
||||||
|
dLevels={0:'',1:u'Info',2:u'Verbose',3:u'Debug'}
|
||||||
|
if level<=self.META.loggerLevel:
|
||||||
|
self.deck.updateProgress(_(text))
|
||||||
|
|
||||||
|
if self.META.logToStdOutput:
|
||||||
|
print self.__class__.__name__+ u" - " + dLevels[level].ljust(9) +u' -\t'+ _(text)
|
||||||
|
|
||||||
|
|
||||||
|
# OPEN AND LOAD
|
||||||
|
def openAnything(self,source):
|
||||||
|
"Open any source / actually only openig of files is used"
|
||||||
|
|
||||||
|
if source == "-":
|
||||||
|
return sys.stdin
|
||||||
|
|
||||||
|
# try to open with urllib (if source is http, ftp, or file URL)
|
||||||
|
import urllib
|
||||||
|
try:
|
||||||
|
return urllib.urlopen(source)
|
||||||
|
except (IOError, OSError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
# try to open with native open function (if source is pathname)
|
||||||
|
try:
|
||||||
|
return open(source)
|
||||||
|
except (IOError, OSError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
# treat source as string
|
||||||
|
import StringIO
|
||||||
|
return StringIO.StringIO(str(source))
|
||||||
|
|
||||||
|
def loadSource(self, source):
|
||||||
|
"""Load source file and parse with xml.dom.minidom"""
|
||||||
|
self.source = source
|
||||||
|
self.logger(u'Load started...')
|
||||||
|
sock = self.openAnything(self.source)
|
||||||
|
self.xmldoc = minidom.parse(sock).documentElement
|
||||||
|
sock.close()
|
||||||
|
self.logger(u'Load done.')
|
||||||
|
|
||||||
|
|
||||||
|
# PARSE
|
||||||
|
def parse(self, node=None):
|
||||||
|
"Parse method - parses document elements"
|
||||||
|
|
||||||
|
if node==None and self.xmldoc<>None:
|
||||||
|
node = self.xmldoc
|
||||||
|
|
||||||
|
_method = "parse_%s" % node.__class__.__name__
|
||||||
|
if hasattr(self,_method):
|
||||||
|
parseMethod = getattr(self, _method)
|
||||||
|
parseMethod(node)
|
||||||
|
else:
|
||||||
|
self.logger(u'No handler for method %s' % _method, level=3)
|
||||||
|
|
||||||
|
def parse_Document(self, node):
|
||||||
|
"Parse XML document"
|
||||||
|
|
||||||
|
self.parse(node.documentElement)
|
||||||
|
|
||||||
|
def parse_Element(self, node):
|
||||||
|
"Parse XML element"
|
||||||
|
|
||||||
|
_method = "do_%s" % node.tagName
|
||||||
|
if hasattr(self,_method):
|
||||||
|
handlerMethod = getattr(self, _method)
|
||||||
|
handlerMethod(node)
|
||||||
|
else:
|
||||||
|
self.logger(u'No handler for method %s' % _method, level=3)
|
||||||
|
#print traceback.print_exc()
|
||||||
|
|
||||||
|
def parse_Text(self, node):
|
||||||
|
"Parse text inside elements. Text is stored into local buffer."
|
||||||
|
|
||||||
|
text = node.data
|
||||||
|
self.cntBuf.append(text)
|
||||||
|
|
||||||
|
#def parse_Comment(self, node):
|
||||||
|
# """
|
||||||
|
# Source can contain XML comments, but we ignore them
|
||||||
|
# """
|
||||||
|
# pass
|
||||||
|
|
||||||
|
|
||||||
|
# DO
|
||||||
|
def do_SuperMemoCollection(self, node):
|
||||||
|
"Process SM Collection"
|
||||||
|
|
||||||
|
for child in node.childNodes: self.parse(child)
|
||||||
|
|
||||||
|
def do_SuperMemoElement(self, node):
|
||||||
|
"Process SM Element (Type - Title,Topics)"
|
||||||
|
|
||||||
|
self.logger('='*45, level=3)
|
||||||
|
|
||||||
|
self.cntElm.append(SuperMemoElement())
|
||||||
|
self.cntElm[-1]['lTitle'] = self.cntMeta['title']
|
||||||
|
|
||||||
|
#parse all child elements
|
||||||
|
for child in node.childNodes: self.parse(child)
|
||||||
|
|
||||||
|
#strip all saved strings, just for sure
|
||||||
|
for key in self.cntElm[-1].keys():
|
||||||
|
if hasattr(self.cntElm[-1][key], 'strip'):
|
||||||
|
self.cntElm[-1][key]=self.cntElm[-1][key].strip()
|
||||||
|
|
||||||
|
#pop current element
|
||||||
|
smel = self.cntElm.pop()
|
||||||
|
|
||||||
|
# Process cntElm if is valid Item (and not an Topic etc..)
|
||||||
|
# if smel.Lapses != None and smel.Interval != None and smel.Question != None and smel.Answer != None:
|
||||||
|
if smel.Title == None and smel.Question != None and smel.Answer != None:
|
||||||
|
if smel.Answer.strip() !='' and smel.Question.strip() !='':
|
||||||
|
|
||||||
|
# migrate only memorized otherway skip/continue
|
||||||
|
if self.META.onlyMemorizedItems and not(int(smel.Interval) > 0):
|
||||||
|
self.logger(u'Element skiped \t- not memorized ...', level=3)
|
||||||
|
else:
|
||||||
|
#import sm element data to Anki
|
||||||
|
self.addItemToCards(smel)
|
||||||
|
self.logger(u"Import element \t- " + smel['Question'], level=3)
|
||||||
|
|
||||||
|
#print element
|
||||||
|
self.logger('-'*45, level=3)
|
||||||
|
for key in smel.keys():
|
||||||
|
self.logger('\t%s %s' % ((key+':').ljust(15),smel[key]), level=3 )
|
||||||
|
else:
|
||||||
|
self.logger(u'Element skiped \t- no valid Q and A ...', level=3)
|
||||||
|
|
||||||
|
|
||||||
|
else:
|
||||||
|
# now we know that item was topic
|
||||||
|
# parseing of whole node is now finished
|
||||||
|
|
||||||
|
# test if it's really topic
|
||||||
|
if smel.Title != None:
|
||||||
|
# remove topic from title list
|
||||||
|
t = self.cntMeta['title'].pop()
|
||||||
|
self.logger(u'End of topic \t- %s' % (t), level=2)
|
||||||
|
|
||||||
|
def do_Content(self, node):
|
||||||
|
"Process SM element Content"
|
||||||
|
|
||||||
|
for child in node.childNodes:
|
||||||
|
if hasattr(child,'tagName') and child.firstChild != None:
|
||||||
|
self.cntElm[-1][child.tagName]=child.firstChild.data
|
||||||
|
|
||||||
|
def do_LearningData(self, node):
|
||||||
|
"Process SM element LearningData"
|
||||||
|
|
||||||
|
for child in node.childNodes:
|
||||||
|
if hasattr(child,'tagName') and child.firstChild != None:
|
||||||
|
self.cntElm[-1][child.tagName]=child.firstChild.data
|
||||||
|
|
||||||
|
# It's being processed in do_Content now
|
||||||
|
#def do_Question(self, node):
|
||||||
|
# for child in node.childNodes: self.parse(child)
|
||||||
|
# self.cntElm[-1][node.tagName]=self.cntBuf.pop()
|
||||||
|
|
||||||
|
# It's being processed in do_Content now
|
||||||
|
#def do_Answer(self, node):
|
||||||
|
# for child in node.childNodes: self.parse(child)
|
||||||
|
# self.cntElm[-1][node.tagName]=self.cntBuf.pop()
|
||||||
|
|
||||||
|
def do_Title(self, node):
|
||||||
|
"Process SM element Title"
|
||||||
|
|
||||||
|
t = self._decode_htmlescapes(node.firstChild.data)
|
||||||
|
self.cntElm[-1][node.tagName] = t
|
||||||
|
self.cntMeta['title'].append(t)
|
||||||
|
self.cntElm[-1]['lTitle'] = self.cntMeta['title']
|
||||||
|
self.logger(u'Start of topic \t- ' + u" / ".join(self.cntMeta['title']), level=2)
|
||||||
|
|
||||||
|
|
||||||
|
def do_Type(self, node):
|
||||||
|
"Process SM element Type"
|
||||||
|
|
||||||
|
if len(self.cntBuf) >=1 :
|
||||||
|
self.cntElm[-1][node.tagName]=self.cntBuf.pop()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
# for testing you can start it standalone
|
||||||
|
|
||||||
|
#file = u'/home/epcim/hg2g/dev/python/sm2anki/ADVENG2EXP.xxe.esc.zaloha_FINAL.xml'
|
||||||
|
#file = u'/home/epcim/hg2g/dev/python/anki/libanki/tests/importing/supermemo/original_ENGLISHFORBEGGINERS_noOEM.xml'
|
||||||
|
#file = u'/home/epcim/hg2g/dev/python/anki/libanki/tests/importing/supermemo/original_ENGLISHFORBEGGINERS_oem_1250.xml'
|
||||||
|
file = str(sys.argv[1])
|
||||||
|
impo = SupermemoXmlImporter(Deck(),file)
|
||||||
|
impo.foreignCards()
|
||||||
|
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# vim: ts=4 sts=2 ft=python
|
||||||
2637
tests/importing/supermemo_ENGLISHFORBEGGINERS_noOEM.xml
Normal file
2637
tests/importing/supermemo_ENGLISHFORBEGGINERS_noOEM.xml
Normal file
File diff suppressed because it is too large
Load diff
929
tests/importing/supermemo_ENGLISHFORBEGGINERS_oem_1250.xml
Normal file
929
tests/importing/supermemo_ENGLISHFORBEGGINERS_oem_1250.xml
Normal file
|
|
@ -0,0 +1,929 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<SuperMemoCollection>
|
||||||
|
<Count>3572</Count>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>1</ID>
|
||||||
|
|
||||||
|
<Type>Topic</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question />
|
||||||
|
|
||||||
|
<Answer />
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40326</ID>
|
||||||
|
|
||||||
|
<Title>English for begginers - czech</Title>
|
||||||
|
|
||||||
|
<Type>Topic</Type>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40327</ID>
|
||||||
|
|
||||||
|
<Title>1-400</Title>
|
||||||
|
|
||||||
|
<Type>Topic</Type>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40615</ID>
|
||||||
|
|
||||||
|
<Title>dolů ... pohybovat</Title>
|
||||||
|
|
||||||
|
<Type>Topic</Type>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40618</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>sly&#353;et</Question>
|
||||||
|
|
||||||
|
<Answer>hear [hi&#273;r]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>6296</Interval>
|
||||||
|
|
||||||
|
<Repetitions>7</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>21.01.2004</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>6,416</AFactor>
|
||||||
|
|
||||||
|
<UFactor>5,835</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40619</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>d&#237;vat se (na)</Question>
|
||||||
|
|
||||||
|
<Answer>look (at) [luk]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>1662</Interval>
|
||||||
|
|
||||||
|
<Repetitions>6</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>22.09.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>5,401</AFactor>
|
||||||
|
|
||||||
|
<UFactor>2,115</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<Type>Topic</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>N&#225;sleduje prv&#253;ch 400 polo&#382;ek =
|
||||||
|
dvojic ot&#225;zka - odpov&#283;&#271;</Question>
|
||||||
|
|
||||||
|
<Answer />
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>0</Interval>
|
||||||
|
|
||||||
|
<Repetitions>0</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>04.08.2000</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>3,000</AFactor>
|
||||||
|
|
||||||
|
<UFactor>0,000</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40677</ID>
|
||||||
|
|
||||||
|
<Title>pršet ... obvykle</Title>
|
||||||
|
|
||||||
|
<Type>Topic</Type>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40678</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>pr&#353;et (nap&#345;.:
|
||||||
|
pr&#353;&#237;)</Question>
|
||||||
|
|
||||||
|
<Answer>rain [rein] (it's raining)</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>1734</Interval>
|
||||||
|
|
||||||
|
<Repetitions>6</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>28.12.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>4,221</AFactor>
|
||||||
|
|
||||||
|
<UFactor>2,206</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40679</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>sestra</Question>
|
||||||
|
|
||||||
|
<Answer>sister ['sist&#273;r]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>4890</Interval>
|
||||||
|
|
||||||
|
<Repetitions>5</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>28.12.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>6,322</AFactor>
|
||||||
|
|
||||||
|
<UFactor>6,302</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40680</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>syn</Question>
|
||||||
|
|
||||||
|
<Answer>son [san]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>5260</Interval>
|
||||||
|
|
||||||
|
<Repetitions>6</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>28.12.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>6,238</AFactor>
|
||||||
|
|
||||||
|
<UFactor>6,284</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40681</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>rozum&#283;t</Question>
|
||||||
|
|
||||||
|
<Answer>understand [,and&#273;r'st&#281;nd]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>5115</Interval>
|
||||||
|
|
||||||
|
<Repetitions>5</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>28.12.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>6,329</AFactor>
|
||||||
|
|
||||||
|
<UFactor>6,292</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40682</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>nav&#353;t&#237;vit</Question>
|
||||||
|
|
||||||
|
<Answer>visit ['vizit]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>4797</Interval>
|
||||||
|
|
||||||
|
<Repetitions>5</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>28.12.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>6,329</AFactor>
|
||||||
|
|
||||||
|
<UFactor>6,295</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40683</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>n&#225;v&#353;t&#283;va</Question>
|
||||||
|
|
||||||
|
<Answer>visit ['vizit]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>4437</Interval>
|
||||||
|
|
||||||
|
<Repetitions>5</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>15.10.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>6,256</AFactor>
|
||||||
|
|
||||||
|
<UFactor>5,398</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40684</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>bez (nap&#345;.: bez n&#225;s)</Question>
|
||||||
|
|
||||||
|
<Answer>without [wi&#247;'aut] (without us)</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>4826</Interval>
|
||||||
|
|
||||||
|
<Repetitions>6</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>28.12.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>6,188</AFactor>
|
||||||
|
|
||||||
|
<UFactor>6,276</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40685</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>potkat</Question>
|
||||||
|
|
||||||
|
<Answer>meet [mi:t]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>1164</Interval>
|
||||||
|
|
||||||
|
<Repetitions>6</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>1</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>14.11.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>3,976</AFactor>
|
||||||
|
|
||||||
|
<UFactor>1,953</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40686</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>postel, l&#367;&#382;ko</Question>
|
||||||
|
|
||||||
|
<Answer>bed [bed]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>5023</Interval>
|
||||||
|
|
||||||
|
<Repetitions>6</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>28.12.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>6,188</AFactor>
|
||||||
|
|
||||||
|
<UFactor>6,302</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40687</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>tma</Question>
|
||||||
|
|
||||||
|
<Answer>darkness [da:rkn&#273;s]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>1186</Interval>
|
||||||
|
|
||||||
|
<Repetitions>8</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>28.12.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>3,801</AFactor>
|
||||||
|
|
||||||
|
<UFactor>1,944</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40688</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>doktor, l&#233;ka&#345;</Question>
|
||||||
|
|
||||||
|
<Answer>doctor ['dokt&#273;r]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>5237</Interval>
|
||||||
|
|
||||||
|
<Repetitions>6</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>28.12.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>6,216</AFactor>
|
||||||
|
|
||||||
|
<UFactor>6,310</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40689</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>hodina (60 minut)</Question>
|
||||||
|
|
||||||
|
<Answer>hour [au&#273;r]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>1771</Interval>
|
||||||
|
|
||||||
|
<Repetitions>6</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>28.12.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>4,193</AFactor>
|
||||||
|
|
||||||
|
<UFactor>2,288</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40690</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>druh (typ)</Question>
|
||||||
|
|
||||||
|
<Answer>kind [kaind] sort [so:rt] (type)</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>1813</Interval>
|
||||||
|
|
||||||
|
<Repetitions>6</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>06.09.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>5,705</AFactor>
|
||||||
|
|
||||||
|
<UFactor>2,457</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40691</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>posledn&#237;</Question>
|
||||||
|
|
||||||
|
<Answer>last [la:st]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>4914</Interval>
|
||||||
|
|
||||||
|
<Repetitions>6</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>28.12.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>6,216</AFactor>
|
||||||
|
|
||||||
|
<UFactor>6,332</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40692</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>cena</Question>
|
||||||
|
|
||||||
|
<Answer>price [prais]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>5178</Interval>
|
||||||
|
|
||||||
|
<Repetitions>6</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>28.12.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>6,202</AFactor>
|
||||||
|
|
||||||
|
<UFactor>6,322</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40693</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>pamatovat</Question>
|
||||||
|
|
||||||
|
<Answer>remember [ri'memb&#273;r]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>1843</Interval>
|
||||||
|
|
||||||
|
<Repetitions>6</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>28.12.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>4,193</AFactor>
|
||||||
|
|
||||||
|
<UFactor>2,267</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40694</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>bohat&#253;</Question>
|
||||||
|
|
||||||
|
<Answer>rich [ri&#269;]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>3958</Interval>
|
||||||
|
|
||||||
|
<Repetitions>8</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>1</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>28.12.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>6,373</AFactor>
|
||||||
|
|
||||||
|
<UFactor>6,243</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40695</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>slunce</Question>
|
||||||
|
|
||||||
|
<Answer>sun [san]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>1924</Interval>
|
||||||
|
|
||||||
|
<Repetitions>6</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>28.12.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>4,193</AFactor>
|
||||||
|
|
||||||
|
<UFactor>2,293</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40696</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>plavat (o &#269;lov&#283;ku nebo
|
||||||
|
zv&#237;&#345;eti)</Question>
|
||||||
|
|
||||||
|
<Answer>swim [swim]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>4792</Interval>
|
||||||
|
|
||||||
|
<Repetitions>6</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>28.12.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>6,238</AFactor>
|
||||||
|
|
||||||
|
<UFactor>6,305</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40697</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>obvykle</Question>
|
||||||
|
|
||||||
|
<Answer>usually ['ju&#382;u&#273;li]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>3770</Interval>
|
||||||
|
|
||||||
|
<Repetitions>7</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>1</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>28.12.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>5,896</AFactor>
|
||||||
|
|
||||||
|
<UFactor>5,610</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
</SuperMemoElement>
|
||||||
|
</SuperMemoElement>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>43617</ID>
|
||||||
|
|
||||||
|
<Title>Vocabulary</Title>
|
||||||
|
|
||||||
|
<Type>Topic</Type>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>43832</ID>
|
||||||
|
|
||||||
|
<Title>gramatika</Title>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>43872</ID>
|
||||||
|
|
||||||
|
<Title>lekce9</Title>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>43876</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>Are you coming? - kratke odp.</Question>
|
||||||
|
|
||||||
|
<Answer>I thing so > Mysli ze ano I belive so I hope so I
|
||||||
|
don't thing so I hope not I thing not</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>525</Interval>
|
||||||
|
|
||||||
|
<Repetitions>5</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>1</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>08.11.2004</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>4,799</AFactor>
|
||||||
|
|
||||||
|
<UFactor>1,888</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>43877</ID>
|
||||||
|
|
||||||
|
<Title>lekce10</Title>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>40126</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>Nechala by nas myt se ve studene vode.</Question>
|
||||||
|
|
||||||
|
<Answer>She WOULD make us wash in ice-cold water.</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>82</Interval>
|
||||||
|
|
||||||
|
<Repetitions>4</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>2</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>27.09.2005</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>5,470</AFactor>
|
||||||
|
|
||||||
|
<UFactor>6,308</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>43884</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>Zvykam si na podnebi.</Question>
|
||||||
|
|
||||||
|
<Answer>I'm getting used to the climate. ----------- get >
|
||||||
|
zmena stavu</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>384</Interval>
|
||||||
|
|
||||||
|
<Repetitions>5</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>2</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>05.09.2005</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>3,699</AFactor>
|
||||||
|
|
||||||
|
<UFactor>1,770</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
</SuperMemoElement>
|
||||||
|
</SuperMemoElement>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>43404</ID>
|
||||||
|
|
||||||
|
<Title>Vocabulary - books</Title>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>29049</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>znep&#345;&#225;telit se</Question>
|
||||||
|
|
||||||
|
<Answer>fall out</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>2447</Interval>
|
||||||
|
|
||||||
|
<Repetitions>6</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>4</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>13.10.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>6,079</AFactor>
|
||||||
|
|
||||||
|
<UFactor>4,582</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>29101</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>bla&#382;en&#253;</Question>
|
||||||
|
|
||||||
|
<Answer>blissful [blisfl]</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>1356</Interval>
|
||||||
|
|
||||||
|
<Repetitions>6</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>1</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>14.11.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>4,236</AFactor>
|
||||||
|
|
||||||
|
<UFactor>2,291</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>29964</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>p&#345;evz&#237;t</Question>
|
||||||
|
|
||||||
|
<Answer>take over</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>1929</Interval>
|
||||||
|
|
||||||
|
<Repetitions>7</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>2</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>04.07.2005</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>4,877</AFactor>
|
||||||
|
|
||||||
|
<UFactor>1,939</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>38828</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question />
|
||||||
|
|
||||||
|
<Answer />
|
||||||
|
</Content>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>39795</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>&#382;ivotopis</Question>
|
||||||
|
|
||||||
|
<Answer>curiculum vitae</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>1999</Interval>
|
||||||
|
|
||||||
|
<Repetitions>6</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>2</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>13.10.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>5,705</AFactor>
|
||||||
|
|
||||||
|
<UFactor>3,675</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>BOOKs - in english</Question>
|
||||||
|
|
||||||
|
<Answer />
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>0</Interval>
|
||||||
|
|
||||||
|
<Repetitions>0</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>0</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>04.08.2000</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>3,000</AFactor>
|
||||||
|
|
||||||
|
<UFactor>0,000</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
|
||||||
|
<SuperMemoElement>
|
||||||
|
<ID>43499</ID>
|
||||||
|
|
||||||
|
<Type>Item</Type>
|
||||||
|
|
||||||
|
<Content>
|
||||||
|
<Question>p&#345;epojit</Question>
|
||||||
|
|
||||||
|
<Answer>put through</Answer>
|
||||||
|
</Content>
|
||||||
|
|
||||||
|
<LearningData>
|
||||||
|
<Interval>1739</Interval>
|
||||||
|
|
||||||
|
<Repetitions>8</Repetitions>
|
||||||
|
|
||||||
|
<Lapses>1</Lapses>
|
||||||
|
|
||||||
|
<LastRepetition>13.10.2002</LastRepetition>
|
||||||
|
|
||||||
|
<AFactor>5,520</AFactor>
|
||||||
|
|
||||||
|
<UFactor>3,257</UFactor>
|
||||||
|
</LearningData>
|
||||||
|
</SuperMemoElement>
|
||||||
|
</SuperMemoElement>
|
||||||
|
</SuperMemoElement>
|
||||||
|
</SuperMemoCollection>
|
||||||
1
tests/importing/supermemo_ENGLISHVOCABULARYBUILDER.xml
Normal file
1
tests/importing/supermemo_ENGLISHVOCABULARYBUILDER.xml
Normal file
File diff suppressed because one or more lines are too long
1
tests/importing/supermemo_EnglishPronunciationTop100.xml
Normal file
1
tests/importing/supermemo_EnglishPronunciationTop100.xml
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -5,7 +5,7 @@ from tests.shared import assertException
|
||||||
|
|
||||||
from anki.errors import *
|
from anki.errors import *
|
||||||
from anki import DeckStorage
|
from anki import DeckStorage
|
||||||
from anki.importing import anki10, csvfile, mnemosyne10
|
from anki.importing import anki10, csvfile, mnemosyne10, supermemo_xml
|
||||||
from anki.stdmodels import BasicModel
|
from anki.stdmodels import BasicModel
|
||||||
from anki.facts import Fact
|
from anki.facts import Fact
|
||||||
from anki.sync import SyncClient, SyncServer
|
from anki.sync import SyncClient, SyncServer
|
||||||
|
|
@ -45,6 +45,44 @@ def test_mnemosyne10():
|
||||||
assert i.total == 5
|
assert i.total == 5
|
||||||
deck.s.close()
|
deck.s.close()
|
||||||
|
|
||||||
|
def test_supermemo_xml_01_unicode():
|
||||||
|
deck = DeckStorage.Deck()
|
||||||
|
deck.addModel(BasicModel())
|
||||||
|
file = unicode(os.path.join(testDir, "importing/supermemo_ENGLISHFORBEGGINERS_noOEM.xml"))
|
||||||
|
i = supermemo_xml.SupermemoXmlImporter(deck, file)
|
||||||
|
#i.META.logToStdOutput = True
|
||||||
|
i.doImport()
|
||||||
|
assert i.total == 92
|
||||||
|
deck.s.close()
|
||||||
|
|
||||||
|
def test_supermemo_xml_02_escaped():
|
||||||
|
deck = DeckStorage.Deck()
|
||||||
|
deck.addModel(BasicModel())
|
||||||
|
file = unicode(os.path.join(testDir, "importing/supermemo_ENGLISHFORBEGGINERS_oem_1250.xml"))
|
||||||
|
i = supermemo_xml.SupermemoXmlImporter(deck, file)
|
||||||
|
i.doImport()
|
||||||
|
assert i.total == 30
|
||||||
|
deck.s.close()
|
||||||
|
|
||||||
|
def test_supermemo_xml_03():
|
||||||
|
deck = DeckStorage.Deck()
|
||||||
|
deck.addModel(BasicModel())
|
||||||
|
file = unicode(os.path.join(testDir, "importing/supermemo_EnglishPronunciationTop100.xml"))
|
||||||
|
i = supermemo_xml.SupermemoXmlImporter(deck, file)
|
||||||
|
#i.META.logToStdOutput = True
|
||||||
|
i.doImport()
|
||||||
|
assert i.total == 100
|
||||||
|
deck.s.close()
|
||||||
|
|
||||||
|
def test_supermemo_xml_04():
|
||||||
|
deck = DeckStorage.Deck()
|
||||||
|
deck.addModel(BasicModel())
|
||||||
|
file = unicode(os.path.join(testDir, "importing/supermemo_ENGLISHVOCABULARYBUILDER.xml"))
|
||||||
|
i = supermemo_xml.SupermemoXmlImporter(deck, file)
|
||||||
|
i.doImport()
|
||||||
|
assert i.total == 60
|
||||||
|
deck.s.close()
|
||||||
|
|
||||||
def test_anki10():
|
def test_anki10():
|
||||||
# though these are not modified, sqlite updates the mtime, so copy to tmp
|
# though these are not modified, sqlite updates the mtime, so copy to tmp
|
||||||
# first
|
# first
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue