Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
RowitZou committed Aug 20, 2019
2 parents 3fb3e5c + c64cfb2 commit 6751daf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions utils/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ def read_instance_with_gaz(input_file, word_dict, char_alphabet, word_alphabet,
label_Ids = []

for line in f:
if len(line) > 2:
if len(line) > 1:
pairs = line.strip().split()
char = pairs[0]
if number_normalized:
char = normalize_word(char)
label = pairs[-1]
chars.append(char)
labels.append(label)
char_Ids.append(char_alphabet.get_index(char))
if len(pairs) > 1:
label = pairs[-1]
else:
label = 'O'
labels.append(label)
label_Ids.append(label_alphabet.get_index(label))

# A sentence is finished.
Expand Down

0 comments on commit 6751daf

Please sign in to comment.