@@ -48,11 +48,11 @@ public class AnnotationService implements IAnnotationService {
4848 private final static String basePath = AnnotationService .class .getResource (File .separator + "GermaNER" ).getPath () + File .separator ;
4949
5050
51- private final static String pathToTokenizedFile = ResourceUtil .getPath ("GermaNER" + File .separator + "temp-file-to-annotate.txt" );
52- private final static String pathToConfig = ResourceUtil .getPath ("GermaNER" + File .separator + "config.properties" );
53- private final static String pathToOuputFile =ResourceUtil .getPath ("GermaNER" + File .separator + "taggedFile.txt" );
51+ private final static String pathToTokenizedFile = ResourceUtil .getPath ("GermaNER" + File .separator + "temp-file-to-annotate.txt" );
52+ private final static String pathToConfig = ResourceUtil .getPath ("GermaNER" + File .separator + "config.properties" );
53+ private final static String pathToOuputFile = ResourceUtil .getPath ("GermaNER" + File .separator + "taggedFile.txt" );
5454 private final static String pathToModel = basePath + "model" ;
55- public final static String pathToTrainingFile = ResourceUtil .getPath ("GermaNER" + File .separator + "trainingsFile.txt" );
55+ public final static String pathToTrainingFile = ResourceUtil .getPath ("GermaNER" + File .separator + "trainingsFile.txt" );
5656 static Properties prop ;
5757 static InputStream configFile = null ;
5858 static File modelDirectory ;
@@ -207,7 +207,7 @@ public static void initGermaNER() {
207207
208208 setModelDir ();
209209
210- File outputtmpFile = File .createTempFile ("result" ,".tmp" );
210+ File outputtmpFile = File .createTempFile ("result" , ".tmp" );
211211 File outputFile = new File (pathToOuputFile );
212212
213213 long initNerModelB = System .currentTimeMillis ();
@@ -249,15 +249,14 @@ public List<Anonymization> annotate(Document document) {
249249 }
250250
251251
252-
253252 File outputFile = new File (pathToOuputFile );
254253
255254 System .out .println ("Start tagging" );
256255
257256 PrintWriter out ;
258257 ArrayList <Anonymization > anonymizations = null ;
259258 try (InputStream inputStream = new FileInputStream (outputFile .getAbsolutePath ())) {
260- File outputtmpFile = File .createTempFile ("result" ,".tmp" );
259+ File outputtmpFile = File .createTempFile ("result" , ".tmp" );
261260 out = new PrintWriter (pathToTokenizedFile );
262261 out .println (tokenizedFile );
263262 out .close ();
@@ -319,18 +318,17 @@ private ArrayList<Anonymization> receiveAnonymizations(InputStream inputStream)
319318 original = original .trim ();
320319 temp = counter ;
321320 anonymization .original (original );
322- try {
323- anonymization .replacement (replacementGenerator .generateReplacement (original , label ));
324- } catch (Exception e ) {
325- e .printStackTrace ();
326- }
321+
322+ anonymization .replacement (replacementGenerator .generateReplacement (original , label ));
323+
327324 anonymization .label (label );
328325
329326 anonymizations .add (anonymization .build ());
330327 original = "" ;
331328
332329 }
333- label = Label .valueOf (splitted [1 ].substring (2 )); // Label - must exactly match!
330+ String substring = splitted [1 ].substring (2 );
331+ label = Label .getOrDefault (substring , Label .UNKNOWN ); // Label - must exactly match!
334332
335333 original += " " + splitted [0 ]; // 1. Teil des Tags
336334 log .debug (line );
0 commit comments