I am trying to use Stanford TokensRegex, however, I am getting an error in line number (11). It says that (). Please do your best to help me. Below is my code:

1 String file="A store has many branches. A manager may manage at most 2 branches.";

2 Properties props = new Properties();

3 props.put("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");

4 StanfordCoreNLP pipeline = new StanfordCoreNLP(props);

5 Annotation document = new Annotation(file);

6 pipeline.annotate(document);

7 List sentences = document.get(CoreAnnotations.SentencesAnnotation.class);

8for(CoreMap sentence: sentences)

9 {

10 TokenSequencePattern pattern = TokenSequencePattern.compile("[]");

11 TokenSequenceMatcher matcher = pattern.getMatcher(sentence);

12 while( matcher.find()){

13 JOptionPane.showMessageDialog(rootPane, "It has been found");

14 }

15 }

More Mussa Omer's questions See All
Similar questions and discussions