From 2a69c7255fef37e9b8c2e63ed775d1dd9aaa8686 Mon Sep 17 00:00:00 2001 From: "trevor.cohn" Date: Wed, 21 Jul 2010 22:42:52 +0000 Subject: 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 --- .../prjava/src/phrase/Agree2Sides.java | 17 +++++++-------- .../prjava/src/phrase/Trainer.java | 24 +++++++++++++++++----- 2 files changed, 28 insertions(+), 13 deletions(-) (limited to 'gi/posterior-regularisation') diff --git a/gi/posterior-regularisation/prjava/src/phrase/Agree2Sides.java b/gi/posterior-regularisation/prjava/src/phrase/Agree2Sides.java index 8bf0b93e..031f887f 100644 --- a/gi/posterior-regularisation/prjava/src/phrase/Agree2Sides.java +++ b/gi/posterior-regularisation/prjava/src/phrase/Agree2Sides.java @@ -157,13 +157,16 @@ public class Agree2Sides { public double[] posterior(int edgeIdx) { - Edge edge1=c1.getEdges().get(edgeIdx); - Edge edge2=c2.getEdges().get(edgeIdx); - double[] prob1=model1.posterior(edge1); - double[] prob2=model2.posterior(edge2); + return posterior(c1.getEdges().get(edgeIdx), c2.getEdges().get(edgeIdx)); + } + + public double[] posterior(Edge e1, Edge e2) + { + double[] prob1=model1.posterior(e1); + double[] prob2=model2.posterior(e2); - llh+=edge1.getCount()*Math.log(arr.F.l1norm(prob1)); - llh+=edge2.getCount()*Math.log(arr.F.l1norm(prob2)); + llh+=e1.getCount()*Math.log(arr.F.l1norm(prob1)); + llh+=e2.getCount()*Math.log(arr.F.l1norm(prob2)); arr.F.l1normalize(prob1); arr.F.l1normalize(prob2); @@ -177,7 +180,6 @@ public class Agree2Sides { public void displayPosterior(PrintStream ps) { - for (int i=0;i