예제 #1
0
def cleanWord(word):
    return ''.join(e for e in word.lower() if e.islower())
예제 #2
0
try:
    export_type = sys.argv[1]
    if export_type == 'text':
        handler = word.Text(config.sources.get('text'))
    elif export_type == 'kindle':
        handler = word.Kindle(config.sources.get('kindle'))
    else:
        raise Exception('unsupported type')

    handler.read()

    lingualeo = service.Lingualeo(email, password)
    lingualeo.auth()

    for word in handler.get():
        word = word.lower()
        translate = lingualeo.get_translates(word)

        lingualeo.add_word(translate["word"], translate["tword"])

        if translate["is_exist"]:
            result = "Already exists: "
        else:
            result = "Add word: "

        result = result + word
        print result


except Exception as e:
    print e.args, e.message
예제 #3
0
learned_words = [word['word_value'] for word in lingualeo.get_learned_words()]

print len(learned_words), 'words learnt'

added_words = [
    word['word_value'] for word in lingualeo.get_user_dict_words(groupId)
]

print len(added_words), 'words in group', groupId

already_learnt = 0
already_added = 0

for word in words:
    word = word.lower()
    i += 1

    print i, 'of', len(words), ':',

    if len(word) == 1:
        print 'skip', word
        continue

    if options.skip_learned and word in learned_words:
        print 'already learnt, skip', word
        already_learnt += 1
        continue

    if word in added_words:
        print 'already added, skip', word