Summary
I am using text-processing-rs 0.2.1
I found punctuation behind number caused number not processed.
Case 1
use text_processing_rs::normalize_sentence_aviation;
fn main() {
let normalized_text = normalize_sentence_aviation("United seven eighty eight, please come up on frequency one three five point six two five, thanks.");
println!("{normalized_text}");
}
United seven eighty eight, please come up on frequency one three five point six two five, thanks.
gives
United 780 eight, please come up on frequency 135.62 five, thanks.
I expect
United 788, please come up on frequency 135.625, thanks.
Case 2 - Changing punctuation to .
United seven eighty eight. please come up on frequency one three five point six two five. thanks.
gives
United 780 eight. please come up on frequency 135.62 five. thanks.
I expect
United 788. please come up on frequency 135.625. thanks.
Case 3 - Adding space before ,
United seven eighty eight, please come up on frequency one three five point six two five, thanks.
gives
United 788 , please come up on frequency 135.625 , thanks.
So I think it is related to punctuation after a number.
Also this applies to normalize_sentence as well not just normalize_sentence_aviation.
Workaround
One workaround way is
- adding space before all punctuations
- run
normalize_sentence or normalize_sentence_aviation
- remove spaces before all punctuations again.
Summary
I am using text-processing-rs 0.2.1
I found punctuation behind number caused number not processed.
Case 1
gives
I expect
Case 2 - Changing punctuation to
.gives
I expect
Case 3 - Adding space before
,gives
So I think it is related to punctuation after a number.
Also this applies to
normalize_sentenceas well not justnormalize_sentence_aviation.Workaround
One workaround way is
normalize_sentenceornormalize_sentence_aviation