Function textspan::align_spans [−][src]
pub fn align_spans(
spans: &[Span],
text: &str,
original_text: &str
) -> Vec<Vec<Span>>
Converts the spans defined in text
to those defined in original_text
.
This is useful, for example, when you want to get the spans in the original text of spans obtained in the normalized text.
Examples
let spans = [(0, 3), (3, 6)]; let text = "foobarbaz"; let original_text = "FOo.BåR baZ"; assert_eq!( textspan::align_spans(&spans, text, original_text), [[(0, 3)], [(4, 7)]] )