本文整理了Java中de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Sentence.getBegin()
方法的一些代码示例,展示了Sentence.getBegin()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Sentence.getBegin()
方法的具体详情如下:
包路径:de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Sentence
类名称:Sentence
方法名:getBegin
暂无
代码示例来源:origin: webanno/webanno
public int getBegin()
{
return uimaSentence.getBegin();
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/webanno-io-tsv
public int getBegin()
{
return uimaSentence.getBegin();
}
代码示例来源:origin: UKPLab/argument-reasoning-comprehension-task
public static int getSentenceNumber(Sentence sentence, JCas jCas)
{
ArrayList<Sentence> sentences = new ArrayList<>(JCasUtil.select(jCas, Sentence.class));
for (int i = 0; i < sentences.size(); i++) {
Sentence s = sentences.get(i);
if (s.getBegin() == sentence.getBegin()) {
return i;
}
}
throw new IllegalStateException();
}
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat
/**
* Get the cureent sentence based on the anotation begin/end offset
*/
public static Sentence getCurrentSentence(JCas aJCas, int aBegin, int aEnd){
Sentence currentSentence = null;
for(Sentence sentence :select(aJCas, Sentence.class)){
if(sentence.getBegin()<=aBegin && sentence.getEnd()>=aEnd){
currentSentence = sentence;
break;
}
}
return currentSentence;
}
代码示例来源:origin: UKPLab/argument-reasoning-comprehension-task
/**
* Returns a covering sentence if it starts at the token, null otherwise
*
* @param t token
* @return sentence or null
*/
public static Sentence sentenceStartsOnToken(Token t)
{
List<Sentence> sentences = JCasUtil.selectCovering(Sentence.class, t);
return (!sentences.isEmpty() && sentences.get(0).getBegin() == t.getBegin()) ?
sentences.get(0) :
null;
}
代码示例来源:origin: de.tudarmstadt.ukp.dkpro.core/de.tudarmstadt.ukp.dkpro.core.opennlp-asl
@Override
public void init(JCas aJCas)
{
text = aJCas.getDocumentText();
sentences = new ArrayList<>();
for (Sentence sent : select(aJCas, Sentence.class)) {
Span s = new Span(sent.getBegin(), sent.getEnd());
sentences.add(s);
}
}
代码示例来源:origin: de.unidue.ltl.flextag/flextag-core
private List<List<String>> extractTags(JCas jCas)
{
List<List<String>> posTags = new ArrayList<List<String>>();
Collection<Sentence> sentences = JCasUtil.select(jCas, Sentence.class);
for (Sentence s : sentences) {
List<String> tags = new ArrayList<String>();
List<TextClassificationOutcome> tcos = JCasUtil.selectCovered(jCas,
TextClassificationOutcome.class, s.getBegin(), s.getEnd());
for (TextClassificationOutcome tco : tcos) {
tags.add(tco.getOutcome());
}
posTags.add(tags);
}
return posTags;
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat
/**
* Check if the start/end offsets of an annotation belongs to the same sentence.
*
* @return
*/
public static boolean isSameSentence(JCas aJcas, int aStartOffset, int aEndOffset)
{
for (Sentence sentence : select(aJcas, Sentence.class)) {
if ((sentence.getBegin() <= aStartOffset && sentence.getEnd() > aStartOffset)
&& aEndOffset <= sentence.getEnd()) {
return true;
}
}
return false;
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat
private static int getLastSentenceAddress(BratAnnotatorModel aBratAnnotatorModel, JCas jCas,
JCas userJCas)
{
Sentence sentence = selectByAddr(userJCas, Sentence.class,
aBratAnnotatorModel.getLastSentenceAddress());
List<Sentence> sentences = JCasUtil.selectCovered(jCas, Sentence.class,
sentence.getBegin(), sentence.getEnd());
return sentences.get(0).getAddress();
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/webanno-api-annotation
default void moveToFirstPage(JCas aJCas)
{
int firstSentenceAddress = WebAnnoCasUtil.getFirstSentenceAddress(aJCas);
if (firstSentenceAddress == getFirstVisibleUnitAddress()) {
throw new IllegalStateException("This is first page!");
}
Sentence sentence = selectByAddr(aJCas, Sentence.class, firstSentenceAddress);
setFirstVisibleUnit(sentence);
setFocusUnitIndex(WebAnnoCasUtil.getSentenceNumber(aJCas, sentence.getBegin()));
}
代码示例来源:origin: webanno/webanno
default void moveToFirstPage(JCas aJCas)
{
int firstSentenceAddress = WebAnnoCasUtil.getFirstSentenceAddress(aJCas);
if (firstSentenceAddress == getFirstVisibleUnitAddress()) {
throw new IllegalStateException("This is first page!");
}
Sentence sentence = selectByAddr(aJCas, Sentence.class, firstSentenceAddress);
setFirstVisibleUnit(sentence);
setFocusUnitIndex(WebAnnoCasUtil.getSentenceNumber(aJCas, sentence.getBegin()));
}
代码示例来源:origin: webanno/webanno
private void updateSentenceNumber(JCas aJCas, int aAddress)
{
AnnotatorState state = getModelObject();
Sentence sentence = selectByAddr(aJCas, Sentence.class, aAddress);
state.setFirstVisibleUnit(sentence);
state.setFocusUnitIndex(WebAnnoCasUtil.getSentenceNumber(aJCas, sentence.getBegin()));
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/webanno-ui-curation
private void updateSentenceNumber(JCas aJCas, int aAddress)
{
AnnotatorState state = getModelObject();
Sentence sentence = selectByAddr(aJCas, Sentence.class, aAddress);
state.setFirstVisibleUnit(sentence);
state.setFocusUnitIndex(WebAnnoCasUtil.getSentenceNumber(aJCas, sentence.getBegin()));
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/webanno-api-annotation
default void moveToLastPage(JCas aJCas)
{
int lastDisplayWindowBeginingSentenceAddress = WebAnnoCasUtil
.getLastDisplayWindowFirstSentenceAddress(aJCas, getPreferences().getWindowSize());
if (lastDisplayWindowBeginingSentenceAddress == getFirstVisibleUnitAddress()) {
throw new IllegalStateException("This is last page!");
}
Sentence sentence = selectByAddr(aJCas, Sentence.class,
lastDisplayWindowBeginingSentenceAddress);
setFirstVisibleUnit(sentence);
setFocusUnitIndex(WebAnnoCasUtil.getSentenceNumber(aJCas, sentence.getBegin()));
}
代码示例来源:origin: webanno/webanno
default void moveToLastPage(JCas aJCas)
{
int lastDisplayWindowBeginingSentenceAddress = WebAnnoCasUtil
.getLastDisplayWindowFirstSentenceAddress(aJCas, getPreferences().getWindowSize());
if (lastDisplayWindowBeginingSentenceAddress == getFirstVisibleUnitAddress()) {
throw new IllegalStateException("This is last page!");
}
Sentence sentence = selectByAddr(aJCas, Sentence.class,
lastDisplayWindowBeginingSentenceAddress);
setFirstVisibleUnit(sentence);
setFocusUnitIndex(WebAnnoCasUtil.getSentenceNumber(aJCas, sentence.getBegin()));
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat
/**
* Get the sentence address for jCas from userJCas.
*/
private static int getSentenceAddress(BratAnnotatorModel aBratAnnotatorModel, JCas jCas,
JCas userJCas)
{
int sentenceAddress = BratAjaxCasUtil.selectSentenceAt(userJCas,
aBratAnnotatorModel.getSentenceBeginOffset(),
aBratAnnotatorModel.getSentenceEndOffset()).getAddress();
Sentence sentence = selectByAddr(userJCas, Sentence.class, sentenceAddress);
List<Sentence> sentences = JCasUtil.selectCovered(jCas, Sentence.class,
sentence.getBegin(), sentence.getEnd());
return sentences.get(0).getAddress();
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/webanno-api-annotation
default void moveToNextPage(JCas aJCas)
{
int nextSentenceAddress = WebAnnoCasUtil.getNextPageFirstSentenceAddress(aJCas,
getFirstVisibleUnitAddress(), getPreferences().getWindowSize());
if (getFirstVisibleUnitAddress() == nextSentenceAddress) {
throw new IllegalStateException("This is last page!");
}
Sentence sentence = selectByAddr(aJCas, Sentence.class, nextSentenceAddress);
setFirstVisibleUnit(sentence);
setFocusUnitIndex(WebAnnoCasUtil.getSentenceNumber(aJCas, sentence.getBegin()));
}
代码示例来源:origin: webanno/webanno
default void moveToNextPage(JCas aJCas)
{
int nextSentenceAddress = WebAnnoCasUtil.getNextPageFirstSentenceAddress(aJCas,
getFirstVisibleUnitAddress(), getPreferences().getWindowSize());
if (getFirstVisibleUnitAddress() == nextSentenceAddress) {
throw new IllegalStateException("This is last page!");
}
Sentence sentence = selectByAddr(aJCas, Sentence.class, nextSentenceAddress);
setFirstVisibleUnit(sentence);
setFocusUnitIndex(WebAnnoCasUtil.getSentenceNumber(aJCas, sentence.getBegin()));
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat
private void updateSentenceAddressAndOffsets(JCas jCas, int start)
{
int address = BratAjaxCasUtil.selectSentenceAt(jCas,
bratAnnotatorModel.getSentenceBeginOffset(),
bratAnnotatorModel.getSentenceEndOffset()).getAddress();
bratAnnotatorModel.setSentenceAddress(BratAjaxCasUtil.getSentenceBeginAddress(jCas,
address, start, bratAnnotatorModel.getProject(), bratAnnotatorModel.getDocument(),
bratAnnotatorModel.getWindowSize()));
Sentence sentence = selectByAddr(jCas, Sentence.class,
bratAnnotatorModel.getSentenceAddress());
bratAnnotatorModel.setSentenceBeginOffset(sentence.getBegin());
bratAnnotatorModel.setSentenceEndOffset(sentence.getEnd());
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat
private void updateSentenceAddressAndOffsets(JCas jCas, int start)
{
int address = BratAjaxCasUtil.selectSentenceAt(jCas,
bratAnnotatorModel.getSentenceBeginOffset(),
bratAnnotatorModel.getSentenceEndOffset()).getAddress();
bratAnnotatorModel.setSentenceAddress(BratAjaxCasUtil.getSentenceBeginAddress(jCas,
address, start, bratAnnotatorModel.getProject(), bratAnnotatorModel.getDocument(),
bratAnnotatorModel.getWindowSize()));
Sentence sentence = selectByAddr(jCas, Sentence.class,
bratAnnotatorModel.getSentenceAddress());
bratAnnotatorModel.setSentenceBeginOffset(sentence.getBegin());
bratAnnotatorModel.setSentenceEndOffset(sentence.getEnd());
}
内容来源于网络,如有侵权,请联系作者删除!