def testNearbyWords(self):
thu1 = thulac.thulac() //默认模式
text = thu1.cut("人脸识别", text=True) //进行一句话分词
words, tags = [], []
data = [x.rsplit("_", 1) for x in text.split()]
for _ in data:
assert len(_) == 2, "seg len should be 2"
words.append(_[0])
After Change
assert synonyms.compare(sen1, sen2) > 0, "the similarity should be bigger then zero"
def testNearbyWords(self):
synonyms.display("人脸") // synonyms.display calls synonyms.nearby
def test():
unittest.main()