Example usage for opennlp.tools.util Span Span

List of usage examples for opennlp.tools.util Span Span

Introduction

In this page you can find the example usage for opennlp.tools.util Span Span.

Prototype

public Span(Span span, double prob) 

Source Link

Document

Creates a new immutable span based on an existing span, where the existing span did not include the prob

Usage

From source file:opennlp.tools.util.Span.java

/**
     * Test for {@link Span#contains(Span)}.
     *///  w w  w .  j  a  va  2 s  . c om
    public void testContainsWithHigherIntersect() {
        Span a = new Span(500, 900);
        Span b = new Span(500, 1000);

        Assert.assertEquals(false, a.contains(b));
    }

From source file:opennlp.tools.util.Span.java

/**
     * Test for {@link Span#contains(int)}.
     *//*from   w  w  w.j  av a  2  s.  c  om*/
    public void testContainsInt() {
        Span a = new Span(10, 300);

        Assert.assertFalse(a.contains(9));
        Assert.assertTrue(a.contains(10));
        Assert.assertTrue(a.contains(200));
        Assert.assertTrue(a.contains(300));
        Assert.assertFalse(a.contains(301));
    }

From source file:opennlp.tools.util.Span.java

/**
     * Test for {@link Span#startsWith(Span)}.
     *///from   w  ww  .  j av a  2s .  c om
    public void testStartsWith() {
        Span a = new Span(10, 50);
        Span b = new Span(10, 12);

        Assert.assertTrue(a.startsWith(a));

        Assert.assertTrue(a.startsWith(b));

        Assert.assertFalse(b.startsWith(a));

    }

From source file:opennlp.tools.util.Span.java

/**
     * Test for {@link Span#intersects(Span)}.
     *///from  ww  w .jav  a 2s. c om
    public void testIntersects() {
        Span a = new Span(10, 50);
        Span b = new Span(40, 100);

        Assert.assertTrue(a.intersects(b));
        Assert.assertTrue(b.intersects(a));

        Span c = new Span(10, 20);
        Span d = new Span(40, 50);

        Assert.assertFalse(c.intersects(d));
        Assert.assertFalse(d.intersects(c));

        Assert.assertTrue(b.intersects(d));
    }

From source file:opennlp.tools.util.Span.java

/**
     * Test for {@link Span#crosses(Span)}.
     *//*from   ww w . ja  v a 2  s .co m*/
    public void testCrosses() {
        Span a = new Span(10, 50);
        Span b = new Span(40, 100);

        Assert.assertTrue(a.crosses(b));
        Assert.assertTrue(b.crosses(a));

        Span c = new Span(10, 20);
        Span d = new Span(40, 50);

        Assert.assertFalse(c.crosses(d));
        Assert.assertFalse(d.crosses(c));

        Assert.assertFalse(b.crosses(d));
    }

From source file:opennlp.tools.util.Span.java

/**
     * Test for {@link Span#compareTo(Object)}.
     *///from   w  w  w.  ja v  a  2 s  .c  o  m
    public void testCompareToLower() {
        Span a = new Span(100, 1000);
        Span b = new Span(10, 50);

        Assert.assertEquals(true, a.compareTo(b) > 0);
    }

From source file:opennlp.tools.util.Span.java

/**
     * Test for {@link Span#compareTo(Object)}.
     *///w  w  w  .j ava  2 s.c om
    public void testCompareToHigher() {
        Span a = new Span(100, 200);
        Span b = new Span(300, 400);

        Assert.assertEquals(true, a.compareTo(b) < 0);
    }

From source file:opennlp.tools.util.Span.java

/**
     * Test for {@link Span#compareTo(Object)}.
     *///from www . j  a va2  s  .c  o m
    public void testCompareToEquals() {
        Span a = new Span(30, 1000);
        Span b = new Span(30, 1000);

        Assert.assertEquals(true, a.compareTo(b) == 0);
    }

From source file:opennlp.tools.util.Span.java

/**
     * Test for {@link Span#hashCode()}.
     *///ww w.ja v  a  2 s.c o m
    public void testhHashCode() {
        Assert.assertEquals(new Span(10, 11), new Span(10, 11));
    }

From source file:opennlp.tools.util.Span.java

/**
     * Test for {@link Span#equals(Object)}.
     *///from  w ww.j  a  v a  2s  . co m
    public void testEqualsWithNull() {
        Span a = new Span(0, 0);

        Assert.assertEquals(a.equals(null), false);
    }