Chinese to english translation
This commit is contained in:
parent
da7bc7fc1f
commit
049d74bd70
@ -8,7 +8,7 @@ from ..base import *
|
||||
|
||||
css = ''
|
||||
|
||||
@register(u'西语助手')
|
||||
@register([u'西语助手', u'esdict'])
|
||||
class Esdict(WebService):
|
||||
|
||||
def __init__(self):
|
||||
@ -55,7 +55,7 @@ class Esdict(WebService):
|
||||
except Exception as e:
|
||||
return {}
|
||||
|
||||
@export(u'真人发音')
|
||||
@export([u'真人发音', u'Real person pronounciation'])
|
||||
def fld_sound(self):
|
||||
url = 'https://api.frdic.com/api/v2/speech/speakweb?langid=es&txt=QYN{word}'.format(
|
||||
word=urllib2.quote(base64.b64encode(self.word.encode('utf-8')))
|
||||
@ -65,30 +65,30 @@ class Esdict(WebService):
|
||||
return self.get_anki_label(filename, 'audio')
|
||||
return ''
|
||||
|
||||
@export(u'音标')
|
||||
@export([u'音标', u'Phonetic symbols'])
|
||||
def fld_phonetic(self):
|
||||
return self._get_field('phonitic')
|
||||
|
||||
@export(u'西汉-汉西词典')
|
||||
@export([u'西汉-汉西词典', u'spanish-chinese/chinese-spanish dictionary'])
|
||||
@with_styles(css=css)
|
||||
def fld_fccf(self):
|
||||
return self._get_field('fccf')
|
||||
|
||||
@export(u'西语例句库')
|
||||
@export([u'西语例句库', u'Spanish examples'])
|
||||
@with_styles(css=css)
|
||||
def fld_example(self):
|
||||
return self._get_field('example')
|
||||
|
||||
@export(u'近义、反义、派生词典')
|
||||
@export([u'近义、反义、派生词典', u'Synonyms, antonyms, derivatives'])
|
||||
def fld_syn(self):
|
||||
return self._get_field('syn')
|
||||
|
||||
@export(u'西西词典')
|
||||
@export([u'西西词典', u'Spanish-spanish dictionary'])
|
||||
@with_styles(css=css)
|
||||
def fld_ff(self):
|
||||
return self._get_field('ff')
|
||||
|
||||
@export(u'西英词典')
|
||||
@export([u'西英词典', u'Spanish-english dictionary'])
|
||||
@with_styles(css=css)
|
||||
def fld_fe(self):
|
||||
return self._get_field('fe')
|
||||
|
||||
@ -8,7 +8,7 @@ from ..base import *
|
||||
|
||||
css = ''
|
||||
|
||||
@register(u'法语助手')
|
||||
@register([u'法语助手', u'frdic'])
|
||||
class Frdic(WebService):
|
||||
|
||||
def __init__(self):
|
||||
@ -55,7 +55,7 @@ class Frdic(WebService):
|
||||
except Exception as e:
|
||||
return {}
|
||||
|
||||
@export(u'真人发音')
|
||||
@export([u'真人发音', u'Real person pronounciation'])
|
||||
def fld_sound(self):
|
||||
url = 'https://api.frdic.com/api/v2/speech/speakweb?langid=fr&txt=QYN{word}'.format(
|
||||
word=urllib2.quote(base64.b64encode(self.word.encode('utf-8')))
|
||||
@ -65,30 +65,30 @@ class Frdic(WebService):
|
||||
return self.get_anki_label(filename, 'audio')
|
||||
return ''
|
||||
|
||||
@export(u'音标')
|
||||
@export([u'音标', u'Phonetic symbol'])
|
||||
def fld_phonetic(self):
|
||||
return self._get_field('phonitic')
|
||||
|
||||
@export(u'法汉-汉法词典')
|
||||
@export([u'法汉-汉法词典', u'French-chinese/chinese-french dictionary'])
|
||||
def fld_fccf(self):
|
||||
return self._get_field('fccf')
|
||||
|
||||
@export(u'法语例句库')
|
||||
@export([u'法语例句库', u'French examples'])
|
||||
@with_styles(css=css)
|
||||
def fld_example(self):
|
||||
return self._get_field('example')
|
||||
|
||||
@export(u'近义、反义、派生词典')
|
||||
@export([u'近义、反义、派生词典', u'Synonyms, antonyms, derivative'])
|
||||
@with_styles(css=css)
|
||||
def fld_syn(self):
|
||||
return self._get_field('syn')
|
||||
|
||||
@export(u'法法词典')
|
||||
@export([u'法法词典', u'French-french dictionary'])
|
||||
@with_styles(css=css)
|
||||
def fld_ff(self):
|
||||
return self._get_field('ff')
|
||||
|
||||
@export(u'法英词典')
|
||||
@export([u'法英词典', u'French-english dictionary'])
|
||||
@with_styles(css=css)
|
||||
def fld_fe(self):
|
||||
return self._get_field('fe')
|
||||
|
||||
@ -11,7 +11,7 @@ from ...utils import ignore_exception
|
||||
iciba_download_mp3 = True
|
||||
|
||||
|
||||
@register(u'爱词霸')
|
||||
@register([u'爱词霸', u'iciba'])
|
||||
class ICIBA(WebService):
|
||||
|
||||
def __init__(self):
|
||||
@ -39,19 +39,19 @@ class ICIBA(WebService):
|
||||
# return resp
|
||||
|
||||
@ignore_exception
|
||||
@export(u'美式音标')
|
||||
@export([u'美式音标', u'American phonetic'])
|
||||
def fld_phonetic_us(self):
|
||||
seg = self._get_field('baesInfo')
|
||||
return '/' + seg['symbols'][0]['ph_am'] + '/'
|
||||
|
||||
@ignore_exception
|
||||
@export(u'英式音标')
|
||||
@export([u'英式音标', u'British phonetic'])
|
||||
def fld_phonetic_uk(self):
|
||||
seg = self._get_field('baesInfo')
|
||||
return '/' + seg['symbols'][0]['ph_en'] + '/'
|
||||
|
||||
@ignore_exception
|
||||
@export(u'美式发音')
|
||||
@export([u'美式发音', u'American pronounciation'])
|
||||
def fld_mp3_us(self):
|
||||
seg = self._get_field('baesInfo')
|
||||
audio_url, t = seg['symbols'][0]['ph_am_mp3'], 'am'
|
||||
@ -64,7 +64,7 @@ class ICIBA(WebService):
|
||||
return audio_url
|
||||
|
||||
@ignore_exception
|
||||
@export(u'英式发音')
|
||||
@export([u'英式发音', u'British pronounciation'])
|
||||
def fld_mp3_uk(self):
|
||||
seg = self._get_field('baesInfo')
|
||||
audio_url, t = seg['symbols'][0]['ph_en_mp3'], 'en'
|
||||
@ -77,14 +77,14 @@ class ICIBA(WebService):
|
||||
return audio_url
|
||||
|
||||
@ignore_exception
|
||||
@export(u'释义')
|
||||
@export([u'释义', u'Explanation'])
|
||||
def fld_definition(self):
|
||||
seg = self._get_field('baesInfo')
|
||||
parts = seg['symbols'][0]['parts']
|
||||
return u'<br>'.join([part['part'] + ' ' + '; '.join(part['means']) for part in parts])
|
||||
|
||||
@ignore_exception
|
||||
@export(u'双语例句')
|
||||
@export([u'双语例句', u'Bilingual examples'])
|
||||
def fld_samples(self):
|
||||
sentences = ''
|
||||
segs = self._get_field('sentence')
|
||||
@ -97,7 +97,7 @@ class ICIBA(WebService):
|
||||
return u"""<ol>{}</ol>""".format(sentences)
|
||||
|
||||
@ignore_exception
|
||||
@export(u'权威例句')
|
||||
@export([u'权威例句', u'Authoritative examples'])
|
||||
def fld_auth_sentence(self):
|
||||
sentences = ''
|
||||
segs = self._get_field('auth_sentence')
|
||||
@ -108,7 +108,7 @@ class ICIBA(WebService):
|
||||
return u"""<ol>{}</ol>""".format(sentences)
|
||||
|
||||
@ignore_exception
|
||||
@export(u'句式用法')
|
||||
@export([u'句式用法', u'Sentence pattern usage'])
|
||||
def fld_usage(self):
|
||||
sentences = ''
|
||||
segs = self._get_field('jushi')
|
||||
@ -121,13 +121,13 @@ class ICIBA(WebService):
|
||||
return u"""<ol>{}</ol>""".format(sentences)
|
||||
|
||||
@ignore_exception
|
||||
@export(u'使用频率')
|
||||
@export([u'使用频率', u'Usage frequency'])
|
||||
def fld_frequence(self):
|
||||
seg = self._get_field('baesInfo')
|
||||
return str(seg['frequence'])
|
||||
|
||||
@ignore_exception
|
||||
@export(u'英文例句')
|
||||
@export([u'英文例句', u'English examples'])
|
||||
def fld_st(self):
|
||||
sentences = ''
|
||||
segs = self._get_field('sentence')
|
||||
@ -137,7 +137,7 @@ class ICIBA(WebService):
|
||||
return sentences
|
||||
|
||||
@ignore_exception
|
||||
@export(u'例句翻译')
|
||||
@export([u'例句翻译', u'Examples translation'])
|
||||
def fld_sttr(self):
|
||||
sentences = ''
|
||||
segs = self._get_field('sentence')
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
from ..base import *
|
||||
|
||||
|
||||
@register(u'海词迷你词典')
|
||||
@register([u'海词迷你词典', u'cidian.dict'])
|
||||
class MiniDict(WebService):
|
||||
|
||||
def __init__(self):
|
||||
@ -45,19 +45,19 @@ class MiniDict(WebService):
|
||||
|
||||
return self.cache_this(result)
|
||||
|
||||
@export(u'音标')
|
||||
@export([u'音标', u'Phonetic symbol'])
|
||||
def fld_phonetic(self):
|
||||
return self._get_field('phonetic')
|
||||
|
||||
@export(u'基本释义')
|
||||
@export([u'基本释义', u'Expressions'])
|
||||
def fld_explains(self):
|
||||
return self._get_field('expressions')
|
||||
|
||||
@export(u'例句与用法')
|
||||
@export([u'例句与用法', u'Example and pattern'])
|
||||
@with_styles(css='em {color:#cc0066;font-style:normal;}', need_wrap_css=True, wrap_class='minidict')
|
||||
def fld_sentences(self):
|
||||
return self._get_field('sentences')
|
||||
|
||||
@export(u'词形变化')
|
||||
@export([u'词形变化', u'Inflections'])
|
||||
def fld_variations(self):
|
||||
return self._get_field('variations')
|
||||
|
||||
@ -33,7 +33,7 @@ class Youdaofr(WebService):
|
||||
pass
|
||||
return self.cache_this(result)
|
||||
|
||||
@export(u'基本释义')
|
||||
@export([u'基本释义', u'Explanations'])
|
||||
def fld_explains(self):
|
||||
return self.cache_result('explains') if self.cached('explains') else \
|
||||
self._get_from_api().get('explains', '')
|
||||
@ -59,18 +59,18 @@ class Youdaofr(WebService):
|
||||
except:
|
||||
return ''
|
||||
|
||||
@export(u'网络释义')
|
||||
@export([u'网络释义', u'Web translation'])
|
||||
def fld_web_trans(self):
|
||||
return self._get_singledict('web_trans')
|
||||
|
||||
@export(u'双语例句')
|
||||
@export([u'双语例句', u'Bilingual examples'])
|
||||
def fld_blng_sents_part(self):
|
||||
return self._get_singledict('blng_sents_part')
|
||||
|
||||
@export(u'百科')
|
||||
@export([u'百科', u'Encyclopedia'])
|
||||
def fld_baike(self):
|
||||
return self._get_singledict('baike')
|
||||
|
||||
@export(u'汉语词典(中)')
|
||||
@export([u'汉语词典(中)', u'Chinese dictionary'])
|
||||
def fld_hh(self):
|
||||
return self._get_singledict('hh')
|
||||
|
||||
@ -33,7 +33,7 @@ class Youdaoko(WebService):
|
||||
pass
|
||||
return self.cache_this(result)
|
||||
|
||||
@export(u'基本释义')
|
||||
@export([u'基本释义', u'Explanations'])
|
||||
def fld_explains(self):
|
||||
return self.cache_result('explains') if self.cached('explains') else \
|
||||
self._get_from_api().get('explains', '')
|
||||
@ -59,18 +59,18 @@ class Youdaoko(WebService):
|
||||
except:
|
||||
return ''
|
||||
|
||||
@export(u'网络释义')
|
||||
@export([u'网络释义', u'Web translation'])
|
||||
def fld_web_trans(self):
|
||||
return self._get_singledict('web_trans')
|
||||
|
||||
@export(u'双语例句')
|
||||
@export([u'双语例句', u'Bilingual examples'])
|
||||
def fld_blng_sents_part(self):
|
||||
return self._get_singledict('blng_sents_part')
|
||||
|
||||
@export(u'百科')
|
||||
@export([u'百科', u'Encyclopedia'])
|
||||
def fld_baike(self):
|
||||
return self._get_singledict('baike')
|
||||
|
||||
@export(u'汉语词典(中)')
|
||||
@export([u'汉语词典(中)', u'Chinese dictionary'])
|
||||
def fld_hh(self):
|
||||
return self._get_singledict('hh')
|
||||
|
||||
Loading…
Reference in New Issue
Block a user