From e26434979adc33bd949566ba7bf02dff64e80a3e Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Tue, 2 Oct 2012 00:19:43 -0400 Subject: cdec cleanup, remove bayesian stuff, parsing stuff --- .../prjava/src/phrase/Agree.java | 204 --------------------- 1 file changed, 204 deletions(-) delete mode 100644 gi/posterior-regularisation/prjava/src/phrase/Agree.java (limited to 'gi/posterior-regularisation/prjava/src/phrase/Agree.java') diff --git a/gi/posterior-regularisation/prjava/src/phrase/Agree.java b/gi/posterior-regularisation/prjava/src/phrase/Agree.java deleted file mode 100644 index 8f7b499e..00000000 --- a/gi/posterior-regularisation/prjava/src/phrase/Agree.java +++ /dev/null @@ -1,204 +0,0 @@ -package phrase; - -import gnu.trove.TIntArrayList; - -import io.FileUtil; - -import java.io.File; -import java.io.IOException; -import java.io.PrintStream; -import java.util.List; - -import phrase.Corpus.Edge; - -public class Agree { - PhraseCluster model1; - C2F model2; - Corpus c; - private int K,n_phrases, n_words, n_contexts, n_positions1,n_positions2; - - /**@brief sum of loglikelihood of two - * individual models - */ - public double llh; - /**@brief Bhattacharyya distance - * - */ - public double bdist; - /** - * - * @param numCluster - * @param corpus - */ - public Agree(int numCluster, Corpus corpus){ - - model1=new PhraseCluster(numCluster, corpus); - model2=new C2F(numCluster,corpus); - c=corpus; - n_words=c.getNumWords(); - n_phrases=c.getNumPhrases(); - n_contexts=c.getNumContexts(); - n_positions1=c.getNumContextPositions(); - n_positions2=2; - K=numCluster; - - } - - /**@brief test - * - */ - public static void main(String args[]){ - //String in="../pdata/canned.con"; - String in="../pdata/btec.con"; - String out="../pdata/posterior.out"; - int numCluster=25; - Corpus corpus = null; - File infile = new File(in); - try { - System.out.println("Reading concordance from " + infile); - corpus = Corpus.readFromFile(FileUtil.reader(infile)); - corpus.printStats(System.out); - } catch (IOException e) { - System.err.println("Failed to open input file: " + infile); - e.printStackTrace(); - System.exit(1); - } - - Agree agree=new Agree(numCluster, corpus); - int iter=20; - for(int i=0;i contexts = c.getEdgesForContext(context); - - for (int ctx=0; ctx 0; - bdist += edge.getCount() * Math.log(z); - arr.F.l1normalize(p); - - double count = edge.getCount(); - //increment expected count - TIntArrayList phraseToks = edge.getPhrase(); - TIntArrayList contextToks = edge.getContext(); - for(int tag=0;tag test) - { - for (Edge edge : test) - { - double probs[] = posterior(edge); - arr.F.l1normalize(probs); - - // emit phrase - ps.print(edge.getPhraseString()); - ps.print("\t"); - ps.print(edge.getContextString(true)); - int t=arr.F.argmax(probs); - ps.println(" ||| C=" + t); - } - } - -} -- cgit v1.2.3