當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。