UnboundLocalError Traceback (most recent call last)
<ipython-input-27-3b13136d5e16> in <module>()
----> 1 j.seg(sample, pos=True)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/jseg/jieba.py in seg(self, text, pos)
277 gws = sorted(gws, key=lambda x: len(x), reverse=True) # 長詞優先
278 for gw in gws:
--> 279 if gw in sentence:
280 text = sentence.replace(gw, self._gw[gw])
281
UnboundLocalError: local variable 'sentence' referenced before assignment
This error happens after adding user define dictionary and then do the seg.
This error happens after adding user define dictionary and then do the seg.