Page 1 of 1

allow user to naturally speak a year

Posted: Tue Mar 27, 2018 1:46 pm
by jverweij
Hi
We have a prompt in our IVR that asks the user to say or enter on the keypad their year of birth . We are not able to get the spoken year of birth to be recognized unless the user says it as individual digits. For example, saying 1968 as "nineteen sixty eight" is not recognized. But saying "one nine six eight" is. How can we get the IVR to accept the year of birth in a way that a user is more inclined to provide?
thanks

Re: allow user to naturally speak a year

Posted: Wed Mar 28, 2018 3:22 pm
by admin
Hi,

Unfortunately there is no built-in grammar that allows user to say the birth year in a more conversational format. We highly recommend allowing only DTMF inputs as a more efficient means of collecting the year. Yet if you wish to include ASR grammar, custom grammar could be built to support various inputs. The sample code below allows for different permutations of year input.

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">
	<form id="start">
		<field name="year">
			<grammar root="main" type="application/srgs+xml" mode="voice">
				<rule id="main" scope="public">
					<item>
						<ruleref uri="#hundreds"/>
						<ruleref uri="#join"/>
						<ruleref uri="#tens"/>
					</item>
					<tag> 
						hundreds = hundreds.SWI_literal; tens = tens.SWI_literal;
						year = hundreds + tens;
					</tag>
				</rule>
				
				<rule id="hundreds">
					<one-of>
            <item>19</item>
            <item>20</item>
            <item>2000</item>
          </one-of>
        </rule>
				
				<rule id="join">
					<item repeat="0-1">and</item>
				</rule>
				
				<rule id = 'tens'>
					<one-of>
						<item>1</item>
						<item>2</item>
						<item>3</item>
						<item>4</item>
						<item>5</item>
						<item>6</item>
						<item>7</item>
						<item>94</item>
					</one-of>
				</rule>
				
			</grammar>
		
			<prompt> Please enter your birth year </prompt>

			<filled>
				<prompt> You said <value expr="year"/> </prompt>
			</filled>
		</field>
	</form>
</vxml>
Regards,
Plum Support