Skip to content

Commit

Permalink
Fixed broken labeling
Browse files Browse the repository at this point in the history
  • Loading branch information
ablx committed Jul 12, 2017
1 parent de15453 commit dcedc93
Showing 1 changed file with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ public class AnnotationService implements IAnnotationService {
private final static String basePath = AnnotationService.class.getResource(File.separator + "GermaNER").getPath() + File.separator;


private final static String pathToTokenizedFile = ResourceUtil.getPath("GermaNER"+File.separator+"temp-file-to-annotate.txt");
private final static String pathToConfig = ResourceUtil.getPath("GermaNER"+File.separator+"config.properties");
private final static String pathToOuputFile =ResourceUtil.getPath("GermaNER"+File.separator+ "taggedFile.txt");
private final static String pathToTokenizedFile = ResourceUtil.getPath("GermaNER" + File.separator + "temp-file-to-annotate.txt");
private final static String pathToConfig = ResourceUtil.getPath("GermaNER" + File.separator + "config.properties");
private final static String pathToOuputFile = ResourceUtil.getPath("GermaNER" + File.separator + "taggedFile.txt");
private final static String pathToModel = basePath + "model";
public final static String pathToTrainingFile = ResourceUtil.getPath("GermaNER"+File.separator+ "trainingsFile.txt");
public final static String pathToTrainingFile = ResourceUtil.getPath("GermaNER" + File.separator + "trainingsFile.txt");
static Properties prop;
static InputStream configFile = null;
static File modelDirectory;
Expand Down Expand Up @@ -207,7 +207,7 @@ public static void initGermaNER() {

setModelDir();

File outputtmpFile = File.createTempFile("result",".tmp");
File outputtmpFile = File.createTempFile("result", ".tmp");
File outputFile = new File(pathToOuputFile);

long initNerModelB = System.currentTimeMillis();
Expand Down Expand Up @@ -249,15 +249,14 @@ public List<Anonymization> annotate(Document document) {
}



File outputFile = new File(pathToOuputFile);

System.out.println("Start tagging");

PrintWriter out;
ArrayList<Anonymization> anonymizations = null;
try (InputStream inputStream = new FileInputStream(outputFile.getAbsolutePath())) {
File outputtmpFile = File.createTempFile("result",".tmp");
File outputtmpFile = File.createTempFile("result", ".tmp");
out = new PrintWriter(pathToTokenizedFile);
out.println(tokenizedFile);
out.close();
Expand Down Expand Up @@ -319,18 +318,17 @@ private ArrayList<Anonymization> receiveAnonymizations(InputStream inputStream)
original = original.trim();
temp = counter;
anonymization.original(original);
try {
anonymization.replacement(replacementGenerator.generateReplacement(original, label));
} catch (Exception e) {
e.printStackTrace();
}

anonymization.replacement(replacementGenerator.generateReplacement(original, label));

anonymization.label(label);

anonymizations.add(anonymization.build());
original = "";

}
label = Label.valueOf(splitted[1].substring(2)); // Label - must exactly match!
String substring = splitted[1].substring(2);
label = Label.getOrDefault(substring, Label.UNKNOWN); // Label - must exactly match!

original += " " + splitted[0]; // 1. Teil des Tags
log.debug(line);
Expand Down

0 comments on commit dcedc93

Please sign in to comment.