org.grobid.core.tokenization.TaggingTokenCluster Java Examples
The following examples show how to use
org.grobid.core.tokenization.TaggingTokenCluster.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NERParserCommon.java From grobid-ner with Apache License 2.0 | 5 votes |
private OffsetPosition calculateOffsets(TaggingTokenCluster cluster) { final List<LabeledTokensContainer> labeledTokensContainers = cluster.getLabeledTokensContainers(); if (CollectionUtils.isEmpty(labeledTokensContainers) || CollectionUtils.isEmpty(labeledTokensContainers.get(0).getLayoutTokens())) { return new OffsetPosition(); } final LabeledTokensContainer labeledTokensContainer = labeledTokensContainers.get(0); final List<LayoutToken> layoutTokens = labeledTokensContainer.getLayoutTokens(); int start = layoutTokens.get(0).getOffset(); int end = start + LayoutTokensUtil.normalizeText(LayoutTokensUtil.toText(cluster.concatTokens())).length(); return new OffsetPosition(start, end); }