0

I have an algorithm that works with insertion, deletion and substitution counts of a word compared to a format. I can find these counts in Python like below, fuzzy_counts give me these error counts:

import regex
regex_pattern = r"([0-9]{6}){e}"
word = '12345'
regex_object = regex.fullmatch(regex_pattern, word, regex.ENHANCEMATCH)
print(regex_object)

Output:

<regex.Match object; span=(0, 5), match='12345', fuzzy_counts=(0, 0, 1)>

However I need this same thing in Java.

Thanks for the help.

s900n
  • 3,115
  • 5
  • 27
  • 35
  • Hi I am not fuzzy matching any strings to another string. I just want to know the error between a format and a word. Thank you. – s900n Apr 12 '19 at 11:12
  • As clarification for the duplicated mark, Java doesn't have anything like Python's `{e}` for regexes. I don't know Python that well, but if I understand correctly `{e}` is a fuzzy regex builtin. With Java you'll have to calculate the amount of Levenshtein differences per type (add, delete, edit) yourself, which will be quite a bit more than simply calling `regex.fullmatch(regex_pattern, word, regex.ENHANCEMATCH)` like Python I'm afraid.. – Kevin Cruijssen Apr 12 '19 at 11:59

0 Answers0