| import vn.pipeline.*;
|
| import java.io.*;
|
| public class VnCoreNLPExample {
|
| public static void main(String[] args) throws IOException {
|
|
|
|
|
| String[] annotators = {"wseg", "pos", "ner", "parse"};
|
| VnCoreNLP pipeline = new VnCoreNLP(annotators);
|
|
|
| String str = "Ông Nguyễn Khắc Chúc đang làm việc tại Đại học Quốc gia Hà Nội. "
|
| + "Bà Lan, vợ ông Chúc, cũng làm việc tại đây.";
|
| Annotation annotation = new Annotation(str);
|
| pipeline.annotate(annotation);
|
|
|
| System.out.println(annotation.toString());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| PrintStream outputPrinter = new PrintStream("output.txt");
|
| pipeline.printToFile(annotation, outputPrinter);
|
|
|
|
|
| Sentence firstSentence = annotation.getSentences().get(0);
|
| System.out.println(firstSentence.toString());
|
| }
|
| } |