From 569958527816fc240769c5a85f4561de98279c6b Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Mon, 15 Jun 2015 08:23:43 +0200 Subject: [PATCH] * Use tree_arc_eager system as baseline in experiments --- bin/parser/train.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/parser/train.py b/bin/parser/train.py index 16fbb7fc4..39e9d2cc9 100755 --- a/bin/parser/train.py +++ b/bin/parser/train.py @@ -18,6 +18,7 @@ from spacy.en import English from spacy.en.pos import POS_TEMPLATES, POS_TAGS, setup_model_dir from spacy.syntax.orig_arc_eager import OrigArcEager +from spacy.syntax.tree_arc_eager import TreeArcEager from spacy.syntax.util import Config from spacy.gold import read_json_file from spacy.gold import GoldParse @@ -105,8 +106,6 @@ def train(Language, gold_tuples, model_dir, n_iter=15, feat_set=u'basic', if n_sents > 0: gold_tuples = gold_tuples[:n_sents] - if use_orig_arc_eager: - Language.ParserTransitionSystem = OrigArcEager nlp = Language(data_dir=model_dir) @@ -214,6 +213,8 @@ def write_parses(Language, dev_loc, model_dir, out_loc, beam_width=None): def main(train_loc, dev_loc, model_dir, n_sents=0, n_iter=15, out_loc="", verbose=False, debug=False, corruption_level=0.0, gold_preproc=False, beam_width=1, eval_only=False, use_orig_arc_eager=False): + if use_orig_arc_eager: + English.ParserTransitionSystem = TreeArcEager if not eval_only: gold_train = list(read_json_file(train_loc)) train(English, gold_train, model_dir,