Lexicon API - retrieving the phrase entry contents


wchar_t * sol_GetPhraseText( HGREN hEngine, int PhraseID )

char * sol_GetPhraseText8( HGREN hEngine, int PhraseID )


IntPtr sol_GetPhraseText( IntPtr hEngine, int PhraseID )

string sol_GetPhraseTextFX( IntPtr hEngine, int PhraseID )


function sol_GetPhraseText( hEngine: PInteger; PhraseID: integer ): PWideChar;

function sol_GetPhraseTextPAS( hEngine: PInteger; PhraseID: integer ): WideString;


hEngine - grammatical dictionary instance handle.

PhraseID - phrase entry ID.

Return value:

-1 - there is no matching phrase entry.

value>=0 - the primary key (id) of the phrase entry.


sol_GetPhraseText and sol_GetPhraseText8 return the pointers to c-style strings. The callee must release the pointers via sol_Free. Delphi and .NET wrappers provide two special functions sol_GetPhraseTextPAS and sol_GetPhraseTextFX which return the platform native strings, that is WideString and System.String respectively.

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.



#include "solarix_grammar_engine.h"


HGREN hEngine = sol_CreateGrammarEngineW(L"..\\..\\bin-windows\\dictionary.xml");

int phrase_id = sol_FindPhrase( hEngine, L"dirt road", 0 );
char * text_utf8 = sol_GetPhraseText( hEngine, phrase_id );
// ...


IntPtr gren = SolarixGrammarEngineNET.GrammarEngine.sol_CreateGrammarEngineW("..\\..\\bin-windows\\dictionary.xml");

// ...

int phrase_id = SolarixGrammarEngineNET.GrammarEngine.sol_FindPhrase( hEngine, "dirt road", 0 );
string text = SolarixGrammarEngineNET.GrammarEngine.sol_GetPhraseTextFX( hEngine, phrase_id );

Пример на 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_phrase: integer;
var phrase_text: WideString;

 hEngine := sol_CreateGrammarEngineA( '..\..\..\..\..\bin-windows\dictionary.xml' );

 id_phrase1 := sol_FindPhrase( hEngine, WideString('проверяем добавление фразы'), 0 );
 phrase_text := sol_GetPhraseTextPAS( hEngine, id_phrase3 );



Related topics

Purchase the Grammatical Dictionary SDK

Phrase class - phrase entry representation in ORM library

Russian version of this page

API layer C++ source code: grammar_engine_api.cpp

Back to the list of API calls

  © Козиев Илья 2019
changed 04-Apr-11