Detecting phone numbers using sapi

135 views Asked by At

This is regarding to the question in Detecting phone numbers using sapi. I used that grammar in the answer.

But it gets numbers with space how can I create grammar get numbers without space?

1

There are 1 answers

0
Eric Brown On

Short answer - it would be quite difficult to do that, as SAPI is designed to recognize words, which have spaces in between them.

However, it's pretty straightforward to annotate the grammar so that you can find the start & end position of the phone number within the reco result, at which point you can remove the spaces using string replacement.

Alternatively, it's also pretty straightforward to place the phone number in a tag, at which point you can extract the number from the rules structure. (This might be trickier from Java.)