mirror of https://github.com/fxsjy/jieba.git
commit
16d626d347
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,51 @@
|
||||
the
|
||||
of
|
||||
is
|
||||
and
|
||||
to
|
||||
in
|
||||
that
|
||||
we
|
||||
for
|
||||
an
|
||||
are
|
||||
by
|
||||
be
|
||||
as
|
||||
on
|
||||
with
|
||||
can
|
||||
if
|
||||
from
|
||||
which
|
||||
you
|
||||
it
|
||||
this
|
||||
then
|
||||
at
|
||||
have
|
||||
all
|
||||
not
|
||||
one
|
||||
has
|
||||
or
|
||||
that
|
||||
的
|
||||
了
|
||||
和
|
||||
是
|
||||
就
|
||||
都
|
||||
而
|
||||
及
|
||||
與
|
||||
著
|
||||
或
|
||||
一個
|
||||
沒有
|
||||
我們
|
||||
你們
|
||||
妳們
|
||||
他們
|
||||
她們
|
||||
是否
|
@ -0,0 +1,32 @@
|
||||
import sys
|
||||
sys.path.append('../')
|
||||
|
||||
import jieba
|
||||
import jieba.analyse
|
||||
from optparse import OptionParser
|
||||
|
||||
USAGE = "usage: python extract_tags_idfpath.py [file name] -k [top k]"
|
||||
|
||||
parser = OptionParser(USAGE)
|
||||
parser.add_option("-k", dest="topK")
|
||||
opt, args = parser.parse_args()
|
||||
|
||||
|
||||
if len(args) < 1:
|
||||
print USAGE
|
||||
sys.exit(1)
|
||||
|
||||
file_name = args[0]
|
||||
|
||||
if opt.topK is None:
|
||||
topK = 10
|
||||
else:
|
||||
topK = int(opt.topK)
|
||||
|
||||
content = open(file_name, 'rb').read()
|
||||
|
||||
jieba.analyse.set_idf_path("../extra_dict/idf.txt.big");
|
||||
|
||||
tags = jieba.analyse.extract_tags(content, topK=topK)
|
||||
|
||||
print ",".join(tags)
|
@ -0,0 +1,33 @@
|
||||
import sys
|
||||
sys.path.append('../')
|
||||
|
||||
import jieba
|
||||
import jieba.analyse
|
||||
from optparse import OptionParser
|
||||
|
||||
USAGE = "usage: python extract_tags_stop_words.py [file name] -k [top k]"
|
||||
|
||||
parser = OptionParser(USAGE)
|
||||
parser.add_option("-k", dest="topK")
|
||||
opt, args = parser.parse_args()
|
||||
|
||||
|
||||
if len(args) < 1:
|
||||
print USAGE
|
||||
sys.exit(1)
|
||||
|
||||
file_name = args[0]
|
||||
|
||||
if opt.topK is None:
|
||||
topK = 10
|
||||
else:
|
||||
topK = int(opt.topK)
|
||||
|
||||
content = open(file_name, 'rb').read()
|
||||
|
||||
jieba.analyse.set_stop_words("../extra_dict/stop_words.txt")
|
||||
jieba.analyse.set_idf_path("../extra_dict/idf.txt.big");
|
||||
|
||||
tags = jieba.analyse.extract_tags(content, topK=topK)
|
||||
|
||||
print ",".join(tags)
|
Loading…
Reference in New Issue