mirror of
https://github.com/fxsjy/jieba.git
synced 2025-07-24 00:00:05 +08:00
hot fix of cut_all=True
This commit is contained in:
parent
59d5d3b811
commit
94d455b079
@ -209,8 +209,12 @@ def cut(sentence,cut_all=False):
|
|||||||
if x.strip(' ')!='':
|
if x.strip(' ')!='':
|
||||||
yield x
|
yield x
|
||||||
else:
|
else:
|
||||||
for xx in x:
|
if not cut_all:
|
||||||
yield xx
|
for xx in x:
|
||||||
|
yield xx
|
||||||
|
else:
|
||||||
|
yield x
|
||||||
|
|
||||||
def cut_for_search(sentence):
|
def cut_for_search(sentence):
|
||||||
words = cut(sentence)
|
words = cut(sentence)
|
||||||
for w in words:
|
for w in words:
|
||||||
|
@ -91,3 +91,7 @@ if __name__ == "__main__":
|
|||||||
cuttest('两块五一套,三块八一斤,四块七一本,五块六一条')
|
cuttest('两块五一套,三块八一斤,四块七一本,五块六一条')
|
||||||
cuttest('小和尚留了一个像大和尚一样的和尚头')
|
cuttest('小和尚留了一个像大和尚一样的和尚头')
|
||||||
cuttest('我是中华人民共和国公民;我爸爸是共和党党员; 地铁和平门站')
|
cuttest('我是中华人民共和国公民;我爸爸是共和党党员; 地铁和平门站')
|
||||||
|
cuttest('张晓梅去人民医院做了个B超然后去买了件T恤')
|
||||||
|
cuttest('AT&T是一件不错的公司,给你发offer了吗?')
|
||||||
|
cuttest('C++和c#是什么关系?11+122=133,是吗?PI=3.14159')
|
||||||
|
cuttest('你认识那个和主席握手的的哥吗?他开一辆黑色的士。')
|
@ -91,3 +91,7 @@ if __name__ == "__main__":
|
|||||||
cuttest('两块五一套,三块八一斤,四块七一本,五块六一条')
|
cuttest('两块五一套,三块八一斤,四块七一本,五块六一条')
|
||||||
cuttest('小和尚留了一个像大和尚一样的和尚头')
|
cuttest('小和尚留了一个像大和尚一样的和尚头')
|
||||||
cuttest('我是中华人民共和国公民;我爸爸是共和党党员; 地铁和平门站')
|
cuttest('我是中华人民共和国公民;我爸爸是共和党党员; 地铁和平门站')
|
||||||
|
cuttest('张晓梅去人民医院做了个B超然后去买了件T恤')
|
||||||
|
cuttest('AT&T是一件不错的公司,给你发offer了吗?')
|
||||||
|
cuttest('C++和c#是什么关系?11+122=133,是吗?PI=3.14159')
|
||||||
|
cuttest('你认识那个和主席握手的的哥吗?他开一辆黑色的士。')
|
Loading…
x
Reference in New Issue
Block a user