Convert "one" to 1, "two" to 2, etc

Hello,

I’m using speech recognition to input a number into my script - but when I speak any number, it is given as a word e.g. “five”.

Do you know if there is a way to convert a number word to digits?

(Searching for topics about converting text/words/numbers/integers didn’t return what I wanted)

Many thanks

try this…

set numberList to {"zero", "one", "two", "three"} -- add more here but keep them in order

set textToConvert to "two"

repeat with i from 1 to count of numberList
	if item i of numberList is equal to textToConvert then return (i - 1)
end repeat