congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
ChainAdapter.addSpan
Code IndexAdd Tabnine to your IDE (free)

How to use
addSpan
method
in
de.tudarmstadt.ukp.clarin.webanno.api.annotation.adapter.ChainAdapter

Best Java code snippets using de.tudarmstadt.ukp.clarin.webanno.api.annotation.adapter.ChainAdapter.addSpan (Showing top 4 results out of 315)

origin: webanno/webanno

@Test
public void thatSpanStackingBehaviorOnCreateThrowsException() throws AnnotationException
{
  TokenBuilder<Token, Sentence> builder = new TokenBuilder<>(Token.class, Sentence.class);
  builder.buildTokens(jcas, "This is a test .");
  ChainAdapter sut = new ChainAdapter(featureSupportRegistry, null, corefLayer, asList(),
      behaviors);
  // First time should work
  sut.addSpan(document, username, jcas, 0, 1);
  
  // Second time not
  assertThatExceptionOfType(AnnotationException.class)
      .isThrownBy(() -> sut.addSpan(document, username, jcas, 0, 1))
      .withMessageContaining("stacking is not enabled");
}

origin: webanno/webanno

  @Test
  public void thatSpanAnchoringAndStackingBehaviorsWorkInConcert() throws AnnotationException
  {
    TokenBuilder<Token, Sentence> builder = new TokenBuilder<>(Token.class, Sentence.class);
    builder.buildTokens(jcas, "This is a test .");

    ChainAdapter sut = new ChainAdapter(featureSupportRegistry, null, corefLayer, asList(),
        behaviors);

    // First time should work - we annotate the whole word "This"
    sut.addSpan(document, username, jcas, 0, 4);
    
    // Second time not - here we annotate "T" but it should be expanded to "This"
    assertThatExceptionOfType(AnnotationException.class)
        .isThrownBy(() -> sut.addSpan(document, username, jcas, 0, 1))
        .withMessageContaining("stacking is not enabled");
  }
}
origin: webanno/webanno

private void createNewChainElement(AjaxRequestTarget aTarget, ChainAdapter aAdapter, JCas aJCas)
  throws AnnotationException
{
  AnnotatorState state = getModelObject();
  Selection selection = state.getSelection();
  AnnotationFS annoFs = aAdapter.addSpan(state.getDocument(), state.getUser().getUsername(),
      aJCas, selection.getBegin(), selection.getEnd());
  selection.selectSpan(new VID(annoFs), aJCas, annoFs.getBegin(), annoFs.getEnd());
}
origin: webanno/webanno

@Test
public void thatSpanCrossSentenceBehaviorOnCreateThrowsException()
{
  corefLayer.setCrossSentence(false);
  
  TokenBuilder<Token, Sentence> builder = new TokenBuilder<>(Token.class, Sentence.class);
  builder.buildTokens(jcas, "This is a test .\nThis is sentence two .");
  ChainAdapter sut = new ChainAdapter(featureSupportRegistry, null, corefLayer, asList(),
      behaviors);
  assertThatExceptionOfType(MultipleSentenceCoveredException.class)
      .isThrownBy(() -> sut.addSpan(document, username, jcas, 0, 
          jcas.getDocumentText().length()))
      .withMessageContaining("covers multiple sentences");
}
de.tudarmstadt.ukp.clarin.webanno.api.annotation.adapterChainAdapteraddSpan

Popular methods of ChainAdapter

  • <init>
  • addArc
  • collectLinks
  • createChainElementAnnotation
  • deleteArc
  • deleteSpan
  • getAnnotationTypeName
  • getChainFirstFeatureName
  • getChainForLink
    Find the chain head for the given link.
  • getChainTypeName
  • getFirstLink
    Get the first link of a chain from the chain head feature structure.
  • getLayer
  • getFirstLink,
  • getLayer,
  • getLinkNextFeatureName,
  • getNextLink,
  • getPrevLink,
  • handle,
  • isLinkedListBehavior,
  • newChain,
  • newLink

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSupportFragmentManager (FragmentActivity)
  • runOnUiThread (Activity)
  • requestLocationUpdates (LocationManager)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now