org.cleartk.timeml.util
Class TextSliceExtractor

java.lang.Object
  extended by org.cleartk.timeml.util.TextSliceExtractor
All Implemented Interfaces:
org.cleartk.classifier.feature.extractor.simple.SimpleFeatureExtractor

public class TextSliceExtractor
extends Object
implements org.cleartk.classifier.feature.extractor.simple.SimpleFeatureExtractor


Copyright (c) 2010, Regents of the University of Colorado
All rights reserved. Extract a slice of the text covered by the annotation. Handles negative slice indices to make it easy to slice from the end of the string.

Author:
Steven Bethard

Constructor Summary
TextSliceExtractor(int start)
          Create an extractor for a slice of text from a single offset to the end of the string.
TextSliceExtractor(int start, int stop)
          Create an extractor for a given slice of the text.
 
Method Summary
 List<org.cleartk.classifier.Feature> extract(org.apache.uima.jcas.JCas view, org.apache.uima.jcas.tcas.Annotation focusAnnotation)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextSliceExtractor

public TextSliceExtractor(int start,
                          int stop)
Create an extractor for a given slice of the text. E.g. new TextSliceExtractor(1, -1) would extract all of the text but its first and last characters.

Parameters:
start - The first character offset of the slice. If negative, it is assumed to count backwards from the end of the string. If the offset falls before the start of the string, the start of the string will be used instead.
stop - The last character offset of the slice. If negative, it is assumed to count backwards from the end of the string. If the offset falls after the end of the string, the end of the string will be used instead.

TextSliceExtractor

public TextSliceExtractor(int start)
Create an extractor for a slice of text from a single offset to the end of the string. E.g. new TextSliceExtractor(-2) would extract a suffix of length 2 from the text.

Parameters:
start - The first character offset of the slice. If negative, it is assumed to count backwards from the end of the string. If the offset falls before the start of the string, the start of the string will be used instead.
Method Detail

extract

public List<org.cleartk.classifier.Feature> extract(org.apache.uima.jcas.JCas view,
                                                    org.apache.uima.jcas.tcas.Annotation focusAnnotation)
Specified by:
extract in interface org.cleartk.classifier.feature.extractor.simple.SimpleFeatureExtractor


Copyright © 2012. All Rights Reserved.