Skip to content

Commit f005e3b

Browse files
author
CogComp Dev
authored
Merge pull request #680 from there/master
Update code example in Programmatic Use
2 parents 99971bd + 17d804e commit f005e3b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

ner/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,14 @@ A complete example follows.
119119
120120
```java
121121
import edu.illinois.cs.cogcomp.core.datastructures.textannotation.TextAnnotation;
122-
import edu.illinois.cs.cogcomp.core.utilities.configuration.ResourceManager;
123122
import edu.illinois.cs.cogcomp.nlp.utility.TokenizerTextAnnotationBuilder;
123+
import edu.illinois.cs.cogcomp.annotation.AnnotatorException;
124124
import edu.illinois.cs.cogcomp.annotation.TextAnnotationBuilder;
125125
import edu.illinois.cs.cogcomp.core.datastructures.ViewNames;
126126
import edu.illinois.cs.cogcomp.ner.NERAnnotator;
127127
import edu.illinois.cs.cogcomp.nlp.tokenizer.StatefulTokenizer;
128-
import edu.illinois.cs.cogcomp.ner.LbjTagger.*;
129128
import java.io.IOException;
130129
131-
import java.util.Properties;
132-
133130
// Filename: App.java
134131
public class App
135132
{
@@ -146,12 +143,16 @@ public class App
146143
TextAnnotationBuilder tab;
147144
// don't split on hyphens, as NER models are trained this way
148145
boolean splitOnHyphens = false;
149-
tab = new TokenizerTextAnnotationBuilder(new StatefulTokenizer(splitOnHyphens));
146+
tab = new TokenizerTextAnnotationBuilder(new StatefulTokenizer(splitOnHyphens, false));
150147
151148
TextAnnotation ta = tab.createTextAnnotation(corpus, textId, text1);
152149
153150
NERAnnotator co = new NERAnnotator(ViewNames.NER_CONLL);
154-
co.getView(ta);
151+
try {
152+
co.getView(ta);
153+
} catch (AnnotatorException e) {
154+
e.printStackTrace();
155+
}
155156
156157
System.out.println(ta.getView(ViewNames.NER_CONLL));
157158
}

0 commit comments

Comments
 (0)