jieba
import jieba
import re
sentence = '叶子本是肩并肩密密地挨着,这便宛然有了一道凝碧的波痕。叶子底下是脉脉的流水,遮住了,不能见一些颜色。'
sentence = re.sub('[,。?!、]', '', sentence)
result = list(jieba.cut(sentence))
print(result)
thulac
import thulac
import re
sentence = '叶子本是肩并肩密密地挨着,这便宛然有了一道凝碧的波痕。叶子底下是脉脉的流水,遮住了,不能见一些颜色。'
sentence = re.sub('[,。?!、]', '', sentence)
thu = thulac.thulac(seg_only=True)
result = thu.cut(sentence, text=True)
print(result.split())
pkuseg
import pkuseg
import re
sentence = '叶子本是肩并肩密密地挨着,这便宛然有了一道凝碧的波痕。叶子底下是脉脉的流水,遮住了,不能见一些颜色。'
sentence = re.sub('[,。?!、]', '', sentence)
pk_useg = pkuseg.pkuseg()
result = pk_useg.cut(sentence)
print(result)
pyhanlp
from pyhanlp import HanLP
import re
sentence = '叶子本是肩并肩密密地挨着,这便宛然有了一道凝碧的波痕。叶子底下是脉脉的流水,遮住了,不能见一些颜色。'
sentence = re.sub('[,。?!、]', '', sentence)
result = HanLP.segment(sentence)
print([term.word for term in result])
snownlp
from snownlp import SnowNLP
import re
sentence = '叶子本是肩并肩密密地挨着,这便宛然有了一道凝碧的波痕。叶子底下是脉脉的流水,遮住了,不能见一些颜色。'
sentence = re.sub('[,。?!、]', '', sentence)
result = SnowNLP(sentence)
print(result.words)