C/C++:
int sol_FindPhrase( HGREN hEngine, const wchar_t * Phrase, int Flags )
int sol_FindPhrase8( HGREN hEngine, const char * PhraseUtf8, int Flags )
C#:
int sol_FindPhrase( IntPtr hEngine, string Phrase, int Flags )
Delphi:
function sol_FindPhrase( hEngine: PInteger; Phrase: PWideChar; Flags: integer ): integer;
Parameters:
hEngine - grammatical dictionary instance handle.
Phrase - phrase text.
Flags - 0 - ignore case, 1 - exact case matching.
Return value:
-1 - there is no matching phrase entry.
value>=0 - the primary key (id) of the phrase entry.
The only difference between sol_FindPhrase and sol_FindPhrase8 is a word entry name encoding encoding. sol_FindPhrase8 requires the name in utf-8.
Phrase ID can be used to get the extended information about entry (see sol_GetPhraseText, sol_GetPhraseLanguage, sol_GetPhraseClass) or to delete it using sol_DeletePhrase.
Dictionary instance is a result of sol_CreateGrammarEngine or sol_LoadDictionary call.
ORM Library includes the PhraseEntry class, the representation of phrase entry.
C++:
#include "solarix_grammar_engine.h"
...
HGREN hEngine = sol_CreateGrammarEngineW(L"..\\..\\bin-windows\\dictionary.xml");
//...
int phrase_id = sol_FindPhrase( hEngine, L"dirt road", 0 );
// ...
C#:
IntPtr gren = SolarixGrammarEngineNET.GrammarEngine.sol_CreateGrammarEngineW("..\\..\\bin-windows\\dictionary.xml");
// ...
int phrase_id = SolarixGrammarEngineNET.GrammarEngine.sol_FindPhrase( hEngine, "dirt road", 0 );
Delphi:
uses SysUtils, Windows,
_sg_api in '..\..\..\..\..\include\lem\solarix\_sg_api.pas',
GrammarEngineApi in '..\..\..\..\..\include\lem\solarix\GrammarEngineApi.pas';
var hEngine: PInteger;
var id_phrase1, id_phrase2, id_phrase3: integer;
var phrase_text: WideString;
begin
hEngine := sol_CreateGrammarEngineA( '..\..\..\..\..\bin-windows\dictionary.xml' );
id_phrase1 := sol_FindPhrase( hEngine, WideString('грамматический словарь русского языка'), 0 );
id_phrase2 := sol_AddPhrase( hEngine, WideString('проверяем добавление фразы'), -1, -1, 0 );
id_phrase3 := sol_FindPhrase( hEngine, WideString('проверяем добавление фразы'), 0 );
phrase_text := sol_GetPhraseTextPAS( hEngine, id_phrase3 );
sol_DeletePhrase( hEngine, id_phrase3 );
sol_DeleteGrammarEngine(hEngine);
end.
Purchase the Grammatical Dictionary SDK
Phrase class - phrase entry representation in ORM library
API layer C++ source code: grammar_engine_api.cpp
© Козиев Илья 2019
![]() |
|
changed 04-Apr-11 |