* Fix unicode regex problem for non-English locales in gold standard

This commit is contained in:
Matthew Honnibal 2016-04-28 14:31:14 +02:00
parent 588026fe93
commit 7c37f45e9f

View File

@ -1,3 +1,4 @@
from __future__ import unicode_literals
import numpy import numpy
import io import io
import json import json
@ -42,7 +43,6 @@ def tags_to_entities(tags):
return entities return entities
def align(cand_words, gold_words): def align(cand_words, gold_words):
cost, edit_path = _min_edit_path(cand_words, gold_words) cost, edit_path = _min_edit_path(cand_words, gold_words)
alignment = [] alignment = []
@ -63,7 +63,7 @@ def align(cand_words, gold_words):
return alignment return alignment
punct_re = re.compile(r'\W') punct_re = re.compile(r'\W', re.UNICODE)
def _min_edit_path(cand_words, gold_words): def _min_edit_path(cand_words, gold_words):
cdef: cdef:
Pool mem Pool mem
@ -264,13 +264,3 @@ cdef class GoldParse:
def is_punct_label(label): def is_punct_label(label):
return label == 'P' or label.lower() == 'punct' return label == 'P' or label.lower() == 'punct'