Beispiel #1
0
 def download_and_install(self):
     logging.info('Will download buildout from %s' % BUILDOUT_URL)
     wget = local['wget']
     cmd = wget[BUILDOUT_URL]
     cmd()
     python('bootstrap.py')
     os.remove('bootstrap.py')
Beispiel #2
0
def test(model, inf, keyin, keyout):
    test_path = get_xml_key_pair(inf, keyin)
    tempdir = tempfile.mkdtemp(prefix="ctx2vec")
    result_path = pjoin(tempdir, "results")
    with local.cwd("systems/context2vec"), local.env(
            PIPENV_IGNORE_VIRTUALENVS="1"):
        pipenv_python(
            "context2vec/eval/wsd/test.py",
            test_path,
            "model.params",
            model,
            result_path,
        )
    python(__file__, "context2vec-key-to-unified", result_path, keyout)
Beispiel #3
0
 def inner(paths, guess_fn):
     args = [
         "lesk_pp.py",
         mean,
         paths["unified"],
         cwd_relpath(guess_fn),
         "--include-wfs",
         "--score-by",
         score_by,
     ]
     if do_expand:
         args.append("--expand")
     if exclude_cand:
         args.append("--exclude-cand")
     setup_paths()
     python(*args)
Beispiel #4
0
def full_wsd_main(modelin, trainin, keyin, testin, testkeyin, resultout):
    train_path = get_xml_key_pair(trainin, keyin)
    test_path = get_xml_key_pair(testin, testkeyin)
    tempdir = tempfile.mkdtemp(prefix="ctx2vec")
    result_path = pjoin(tempdir, "results")
    with local.cwd("systems/context2vec"), local.env(
            PIPENV_IGNORE_VIRTUALENVS="1"):
        pipenv_python(
            "context2vec/eval/wsd/wsd_main.py",
            train_path,
            test_path,
            result_path,
            modelin,
            "1",
        )
    python(__file__, "context2vec-key-to-unified", result_path, resultout)
Beispiel #5
0
def test_run_code_locally(ctype, template_dir, cookies):
    project = cookies.bake(template=str(template_dir.absolute()),
                           extra_context={
                               'container_name': 'example',
                               'container_type': ctype
                           })
    cwd = os.getcwd()
    os.chdir(str(project.project))

    # run script src/[submission|evaluation].py
    try:
        python(Path('src') / '{}.py'.format(ctype))
    except plumbum.ProcessExecutionError as e:
        pytest.fail(e)
    finally:
        os.chdir(cwd)

    # test output
    out = project.project.join('data', 'output')
    assert os.path.isfile(str(out))
Beispiel #6
0
 def run(paths, guess_fn):
     all_args = (["lesk.py", variety] + list(args) +
                 [paths["suptag"], cwd_relpath(guess_fn)])
     setup_paths()
     python(*all_args)
Beispiel #7
0
 def run(paths, guess_fn):
     all_args = (["baselines.py"] + list(args) +
                 [paths["unified"], cwd_relpath(guess_fn)])
     setup_paths()
     python(*all_args)
Beispiel #8
0
def pipenv_python(*args):
    if os.environ.get("NO_CTX2VEC_PIPENV"):
        python(*args)
    else:
        pipenv("run", "python", *args)
Beispiel #9
0
def setuppy_version(project_name):
    return python(f"{project_name}/setup.py", "--version").strip()