2015-01-03 10:02:21 +00:00
|
|
|
from fabric.api import local, run, lcd, cd, env
|
|
|
|
from os.path import exists as file_exists
|
2015-01-04 18:30:24 +00:00
|
|
|
from fabtools.python import virtualenv
|
2015-01-03 10:02:21 +00:00
|
|
|
from os import path
|
2014-09-11 10:28:38 +00:00
|
|
|
|
2015-01-03 10:02:21 +00:00
|
|
|
|
|
|
|
PWD = path.dirname(__file__)
|
|
|
|
VENV_DIR = path.join(PWD, '.env')
|
2015-01-03 14:59:14 +00:00
|
|
|
DEV_ENV_DIR = path.join(PWD, '.denv')
|
|
|
|
|
|
|
|
|
|
|
|
def dev():
|
|
|
|
# Allow this to persist, since we aren't as rigorous about keeping state clean
|
|
|
|
if not file_exists('.denv'):
|
|
|
|
local('virtualenv .denv')
|
|
|
|
|
|
|
|
with virtualenv(DEV_ENV_DIR):
|
2015-01-04 18:30:24 +00:00
|
|
|
local('pip install cython')
|
|
|
|
local('pip install murmurhash')
|
|
|
|
local('pip install -r dev_requirements.txt')
|
|
|
|
|
2015-01-03 10:02:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
def sdist():
|
|
|
|
if file_exists('dist/'):
|
|
|
|
local('rm -rf dist/')
|
|
|
|
local('mkdir dist')
|
|
|
|
with virtualenv(VENV_DIR):
|
|
|
|
local('python setup.py sdist')
|
|
|
|
|
|
|
|
|
|
|
|
def publish():
|
|
|
|
with virtualenv(VENV_DIR):
|
|
|
|
local('python setup.py register')
|
|
|
|
local('twine upload dist/*.tar.gz')
|
2015-01-05 06:55:51 +00:00
|
|
|
local('git push origin master')
|
2015-01-03 10:02:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
def setup():
|
|
|
|
if file_exists('.env'):
|
|
|
|
local('rm -rf .env')
|
|
|
|
local('virtualenv .env')
|
|
|
|
|
|
|
|
|
|
|
|
def install():
|
|
|
|
with virtualenv(VENV_DIR):
|
2015-01-04 18:30:24 +00:00
|
|
|
local('pip install --upgrade setuptools')
|
2015-01-03 10:02:21 +00:00
|
|
|
local('pip install dist/*.tar.gz')
|
|
|
|
local('pip install pytest')
|
|
|
|
|
2014-07-05 18:49:34 +00:00
|
|
|
|
|
|
|
def make():
|
2015-01-04 10:14:07 +00:00
|
|
|
with virtualenv(DEV_ENV_DIR):
|
2015-01-03 10:02:21 +00:00
|
|
|
with lcd(path.dirname(__file__)):
|
2015-01-04 18:30:24 +00:00
|
|
|
local('python setup.py build_ext --inplace')
|
2015-01-03 10:02:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
def clean():
|
|
|
|
with lcd(path.dirname(__file__)):
|
|
|
|
local('python dev_setup.py clean --all')
|
|
|
|
|
2014-07-05 18:49:34 +00:00
|
|
|
|
2015-01-03 10:02:21 +00:00
|
|
|
def test():
|
|
|
|
with virtualenv(VENV_DIR):
|
|
|
|
with lcd(path.dirname(__file__)):
|
|
|
|
local('py.test -x')
|
2014-09-11 10:28:38 +00:00
|
|
|
|
2014-11-05 09:46:29 +00:00
|
|
|
|
2015-01-04 18:30:24 +00:00
|
|
|
def travis():
|
|
|
|
local('open https://travis-ci.org/honnibal/thinc')
|
2014-08-20 15:02:32 +00:00
|
|
|
|
2014-09-11 10:28:38 +00:00
|
|
|
|
2014-11-05 09:46:29 +00:00
|
|
|
def pos():
|
2014-11-06 17:44:14 +00:00
|
|
|
local('rm -rf data/en/pos')
|
2014-11-05 09:46:29 +00:00
|
|
|
local('python tools/train.py pos ~/work_data/docparse/wsj02-21.conll data/en/pos')
|
|
|
|
local('python tools/tag.py ~/work_data/docparse/wsj22.raw /tmp/tmp')
|
|
|
|
local('python tools/eval_pos.py ~/work_data/docparse/wsj22.conll /tmp/tmp')
|
|
|
|
|
|
|
|
|
|
|
|
def ner():
|
|
|
|
local('rm -rf data/en/ner')
|
2014-11-11 10:10:40 +00:00
|
|
|
local('python tools/train_ner.py ~/work_data/docparse/wsj02-21.conll data/en/ner')
|
|
|
|
local('python tools/tag_ner.py ~/work_data/docparse/wsj22.raw /tmp/tmp')
|
2014-11-06 17:44:14 +00:00
|
|
|
local('python tools/eval_ner.py ~/work_data/docparse/wsj22.conll /tmp/tmp | tail')
|
2014-11-12 12:22:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
def conll():
|
|
|
|
local('rm -rf data/en/ner')
|
|
|
|
local('python tools/conll03_train.py ~/work_data/ner/conll2003/eng.train data/en/ner/')
|
|
|
|
local('python tools/conll03_eval.py ~/work_data/ner/conll2003/eng.testa')
|