diff options
author | desaicwtf <desaicwtf@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-04 19:04:31 +0000 |
---|---|---|
committer | desaicwtf <desaicwtf@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-07-04 19:04:31 +0000 |
commit | 37d5d18ac69dfe7830607f7c288f29b5f0141312 (patch) | |
tree | abfe52c9a1979952146d7329a00e6f5e37404473 /gi/posterior-regularisation | |
parent | f83e234e9b59ad8493c980f9b7ef73a2f86c3549 (diff) |
PR phrase labeling draft
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@124 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'gi/posterior-regularisation')
4 files changed, 13 insertions, 22 deletions
diff --git a/gi/posterior-regularisation/prjava/src/data/Corpus.java b/gi/posterior-regularisation/prjava/src/data/Corpus.java index f0da0b33..425ede11 100644 --- a/gi/posterior-regularisation/prjava/src/data/Corpus.java +++ b/gi/posterior-regularisation/prjava/src/data/Corpus.java @@ -186,6 +186,9 @@ public class Corpus { tagData.get(i)[j]=tagIdx(s[j]);
}
}
+ sent=null;
+ tag=null;
+ System.gc();
}
public int [] getInt(int idx){
diff --git a/gi/posterior-regularisation/prjava/src/hmm/HMMObjective.java b/gi/posterior-regularisation/prjava/src/hmm/HMMObjective.java index 551210c0..70b6c966 100644 --- a/gi/posterior-regularisation/prjava/src/hmm/HMMObjective.java +++ b/gi/posterior-regularisation/prjava/src/hmm/HMMObjective.java @@ -18,7 +18,7 @@ public class HMMObjective extends ProjectedObjective{ private static final double GRAD_DIFF = 3;
public static double INIT_STEP_SIZE=10;
- public static double VAL_DIFF=2000;
+ public static double VAL_DIFF=1000;
private HMM hmm;
double[] newPoint ;
@@ -33,7 +33,7 @@ public class HMMObjective extends ProjectedObjective{ private SimplexProjection projection;
private int wordFreq[];
- private static int MIN_FREQ=3;
+ private static int MIN_FREQ=10;
private int numWordsToProject=0;
private int n_param;
@@ -88,6 +88,9 @@ public class HMMObjective extends ProjectedObjective{ if(projectionMap[word]==null){
projectionMap[word]=new TIntArrayList[n_states];
}
+ // if(posteriorMap[sentNum][i]==null){
+ // posteriorMap[sentNum][i]=new int[n_states];
+ // }
posteriorMap[sentNum][i][state]=n_param;
if(projectionMap[word][state]==null){
@@ -96,8 +99,8 @@ public class HMMObjective extends ProjectedObjective{ }
projectionMap[word][state].add(n_param);
n_param++;
- }else{
-
+ }
+ else{
posteriorMap[sentNum][i][state]=-1;
}
}
diff --git a/gi/posterior-regularisation/prjava/src/hmm/POS.java b/gi/posterior-regularisation/prjava/src/hmm/POS.java index 722d38e2..2dcf271c 100644 --- a/gi/posterior-regularisation/prjava/src/hmm/POS.java +++ b/gi/posterior-regularisation/prjava/src/hmm/POS.java @@ -8,8 +8,8 @@ import data.Corpus; public class POS {
//public String trainFilename="../posdata/en_train.conll";
- //public static String trainFilename="../posdata/small_train.txt";
- public static String trainFilename="../posdata/en_test.conll";
+ public static String trainFilename="../posdata/small_train.txt";
+// public static String trainFilename="../posdata/en_test.conll";
// public static String trainFilename="../posdata/trial1.txt";
public static String testFilename="../posdata/en_test.conll";
@@ -72,21 +72,6 @@ public class POS { }
hmm.writeModel(modelFilename);
-
- Corpus test=new Corpus(testFilename,c.vocab);
-
- PrintStream ps= io.FileUtil.openOutFile(predFilename);
-
- int [][]data=test.getAllData();
- for(int i=0;i<data.length;i++){
- int []tag=hmm.viterbi(data[i]);
- String sent[]=test.get(i);
- for(int j=0;j<data[i].length;j++){
- ps.println(sent[j]+"\t"+tag[j]);
- }
- ps.println();
- }
- ps.close();
}
diff --git a/gi/posterior-regularisation/prjava/src/test/HMMModelStats.java b/gi/posterior-regularisation/prjava/src/test/HMMModelStats.java index 26d7abec..dbf517fd 100644 --- a/gi/posterior-regularisation/prjava/src/test/HMMModelStats.java +++ b/gi/posterior-regularisation/prjava/src/test/HMMModelStats.java @@ -89,7 +89,7 @@ public class HMMModelStats { }
}
- ps.println("max w t P(w_i|t)"+sum);
+ ps.println("max w t P(w_i|t): "+sum);
}
|