当前位置: 首页>>代码示例>>Java>>正文


Java Spans.start方法代码示例

本文整理汇总了Java中org.apache.lucene.search.spans.Spans.start方法的典型用法代码示例。如果您正苦于以下问题:Java Spans.start方法的具体用法?Java Spans.start怎么用?Java Spans.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.lucene.search.spans.Spans的用法示例。


在下文中一共展示了Spans.start方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CandidateSpan

import org.apache.lucene.search.spans.Spans; //导入方法依赖的package包/类
/**
 * Constructs a CandidateSpan for the given Span.
 * 
 * @param span
 *            a Span
 * @throws IOException
 */
public CandidateSpan (Spans span) throws IOException {
    this.doc = span.doc();
    this.start = span.start();
    this.end = span.end();
    this.cost = span.cost();

    this.payloads = new ArrayList<>();
    if (span.isPayloadAvailable()) {
        setPayloads(span.getPayload());
    }
    if (span instanceof SimpleSpans) {
        SimpleSpans temp = (SimpleSpans) span;
        this.spanId = temp.getSpanId();
        this.hasSpanId = temp.hasSpanId;
    }
    else if (span instanceof ClassSpans) {
        this.spanId = ((ClassSpans) span).getNumber();
        this.hasSpanId = true;
    }
}
 
开发者ID:KorAP,项目名称:Krill,代码行数:28,代码来源:CandidateSpan.java

示例2: advanceElementTo

import org.apache.lucene.search.spans.Spans; //导入方法依赖的package包/类
/**
 * Advances the element spans until encountering the given span.
 * 
 * @param span
 *            a span
 * @return <code>true</code> if such an element is found,
 *         <code>false</code>
 *         if the span is not in an element.
 * @throws IOException
 */
private boolean advanceElementTo (Spans span) throws IOException {
    while (hasMoreElements && elements.doc() == currentDocNum
            && elements.start() < span.end()) {

        if (span.start() >= elements.start()
                && span.end() <= elements.end()) {
            return true;
        }
        elementList.add(new CandidateSpan(elements, elementPosition));
        hasMoreElements = elements.next();
        elementPosition++;
    }

    return false; // invalid
}
 
开发者ID:KorAP,项目名称:Krill,代码行数:26,代码来源:UnorderedElementDistanceSpans.java

示例3: advanceNotAttributes

import org.apache.lucene.search.spans.Spans; //导入方法依赖的package包/类
/**
 * Advances the <em>not-attributes</em> to be in the same or
 * greater
 * document number than referentSpans' document number. If a
 * <em>not-attribute</em> is in the same document, it is advanced
 * to be in
 * the same as or greater start position than the current
 * referentSpan.
 * 
 * @throws IOException
 */
private void advanceNotAttributes (Spans referentSpans) throws IOException {

    for (AttributeSpans a : notAttributeList) {
        // advance the doc# of not AttributeSpans
        // logger.info("a "+a.start());
        while (!a.isFinish() && a.doc() <= referentSpans.doc()) {

            if (a.doc() == referentSpans.doc()
                    && a.start() >= referentSpans.start())
                break;

            if (!a.next())
                a.setFinish(true);
        }
    }
}
 
开发者ID:KorAP,项目名称:Krill,代码行数:28,代码来源:SpansWithAttribute.java

示例4: advanceElementTo

import org.apache.lucene.search.spans.Spans; //导入方法依赖的package包/类
/**
 * Tells if the given span is in an element distance unit, or not,
 * by
 * advancing the element distance unit to the span position.
 * 
 * @param span
 *            a span
 * @return <code>true</code> if the element distance unit can be
 *         advanced to
 *         contain the given span, <code>false</code> otherwise.
 * @throws IOException
 */
private boolean advanceElementTo (Spans span) throws IOException {
    while (hasMoreElements && elements.doc() == currentDocNum
            && elements.start() < span.end()) {

        if (span.start() >= elements.start()
                && span.end() <= elements.end()) {
            return true;
        }

        hasMoreElements = elements.next();
        elementPosition++;
    }
    return false;
}
 
开发者ID:KorAP,项目名称:Krill,代码行数:27,代码来源:ElementDistanceExclusionSpans.java

示例5: advanceElementTo

import org.apache.lucene.search.spans.Spans; //导入方法依赖的package包/类
/**
 * Advance elements until encountering a span within the given
 * document.
 * 
 * @return true iff an element containing the span, is found.
 */
