I am writing a Python chatbot. No matter what the method is (Levenshtein, LCS, regular expression, etc.), I need a template like My name is [ A ]. smart enough to match strings like:
My name is Tslmy.
Let me use groupdict()['a'] to indicate what thing [ A ] captured (actually (?P<identifier>match) ).
- In other words, I'm looking for "Levenshtein" with missing / missing / spaces / neglects, and picks what was missing .
- In another way, I’m looking for a fuzzy (so-called) regular expression that might be less strict with the pattern, still provides the good old
groupdict() , as well as the value “fuzzy” (or “editing distance” later needed to determine “ best matching pattern with string ").
This is the preferred solution because it provides "sufficient" groupdict() if it is well managed.
However, the TRE library and the REGEX library, which turned out to be the closest solution, do not seem to give a “fuzzy” value. If this can be solved, so much the better!
Is it possible? Thank you for your attention.
Update:
I decided to use a powerful regex module, but still could not get a "fuzzy value".
Since the question on this page is theoretically resolved, adding too much further will be dishonorable. Therefore, I put forward another question about this new problem and I hope that you can solve it!
tslmy
source share