本文整理汇总了Java中edu.jhu.hlt.concrete.TokenTagging.setUuid方法的典型用法代码示例。如果您正苦于以下问题:Java TokenTagging.setUuid方法的具体用法?Java TokenTagging.setUuid怎么用?Java TokenTagging.setUuid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.jhu.hlt.concrete.TokenTagging
的用法示例。
在下文中一共展示了TokenTagging.setUuid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addTagging
import edu.jhu.hlt.concrete.TokenTagging; //导入方法依赖的package包/类
private static void addTagging(Tokenization tokenization, String tagType, String toolName, String[] tags) {
List<TaggedToken> taggedTokenList = new ArrayList<>();
int i = 0;
for (String tag : tags) {
TaggedToken t = new TaggedToken();
t.setTag(tag);
t.setTokenIndex(i++);
taggedTokenList.add(t);
}
TokenTagging tt = new TokenTagging();
tt.setUuid(getUUID());
tt.setMetadata(getMetadata(toolName));
tt.setTaggedTokenList(taggedTokenList);
tt.setTaggingType(tagType);
tokenization.addToTokenTaggingList(tt);
}
示例2: generateConcreteTokenization
import edu.jhu.hlt.concrete.TokenTagging; //导入方法依赖的package包/类
/**
* Generate a {@link Tokenization} object from a list of tokens, list of tags, list of offsets, and start position of the text (e.g., first text character in
* the text). Assumes tags are part of speech tags.
*
* Invokes {@link #generateConcreteTokenization(List, int[], int)} then adds tagging.
*
* @see #generateConcreteTokenization(List, int[], int)
*
* @param tokens
* - a {@link List} of tokens (Strings)
* @param offsets
* - an array of integers (offsets)
* @param startPos
* - starting position of the text
* @return a {@link Tokenization} object with correct tokenization and token tagging
*/
public static Tokenization generateConcreteTokenization(String[] tokens, String[] tokenTags, int[] offsets, int startPos) {
Tokenization tokenization = generateConcreteTokenization(tokens, offsets, startPos);
TokenTagging tt = new TokenTagging();
tt.setUuid(UUIDFactory.newUUID());
tt.setTaggingType("twitter");
tt.setMetadata(new AnnotationMetadata(tiftMetadata));
for (int i = 0; i < tokens.length; i++) {
String tag = tokenTags[i];
if (tag != null) {
TaggedToken tok = new TaggedToken();
tok.setTokenIndex(i).setTag(tokenTags[i]);
tt.addToTaggedTokenList(tok);
}
}
// Do not set the tags if everything was "null".
if (tt.isSetTaggedTokenList())
tokenization.addToTokenTaggingList(tt);
return tokenization;
}