Browse
 
Tools
Rss Categories

Sandbox environment

Reference Number: AA-02016 Views: 9342 0 Rating/ Voters

One of the key features of the Speech Tuner is the ability to modify grammars and lexicons and test out the changes with existing audio samples collected. During this process of grammar testing and development, it is highly desirable to limit modifications to the grammars or lexicons to be sand-boxed away from the original files until the modified files are validated to perform well. To this end, the Speech Tuner uses a copy of all grammars and lexicons stored in a local temporary folder thus creating a sandbox environment for the testing. 

When a grammar or lexicon is loaded into the Speech Tuner from a toolbar option of "Open Grammar File" or "Open Lexicon File", the original file is fetched and then stored in the local temporary directory. Any external referenced paths for grammars or lexicons that may exist are also fetched and stored in the local temporary directory. The parent grammar is automatically modified each time it is saved to disk by replacing the external referenced URIs with the local temp directory paths. This also applies to child grammars when grandchild references exist. 

The same behavior applies to grammars/lexicons loaded from callsre files but instead of fetching the external references from the URI paths provided, they are read from the references stored within the callsre file itself and then stored to the local temporary directory. From this point on, the grammars used in the ASR via the Speech Tuner are just the ones in the temporary directory. Using the Grammar Editor to edit the grammar and hitting "Apply" only affects the files in this local temporary directory. Once satisfied with the grammar modifications, the files would manually need to be saved to the desired location via the "Save Selected Grammar" or "Save Selected Lexicon" options in the Speech Tuner.

Sandbox location

The temporary location for the grammars and lexicons used in the Speech Tuner is located in a directory structure underneath the windows temp directory location returned by the windows API call GetTempPath(). The exact folder returned by this API call is OS version dependent. The folder path also takes into account the user logged into the machine. A sample temporary directory returned by the  windows API call GetTempPath() on a Windows 7 machine is :

C:\Users\<UserName>\AppData\Local\Temp\

<UserName> here varies based on the Windows user logged in. The Windows Server 2008 OS has an extra directory after "Temp" with an integer name such as  :

C:\Users\<UserName>\AppData\Local\Temp\1\

The Speech Tuner creates a new folder called ".TunerGrams" at this temporary directory location for the sandbox such as : 

C:\Users\<UserName>\AppData\Local\Temp\1\.TunerGrams\

Since the ".TunerGrams" folder is prefixed with a dot (.), it is treated as a hidden windows folder so it may not be visible to users unless the "Show hidden files and folders" is checked in the "Folder Options". For the LumenVox Speech Tuner 13.0 and future versions there is an additional unique GUID folder created in the form of "Tuner_<8 character guid>". It is created with a unique GUID every time a new Speech Tuner instance is started up. This Speech Tuner instance specific GUID folder is cleaned up when the Speech Tuner is shutdown in a graceful manner. The usage of a Speech Tuner instance specific GUID folder prevents multiple instances of the Speech Tuner running on the same machine from affecting each other. Speech Tuner versions prior to 13.0 had the risk of grammars from multiple Speech Tuner instances from interacting with each other so it was unsafe to have multiple Speech Tuner instances using the same grammars.

Underneath the GUID folder, there is a directory structure used by the Speech Tuner that is based on the URI of the original grammar path and certain other internal parameters. This path is subject to change in future versions of the Speech Tuner. The first directory here is usually an integer and based upon the parent grammar index in the Speech Tuner.  The next directory is the scheme type of the URI such as "file", "http", "builtin" etc. The rest of the directories are based on the URI path of the original grammar. An example of this path is below:

C:\Users\admin\AppData\Local\Temp\.TunerGrams\Tuner_783F82CA\0\http\10.22.0.166\mpp\misc\collector\name.grxml

The exact location for the local temporary directory for a specific grammar is displayed in the Grammar Properties page under the "Local" text box as show in the below image:



The reason for describing how the sand box works is only to give the Speech Tuner user a general understanding of the sandbox as well as a tool for some advanced debugging in case the Speech Tuner is not behaving as expected. However, most users will never have to manually go to the sandbox folder or make any modifications in here. Making custom edits in the sandbox location may lead to undefined behavior by the Speech Tuner so it is recommended to not manually make any changes in the sandbox files but to only review them as a sanity check if you are getting unexpected behavior from the Speech Tuner.

Sandbox cleanup

There was no cleanup of these temporary grammars in pre-13.0 Speech Tuners. In the 13.0 Speech Tuner, there has been some cleanup functionality added to clean up the temporary Tuner_GUID directory created by the current Speech Tuner instance on a graceful shutdown of the Speech Tuner. The GUID folder also gets cleared up before a new Interaction Database or TunerZip is loaded up by the Speech Tuner.

A manual flush of the sandbox is not really needed, however, if you did want to flush the sandbox to clear out old files from pre-13.0 Speech Tuners or from Speech Tuner instances that did not shutdown gracefully, these are the steps

  1. Shutdown all instances of the Speech Tuner. 
  2. Explore to the ".TunerGrams" folder 
  3. Delete all sub directories and files underneath it. 
Do not delete files here when a Speech Tuner instance is running since you may get unexpected behavior.