Añotador
Temporal Tagger
Main.java
Go to the documentation of this file.
1 package oeg.tagger.core.servlets;
2 
4 
10 public class Main {
11 
15  public static void main(String[] args) throws Exception {
16 
17  try {
18 
19  String txt = "Eso será mañana por la mañana."; // Our test sentence
20  System.out.println(txt);
21  System.out.println("---------------------------------------------------------------");
22  String parseLegalRef = parseAndTag(txt); // We tag it
23  System.out.println(parseLegalRef); // We print the output of the tagger
24 
25  } catch (Exception ex) {
26  System.out.print(ex.toString());
27  }
28 
29  }
30 
36  public static String parseAndTag(String txt) {
37 
38  try {
39  AnnotadorStandard annotador = new AnnotadorStandard("ES"); // We innitialize the tagger in Spanish
40  String date = "2000-02-11"; // Our test anchor date
41  if (date != null && !date.matches("\\d\\d\\d\\d-(1[012]|0\\d)-(3[01]|[012]\\d)")) // Is it valid?
42  {
43  date = null; // If not, we use no date (so anchor values will not be normalized)
44  }
45  Salida output = annotador.annotateBRAT(txt, date); // We annotate in BRAT format
46  return output.txt + "\n\n" + output.format; // We return the javascript with the values to evaluate
47  } catch (Exception ex) {
48  System.err.print(ex.toString());
49  }
50  return "";
51  }
52 
53 }
oeg.tagger.core.servlets.Main
Definition: Main.java:10
oeg.tagger.core.time
oeg.tagger.core.time.tictag.AnnotadorStandard
Definition: AnnotadorStandard.java:49
oeg.tagger.core
oeg.tagger.core.servlets.Salida.format
String format
Definition: Salida.java:11
oeg.tagger.core.time.tictag
Definition: Annotador.java:1
oeg.tagger.core.servlets.Salida.txt
String txt
Definition: Salida.java:10
oeg
oeg.tagger
oeg.tagger.core.time.tictag.AnnotadorStandard.annotateBRAT
Salida annotateBRAT(String input, String anchorDate)
Definition: AnnotadorStandard.java:877
oeg.tagger.core.servlets.Main.parseAndTag
static String parseAndTag(String txt)
Definition: Main.java:36
oeg.tagger.core.servlets.Main.main
static void main(String[] args)
Definition: Main.java:15
oeg.tagger.core.servlets.Salida
Definition: Salida.java:8