本文整理汇总了Python中PyDictionary.PyDictionary.googlemeaning方法的典型用法代码示例。如果您正苦于以下问题:Python PyDictionary.googlemeaning方法的具体用法?Python PyDictionary.googlemeaning怎么用?Python PyDictionary.googlemeaning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyDictionary.PyDictionary
的用法示例。
在下文中一共展示了PyDictionary.googlemeaning方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pieceOfLyric
# 需要导入模块: from PyDictionary import PyDictionary [as 别名]
# 或者: from PyDictionary.PyDictionary import googlemeaning [as 别名]
def pieceOfLyric(self, video, numWord):
""" Para la que la Api de MusixMatch funcione solo neceisita un trozo de la letra con palabras
relevantes, por ello se usa pieceLyric. Que se queda con las palabras mayores de tres letras"""
lyric = self.scanOCR(video)
searchLyric = lyric[100:]
searchLyriclist = searchLyric.split()
listLyric = ""
lenLyriclist = len(searchLyriclist)
count = 0
countlen = 0
dictionary=PyDictionary()
while (count <= numWord) and (countlen < lenLyriclist):
# El numero de letras por palabra es mayor de dos
if len(searchLyriclist[countlen]) > 2:
if searchLyriclist[countlen] not in listLyric:
#Busca si la palabra existe en google
if dictionary.googlemeaning(searchLyriclist[countlen]):
listLyric = listLyric + " " + searchLyriclist[countlen]
count += 1
countlen += 1
return listLyric
示例2: print
# 需要导入模块: from PyDictionary import PyDictionary [as 别名]
# 或者: from PyDictionary.PyDictionary import googlemeaning [as 别名]
dictionary=PyDictionary()
r = sr.Recognizer()
m = sr.Microphone()
print("A moment of silence, please...")
with m as source: r.adjust_for_ambient_noise(source)
print("Set minimum energy threshold to {}".format(r.energy_threshold))
print("Say The Word....")
with m as source: audio = r.listen(source)
print("Got it! Now to recognize it...")
try:
# recognize speech using Google Speech Recognition
value = r.recognize_google(audio)
word=str(value)
print word
word=word.replace(' ','')
print word
except sr.UnknownValueError:
print("Oops! Didn't catch that")
except sr.RequestError as e:
print("Plese Check your internet Connection")
if(type(None)!=type(dictionary.googlemeaning(word))):
print('\n\n\n'+dictionary.googlemeaning(word))
else:
print "Even Google Doesn't Know Its Meaning ...!!!!!!!"