Exemplo n.º 1
0
def en_lookup(word, is_speak, is_forms, is_web_translatation,
              is_example_sentences, is_web_explains):
    mydictionary = en_dictionary(word)
    if mydictionary.return_phrase == "":
        fanyi_lookup(word)
    else:
        print "\033[1;34;40m%s\033[0m" % mydictionary.return_phrase
        if mydictionary.phonetic_symbol != None:
            print  "\033[1;31;40m[%s]\033[0m" % mydictionary.phonetic_symbol
        for x in mydictionary.cn_translation:
            print  "\033[1;36;40m%s\033[0m" % x
        if is_forms:
            display_forms(mydictionary)
        if is_web_explains:
            display_web_explains(word)
        if is_example_sentences:
            display_web_sencences(mydictionary)
        if is_speak:
            mydictionary.speak()
Exemplo n.º 2
0
def look_up(word):
    mydictionary = en_dictionary(str(word))
    myfanyi = fanyi_dictionary(str(word))
    res = translate(mydictionary, myfanyi)
    return res