private boolean advanceElementTo (Spans span) throws IOException {
    while (hasMoreElements && elements.doc() == candidateListDocNum
            && elements.start() < span.end()) {

        if (span.start() >= elements.start()
                && span.end() <= elements.end()) {
            return true;
        }

        hasMoreElements = elements.next();
        elementPosition++;
    }
    return false;
}
 
开发者ID:KorAP,项目名称:Krill,代码行数:21,代码来源:ElementDistanceSpans.java

示例6: findElementPosition

import org.apache.lucene.search.spans.Spans; //导入方法依赖的package包/类
/**
 * Finds the element position of the specified span in the element
 * list or by advancing the element spans until encountering the
 * span.
 * 
 * @param span
 *            a Span
 * @return the element position
 * @throws IOException
 */
private int findElementPosition (Spans span) throws IOException {
    // Check in the element list
    if (!elementList.isEmpty() && span.end() <= elementList
            .get(elementList.size() - 1).getEnd()) {

        for (CandidateSpan e : elementList)
            if (e.getEnd() >= span.end() && e.getStart() <= span.start()) {
                return e.getPosition();
            }
        return -1; // The span is not in an element.
    }

    return (advanceElementTo(span) ? elementPosition : -1);
}
 
开发者ID:KorAP,项目名称:Krill,代码行数:25,代码来源:UnorderedElementDistanceSpans.java

示例7: isWithinMaxDistance

import org.apache.lucene.search.spans.Spans; //导入方法依赖的package包/类
/**
 * Tells if the target and candidate spans are not too far from
 * each other
 * (within the maximum distance).
 * 
 * @param target
 *            a target span
 * @param candidate
 *            a candidate span
 * @return <code>true</code> if the target and candidate spans are
 *         within
 *         the maximum distance, <code>false</code> otherwise.
 */
protected boolean isWithinMaxDistance (CandidateSpan target,
        Spans candidate) {
    // left candidate
    if (candidate.end() < target.getStart()
            && candidate.end() + maxDistance <= target.getStart()) {
        return false;
    }
    // right candidate
    if (candidate.start() > target.getEnd()
            && target.getEnd() + maxDistance <= candidate.start()) {
        return false;
    }
    return true;
}
 
开发者ID:KorAP,项目名称:Krill,代码行数:28,代码来源:UnorderedTokenDistanceSpans.java

示例8: _constellation

import org.apache.lucene.search.spans.Spans; //导入方法依赖的package包/类
public int _constellation (Spans a, Spans b) {

        // Constellation checks are
        // optimized for lazy loading,
        // i.e. trying to minimize callings of end()

        // A starts after B
        if (a.start() > b.start()) {

            // if (this.vector & next_b(SUCCEEDS_DIRECTLY) > 0)

            // Don't call end() on A
            if (a.start() == b.end())
                return SUCCEEDS_DIRECTLY;

            if (a.start() > b.end())
                return SUCCEEDS;

            // a) Check if match is possible
            // b) Check if mext is possible on A

            // Call end() on A
            else if (a.end() == b.end()) {
                return ALIGNS_RIGHT;
            }

            else if (a.end() < b.end()) {
                return IS_WITHIN;
            };

            // a.end() > b.end() &&
            // a.start() < b.end()
            return OVERLAPS_RIGHT;
        }

        // A starts before B
        else if (a.start() < b.start()) {

            // Don't call end() on b
            if (a.end() == b.start()) {
                return PRECEDES_DIRECTLY;
            }

            else if (a.end() < b.start()) {
                return PRECEDES;
            }

            // Call end() on B
            else if (a.end() == b.end()) {
                return ENDS_WITH;
            }

            else if (a.end() > b.end()) {
                return IS_AROUND;
            };

            // a.end() > b.start()
            return OVERLAPS_LEFT;
        }

        // A and B start at the same position
        // a.start() == b.start()
        else if (a.end() > b.end()) {
            return STARTS_WITH;
        }
        else if (a.end() < b.end()) {
            return ALIGNS_LEFT;
        };

        // a.end() == b.end()
        return MATCHES;
    }
 
开发者ID:KorAP,项目名称:Krill,代码行数:73,代码来源:FrameConstraint.java


注:本文中的org.apache.lucene.search.spans.Spans.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。