Hi Irving. That is a very interesting and kind of cool problem.
Happily, Mike Brock who built MVEL, which is part of drools, embeded soundex
into it.
So you can do (and I just tried this):
rule "Hello World"
when
c : Cheese( eval(type soundslike "foobar") )
then
c.setPrice(42);
end
And it will match "Cheese" with a type of "fubar" as well. Using
soundex
standard. You could of course use a function to use some other library that
you want, but this is built in.
Note the use of "eval" inside the pattern to indicate it is an expression,
not a field constraint.
Hope that helps !
Michael.
On 9/4/07, Irving Reid <irving(a)cfrq.net> wrote:
I have a use case where we'd like to match free text strings, with words
sometimes spelled incorrectly. Has anyone tried Drools with an approximate
string matcher (
http://en.wikipedia.org/wiki/Approximate_string_matching)?
I know that I can use regular expressions to match some common spelling
errors, but it would be way cool to use an algorithm that doesn't need to
have all the possible errors programmed in beforehand.
- irving -
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users