Last reviewed: 3/23/2024 10:08:33 AM
Selecting a Recognizer
Since there may be more than one recognizer available on the system in which your application runs, you may want to integrate selection into your application.
Applications obtain an enumerated list of available engines and then select the desired recognizer by Name, ID, or ISO5Language.
for (JChantEngine engine : _Recognizer.getChantEngines())
{
// Access engine properties
String name = engine.getName();
...
// If this is the desired engine, select it
_Recognizer.setEngine(name);
break;
}
foreach (NChantEngine chantEngine in _Recognizer.ChantEngines)
{
// Access engine properties
string name = chantEngine.Name;
...
// If this is the desired engine, select it
_Recognizer.SetEngine(name);
break;
}
for (int i = 0; i < _Recognizer->GetChantEngines()->GetCount(); i++)
{
CChantEngine* pChantEngine = _Recognizer->GetChantEngines()->GetChantEngine(i);;
// Access engine properties
wchar_t* engine = pChantEngine->GetName();
...
// If this is the desired engine, select it
_Recognizer->SetEngine(engine);
break;
}
for (int i = 0; i < _Recognizer->GetChantEngines()->Count; i++)
{
CChantEngine* pChantEngine = _Recognizer->GetChantEngines()->GetChantEngine(i);
// Access engine properties
String engine = pChantEngine->GetName();
...
// If this is the desired engine, select it
_Recognizer->SetEngine(engine);
break;
}
var
chantTTSEngine: TChantEngine;
name: string;
begin
for chantEngine in _Recognizer.ChantEngines do
begin
// Access engine properties
name := chantTTSEngine.Name;
...
// If this is the desired engine, select it
_Recognizer.SetEngine(name);
exit;
end;
end;
for (JChantEngine engine : _Recognizer.getChantEngines())
{
// Access engine properties
String name = engine.getName();
...
// If this is the desired engine, select it
_Recognizer.setEngine(name);
break;
}
NSArray<CSChantEngine*>* engines = [_recognizer chantEngines];
if (engines != nil)
{
for (CSChantEngine* ce in engines)
{
// Access engine properties
NSString* name = [ce name];
...
// If this is the desired engine, select it
[_recognizer setEngine:engine];
break;
}
}
let engines = _Recognizer!.getChantEngines()
if (engines.count > 0)
{
enginelookup: for ce in engines
{
// Access engine properties
let name = ce.name
...
// If this is the desired engine, select it
_Recognizer!.setEngine(name: name)
break enginelookup
}
}
Dim chantEngine As NChantEngine
Dim name As String
For Each chantEngine In _Recognizer.ChantEngines
' Access engine properties
name = chantTTSEngine.Name
...
// If this is the desired engine, select it
_Recognizer.SetEngine(name)
Exit
Next