BurntSushi / fst

Represent large sets and maps compactly with finite state transducers.
The Unlicense
1.77k stars 125 forks source link

TooManyStates(10000) #83

Closed serega closed 5 years ago

serega commented 5 years ago

I played with the example in documentation and found that Levenshtein does not accept long strings. Here is an example

let lev = Levenshtein::new("monomorphization", 3).unwrap();

This line causes panic

thread 'main' panicked at 'calledResult::unwrap()on anErrvalue: TooManyStates(10000)', src/libcore/result.rs:1051:5

Any sufficiently long string results in panic.

BurntSushi commented 5 years ago

I don't understand why you are reporting this. It is documented behavior: https://docs.rs/fst-levenshtein/0.2.1/fst_levenshtein/enum.Error.html

The library isn't causing the panic. Your code is by calling unwrap.

Moreover, the length of the string isn't the only variable. The edit distance also significant impacts the number of states.

serega commented 5 years ago

Thanks for your reply. I sure saw in the documentation that the construction may return an error, but I didn't find what the supported limits are on the string length and the number of edit distance. I thought that my query seems reasonable. Thanks.

BurntSushi commented 5 years ago

Sure. You could open an issue asking for better documentation or even to configure the limit. But in this issue you are talking about panics and it's not clear what you want.