MoralCode / parse-opening-hours

a python library to convert arbitrary strings representing business opening hours into a JSON format that's easier to use in code
https://moralcode.github.io/parse-opening-hours/
MIT License
8 stars 4 forks source link

Handle small typos and other small mistakes #8

Open MoralCode opened 3 years ago

MoralCode commented 3 years ago

It would be nice to be able to pass in real-world opening hours data that may have some typos and have this library automatically handle that.

Maybe a more complex solution would be better but for now an easy solution to this would be to change some of the patterns that currently use CaselessMatch for parsing so they can tolerate a certain number of incorrect characters and still be considered valid.

This "ignore up to x typos" functionality does not currently exist in this specific class in pyparsing, although it exists in other classes (CloseMatch if i recall correctly). There is currently an open PR in pyparsing to add this functionality.