markkamp / ruler

An attempt to auto correct historic rally events
GNU General Public License v3.0
0 stars 0 forks source link

Perform string matching instead of character matching #1

Open baskapteijn opened 6 years ago

baskapteijn commented 6 years ago

This is required because the 'TC1' stamps should be interpreted as one element and not as single characters. @markkamp please elaborate about this feature if you can, it's been a while since we discussed this.

markkamp commented 6 years ago

@baskapteijn Agreed. 'TC1' is one of the possibilities. 'ST1' (rubber stamp) or a number (e.g. 51) are also possible.

baskapteijn commented 6 years ago

Created feature branch 'feature/string-match'

baskapteijn commented 6 years ago

Not sure yet why it is required though. Because the characters 'tc1' and 'st1' will still be matched when performing character matching.

And if we move to string matching, how would we detect certain string in the input? Are we going to use special characters to denote that the characters 'tc1' are actually part of 1 string? Or are we going to hardcode special sequences to recognize them? The current input is (f.e.):

mcard =    "tc1a [bkg]do[efe]fs[  ]gshnu[j ]ln[b ][w ]a[rv]p[ t]vxwayb[ cb]tc2tc3bac deghe[ f]jkr[ ln]cmcoi stxuwyftc4";
mcardErr = "    c               em        w     u   j        z         e            q      z      o        p          ";
ucard = "tc1abkgdofsgshnjlnbjarvzvxwaybcbtc2tc3bacdeghefjkrlncmcoipstuwyftc4";

If we were to denote certain character pairs as a single string, we could do this:

"{tc1}a [bkg]do[efe]fs[  ]gshnu[j ]ln[b ][w ]a[rv]p[ t]vxwayb[ cb]{tc2}{tc3}bac deghe[ f]jkr[ ln]cmcoi stxuwyf{tc4}"

Equally for the user string of course if the card boxes contain strings instead of single chars.