Replies: 1 comment 4 replies
-
Good question. Cool to see you pushing the limits of Autocorrect! =) This error means that the typo entry would require more than 63 backspaces to remove the incorrect letters before send-string'ing the correction, long enough that it exceeds what the serialization format can represent. I presumed this was a "this will never happen" sort of error path, but now in hindsight, I wish this had a proper error message and context, something like if backspaces > 63:
print('Error: Typo entry with more than 63 backspaces is unsupported.')
print(f'{typo} -> {correction}')
sys.exit(1) The limit comes from how I serialized the trie nodes. There are 3 kinds of nodes: chain nodes, branching nodes, and leaf nodes. It costs 2 bits per node to identify its kind. I packed this node kind identifier metadata into the top 2 bits of the first byte, leaving the lower 6 bits for the node itself. For a leaf node, these 6 bits are where the number of backspaces is stored. This is where the 63 backspaces limit comes from. E.g. in the docs is this example of encoding a leaf node, where the "
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Wasn't sure where to ask, specifically. But if i's seeing this error, I'm assuming that it's because I've hit the limit of what the current autocorrect code can handle for the trie structure?
Beta Was this translation helpful? Give feedback.
All reactions