ur'string' is Py3 SyntaxError, use u'string' instead
$ python2 ``` $ python2 Python 2.7.13 (default, Jul 18 2017, 09:17:00) [GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> ur"[\w\u2E80-\u9FFF]" == u"[\w\u2E80-\u9FFF]" True >>> ur"[\w\u2E80-\u9FFF]" == r"[\w\u2E80-\u9FFF]" False ```
This commit is contained in:
@@ -86,7 +86,7 @@ class SEG(object):
|
||||
elif mem2!=None:
|
||||
delta = mem2[0]-i
|
||||
if delta>=1:
|
||||
if (delta<5) and (re.search(ur"[\w\u2E80-\u9FFF]",t)!=None):
|
||||
if (delta<5) and (re.search(u"[\w\u2E80-\u9FFF]",t)!=None):
|
||||
pre = text[i-j]
|
||||
#print pre
|
||||
if not (pre in self.specialwords):
|
||||
@@ -141,4 +141,4 @@ class SEG(object):
|
||||
recognised.append(text[i-j:i])
|
||||
else:
|
||||
recognised.extend(self._pro_unreg(text[i-j:z]))
|
||||
return recognised
|
||||
return recognised
|
||||
|
||||
Reference in New Issue
Block a user