From bb793d2e16b4e77929db7b6e0c46f75399726b0a Mon Sep 17 00:00:00 2001 From: Dmitry Ustalov Date: Sun, 5 May 2013 23:08:50 +0600 Subject: [PATCH] Make the evaluation task compatible with 1.9.2 --- lib/tasks/evaluate.rake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/tasks/evaluate.rake b/lib/tasks/evaluate.rake index e7050a9..43caf08 100644 --- a/lib/tasks/evaluate.rake +++ b/lib/tasks/evaluate.rake @@ -44,8 +44,14 @@ task :evaluate => :petrovich do errors << %w(lemma expected actual params) CSV.open(filename, col_sep: "\t", headers: true).each do |row| - word, lemma = row['word'], row['lemma'] - grammemes = row['grammemes'] ? row['grammemes'].split(',') : [] + word = row['word'].force_encoding('UTF-8') + lemma = row['lemma'].force_encoding('UTF-8') + + grammemes = if row['grammemes'] + row['grammemes'].force_encoding('UTF-8').split(',') + else + [] + end gender = grammemes.include?('мр') ? :male : :female