|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.googlecode.whatswrong.EdgeTokenFilter
public class EdgeTokenFilter
An EdgeTokenFilter filters out edges based on the properties of their tokens. For example, we can filter out all edges that do not contain at least one token with the word "blah". The filter can also be configured to filter out all edges which are not on a path between tokens with certain properties. For example, we can filter out all edges that are not on the paths between a token with word "blah" and a token with word "blub".
This filter can also filter out the tokens for which all edges have been filtered out via the edge filtering process. This mode is called "collapsing" because the graph is collapsed to contain only connected components.
Note that if no allowed property values are defined (addAllowedProperty(String)
)
then the filter does nothing and keeps all edges.
Constructor Summary | |
---|---|
EdgeTokenFilter(java.util.Set<java.lang.String> allowedPropertyValues)
Creates a new filter with the given allowed property values. |
|
EdgeTokenFilter(java.lang.String... allowedProperties)
Creates a new filter with the given allowed property values. |
Method Summary | |
---|---|
void |
addAllowedProperty(java.lang.String propertyValue)
Adds an allowed property value. |
boolean |
allows(java.lang.String propertyValue)
Returns whether the given value is an allowed property value. |
void |
clear()
Removes all allowed words. |
NLPInstance |
filter(NLPInstance original)
First filters out edges and then filters out tokens without edges if isCollaps() is true. |
java.util.Collection<Edge> |
filterEdges(java.util.Collection<Edge> original)
Filters out all edges that do not have at least one token with an allowed property value. |
boolean |
isCollaps()
If active this property will cause the filter to filter out all tokens for which all edges where filtered out in the edge filtering step. |
boolean |
isUsePaths()
Usually the filter allows all edges that have tokens with allowed properties. |
boolean |
isWholeWords()
If true at least one edge tokens must contain at least one property value that matches one of the allowed properties. |
void |
removeAllowedProperty(java.lang.String propertyValue)
Remove an allowed property value. |
void |
setCollaps(boolean collaps)
If active this property will cause the filter to filter out all tokens for which all edges where filtered out in the edge filtering step. |
void |
setUsePaths(boolean usePaths)
Sets whether the filter uses paths. |
void |
setWholeWords(boolean wholeWords)
Sets whether the filter should check for whole word matches of properties. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EdgeTokenFilter(java.lang.String... allowedProperties)
allowedProperties
- A var array of allowed property values. An Edge will be filtered out if none of its tokens
has a property with an allowed property value (or a property value that contains an
allowed value, if isWholeWords()
is
false).public EdgeTokenFilter(java.util.Set<java.lang.String> allowedPropertyValues)
allowedPropertyValues
- A set of allowed property values. An Edge will be filtered out if none of its tokens
has a property with an allowed property value (or a property value that contains an
allowed value, if isWholeWords()
is
false).Method Detail |
---|
public boolean isCollaps()
public void setCollaps(boolean collaps)
collaps
- true if the filter should collapse the graph and remove tokens without edge.public boolean isUsePaths()
public void setUsePaths(boolean usePaths)
usePaths
- should the filter use paths.isUsePaths()
public void addAllowedProperty(java.lang.String propertyValue)
isWholeWords()
.
propertyValue
- the property value to allow.public void removeAllowedProperty(java.lang.String propertyValue)
propertyValue
- the property value to remove from the set of allowed property values.public void clear()
public boolean isWholeWords()
public void setWholeWords(boolean wholeWords)
wholeWords
- true iff the filter should check for whold words.isWholeWords()
public java.util.Collection<Edge> filterEdges(java.util.Collection<Edge> original)
original
- the input set of edges.
public boolean allows(java.lang.String propertyValue)
propertyValue
- the value to test.
public NLPInstance filter(NLPInstance original)
isCollaps()
is true.
filter
in interface NLPInstanceFilter
original
- the original nlp instance.
NLPInstanceFilter.filter(NLPInstance)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |