summaryrefslogtreecommitdiff
path: root/gi/posterior-regularisation/prjava/src/phrase
diff options
context:
space:
mode:
authortrevor.cohn <trevor.cohn@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-21 22:48:02 +0000
committertrevor.cohn <trevor.cohn@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-21 22:48:02 +0000
commitd6cdcf776b2f4541a7ee80c1a489d4a0fee41be3 (patch)
tree28605d2fd838c4f5efb819cf5fe9c01e01df6d0c /gi/posterior-regularisation/prjava/src/phrase
parent2a69c7255fef37e9b8c2e63ed775d1dd9aaa8686 (diff)
Posterior output
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@366 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'gi/posterior-regularisation/prjava/src/phrase')
-rw-r--r--gi/posterior-regularisation/prjava/src/phrase/Agree.java7
-rw-r--r--gi/posterior-regularisation/prjava/src/phrase/Trainer.java12
2 files changed, 11 insertions, 8 deletions
diff --git a/gi/posterior-regularisation/prjava/src/phrase/Agree.java b/gi/posterior-regularisation/prjava/src/phrase/Agree.java
index f3dc5c36..8f7b499e 100644
--- a/gi/posterior-regularisation/prjava/src/phrase/Agree.java
+++ b/gi/posterior-regularisation/prjava/src/phrase/Agree.java
@@ -182,7 +182,12 @@ public class Agree {
public void displayPosterior(PrintStream ps)
{
- for (Edge edge : c.getEdges())
+ displayPosterior(ps, c.getEdges());
+ }
+
+ public void displayPosterior(PrintStream ps, List<Edge> test)
+ {
+ for (Edge edge : test)
{
double probs[] = posterior(edge);
arr.F.l1normalize(probs);
diff --git a/gi/posterior-regularisation/prjava/src/phrase/Trainer.java b/gi/posterior-regularisation/prjava/src/phrase/Trainer.java
index c1d4775e..b51db919 100644
--- a/gi/posterior-regularisation/prjava/src/phrase/Trainer.java
+++ b/gi/posterior-regularisation/prjava/src/phrase/Trainer.java
@@ -180,23 +180,21 @@ public class Trainer
File outfile = (File) options.valueOf("out");
try {
PrintStream ps = FileUtil.printstream(outfile);
- List<Edge> test;
- if (!options.has("test")) // just use the training
- test = corpus.getEdges();
- else
+ List<Edge> test = corpus.getEdges();
+ if (options.has("test")) // just use the training
{ // if --test supplied, load up the file
- if (agree == null && agree2sides == null)
+ if (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.");
+ System.err.println("Can't run bilingual agreement model on different test data cf training (yet); --test ignored.");
}
if (agree != null)
- agree.displayPosterior(ps);
+ agree.displayPosterior(ps, test);
else if (agree2sides != null)
agree2sides.displayPosterior(ps);
else