[rules-users] Anybody using Drools 4.0 with approximate string matching?

Michael Neale michael.neale at gmail.com
Tue Sep 4 00:25:52 EDT 2007


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 at 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 at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070904/50d0327b/attachment.html 


More information about the rules-users mailing list