For user interaction: the IniGrammar class
This is Quintijn Hoogenboom's extension to provide easy interaction between a user inifile and the grammar.
Controlled through commands in the grammar _control, the contents of a ini file can be inspected and edited.
- Inspecting is done through a temporary .txt file that is displayed in Notepad, or another program that is attached with files of this extension,
- Changing is done by calling the appropriate .ini file. After editing and saving the file, the changes are updated in the appropriate grammar instance.
- If the grammar name or the grammar words are changed, the corresponding grammar is reloaded, one utterance later.
Other features of the IniGrammar class: - grammar parts for getting a number. Exploited in _number, _lines and in the browsing grammars (firefox_browsing).
- functions for searching, which can be called from discrete and continuous grammars (_general and _repeat)
- (new in 2010) numbers lists are converted in spoken forms lists, see numbers page.
To update or not
A special variable 'self.checkForChanges' controls whether the changes to link("/features/inifiles.html", "inifiles") should be checked for or not. It is switched on when calling such an inifile by one of the edit commands of the grammar _control. This prevents unnecessary checking for changed ini files. On the other hand, opening a ini file manually (instead of with one of those special commands) means there will be no tracking of changes.
The actions.ini file is also updated after a call to edit actions. Howeveer the numbers.ini file is NOT updated in the grammars automatically, you need a restart of NatSpeak. |