From e64501cdb739cd88f2c88c241158019a07839ba9 Mon Sep 17 00:00:00 2001 From: "St.Huang" Date: Mon, 1 Oct 2018 14:15:03 +0800 Subject: [PATCH] bug fixes. --- addons/fastwq/service/dict/bing3tp.py | 10 ++++++++-- addons21/fastwq/service/dict/bing3tp.py | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/addons/fastwq/service/dict/bing3tp.py b/addons/fastwq/service/dict/bing3tp.py index 8af015b..cb0d5c9 100644 --- a/addons/fastwq/service/dict/bing3tp.py +++ b/addons/fastwq/service/dict/bing3tp.py @@ -32,12 +32,18 @@ class BingXtk(WebService): @export('AME_PHON') def fld_phonetic_us(self): seg = self._get_field('pronunciation') - return seg.get('AmE', u'') if seg else u'' + phon = seg.get('AmE', u'') if seg else u'' + if phon and phon[0:1] not in '/[': + return u'/{}/'.format(phon) + return u'' @export('BRE_PHON') def fld_phonetic_uk(self): seg = self._get_field('pronunciation') - return seg.get('BrE', u'') if seg else u'' + phon = seg.get('BrE', u'') if seg else u'' + if phon and phon[0:1] not in '/[': + return u'/{}/'.format(phon) + return u'' def _fld_mp3(self, fld): seg = self._get_field('pronunciation') diff --git a/addons21/fastwq/service/dict/bing3tp.py b/addons21/fastwq/service/dict/bing3tp.py index 8af015b..cb0d5c9 100644 --- a/addons21/fastwq/service/dict/bing3tp.py +++ b/addons21/fastwq/service/dict/bing3tp.py @@ -32,12 +32,18 @@ class BingXtk(WebService): @export('AME_PHON') def fld_phonetic_us(self): seg = self._get_field('pronunciation') - return seg.get('AmE', u'') if seg else u'' + phon = seg.get('AmE', u'') if seg else u'' + if phon and phon[0:1] not in '/[': + return u'/{}/'.format(phon) + return u'' @export('BRE_PHON') def fld_phonetic_uk(self): seg = self._get_field('pronunciation') - return seg.get('BrE', u'') if seg else u'' + phon = seg.get('BrE', u'') if seg else u'' + if phon and phon[0:1] not in '/[': + return u'/{}/'.format(phon) + return u'' def _fld_mp3(self, fld): seg = self._get_field('pronunciation')