本文整理汇总了Python中enchant.utils.EnchantStr.decode方法的典型用法代码示例。如果您正苦于以下问题:Python EnchantStr.decode方法的具体用法?Python EnchantStr.decode怎么用?Python EnchantStr.decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类enchant.utils.EnchantStr
的用法示例。
在下文中一共展示了EnchantStr.decode方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cb_func
# 需要导入模块: from enchant.utils import EnchantStr [as 别名]
# 或者: from enchant.utils.EnchantStr import decode [as 别名]
def cb_func(tag,name,desc,file):
s = EnchantStr("")
tag = s.decode(tag)
name = s.decode(name)
desc = s.decode(desc)
file = s.decode(file)
cb_result.append((tag,name,desc,file))
示例2: __describe_callback
# 需要导入模块: from enchant.utils import EnchantStr [as 别名]
# 或者: from enchant.utils.EnchantStr import decode [as 别名]
def __describe_callback(self,name,desc,file):
"""Collector callback for dictionary description.
This method is used as a callback into the _enchant function
'enchant_broker_describe'. It collects the given arguments in
a tuple and appends them to the list '__describe_result'.
"""
s = EnchantStr("")
name = s.decode(name)
desc = s.decode(desc)
file = s.decode(file)
self.__describe_result.append((name,desc,file))
示例3: __list_dicts_callback
# 需要导入模块: from enchant.utils import EnchantStr [as 别名]
# 或者: from enchant.utils.EnchantStr import decode [as 别名]
def __list_dicts_callback(self,tag,name,desc,file):
"""Collector callback for listing dictionaries.
This method is used as a callback into the _enchant function
'enchant_broker_list_dicts'. It collects the given arguments into
an appropriate tuple and appends them to '__list_dicts_result'.
"""
s = EnchantStr("")
tag = s.decode(tag)
name = s.decode(name)
desc = s.decode(desc)
file = s.decode(file)
self.__list_dicts_result.append((tag,(name,desc,file)))
示例4: get_param
# 需要导入模块: from enchant.utils import EnchantStr [as 别名]
# 或者: from enchant.utils.EnchantStr import decode [as 别名]
def get_param(self,name):
"""Get the value of a named parameter on this broker.
Parameters are used to provide runtime information to individual
provider backends. See the method 'set_param' for more details.
"""
name = EnchantStr(name)
return name.decode(_e.broker_get_param(self._this,name.encode()))
示例5: suggest
# 需要导入模块: from enchant.utils import EnchantStr [as 别名]
# 或者: from enchant.utils.EnchantStr import decode [as 别名]
def suggest(self,word):
"""Suggest possible spellings for a word.
This method tries to guess the correct spelling for a given
word, returning the possibilities in a list.
"""
self._check_this()
word = EnchantStr(word)
suggs = _e.dict_suggest(self._this,word.encode())
return [word.decode(w) for w in suggs]
示例6: suggest
# 需要导入模块: from enchant.utils import EnchantStr [as 别名]
# 或者: from enchant.utils.EnchantStr import decode [as 别名]
def suggest(self,word):
"""Suggest possible spellings for a word.
This method tries to guess the correct spelling for a given
word, returning the possibilities in a list.
"""
self._check_this()
word = EnchantStr(word)
# Enchant asserts that the word is non-empty.
# Check it up-front to avoid nasty warnings on stderr.
if len(word) == 0:
raise ValueError("can't suggest spellings for empty string")
suggs = _e.dict_suggest(self._this,word.encode())
return [word.decode(w) for w in suggs]