Package edu.washington.cs.knowitall.nlp.extraction

Examples of edu.washington.cs.knowitall.nlp.extraction.ChunkedArgumentExtraction


        ChunkedSentence sent = rel.getSentence();
        Collection<Range> npChunkRanges = removeRangeOverlapWithRelation(rel, sent.getNpChunkRanges());
        Collection<ChunkedArgumentExtraction> args = new ArrayList<ChunkedArgumentExtraction>();
        for (Range npChunkRange : npChunkRanges) {
            if (acceptRange(rel, npChunkRange)) {
                ChunkedArgumentExtraction arg = new ChunkedArgumentExtraction(sent, npChunkRange, rel);
                args.add(arg);
            }
        }
        return args;
    }
View Full Code Here


        return new Predicate<ChunkedBinaryExtraction>() {
            @Override
            public boolean apply(ChunkedBinaryExtraction arg0) {

                ChunkedSentence sentence = arg0.getSentence();
                ChunkedArgumentExtraction arg2 = arg0.getArgument2();

                for (int i = arg2.getStart() + arg2.getLength(); i < sentence
                        .getLength(); ++i) {

                    if (sentence.getToken(i).equalsIgnoreCase("that")) {
                        return true;
                    }
View Full Code Here

     */
    public static ExtractionFeature rightBeforeArg1(Collection<String> tokens) {
        return new TokenFeature(tokens) {
            @Override
            protected Range rangeToExamine(ChunkedBinaryExtraction cbe) {
                ChunkedArgumentExtraction arg1 = cbe.getArgument1();
                int index = arg1.getStart() - 1;
                if (index < 0 || index > arg1.getSentence().getLength()) {
                    return Range.EMPTY;
                } else
                    return Range.fromInterval(index, index + 1);
            }
        };
View Full Code Here

        return new Predicate<ChunkedBinaryExtraction>() {
            @Override
            public boolean apply(ChunkedBinaryExtraction arg0) {

                ChunkedSentence sentence = arg0.getSentence();
                ChunkedArgumentExtraction arg2 = arg0.getArgument2();

                int i = arg2.getStart() + arg2.getLength();
                if (i < sentence.getLength()) {
                    String token = sentence.getToken(i);
                    if (!token.isEmpty() && !period.matcher(token).matches()
                            && punct.matcher(token).matches()) {
View Full Code Here

     */
    public static ExtractionFeature rightAfterArg2(String... tokens) {
        return new TokenFeature(tokens) {
            @Override
            protected Range rangeToExamine(ChunkedBinaryExtraction cbe) {
                ChunkedArgumentExtraction arg2 = cbe.getArgument2();
                int index = arg2.getStart() + arg2.getLength();
                if (index < 0 || index >= arg2.getSentence().getLength()) {
                    return Range.EMPTY;
                } else
                    return Range.fromInterval(index, index + 1);
            }
        };
View Full Code Here

        int len = sent.getLength();
        return a <= len && len < b;
    }

    private boolean npAfterArg2(ChunkedBinaryExtraction e) {
        ChunkedArgumentExtraction arg2 = e.getArgument2();
        int lastArg2 = arg2.getRange().getLastIndex();
        ChunkedSentence sent = arg2.getSentence();
        return lastArg2 + 1 < sent.getLength()
                && sent.getChunkTags().get(lastArg2 + 1).equals("B-NP");
    }
View Full Code Here

        return new Predicate<ChunkedBinaryExtraction>() {
            @Override
            public boolean apply(ChunkedBinaryExtraction arg0) {

                ChunkedSentence sentence = arg0.getSentence();
                ChunkedArgumentExtraction arg1 = arg0.getArgument1();

                int i = arg1.getStart() - 1;
                if (i >= 0 && sentence.getLength() > 0) {
                    String token = sentence.getToken(i);
                    for (String givenTok : givenTokens) {
                        if (token.equals(givenTok)) {
                            return true;
View Full Code Here

     */
    public static ExtractionFeature anywhereBeforeArg1(Collection<String> tokens) {
        return new TokenFeature(tokens) {
            @Override
            protected Range rangeToExamine(ChunkedBinaryExtraction cbe) {
                ChunkedArgumentExtraction arg1 = cbe.getArgument1();
                int index = arg1.getStart() - 1;
                if (index < 0 || index >= arg1.getSentence().getLength()) {
                    return Range.EMPTY;
                } else
                    return Range.fromInterval(0, index + 1);
            }
        };
View Full Code Here

        return lastArg2 + 1 < sent.getLength()
                && sent.getChunkTags().get(lastArg2 + 1).equals("B-NP");
    }

    private boolean verbAfterArg2(ChunkedBinaryExtraction e) {
        ChunkedArgumentExtraction arg2 = e.getArgument2();
        int pastArg2 = arg2.getStart() + arg2.getLength();
        if (pastArg2 < e.getSentence().getLength()) {
            String pastPosTag = e.getSentence().getPosTags().get(pastArg2);
            if (pastPosTag.equals("MD") || pastPosTag.startsWith("V")) {
                return true;
            }
View Full Code Here

     */
    public static ExtractionFeature anywhereAfterArg2(Collection<String> tokens) {
        return new TokenFeature(tokens) {
            @Override
            protected Range rangeToExamine(ChunkedBinaryExtraction cbe) {
                ChunkedArgumentExtraction arg2 = cbe.getArgument2();
                int index = arg2.getStart() + arg2.getLength();
                if (index < 0 || index >= arg2.getSentence().getLength()) {
                    return Range.EMPTY;
                } else
                    return Range.fromInterval(index, cbe.getSentence()
                            .getLength());
            }
View Full Code Here

TOP

Related Classes of edu.washington.cs.knowitall.nlp.extraction.ChunkedArgumentExtraction

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.