本文整理汇总了Python中gmail.Gmail.readEmails方法的典型用法代码示例。如果您正苦于以下问题:Python Gmail.readEmails方法的具体用法?Python Gmail.readEmails怎么用?Python Gmail.readEmails使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gmail.Gmail
的用法示例。
在下文中一共展示了Gmail.readEmails方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from gmail import Gmail [as 别名]
# 或者: from gmail.Gmail import readEmails [as 别名]
def main(useDefault):
text = "There is a flood on 1444 N Bosworth Avenue. My name is Deckard Cain."
time = None
email = Gmail()
messages = email.readEmails(True)
if not useDefault:
text,time = messages[-1].split("|")
entities = findEntities(text)
if not time == None:
entities[time] = "Time"
s = parsetree(text)
for sentence in s:
chunks = sentence.chunks
for chunk in chunks:
tag, myString = chunk.tag, chunk.string
if tag == "NP":
no_adjective_string = removeAdjective(chunk)
no_adjective_string = formatString(no_adjective_string)
if len(no_adjective_string) > 0:
if not entities.has_key(no_adjective_string):
entities[no_adjective_string] = determineType(no_adjective_string,sentence)
for i,textfile in enumerate(textfile_names):
value = textfile_mappings[i]
writeOutput(textfile,entities,value)
示例2: getEmails
# 需要导入模块: from gmail import Gmail [as 别名]
# 或者: from gmail.Gmail import readEmails [as 别名]
def getEmails(username,password):
HOST = "pod51009.outlook.com"
email = Gmail(HOST,username,password)
messages = email.readEmails(False)
return messages