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/hmm/POS.java | 120 --------------------- 1 file changed, 120 deletions(-) delete mode 100644 gi/posterior-regularisation/prjava/src/hmm/POS.java (limited to 'gi/posterior-regularisation/prjava/src/hmm/POS.java') diff --git a/gi/posterior-regularisation/prjava/src/hmm/POS.java b/gi/posterior-regularisation/prjava/src/hmm/POS.java deleted file mode 100644 index bdcbc683..00000000 --- a/gi/posterior-regularisation/prjava/src/hmm/POS.java +++ /dev/null @@ -1,120 +0,0 @@ -package hmm; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.PrintStream; -import java.util.HashMap; - -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/trial1.txt"; - - public static String testFilename="../posdata/en_test.conll"; - //public static String testFilename="../posdata/trial1.txt"; - - public static String predFilename="../posdata/en_test.predict.conll"; - public static String modelFilename="../posdata/posModel.out"; - public static final int ITER=20; - public static final int N_STATE=30; - - public static void main(String[] args) { - //POS p=new POS(); - //POS p=new POS(true); - try { - PRPOS(); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - - public POS() throws FileNotFoundException, IOException{ - Corpus c= new Corpus(trainFilename); - //size of vocabulary +1 for unknown tokens - HMM hmm =new HMM(N_STATE, c.getVocabSize()+1,c.getAllData()); - for(int i=0;itagVocab= - (HashMap) io.SerializedObjects.readSerializedObject(Corpus.tagalphaFilename); - String [] tagdict=new String [tagVocab.size()+1]; - for(String key:tagVocab.keySet()){ - tagdict[tagVocab.get(key)]=key; - } - tagdict[tagdict.length-1]=Corpus.UNK_TOK; - - System.out.println(c.vocab.get("")); - - PrintStream ps= io.FileUtil.printstream(new File(predFilename)); - - int [][]data=test.getAllData(); - for(int i=0;i