diff --git a/README.md b/README.md index e52dcdb..a75001a 100644 --- a/README.md +++ b/README.md @@ -11,5 +11,9 @@ Additionally, `pip install -r optrequirements.txt` for optional dependencies use ## Building -`python run_mindep.py run lang1 lang2 ... langn` for an initial run. +``` +python run_mindep.py run lang1 lang2 ... langn > out.csv +python run_mindep.py postprocess out.csv > processed.csv +``` + The list of langs can be found at `corpora.ud_langs`. diff --git a/mindep/__init__.py b/mindep/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mindep.py b/mindep/mindep.py similarity index 100% rename from mindep.py rename to mindep/mindep.py diff --git a/opt_mindep.py b/mindep/opt_mindep.py similarity index 99% rename from opt_mindep.py rename to mindep/opt_mindep.py index 9b94192..3a65cbe 100644 --- a/opt_mindep.py +++ b/mindep/opt_mindep.py @@ -9,7 +9,7 @@ from rfutils import mreduce_by_key import conditioning as cond -import mindep +from . import mindep WEIGHT_MIN = -1 WEIGHT_MAX = 1 diff --git a/run_mindep.py b/run_mindep.py index 8c69625..9d43f97 100644 --- a/run_mindep.py +++ b/run_mindep.py @@ -1,7 +1,6 @@ from __future__ import division import sys import copy -import itertools import functools import random import csv @@ -10,8 +9,8 @@ import pandas as pd #from distributed import Executor, as_completed -import mindep -import opt_mindep +from mindep import mindep +from mindep import opt_mindep #import linearize as lin import corpora @@ -32,6 +31,7 @@ def with_open(filename, mode, f): @rfutils.memoize def load_linearization_model(lang, spec): + import pickle return with_open(MODEL_FILENAME_TEMPLATE % (lang, spec), 'rb', pickle.load) LANGS = set(corpora.ud_corpora.keys())