TOKEN_TYPE
- the type system token type (e.g. org.apache.uima.fit.examples.type.Token
)SENTENCE_TYPE
- the type system sentence type (e.g. org.apache.uima.fit.examples.type.Sentence
)public class TokenBuilder<TOKEN_TYPE extends org.apache.uima.jcas.tcas.Annotation,SENTENCE_TYPE extends org.apache.uima.jcas.tcas.Annotation> extends Object
JCas
.Constructor and Description |
---|
TokenBuilder(Class<TOKEN_TYPE> aTokenClass,
Class<SENTENCE_TYPE> aSentenceClass)
Calls
TokenBuilder(Class, Class, String, String) with the last two
arguments as null. |
TokenBuilder(Class<TOKEN_TYPE> aTokenClass,
Class<SENTENCE_TYPE> aSentenceClass,
String aPosFeatureName,
String aStemFeatureName)
Instantiates a TokenBuilder with the type system information that the builder needs to build
tokens.
|
Modifier and Type | Method and Description |
---|---|
void |
buildTokens(org.apache.uima.jcas.JCas aJCas,
String aText)
Builds white-space delimited tokens from the input text.
|
void |
buildTokens(org.apache.uima.jcas.JCas aJCas,
String aText,
String aTokensString) |
void |
buildTokens(org.apache.uima.jcas.JCas aJCas,
String aText,
String aTokensString,
String aPosTagsString) |
void |
buildTokens(org.apache.uima.jcas.JCas aJCas,
String aText,
String aTokensString,
String aPosTagsString,
String aStemsString)
Build tokens for the given text, tokens, part-of-speech tags, and word stems.
|
static <T extends org.apache.uima.jcas.tcas.Annotation,S extends org.apache.uima.jcas.tcas.Annotation> |
create(Class<T> aTokenClass,
Class<S> aSentenceClass)
Instantiates a TokenBuilder with the type system information that the builder needs to build
tokens.
|
void |
setPosFeatureName(String aPosFeatureName)
Set the feature name for the part-of-speech tag for your token type.
|
void |
setStemFeatureName(String aStemFeatureName)
Set the feature name for the stem for your token type.
|
public TokenBuilder(Class<TOKEN_TYPE> aTokenClass, Class<SENTENCE_TYPE> aSentenceClass)
TokenBuilder(Class, Class, String, String)
with the last two
arguments as null.aTokenClass
- the class of your token type from your type system (e.g.
org.apache.uima.fit.type.Token.class)aSentenceClass
- the class of your sentence type from your type system (e.g.
org.apache.uima.fit.type.Sentence.class)public TokenBuilder(Class<TOKEN_TYPE> aTokenClass, Class<SENTENCE_TYPE> aSentenceClass, String aPosFeatureName, String aStemFeatureName)
aTokenClass
- the class of your token type from your type system (e.g.
org.apache.uima.fit.type.Token.class)aSentenceClass
- the class of your sentence type from your type system (e.g.
org.apache.uima.fit.type.Sentence.class)aPosFeatureName
- the feature name for the part-of-speech tag for your token type. This assumes that
there is a single string feature for which to put your pos tag. null is an ok value.aStemFeatureName
- the feature name for the stem for your token type. This assumes that there is a single
string feature for which to put your stem. null is an ok value.public static <T extends org.apache.uima.jcas.tcas.Annotation,S extends org.apache.uima.jcas.tcas.Annotation> TokenBuilder<T,S> create(Class<T> aTokenClass, Class<S> aSentenceClass)
T
- the type system token type (e.g. org.apache.uima.fit.examples.type.Token)S
- the type system sentence type (e.g. org.apache.uima.fit.examples.type.Sentence
)aTokenClass
- the class of your token type from your type system (e.g.
org.apache.uima.fit.type.Token
)aSentenceClass
- the class of your sentence type from your type system (e.g.
org.apache.uima.fit.type.Sentence
)public void setPosFeatureName(String aPosFeatureName)
aPosFeatureName
- the part-of-speech feature name.public void setStemFeatureName(String aStemFeatureName)
aStemFeatureName
- the stem feature name.public void buildTokens(org.apache.uima.jcas.JCas aJCas, String aText)
aJCas
- the JCas to add the Token annotations toaText
- the text to initialize the JCas
withpublic void buildTokens(org.apache.uima.jcas.JCas aJCas, String aText, String aTokensString)
aJCas
- the JCas to add the Token annotations toaText
- the text to initialize the JCas
withaTokensString
- the tokensString must have the same non-white space characters as the text. The
tokensString is used to identify token boundaries using white space - i.e. the only
difference between the 'text' parameter and the 'tokensString' parameter is that the
latter may have more whitespace characters. For example, if the text is "She ran."
then the tokensString might be "She ran ."buildTokens(JCas, String, String, String, String)
public void buildTokens(org.apache.uima.jcas.JCas aJCas, String aText, String aTokensString, String aPosTagsString)
aJCas
- the JCas to add the Token annotations toaText
- the text to initialize the JCas
withaTokensString
- the tokensString must have the same non-white space characters as the text. The
tokensString is used to identify token boundaries using white space - i.e. the only
difference between the 'text' parameter and the 'tokensString' parameter is that the
latter may have more whitespace characters. For example, if the text is "She ran."
then the tokensString might be "She ran ."aPosTagsString
- the posTagsString should be a space delimited string of part-of-speech tags - one for
each tokenbuildTokens(JCas, String, String, String, String)
public void buildTokens(org.apache.uima.jcas.JCas aJCas, String aText, String aTokensString, String aPosTagsString, String aStemsString)
aJCas
- the JCas to add the Token annotations toaText
- the text to initialize the JCas
withaTokensString
- the tokensString must have the same non-white space characters as the text. The
tokensString is used to identify token boundaries using white space - i.e. the only
difference between the 'text' parameter and the 'tokensString' parameter is that the
latter may have more whitespace characters. For example, if the text is "She ran."
then the tokensString might be "She ran ."aPosTagsString
- the posTagsString should be a space delimited string of part-of-speech tags - one for
each tokenaStemsString
- the stemsString should be a space delimited string of stems - one for each tokenCopyright © 2012–2014 The Apache Software Foundation. All rights reserved.