Commit fd0008c1 authored by Arne Christian Loose's avatar Arne Christian Loose

Replace MedReportReader.java

parent 17adabfd
Pipeline #2477 skipped
package Ueb6;
package ueb6.ueb6;
import java.io.BufferedReader;
import java.io.File;
......@@ -7,7 +7,11 @@ import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import edu.stanford.nlp.classify.Classifier;
import edu.stanford.nlp.classify.ColumnDataClassifier;
import edu.stanford.nlp.ling.CoreLabel;
import edu.stanford.nlp.ling.Datum;
import edu.stanford.nlp.objectbank.ObjectBank;
import edu.stanford.nlp.process.CoreLabelTokenFactory;
import edu.stanford.nlp.process.PTBTokenizer;
import edu.stanford.nlp.tagger.maxent.MaxentTagger;
......@@ -15,7 +19,30 @@ import edu.stanford.nlp.tagger.maxent.MaxentTagger;
public class MedReportReader {
public static void main(String[] args) throws IOException {
// ACL: Pfad zu Diagnosen, Trainig und Property File
final String diag = "diag.txt";
final String prop = "icd10.prop";
final String train = "icd10.train";
// Create new DataClassifier (use Propertyfile as defined in prop)
ColumnDataClassifier cdc = new ColumnDataClassifier(prop);
// Train Classifier with ICD10 Codes
Classifier<String,String> cla = cdc.makeClassifier(cdc.readTrainingExamples(train));
// Test given IPT against Classifier - Could also be: Output cdc.makeDatumFromStrings(String[])
// ICD10 Code als String in cla.classOf(d)
for (String line : ObjectBank.getLineIterator(diag, "utf-8")) {
Datum<String,String> d = cdc.makeDatumFromLine(line);
System.out.println(line + " *Erkannte Diagnose => " + cla.classOf(d) + " Score => " + cla.scoresOf(d).getCount(cla.classOf(d)) );
}
/* Tagging - old
// Pfad zu Arztbriefen
String file = "C:/Users/Julia/Desktop/ueb6_alternative/UEB06_A1_alternativ/src/ueb06/Arztbrief1.txt";
String zeile;
......@@ -61,6 +88,7 @@ public class MedReportReader {
e.printStackTrace();
}
}
}*/
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment