summaryrefslogtreecommitdiff
path: root/gi/posterior-regularisation/prjava/src/phrase/Trainer.java
diff options
context:
space:
mode:
authortrevor.cohn <trevor.cohn@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-21 22:42:52 +0000
committertrevor.cohn <trevor.cohn@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-21 22:42:52 +0000
commit9e3c1c2e7ee29d8967dab8e0d4d321fdccd5624b (patch)
tree8c5d5cbcd82d813040b448df29cfa6bd21788edd /gi/posterior-regularisation/prjava/src/phrase/Trainer.java
parentdd456888d9648ff8a79c0eee36c03a4dc5558b1c (diff)
Fixes to PR command line.
Added bilingual agreement model processing to pipeline. git-svn-id: https://ws10smt.googlecode.com/svn/trunk@365 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'gi/posterior-regularisation/prjava/src/phrase/Trainer.java')
-rw-r--r--gi/posterior-regularisation/prjava/src/phrase/Trainer.java24
1 files changed, 19 insertions, 5 deletions
diff --git a/gi/posterior-regularisation/prjava/src/phrase/Trainer.java b/gi/posterior-regularisation/prjava/src/phrase/Trainer.java
index 202930f5..c1d4775e 100644
--- a/gi/posterior-regularisation/prjava/src/phrase/Trainer.java
+++ b/gi/posterior-regularisation/prjava/src/phrase/Trainer.java
@@ -166,8 +166,10 @@ public class Trainer
last = o;
}
- if (cluster == null)
+ if (cluster == null && agree != null)
cluster = agree.model1;
+ else if (cluster == null && agree2sides != null)
+ cluster = agree2sides.model1;
double pl1lmax = cluster.phrase_l1lmax();
double cl1lmax = cluster.context_l1lmax();
@@ -183,11 +185,23 @@ public class Trainer
test = corpus.getEdges();
else
{ // if --test supplied, load up the file
- infile = (File) options.valueOf("test");
- System.out.println("Reading testing concordance from " + infile);
- test = corpus.readEdges(FileUtil.reader(infile));
+ if (agree == null && agree2sides == null)
+ {
+ infile = (File) options.valueOf("test");
+ System.out.println("Reading testing concordance from " + infile);
+ test = corpus.readEdges(FileUtil.reader(infile));
+ }
+ else
+ System.err.println("Can't run agreement models on different test data cf training (yet); --test ignored.");
}
- cluster.displayPosterior(ps, test);
+
+ if (agree != null)
+ agree.displayPosterior(ps);
+ else if (agree2sides != null)
+ agree2sides.displayPosterior(ps);
+ else
+ cluster.displayPosterior(ps, test);
+
ps.close();
} catch (IOException e) {
System.err.println("Failed to open either testing file or output file");