API for getting the name of part of speech

int sol_GetEntryName( HGREN hEngine, int EntryID, wchar_t * NameBuffer )

int sol_GetEntryName8( HGREN hEngine, int EntryID, char * NameBufferUtf8 )

Parameters:

hEngine - grammatical dictionary instance handle.

EntryID - ID of word entry.

NameBuffer - buffer which receives the result string.

Return value:

0 - success, the word entry name is written in buffer.

value<0 - error.

Remarks

sol_GetEntryName stores the name as a wide string, whereas sol_GetEntryName8 stores the utf-8 string.

The functions are thread-safe.

Function sol_MaxLexemLen returns the maximum number of wide chars in the word entry name. Use it to get the required size of NameBuffer. UTF-8 version usually requires longer buffer; sol_MaxLexemLen8 is the best way to get the required size in this case.

Dictionary instance is a result of sol_CreateGrammarEngine or sol_LoadDictionary call.

Examples

C++ sample:

#include "solarix_grammar_engine.h"

...

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

//...

int entry_id = sol_FindEntry( hEngine, L"СТАТЬ", NOUN_ru, RUSSIAN_LANGUAGE );

int n = sol_MaxLexemLen(hEngine);
wchar *buffer = new wchar_t[n];
sol_GetEntryName( hEngine, entry_id, buffer );
// ...
delete [] buffer;

// ...
  

C# sample:

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

// ...

int entry_id = SolarixGrammarEngineNET.GrammarEngine.sol_FindEntry( hEngine, "СТАТЬ", -1, -1 );

StringBuilder buffer = new StringBuilder( SolarixGrammarEngineNET.GrammarEngine.sol_MaxLexemLen(gren) );
SolarixGrammarEngineNET.GrammarEngine.sol_GetEntryName( gren, entry_id, buffer );

// ...

Related topics

Purchase the Grammatical Dictionary SDK

Russian version of this page

WordEntry class inORM library

Словарные статьи

API layer C++ source code: grammar_engine_api.cpp

Back to the list of API calls

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