Skip to content

Commit

Permalink
fix bug of tagger in Python2
Browse files Browse the repository at this point in the history
  • Loading branch information
taishi-i committed Jan 9, 2019
1 parent 5225d89 commit ed5d262
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions nagisa/prepro.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def __init__(self, filename, window_size, vocabs):
self.filename = filename
uni2id, bi2id, word2id, pos2id, word2postags = vocabs

if '名詞' in pos2id:
if u'名詞' in pos2id:
self.use_noun_heuristic = True
else:
self.use_noun_heuristic = False
Expand Down Expand Up @@ -187,9 +187,9 @@ def __init__(self, filename, window_size, vocabs):
if self.use_noun_heuristic is True:
if word.isalnum() is True:
if w2p == [0]:
w2p = [pos2id['名詞']]
w2p = [pos2id[u'名詞']]
else:
w2p.append(pos2id['名詞'])
w2p.append(pos2id[u'名詞'])

w2p = list(set(w2p))
ptags.append(w2p)
Expand Down
2 changes: 1 addition & 1 deletion nagisa/tagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, vocabs=None, params=None, hp=None, single_word_list=None):
self.pattern = re.compile('|'.join(single_word_list))

# If use_noun_heuristic is True, nouns are more lilely to appear.
if '名詞' in self._pos2id:
if u'名詞' in self._pos2id:
self.use_noun_heuristic = True
else:
self.use_noun_heuristic = False
Expand Down

0 comments on commit ed5d262

Please sign in to comment.