diff --git a/README.md b/README.md index 8de65a400..5784cc074 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,23 @@ static $meeting_search_radius = -50; ``` This would set the radius at the first 50 results and is the default. +## Voice Recognition Optimizations ## + +It's possible to set the expected spoken language, for recognition by setting the following variable in config.php to the culture variant. The default is `en-US`, which is US English. + +Use the this chart to find the code of your preference https://www.twilio.com/docs/api/twiml/gather#languagetags. + +```php +$gather_language = "en-US"; +``` + +You can also set some expected words or hints, to help the voice recognition engine along. Use the setting by separating words with commas. You can use phrases as well. + +Each hint may not be more than 100 characters (including spaces). You can use up to 500 hints. + +```php +$gather_hints = ""; +``` ## Helpline Call Routing diff --git a/city-or-county-voice-input.php b/city-or-county-voice-input.php index 037fe858b..9f0c4fa97 100644 --- a/city-or-county-voice-input.php +++ b/city-or-county-voice-input.php @@ -1,5 +1,6 @@ \n"; @@ -12,7 +13,7 @@ } ?> - + Please say the name of the city or county. diff --git a/functions.php b/functions.php index f3dd0e754..366fe67ab 100644 --- a/functions.php +++ b/functions.php @@ -39,6 +39,11 @@ class MeetingResults { public $filteredList = []; } +class GatherMods { + public $language; + public $hints; +} + function getCoordinatesForAddress($address) { $coordinates = new Coordinates(); @@ -71,6 +76,14 @@ function getProvince() { } } +function getGatherLanguage() { + return isset($GLOBALS["gather_language"]) ? $GLOBALS["gather_language"] : "en-US"; +} + +function getGatherHints() { + return isset($GLOBALS["gather_hints"]) ? $GLOBALS["gather_hints"] : ""; +} + function helplineSearch($latitude, $longitude) { $helpline_search_radius = isset($GLOBALS['helpline_search_radius']) ? $GLOBALS['helpline_search_radius'] : 30; $bmlt_search_endpoint = getHelplineBMLTRootServer() . "/client_interface/json/?switcher=GetSearchResults&sort_results_by_distance=1&long_val={LONGITUDE}&lat_val={LATITUDE}&geo_width=" . $helpline_search_radius; diff --git a/province-voice-input.php b/province-voice-input.php index 38a2f7bfb..08903a535 100644 --- a/province-voice-input.php +++ b/province-voice-input.php @@ -1,12 +1,13 @@ \n"; $searchType = $_REQUEST['SearchType']; ?> - + Please say the name of the state or province.