-
-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return the automaton state with the (key, value)
#60
Comments
Could you please state more explicitly what API changes your requesting? Please include any relevant changes in the public API documentation. (I'm asking because this is the easiest way for me to understand the feature request.) |
Sure... So right now if I intersect an let mut stream = fst_map.search(lev).into_stream();
while let Some((key, val)) = stream.next() {
// ...
} In the case where the state contains important information (e.g. a levenshtein automaton which would let you access the lev distance from its state), it might be handful to have a way to get a Maybe this could be done with an extra method on the So for instance, Note that I think there is enough API public access on the fst crate to implement this feature outside of the crate, so this is not a blocker. In the end for the user, usage would look like this : let mut stream = fst_map.search(lev).with_state().into_stream();
while let Some((key, val, state)) = stream.next() {
let levenshtein_distance: usize = get_lev_distance(state);
// ...
} |
@fulmicoton I think that seems reasonable to me! |
Hey guys, I'm writing a search library and I want to use |
@MartinKavik I think submitting a PR with the above API might be a good start. |
This is apparently useful in some cases when access to the underlying automaton's state can produce useful information about a match. Regretably, the implementation requires the states to satisfy `Clone`, or else we would otherwise need to execute the state transition twice. In practice, states are usually `Copy` and quite small. Closes #60, Closes #61
This is apparently useful in some cases when access to the underlying automaton's state can produce useful information about a match. Regretably, the implementation requires the states to satisfy `Clone`, or else we would otherwise need to execute the state transition twice. In practice, states are usually `Copy` and quite small. Closes #60, Closes #61
This is apparently useful in some cases when access to the underlying automaton's state can produce useful information about a match. Regretably, the implementation requires the states to satisfy `Clone`, or else we would otherwise need to execute the state transition twice. In practice, states are usually `Copy` and quite small. Closes #60, Closes #61
This is apparently useful in some cases when access to the underlying automaton's state can produce useful information about a match. Regretably, the implementation requires the states to satisfy `Clone`, or else we would otherwise need to execute the state transition twice. In practice, states are usually `Copy` and quite small. Closes #60, Closes #61
This is apparently useful in some cases when access to the underlying automaton's state can produce useful information about a match. Regretably, the implementation requires the states to satisfy `Clone`, or else we would otherwise need to execute the state transition twice. In practice, states are usually `Copy` and quite small. Closes #60, Closes #61
In some cases it can be useful to know the automaton state as well, when intersecting the fst with an automaton using
.search(...)
.For instance, levenshtein's automaton's state hold the actual levenshtein distance of the current
key
. It is a very valuable information that could be used for ranking the results for instance.The text was updated successfully, but these errors were encountered: