Lexicon API - gettinh the part of speech ID

C/C++:

int sol_GetPhraseClass( HGREN hEngine, const wchar_t * Phrase, int Flags )

C#:

int sol_GetPhraseClass( IntPtr hEngine, int PhraseID )

Delphi:

function sol_GetPhraseClass( hEngine: PInteger; PhraseID: integer ): integer;

Parameters:

hEngine - grammatical dictionary instance handle.

PhraseID - phrase entry ID.

Return value:

-1 - the phrase entry does not have required property.

value>=0 - part of speech id.

Remarks

Use sol_FindPhrase or sol_ListEntries to get the phrase entry ID.

Dictionary instance is a result of sol_CreateGrammarEngine or sol_LoadDictionary call.

ORM Library includes the PhraseEntry class, the representation of phrase entry.

Examples

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 );
int id_partofspeech = sol_GetPhraseClass( hEngine, phrase_id );

// ...
  

C#:

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

// ...

int phrase_id = SolarixGrammarEngineNET.GrammarEngine.sol_FindPhrase( hEngine, "dirt road", 0 );
int id_partofspeech = SolarixGrammarEngineNET.GrammarEngine.sol_GetPhraseClass( 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, id_partofspeech: integer;
begin

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

 id_phrase := sol_FindPhrase( hEngine, WideString('грамматический словарь русского языка'), 0 );
 id_partofspeech := sol_GetPhraseClass( hEngine, id_phrase );

 sol_DeleteGrammarEngine(hEngine);

end.

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