Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Most specific pattern (edit distance)

by Ovid (Cardinal)
on Jun 30, 2005 at 21:14 UTC ( [id://471481]=note: print w/replies, xml ) Need Help??


in reply to Most specific pattern

Now I'm just guessing, but it seems to me that what they want is the text that most closely corresponds to a given action. The concern is the text, not the regex. Since I haven't seen the data you work with, this might be way off base, but perhaps a better way would be to find all regexes that will match with the text and then choose the text with the smallest "edit distance" against a target text?

Edit distance is generally concerned with the number of additions, deletions and substitutions necessary to transform one string into another. There are a number of CPAN modules which can calculate this for you. See Text::LevenshteinXS for a representative example.

Cheers,
Ovid

New address of my CGI Course.

  • Comment on Re: Most specific pattern (edit distance)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://471481]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-16 19:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found