This commit is contained in:
xieshen 2020-10-19 14:43:13 +08:00
parent 156e62fa23
commit b652639aae
1 changed files with 5 additions and 5 deletions

View File

@ -163,11 +163,11 @@ def test_json(request):
if len(x) > 1 and x != '\r\n': if len(x) > 1 and x != '\r\n':
c[x] += 1 c[x] += 1
for (k, v) in c.most_common(200): # 遍历输出高频词 for (k, v) in c.most_common(200): # 遍历输出高频词
print('%s%s %s %d' % (' ' * (5 - len(k)), k, '*', v)) if all(map(lambda c:'\u4e00' <= c <= '\u9fa5',k)):
o = dict() o = dict()
o['name'] = k o['name'] = k
o['value'] = v o['value'] = v
res.append(o) res.append(o)
return HttpResponse(json.dumps({ return HttpResponse(json.dumps({
"res": res "res": res
})) }))