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#equals(Object)}.
     *//*  ww  w .ja  v a2 s. c o m*/
    public void testEquals() {
        Span a = new Span(100, 1000);
        Span b = new Span(100, 1000);

        Assert.assertEquals(a.equals(b), true);
    }

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

/**
     * Test for {@link Span#toString()}.
     */
    public void testToString() {
        new Span(50, 100).toString();
    }

From source file:util.text.OpenNLP.java

public static Parse parseLine(String text) {
    final Parse p = new Parse(text,
            // a new span covering the entire text
            new Span(0, text.length()),
            // the label for the top if an incomplete node
            AbstractBottomUpParser.INC_NODE,
            // the probability of this parse...uhhh...?
            1,/*w ww . ja v a 2 s . co  m*/
            // the token index of the head of this parse
            0);

    // make sure to initialize the _tokenizer correctly
    final Span[] spans = tokenizer_.tokenizePos(text);

    for (int idx = 0; idx < spans.length; idx++) {
        final Span span = spans[idx];
        // flesh out the parse with individual token sub-parses
        p.insert(new Parse(text, span, AbstractBottomUpParser.TOK_NODE, 0, idx));
    }
    return parser_.parse(p);
}