Package edu.washington.cs.knowitall.commonlib

Examples of edu.washington.cs.knowitall.commonlib.Range


            leftbound = 0;
            rightbound = 0;
        }

        // create arg2
        Range newrange = new Range(leftbound, rightbound - leftbound);
        if (rightbound == 0) {
            return null;
        }
        ChunkedArgumentExtraction argument2 = new ChunkedArgumentExtraction(
                predicate.getSentence(), newrange, predicate, conf);
View Full Code Here


    public static PosFeature relSingleVerb() {
        return new PosFeature(PosFeature.allVerbPosTags) {
            @Override
            protected Range rangeToExamine(ChunkedBinaryExtraction cbe) {

                Range range = cbe.getRelation().getRange();
                if (range.getLength() == 1)
                    return range;
                else
                    return Range.EMPTY;
            }
        };
View Full Code Here

                ChunkedArgumentExtraction arg2 = extr.getArgument2();
                ChunkedSentence sentence = arg2.getSentence();
                List<Match<ChunkedSentenceToken>> matchList = listPattern2
                        .findAll(ChunkedSentenceToken.tokenize(sentence));
                for (Match<ChunkedSentenceToken> match : matchList) {
                    Range matchRange = new Range(match.startIndex(),
                            match.endIndex() - match.startIndex());
                    if (matchRange.overlapsWith(arg2.getRange())) {
                        return true;
                    }
                }
                matchList = listPattern1.findAll(ChunkedSentenceToken
                        .tokenize(sentence));
                for (Match<ChunkedSentenceToken> match : matchList) {
                    Range matchRange = new Range(match.startIndex(),
                            match.endIndex() - match.startIndex());
                    if (matchRange.overlapsWith(arg2.getRange())) {
                        return true;
                    }
                }
                return false;
            }
View Full Code Here

        return new Predicate<ChunkedBinaryExtraction>() {
            public boolean apply(ChunkedBinaryExtraction e) {
                ChunkedSentence sent = e.getSentence();
                List<String> tokens = sent.getTokens();

                Range x = e.getArgument1().getRange();
                Range y = e.getArgument2().getRange();
                Range r = e.getRelation().getRange();
                boolean adj = x.isAdjacentTo(r) && r.isAdjacentTo(y);

                int xs = x.getStart();
                boolean leftOk = xs == 0 || tokens.get(xs - 1).equals(",")
                        || tokens.get(xs - 1).equals(".");
View Full Code Here

        for (int i = 0; i < length; i++) {
            if (inChunk) {
                if (isChunkInTag(tags[i], name)) {
                    chunkLength++;
                } else {
                    Range r = new Range(start, chunkLength);
                    chunkRanges.add(r);
                    inChunk = false;
                    chunkLength = 0;
                }
            }
            if (isChunkBeginTag(tags[i], name)) {
                inChunk = true;
                start = i;
                chunkLength = 1;
            }
        }

        if (inChunk) {
            Range r = new Range(start, chunkLength);
            chunkRanges.add(r);
        }

        return chunkRanges;
    }
View Full Code Here

        for (int i = 0; i < tags.size(); i++) {

            String tag = tags.get(i);
            if (inType != null && (!tag.equals("I-" + inType))) {

                Range r = new Range(startIndex, length);
                results.put(inType, r);

                inType = null;
                startIndex = -1;
                length = 0;

            }

            if (tag.startsWith("B-")) {

                inType = getType(tag);
                startIndex = i;
                length = 1;

            } else if (tag.startsWith("I-") && inType != null
                    && tag.equals("I-" + inType)) {

                length++;

            }
        }

        if (inType != null) {
            Range r = new Range(startIndex, length);
            results.put(inType, r);
        }

        return results;
    }
View Full Code Here

TOP

Related Classes of edu.washington.cs.knowitall.commonlib.Range

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.