Tabnine Logo
SpanAnchoringModeBehavior
Code IndexAdd Tabnine to your IDE (free)

How to use
SpanAnchoringModeBehavior
in
de.tudarmstadt.ukp.clarin.webanno.api.annotation.adapter

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

origin: webanno/webanno

int[] adjustedRange = SpanAnchoringModeBehavior.adjust(aJCas,
    layer.getAnchoringMode(), new int[] { selection.getBegin(),
        selection.getEnd() });
origin: webanno/webanno

new SpanAnchoringModeBehavior());
origin: webanno/webanno

@Before
public void setup() throws Exception
{
  if (jcas == null) {
    jcas = JCasFactory.createJCas();
  }
  else {
    jcas.reset();
  }
  
  username = "user";
  
  project = new Project();
  project.setId(1l);
  project.setMode(PROJECT_TYPE_ANNOTATION);
  
  document = new SourceDocument();
  document.setId(1l);
  document.setProject(project);
  
  neLayer = new AnnotationLayer(NamedEntity.class.getName(), "NE", SPAN_TYPE, project, true,
      TOKENS);
  neLayer.setId(1l);
  featureSupportRegistry = new FeatureSupportRegistryImpl(asList());
  
  behaviors = asList(new SpanStackingBehavior(), new SpanCrossSentenceBehavior(),
      new SpanAnchoringModeBehavior());
}

origin: de.tudarmstadt.ukp.clarin.webanno/webanno-api-annotation

@Override
public CreateSpanAnnotationRequest onCreate(TypeAdapter aAdapter,
    CreateSpanAnnotationRequest aRequest)
  throws AnnotationException
{
  if (aRequest.getBegin() == aRequest.getEnd()) {
    if (!aAdapter.getLayer().getAnchoringMode().isZeroSpanAllowed()) {
      throw new AnnotationException(
          "Cannot create zero-width annotation on layers that lock to token boundaries.");
    }
    return aRequest;
  }
  
  int[] originalRange = new int[] { aRequest.getBegin(), aRequest.getEnd() };
  int[] adjustedRange = adjust(aRequest.getJcas(), aAdapter.getLayer().getAnchoringMode(),
      originalRange);
  
  if (adjustedRange.equals(originalRange)) {
    return aRequest;
  }
  else {
    return aRequest.changeSpan(adjustedRange[0], adjustedRange[1]);
  }
}

origin: webanno/webanno

@Override
public CreateSpanAnnotationRequest onCreate(TypeAdapter aAdapter,
    CreateSpanAnnotationRequest aRequest)
  throws AnnotationException
{
  if (aRequest.getBegin() == aRequest.getEnd()) {
    if (!aAdapter.getLayer().getAnchoringMode().isZeroSpanAllowed()) {
      throw new AnnotationException(
          "Cannot create zero-width annotation on layers that lock to token boundaries.");
    }
    return aRequest;
  }
  
  int[] originalRange = new int[] { aRequest.getBegin(), aRequest.getEnd() };
  int[] adjustedRange = adjust(aRequest.getJcas(), aAdapter.getLayer().getAnchoringMode(),
      originalRange);
  
  if (adjustedRange.equals(originalRange)) {
    return aRequest;
  }
  else {
    return aRequest.changeSpan(adjustedRange[0], adjustedRange[1]);
  }
}

de.tudarmstadt.ukp.clarin.webanno.api.annotation.adapterSpanAnchoringModeBehavior

Most used methods

  • adjust
  • <init>

Popular in Java

  • Making http post requests using okhttp
  • getApplicationContext (Context)
  • getExternalFilesDir (Context)
  • requestLocationUpdates (LocationManager)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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