"Attribute Filter"
shilaski
New Altair Community Member
Answers
-
Hi Stacy,
you mean, you want to filter two attributes simultaneously? This can be done using regular expressions. E.g. if you want to remove two attributes called att1 and att2, you have to set the corresponding parameter to "att1|att2" meaning you want to remove all attributes whose names match either att1 or att2.
Kinds regards,
Tobias0 -
Tobias,
Do you have an example?
Here is what I have
Number Comment Amount
1 Trailer lights don't work because the connection is loose $75.08
2 Rear lights blink intermittantly $125.73
3 Trailer light stopped working water in the connection $23.34
4 brake light are inop $34.56
5 Dome light doesn't work $87.23
When I pull the data in from an Excel spreadsheet the data will have 3 attributes.....Number Comment and Amount. I used the attribute filter to just get the comments so I could create word vectors from the comments. Now I would like to also pull the amount with the comment. Maybe I need a model shift here?
0 -
Hi Stacy,
just use the [tt]AttributeFilter[/tt] and specify "Comment|Amount" as parameter [tt]parameter_string[/tt], or simply take the following code ...
Hope that solves your problem.
<operator name="AttributeFilter" class="AttributeFilter">
<parameter key="condition_class" value="attribute_name_filter"/>
<parameter key="parameter_string" value="Comment|Amount"/>
</operator>
Regards,
Tobias0 -
I've also noticed that you can get fancier with these filters via regex. I am guessing that the backing implementation is standard java regex. Here I filter out all fields ending in -FIELD- followed by a single digit. Filtering out being specified by the "true" value in the "invert_filter" argument. Otherwise, it'd be an inclusive filter rather than an exclusive one.
<operator name="FilterNumberedFields" class="AttributeFilter">
<parameter key="condition_class" value="attribute_name_filter"/>
<parameter key="parameter_string" value=".*-FIELD-(\d)"/>
<parameter key="invert_filter" value="true"/>
</operator>
0