当前位置: 首页>>代码示例>>Python>>正文


Python PyDictionary.PyDictionary方法代码示例

本文整理汇总了Python中PyDictionary.PyDictionary方法的典型用法代码示例。如果您正苦于以下问题:Python PyDictionary.PyDictionary方法的具体用法?Python PyDictionary.PyDictionary怎么用?Python PyDictionary.PyDictionary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyDictionary的用法示例。


在下文中一共展示了PyDictionary.PyDictionary方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: dictionary

# 需要导入模块: import PyDictionary [as 别名]
# 或者: from PyDictionary import PyDictionary [as 别名]
def dictionary(self):
    # Returns meaning, synonym and antonym of any word
    Dict = PyDictionary()
    print_say('\nEnter word', self)
    word = raw_input()
    print('\nMeaning : ' + str(Dict.googlemeaning(word)))
    blockPrint()
    syn = Dict.synonym(word)
    ant = Dict.antonym(word)
    if syn is not None:
        syn = [x.encode('UTF8') for x in syn]
    if ant is not None:
        ant = [x.encode('UTF8') for x in ant]
    enablePrint()
    print('\nSynonyms : ' + str(syn))
    print('\nAntonyms : ' + str(ant)) 
开发者ID:sukeesh,项目名称:Jarvis,代码行数:18,代码来源:dictionary.py

示例2: handle

# 需要导入模块: import PyDictionary [as 别名]
# 或者: from PyDictionary import PyDictionary [as 别名]
def handle(text, mic, profile):

    lst = text.split()

    text = lst[len(lst)-1]
    if(text):
        dictionary=PyDictionary() 
        mean = dictionary.meaning(text)
        if not mean:
            mic.say("I'm sorry I couldn't find the meaning of the word "+text)
            return
        mic.say(text)
        for keys in mean:
            mic.say(keys)
            lst = mean[keys]
            for l in lst:
                mic.say(l) 
开发者ID:mattcurrycom,项目名称:jasper-modules,代码行数:19,代码来源:Dictionary.py

示例3: __init__

# 需要导入模块: import PyDictionary [as 别名]
# 或者: from PyDictionary import PyDictionary [as 别名]
def __init__(self, bot):
        self.bot = bot
        self.dictionary = PyDictionary('lxml')
       
       #TODO a query like 'a;lskejf;laskjf;lkjvldskjrlgjslfgnhslkfnhsoifjosijosjeojsopejr' gives a valid response with an unknown subject. UNKNOWN FIX 
开发者ID:henrymzhao,项目名称:csss-minion,代码行数:7,代码来源:dictionary.py

示例4: __init__

# 需要导入模块: import PyDictionary [as 别名]
# 或者: from PyDictionary import PyDictionary [as 别名]
def __init__(self, bot):
        self.bot = bot
        self.dictionary = PyDictionary()
        # self.lang = fileIO("data/dictionary/lang.json", "load") 
开发者ID:UltimatePancake,项目名称:Pancake-Cogs,代码行数:6,代码来源:dictionary.py

示例5: define

# 需要导入模块: import PyDictionary [as 别名]
# 或者: from PyDictionary import PyDictionary [as 别名]
def define(self, word: str):
        dictionary = PyDictionary()
        await self.bot.say(dictionary.meaning(word)) 
开发者ID:link2110,项目名称:PoiBot,代码行数:5,代码来源:Commands.py

示例6: __init__

# 需要导入模块: import PyDictionary [as 别名]
# 或者: from PyDictionary import PyDictionary [as 别名]
def __init__(self, *args, **kwargs):
        super(SloganBot, self).__init__(*args, **kwargs)
        twitter = None
        only_twitter = "This bot publishes to Twitter and only Twitter."
        if len(self.publishers) != 1:
            raise Exception(only_twitter)
        [publisher] = self.publishers
        if publisher.service != 'twitter':
            raise Exception(only_twitter)
        self.twitter = publisher.api
        self.dictionary = PyDictionary() 
