Пример #1
0
def get_notations_result(userid, content):
    r = phonetic.get_notations_result(content)
    if r:
        if cache_user_msg(userid, "@" + content):
            result = TranslateResult()
            result.words = r.in_str
            result.pronounce_list = r.plist
            result.has_pronounce = True
            cache_notations(userid, result)
            return r.pretty() + u"\n--回复#获得语音--"
        else:
            return r.pretty()

    else:
        return u"暂无解析1"
Пример #2
0
def get_notations_result(userid, content):
	r = phonetic.get_notations_result(content)
	if r:
		if cache_user_msg(userid,"@"+content):
			result = TranslateResult()
			result.words = r.in_str
			result.pronounce_list = r.plist
			result.has_pronounce = True
			cache_notations(userid, result)
			return r.pretty() + u"\n--回复#获得语音--"
		else:
			return r.pretty()

	else:
		return u"暂无解析1"
Пример #3
0
	except Exception, e:
		print resp
		raise e

	trans_result = node["trans_result"]
	result_text = ""
	for t in trans_result:
		dst = t["dst"]
		if type(dst)==unicode:
			dst = dst.encode("utf-8")
			# print dst
		result_text = result_text + "\n" + dst 

	# print result_text
	result_text = result_text[1:]
	r = phonetic.get_notations_result(result_text.decode("utf-8"))
	print r.plist
	result = TranslateResult()
	result.words = r.in_str
	result.pronounce_list = r.plist
	result.has_pronounce = True
	return result

_traslate_url = "http://www.l2china.com/yueyu/"
_text_len_limit = 100

def get_translation_l2china(text):
	uni = type(text) == unicode
	if uni:
		txt_len = len(text)
		utf8_txt = text.encode('utf-8')