From 6076213c167640c5f2c4cf24ec2cd354b7a8bda0 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sat, 25 Jul 2015 22:35:52 +0200 Subject: [PATCH] * Fix init_model script --- bin/init_model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/init_model.py b/bin/init_model.py index d40e7813d..2d3c62368 100644 --- a/bin/init_model.py +++ b/bin/init_model.py @@ -91,7 +91,7 @@ def _read_probs(loc): def _read_freqs(loc): counts = PreshCounter() total = 0 - for line in open(loc): + for line in loc.open(): freq, doc_freq, key = line.split('\t', 2) freq = int(freq) counts[hash_string(key)] = freq @@ -99,7 +99,7 @@ def _read_freqs(loc): counts.smooth() log_total = math.log(total) probs = {} - for line in open(loc): + for line in loc.open(): freq, doc_freq, key = line.split('\t', 2) if int(doc_freq) >= 2 and int(freq) >= 5 and len(key) < 200: word = literal_eval(key)