edu.stanford.nlp.util
Class ArrayStringFilter

java.lang.Object
  extended by edu.stanford.nlp.util.ArrayStringFilter
All Implemented Interfaces:
Filter<java.lang.String>, java.io.Serializable

public class ArrayStringFilter
extends java.lang.Object
implements Filter<java.lang.String>

Filters Strings based on whether they exactly match any string in the array it is initially onstructed with. Saves some time over using regexes if the array of strings is small enough. No specific experiments exist for how long the array can be before performance is worse than a regex, but the English dependencies code was helped by replacing disjunction regexes of 6 words or fewer with this.

Author:
John Bauer
See Also:
Serialized Form

Constructor Summary
ArrayStringFilter(java.lang.String... words)
           
 
Method Summary
 boolean accept(java.lang.String input)
          Checks if the given object passes the filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayStringFilter

public ArrayStringFilter(java.lang.String... words)
Method Detail

accept

public boolean accept(java.lang.String input)
Description copied from interface: Filter
Checks if the given object passes the filter.

Specified by:
accept in interface Filter<java.lang.String>
Parameters:
input - an object to test
Returns:
Whether the object should be accepted (for some processing)


Stanford NLP Group