File: test_pos_file.py

package info (click to toggle)
python-jieba 0.42.1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 51,824 kB
  • sloc: python: 194,937; makefile: 5; sh: 3
file content (21 lines) | stat: -rw-r--r-- 403 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from __future__ import print_function
import sys
import time
sys.path.append("../")
import jieba
jieba.initialize()
import jieba.posseg as pseg

url = sys.argv[1]
content = open(url,"rb").read()
t1 = time.time()
words = list(pseg.cut(content))

t2 = time.time()
tm_cost = t2-t1

log_f = open("1.log","w")
log_f.write(' / '.join(map(str, words)))

print('speed' , len(content)/tm_cost, " bytes/second")