|
|
@ -5,7 +5,7 @@ import jieba
|
|
|
|
|
|
|
|
|
|
|
|
def cuttest(test_sent):
|
|
|
|
def cuttest(test_sent):
|
|
|
|
result = jieba.cut(test_sent)
|
|
|
|
result = jieba.cut(test_sent)
|
|
|
|
print " ".join(result)
|
|
|
|
print(" ".join(result) )
|
|
|
|
|
|
|
|
|
|
|
|
def testcase():
|
|
|
|
def testcase():
|
|
|
|
cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Python和C++。")
|
|
|
|
cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Python和C++。")
|
|
|
@ -22,6 +22,6 @@ def testcase():
|
|
|
|
if __name__ == "__main__":
|
|
|
|
if __name__ == "__main__":
|
|
|
|
testcase()
|
|
|
|
testcase()
|
|
|
|
jieba.set_dictionary("foobar.txt")
|
|
|
|
jieba.set_dictionary("foobar.txt")
|
|
|
|
print "================================"
|
|
|
|
print("================================")
|
|
|
|
testcase()
|
|
|
|
testcase()
|
|
|
|
|
|
|
|
|
|
|
|