本文整理了Java中de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Sentence.getAddress()
方法的一些代码示例,展示了Sentence.getAddress()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Sentence.getAddress()
方法的具体详情如下:
包路径:de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Sentence
类名称:Sentence
方法名:getAddress
暂无
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat
public static int getLastSentenceAddress(JCas aJcas)
{
int lastSentenceAddress = -1;
for (Sentence selectedSentence : select(aJcas, Sentence.class)) {
lastSentenceAddress = selectedSentence.getAddress();
}
return lastSentenceAddress;
}
/**
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat
/**
* Get the ordinal sentence number in the display window. This will be sent to brat so that it
* will adjust the sentence number to display accordingly
*
*/
public static int getFirstSentenceNumber(JCas aJcas, int aSentenceAddress)
{
int sentenceNumber = 0;
for (Sentence sentence : select(aJcas, Sentence.class)) {
if (sentence.getAddress() == aSentenceAddress) {
break;
}
sentenceNumber++;
}
return sentenceNumber;
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat
/**
* Get the internal address of the first sentence annotation from JCAS. This will be used as a
* reference for moving forward/backward sentences positions
*
* @param aJcas
* The CAS object assumed to contains some sentence annotations
* @return the sentence number or -1 if aJcas don't have sentence annotation
*/
public static int getFirstSentenceAddress(JCas aJcas)
{
int firstSentenceAddress = -1;
for (Sentence selectedSentence : select(aJcas, Sentence.class)) {
firstSentenceAddress = selectedSentence.getAddress();
break;
}
return firstSentenceAddress;
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat
/**
* Get Sentence address for this ordinal sentence number. Used to go to specific sentence number
*/
public static int getSentenceAddress(JCas aJcas, int aSentenceNumber)
{
int i = 1;
int address = 0;
if (aSentenceNumber <1){
return 0;
}
for (Sentence sentence : select(aJcas, Sentence.class)) {
if (i == aSentenceNumber) {
address = sentence.getAddress();
break;
}
address = sentence.getAddress();
i++;
}
if (aSentenceNumber > i) {
return 0;
}
return address;
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat
/**
* Returns the beginning address of all pages. This is used properly display<b> Page X of Y </b>
*/
public static List<Integer> getDisplayWindowBeginningSentenceAddresses(JCas aJcas,
int aWindowSize)
{
List<Integer> beginningAddresses = new ArrayList<Integer>();
int j = 0;
for (Sentence sentence : select(aJcas, Sentence.class)) {
if (j % aWindowSize == 0) {
beginningAddresses.add(sentence.getAddress());
}
j++;
}
return beginningAddresses;
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/webanno-tsv
private void setTokenSentenceAddress(JCas aJCas, Map<Integer, Integer> aTokenListInSentence)
{
for (Sentence sentence : select(aJCas, Sentence.class)) {
for (Token token : selectCovered(Token.class, sentence)) {
aTokenListInSentence.put(token.getAddress(), sentence.getAddress());
}
}
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.tsv
private void setTokenSentenceAddress(JCas aJCas, Map<Integer, Integer> aTokenListInSentence)
{
for (Sentence sentence : select(aJCas, Sentence.class)) {
for (Token token : selectCovered(Token.class, sentence)) {
aTokenListInSentence.put(token.getAddress(), sentence.getAddress());
}
}
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat
/**
* Get the sentence address of the next sentence
*
* @param aJcas
* The CAS object
* @param aRef
* The address of the current sentence
* @return address of the next sentence
*/
public static int getFollowingSentenceAddress(JCas aJcas, int aRef)
{
Sentence sentence = selectByAddr(aJcas, Sentence.class, aRef);
List<Sentence> followingSentence = selectFollowing(aJcas, Sentence.class, sentence, 1);
if (followingSentence.size() > 0) {
return followingSentence.get(0).getAddress();
}
else {
return aRef;
}
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat
i = precedingSentences.get(0).getAddress();
return precedingSentences.get(0).getAddress();
return precedingSentences.get(0).getAddress();
return sentence.getAddress();
代码示例来源: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/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/de.tudarmstadt.ukp.clarin.webanno.brat
Sentence.class,
BratAjaxCasUtil.getLastSentenceAddressInDisplayWindow(jCas,
firstSentence.getAddress(), windowSize));
sentenceNumber = BratAjaxCasUtil.getFirstSentenceNumber(jCas, firstSentence.getAddress());
segmentAdress.put(username, new HashMap<Integer, Integer>());
segmentText.put(sentence.getBegin(), sentence.getCoveredText().toString());
segmentNumber.put(sentence.getBegin(), sentenceNumber);
segmentAdress.get(username).put(sentence.getBegin(), sentence.getAddress());
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat
for (Sentence sentence : selectCovered(mergeJCas, Sentence.class, begin, end)) {
segmentAdress.get(CurationPanel.CURATION_USER).put(sentence.getBegin(),
sentence.getAddress());
代码示例来源: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());
}
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat
firstSentence.getAddress(), aBratAnnotatorModel.getWindowSize());
firstSentence.getAddress());
aResponse.setSentenceNumberOffset(sentenceNumber);
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat
aJCas,
Sentence.class,
BratAjaxCasUtil.getLastSentenceAddressInDisplayWindow(aJCas, sentence.getAddress(),
aBratAnnotatorModel.getWindowSize())).getEnd();
if (crossMultipleSentence
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat
firstSentence.getAddress(), aBratAnnotatorModel.getWindowSize());
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat
firstSentence.getAddress(), aBratAnnotatorModel.getWindowSize());
代码示例来源:origin: de.tudarmstadt.ukp.clarin.webanno/de.tudarmstadt.ukp.clarin.webanno.brat
int address = BratAjaxCasUtil.selectSentenceAt(clickedJCas,
aBratAnnotatorModel.getSentenceBeginOffset(),
aBratAnnotatorModel.getSentenceEndOffset()).getAddress();
aBratAnnotatorModel.setSentenceAddress(BratAjaxCasUtil
.getSentenceBeginAddress(clickedJCas, address,
内容来源于网络,如有侵权,请联系作者删除!