Package edu.washington.cs.knowitall.extractor.mapper

Source Code of edu.washington.cs.knowitall.extractor.mapper.AdjacentToRelationFilter

package edu.washington.cs.knowitall.extractor.mapper;

import edu.washington.cs.knowitall.commonlib.Range;
import edu.washington.cs.knowitall.nlp.extraction.ChunkedArgumentExtraction;
import edu.washington.cs.knowitall.nlp.extraction.ChunkedExtraction;

/**
* A filter that returns only arguments that are adjacent to the relation.
* @author afader
*
*/
public class AdjacentToRelationFilter extends FilterMapper<ChunkedArgumentExtraction> {

    /**
     * Returns <code>true</code> if the given argument is adjacent to its relation.
     */
    public boolean doFilter(ChunkedArgumentExtraction arg) {
        ChunkedExtraction rel = arg.getRelation();
        Range argRange = arg.getRange();
        Range relRange = rel.getRange();
        return argRange.isAdjacentTo(relRange);
    }

}
TOP

Related Classes of edu.washington.cs.knowitall.extractor.mapper.AdjacentToRelationFilter

TOP
Copyright © 2018 www.massapi.com. 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.