Skip to content

Commit 2cfc94a

Browse files
authored
OPENNLP-1758: Enhance Javadoc of opennlp.uima (#813)
1 parent 5c0f9c8 commit 2cfc94a

28 files changed

+245
-127
lines changed

opennlp-extensions/opennlp-uima/src/main/java/opennlp/uima/chunker/Chunker.java

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,34 @@
3838
import opennlp.uima.util.UimaUtil;
3939

4040
/**
41-
* OpenNLP Chunker annotator.
41+
* An OpenNLP-based Chunker annotator.
4242
* <p>
43-
* Mandatory parameters
43+
* Mandatory parameters:
4444
* <table border=1>
4545
* <caption></caption>
4646
* <tr><th>Type</th> <th>Name</th> <th>Description</th></tr>
47-
* <tr><td>String</td> <td>opennlp.uima.ModelName</td> <td>The name of the model file</td></tr>
48-
* <tr><td>String</td> <td>opennlp.uima.SentenceType</td> <td>The full name of the sentence type</td></tr>
49-
* <tr><td>String</td> <td>opennlp.uima.TokenType</td> <td>The full name of the token type</td></tr>
50-
* <tr><td>String</td> <td>opennlp.uima.POSFeature</td></tr>
51-
* <tr><td>String</td> <td>opennlp.uima.ChunkType</td></tr>
52-
* <tr><td>String</td> <td>opennlp.uima.ChunkTagFeature</td></tr>
47+
* <tr><td>String</td>
48+
* <td>{@code opennlp.uima.ModelName}</td>
49+
* <td>The name of the model file</td>
50+
* </tr>
51+
* <tr><td>String</td>
52+
* <td>{@code opennlp.uima.SentenceType}</td>
53+
* <td>The full name of the sentence type</td>
54+
* </tr>
55+
* <tr><td>String</td>
56+
* <td>{@code opennlp.uima.TokenType}</td>
57+
* <td>The full name of the token type</td>
58+
* </tr>
59+
* <tr><td>String</td> <td>{@code opennlp.uima.POSFeature}</td></tr>
60+
* <tr><td>String</td> <td>{@code opennlp.uima.ChunkType}</td></tr>
61+
* <tr><td>String</td> <td>{@code opennlp.uima.ChunkTagFeature}</td></tr>
5362
* </table>
5463
* <p>
55-
* Optional parameters
64+
* Optional parameters:
5665
* <table border=1>
5766
* <caption></caption>
5867
* <tr><th>Type</th> <th>Name</th> <th>Description</th></tr>
59-
* <tr><td>Integer</td> <td>opennlp.uima.BeamSize</td></tr>
68+
* <tr><td>Integer</td> <td>{@code opennlp.uima.BeamSize}</td></tr>
6069
* </table>
6170
*/
6271
public final class Chunker extends CasAnnotator_ImplBase {
@@ -70,8 +79,7 @@ public final class Chunker extends CasAnnotator_ImplBase {
7079
/**
7180
* The chunk tag feature parameter
7281
*/
73-
public static final String CHUNK_TAG_FEATURE_PARAMETER =
74-
"opennlp.uima.ChunkTagFeature";
82+
public static final String CHUNK_TAG_FEATURE_PARAMETER = "opennlp.uima.ChunkTagFeature";
7583

7684
private Type mTokenType;
7785

@@ -100,9 +108,8 @@ public Chunker() {
100108
* <p>
101109
* Note: Do all initialization in this method, do not use the constructor.
102110
*/
103-
public void initialize(UimaContext context)
104-
throws ResourceInitializationException {
105-
111+
@Override
112+
public void initialize(UimaContext context) throws ResourceInitializationException {
106113
super.initialize(context);
107114

108115
this.context = context;
@@ -128,10 +135,10 @@ public void initialize(UimaContext context)
128135
}
129136

130137
/**
131-
* Initializes the type system.
138+
* Initializes the {@link TypeSystem type system}.
132139
*/
133-
public void typeSystemInit(TypeSystem typeSystem)
134-
throws AnalysisEngineProcessException {
140+
@Override
141+
public void typeSystemInit(TypeSystem typeSystem) throws AnalysisEngineProcessException {
135142

136143
// chunk type
137144
mChunkType = AnnotatorUtil.getRequiredTypeParameter(context, typeSystem,
@@ -177,13 +184,10 @@ public void process(CAS tcas) {
177184
int index = 0;
178185

179186
for (AnnotationFS tokenAnnotation : tokenAnnotationIndex) {
180-
181187
tokenAnnotations[index] = tokenAnnotation;
182-
183188
tokens[index] = tokenAnnotation.getCoveredText();
184189

185-
pos[index++] = tokenAnnotation.getFeatureValueAsString(
186-
mPosFeature);
190+
pos[index++] = tokenAnnotation.getFeatureValueAsString(mPosFeature);
187191
}
188192

189193
String[] result = mChunker.chunk(tokens, pos);

opennlp-extensions/opennlp-uima/src/main/java/opennlp/uima/chunker/ChunkerModelResource.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919

2020
import opennlp.tools.chunker.ChunkerModel;
2121

22+
/**
23+
* A resource encapsulating an OpenNLP {@link ChunkerModel} which can be shared between
24+
* <i>analysis engines</i> and loaded via the UIMA resource model.
25+
*/
2226
public interface ChunkerModelResource {
2327

2428
ChunkerModel getModel();

opennlp-extensions/opennlp-uima/src/main/java/opennlp/uima/chunker/ChunkerModelResourceImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
import opennlp.tools.chunker.ChunkerModel;
2424
import opennlp.uima.util.AbstractModelResource;
2525

26+
/**
27+
* A default implementation of {@link ChunkerModelResource}.
28+
*/
2629
public class ChunkerModelResourceImpl extends AbstractModelResource<ChunkerModel>
2730
implements ChunkerModelResource {
2831

opennlp-extensions/opennlp-uima/src/main/java/opennlp/uima/dictionary/DictionaryResource.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919

2020
import opennlp.tools.dictionary.Dictionary;
2121

22+
/**
23+
* A resource encapsulating an OpenNLP {@link Dictionary} which can be shared between
24+
* <i>analysis engines</i> and loaded via the UIMA resource model.
25+
*/
2226
public interface DictionaryResource {
27+
2328
Dictionary getDictionary();
2429
}

opennlp-extensions/opennlp-uima/src/main/java/opennlp/uima/dictionary/DictionaryResourceImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
import opennlp.tools.dictionary.Dictionary;
2424
import opennlp.uima.util.AbstractModelResource;
2525

26+
/**
27+
* A default implementation of {@link DictionaryResource}.
28+
*/
2629
public class DictionaryResourceImpl extends AbstractModelResource<Dictionary>
2730
implements DictionaryResource {
2831

opennlp-extensions/opennlp-uima/src/main/java/opennlp/uima/doccat/DoccatModelResource.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919

2020
import opennlp.tools.doccat.DoccatModel;
2121

22+
/**
23+
* A resource encapsulating an OpenNLP {@link DoccatModel} which can be shared between
24+
* <i>analysis engines</i> and loaded via the UIMA resource model.
25+
*/
2226
public interface DoccatModelResource {
27+
2328
DoccatModel getModel();
2429
}

opennlp-extensions/opennlp-uima/src/main/java/opennlp/uima/doccat/DoccatModelResourceImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
import opennlp.tools.doccat.DoccatModel;
2424
import opennlp.uima.util.AbstractModelResource;
2525

26+
/**
27+
* A default implementation of {@link DoccatModelResource}.
28+
*/
2629
public class DoccatModelResourceImpl extends AbstractModelResource<DoccatModel>
2730
implements DoccatModelResource {
2831

opennlp-extensions/opennlp-uima/src/main/java/opennlp/uima/namefind/NameFinder.java

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,38 @@
3636
import opennlp.uima.util.UimaUtil;
3737

3838
/**
39-
* OpenNLP Name annotator.
39+
* An OpenNLP-based Name annotator.
4040
* <p>
41-
* Mandatory parameters
41+
* Mandatory parameters:
4242
* <table border=1>
4343
* <caption></caption>
4444
* <tr><th>Type</th> <th>Name</th> <th>Description</th></tr>
45-
* <tr><td>String</td> <td>opennlp.uima.ModelName</td> <td>The name of the model file</td></tr>
46-
* <tr><td>String</td> <td>opennlp.uima.SentenceType</td> <td>The full name of the sentence type</td></tr>
47-
* <tr><td>String</td> <td>opennlp.uima.TokenType</td> <td>The full name of the token type</td></tr>
48-
* <tr><td>String</td> <td>opennlp.uima.NameType</td> <td>The full name of the name type</td></tr>
45+
* <tr><td>String</td>
46+
* <td>{@code opennlp.uima.ModelName}</td>
47+
* <td>The name of the model file</td>
48+
* </tr>
49+
* <tr><td>String</td>
50+
* <td>{@code opennlp.uima.SentenceType}</td>
51+
* <td>The full name of the sentence type</td>
52+
* </tr>
53+
* <tr><td>String</td>
54+
* <td>{@code opennlp.uima.TokenType}</td>
55+
* <td>The full name of the token type</td>
56+
* </tr>
57+
* <tr><td>String</td>
58+
* <td>{@code opennlp.uima.NameType}</td>
59+
* <td>The full name of the name type</td>
60+
* </tr>
4961
* </table>
5062
* <p>
51-
* Optional parameters
63+
* Optional parameters:
5264
* <table border=1>
5365
* <caption></caption>
5466
* <tr><th>Type</th> <th>Name</th> <th>Description</th></tr>
55-
* <tr><td>String</td> <td>opennlp.uima.ProbabilityFeature</td> <td>The name of the double
67+
* <tr><td>String</td> <td>{@code opennlp.uima.ProbabilityFeature}</td> <td>The name of the double
5668
* probability feature (not set by default)</td></tr>
57-
* <tr><td>Integer</td> <td>opennlp.uima.BeamSize</td></tr>
58-
* <tr><td>String</td> <td>opennlp.uima.DocumentConfidenceType</td></tr>
59-
* <tr><td>String</td> <td>opennlp.uima.DocumentConfidenceType</td></tr>
69+
* <tr><td>Integer</td> <td>{@code opennlp.uima.BeamSize}</td></tr>
70+
* <tr><td>String</td> <td>{@code opennlp.uima.DocumentConfidenceType}</td></tr>
6071
* </table>
6172
*/
6273
public final class NameFinder extends AbstractNameFinder {
@@ -114,7 +125,6 @@ public NameFinder() {
114125
*/
115126
@Override
116127
public void initialize() throws ResourceInitializationException {
117-
118128
super.initialize();
119129

120130
TokenNameFinderModel model;
@@ -132,11 +142,10 @@ public void initialize() throws ResourceInitializationException {
132142
}
133143

134144
/**
135-
* Initializes the type system.
145+
* Initializes the {@link TypeSystem type system}.
136146
*/
137147
@Override
138148
public void typeSystemInit(TypeSystem typeSystem) throws AnalysisEngineProcessException {
139-
140149
super.typeSystemInit(typeSystem);
141150

142151
probabilityFeature = AnnotatorUtil.getOptionalFeatureParameter(context, mNameType,

opennlp-extensions/opennlp-uima/src/main/java/opennlp/uima/namefind/TokenNameFinderModelResource.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919

2020
import opennlp.tools.namefind.TokenNameFinderModel;
2121

22+
/**
23+
* A resource encapsulating an OpenNLP {@link TokenNameFinderModel} which can be shared between
24+
* <i>analysis engines</i> and loaded via the UIMA resource model.
25+
*/
2226
public interface TokenNameFinderModelResource {
27+
2328
TokenNameFinderModel getModel();
2429
}

opennlp-extensions/opennlp-uima/src/main/java/opennlp/uima/namefind/TokenNameFinderModelResourceImpl.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
import opennlp.tools.namefind.TokenNameFinderModel;
2424
import opennlp.uima.util.AbstractModelResource;
2525

26+
/**
27+
* A default implementation of {@link TokenNameFinderModelResource}.
28+
*/
2629
public class TokenNameFinderModelResourceImpl extends AbstractModelResource<TokenNameFinderModel>
2730
implements TokenNameFinderModelResource {
2831

0 commit comments

Comments
 (0)