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


Python TextBlob.split方法代码示例

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


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

示例1: get_text

# 需要导入模块: from textblob import TextBlob [as 别名]
# 或者: from textblob.TextBlob import split [as 别名]
 def get_text(self):
     """ NOTE: THIS SHOULD NOT REBUILD DICT EVERY TIME -- REFACTOR """
     blob = TextBlob(self.content.decode('utf-8'))
     words_ = blob.split()
     d = parser.build_ngram_dict(words_)
     s = parser.build_sentence(d)
     # TODO: add check for max text length
     self.text = s
开发者ID:torypeterschild,项目名称:the-cartoonist,代码行数:10,代码来源:caption.py

示例2: main

# 需要导入模块: from textblob import TextBlob [as 别名]
# 或者: from textblob.TextBlob import split [as 别名]
def main():
    filename = sys.argv[1]

    with open(filename) as f:
        content = f.read()

    blob = TextBlob(content.decode('utf-8'))

    words = blob.split()
    d = build_ngram_dict(words)
    pprint(d)
    print()
    s = build_sentence(d)
    print(s)
    if s in content.decode('utf-8'):
        print("\nBummer! This sentence is just a copy of one in the corpus.")
开发者ID:torypeterschild,项目名称:markov-text-generator,代码行数:18,代码来源:parser.py

示例3: int

# 需要导入模块: from textblob import TextBlob [as 别名]
# 或者: from textblob.TextBlob import split [as 别名]
if __name__=="__main__":

	count = 0
	days = {}
	polarity = {}
	num_files = int(sys.argv[1])
	#print num_files
	for i in range (1,num_files+1):
		input_file = open(sys.argv[1+i],'r')
		#print i
		for line in input_file:
			tweet_json = json.loads(line)
			tweet = TextBlob(tweet_json['text'])
			blob = TextBlob(tweet_json['created_at'])
			#print blob
			date = blob.split(' ')
			day = date[0]
			if day == 'Sun':
				day = "2016-04-03"
			if day == 'Mon':
				day = "2016-04-04"
			if day == 'Tue':
				day = "2016-04-05"
			if day == 'Wed':
				day = "2016-04-06"
			if day == 'Thu':
				day = "2016-04-07"
			if day == 'Fri':
				day = "2016-04-08"
			if day == 'Sat':
				day = "2016-04-09"
开发者ID:Lucinda-K,项目名称:Twitter_MTVMovieAwards,代码行数:33,代码来源:timeline.py


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