开发者ID:leonardr,项目名称:botfriend,代码行数:13,代码来源:__init__.py

示例7: ex

# 需要导入模块: import PyDictionary [as 别名]
# 或者: from PyDictionary import PyDictionary [as 别名]
def ex(dclient, private_channel, public_channel, mention, a, cmd_char):
    a = a.split(' ')
    if len(a) == 1:
        word = a[0].lower()
        pydict = PyDictionary()
        r = pydict.meaning(word)
        try:
            an = '''```Markdown
# Meaning: {} #
'''.format(word)
            if 'Noun' in r:
                an += '''<Noun>
'''
                cnt = 1
                for d in r['Noun']:
                    an += '''[{}]: {}
'''.format(cnt, d)
                    cnt += 1
            if 'Verb' in r:
                an += '''<Verb>
'''
                cnt = 1
                for d in r['Verb']:
                    an += '''[{}]: {}
'''.format(cnt, d)
                    cnt += 1
            if 'Adjective' in r:
                an += '''<Adjective>
'''
                cnt = 1
                for d in r['Adjective']:
                    an += '''[{}]: {}
'''.format(cnt, d)
                    cnt += 1
            an += '''```'''
            await dclient.send_message(private_channel, an)
            await dclient.send_message(public_channel, '{}, the meaning for the term `{}` has been sent in a private '
                                                       'message.'.format(mention, word))
        except Exception:
            await dclient.send_message(public_channel, '{}, there is no meaning for the term `{}`!'.format(mention,
                                                                                                           word))
    else:
        await dclient.send_message(public_channel, '{}, **USAGE:** {}dictionary <term>'.format(mention, cmd_char)) 
开发者ID:Atomicbeast101,项目名称:jinux-discord,代码行数:45,代码来源:dictionary.py

示例8: buildUi

# 需要导入模块: import PyDictionary [as 别名]
# 或者: from PyDictionary import PyDictionary [as 别名]
def buildUi(self):
    	global word
        self.gridlayout = QtGui.QGridLayout()
	title=QLabel()
	titleFont = QtGui.QFont("Verdana", 12, QtGui.QFont.Bold)
	title.setFont(titleFont)
	title.setText(word.title())
	title.setAlignment(QtCore.Qt.AlignHCenter)
	self.gridlayout.addWidget(title)#,0,0,1,1)


        l=QtGui.QTextEdit()
        #font=QtGui.QFont()
        #font.setFamily(_fromUtf8("Baskerville Old Face"))
        # dictionary=PyDictionary()
	
        # meanings=dictionary.meaning(word)
        # Nouns=[]
        # Verbs=[]
        # for types in meanings:
        #     if types == "Noun":
        #         Nouns=meanings[u'Noun']
        #     elif types == "Verb":
        #         Verbs = meanings[u'Verb']

        out = ""


        # for x in meanings:
        # 	out=out+'<b><font face="Comic sans MS" color="red">'+x.upper()+'</font></b><br/>'
        #         for y in meanings[x]:
        #         	out=out+ '<br/><font face="Comic sans MS">• ' + y+'</font><br/>'
        
        meanings = definition(word)  # offline dict

        if len(meanings) > 0:
            for x in meanings:
                x = '<b>' + x[:1] + '</b>' + x[1:]
                out += x + '<br>'
        else:
            out = 'word not found'

        out = '<font face="Comic sans MS">' + out + '</font>'

	l.setHtml(out)
        l.setReadOnly(True)
        #l.setHtml("<h3> HEY </h3>")
	#a = QtCore.QString('<b>HEY</b>')
	#l.insertHtml(a)
            
        #l.setPlainText(out)    
        self.gridlayout.addWidget(l)#,0,0,1,1)
        self.setLayout(self.gridlayout) 
开发者ID:GDGVIT,项目名称:Lookup-Dictionary,代码行数:55,代码来源:lookupBox2.py


注:本文中的PyDictionary.PyDictionary方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。