本文整理汇总了Python中SonicScrewdriver.get_tagset方法的典型用法代码示例。如果您正苦于以下问题:Python SonicScrewdriver.get_tagset方法的具体用法?Python SonicScrewdriver.get_tagset怎么用?Python SonicScrewdriver.get_tagset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SonicScrewdriver
的用法示例。
在下文中一共展示了SonicScrewdriver.get_tagset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: input
# 需要导入模块: import SonicScrewdriver [as 别名]
# 或者: from SonicScrewdriver import get_tagset [as 别名]
import matplotlib.pyplot as plt
import SonicScrewdriver as utils
targetfile = input('Path to input file? ')
counts = dict()
alltags = set()
alldecades = set()
allcounts = Counter()
with open(targetfile, encoding = 'utf-8') as f:
reader = csv.DictReader(f)
for row in reader:
date = row['date']
decade = 10 * int(int(date)/10)
tagset = utils.get_tagset(row['genretags'])
for tag in tagset:
if tag == 'chirandom' and ('chiscifi' in tagset):
continue
if tag not in counts:
counts[tag] = Counter()
counts[tag][decade] += 1
alltags.add(tag)
alldecades.add(decade)
allcounts[decade] += 1
sorted_decades = sorted(list(alldecades))
numdecs = len(sorted_decades)
colors = ['g-', 'b-', 'r-', 'k-', 'ro', 'go', 'bo', 'ko']