tre-library

Fuzzy Regular Expressions

狂风中的少年 提交于 2019-12-17 21:48:29
问题 In my work I have with great results used approximate string matching algorithms such as Damerau–Levenshtein distance to make my code less vulnerable to spelling mistakes. Now I have a need to match strings against simple regular expressions such TV Schedule for \d\d (Jan|Feb|Mar|...) . This means that the string TV Schedule for 10 Jan should return 0 while T Schedule for 10. Jan should return 2. This could be done by generating all strings in the regex (in this case 100x12) and find the best

Loading c libraries from php

妖精的绣舞 提交于 2019-12-03 18:56:07
in a recent project I've come really need the lib tre matching library. However the project is in php, and there are no php bindings for the library. I've tried to google how to create an interface for c libs, but all I found was the dl function which seams to load only php extensions. What am I missing? Pascal MARTIN If no " php bindings " exist, it looks like you'll have to develop them ;-) This is done via a PHP extension -- such as, for example : the mysql extension , that's used to communicate with MySQL, binding the libmysql library (with PHP <= 5.2) The curl extension , that's a wrapper

Fuzzy Regular Expressions

旧街凉风 提交于 2019-11-28 16:30:27
In my work I have with great results used approximate string matching algorithms such as Damerau–Levenshtein distance to make my code less vulnerable to spelling mistakes. Now I have a need to match strings against simple regular expressions such TV Schedule for \d\d (Jan|Feb|Mar|...) . This means that the string TV Schedule for 10 Jan should return 0 while T Schedule for 10. Jan should return 2. This could be done by generating all strings in the regex (in this case 100x12) and find the best match, but that doesn't seam practical. Do you have any ideas how to do this effectively? Thomas Ahle