API for getting the name of grammatical category by its ID

int sol_GetCoordName( HGREN hEngine, int CategoryID, wchar_t * NameBuffer )

int sol_GetCoordName8( HGREN hEngine, int CategoryID, char * NameBufferUtf8 )

Parameters:

hEngine - grammatical dictionary instance handle.

CategoryID - ID of grammatical category.

NameBuffer - buffer which receives the result string.

Return value:

0 - success, the name of grammatical category is written in buffer.

value<0 - error.

Remarks

sol_GetCoordName stores the name as a wide string, whereas sol_GetCoordName8 stores the utf-8 string.

There are symbolic constants for the IDs of almost all grammatical categories. They are declared in _sg_api.* files for C, C++, C# and Delphi languages. It is also possible to find an ID of category by its name using sol_FindEnum.

The functions are thread-safe.

Function sol_MaxLexemLen returns the maximum number of wide chars in the category name. Use it to get the required size of NameBuffer. UTF-8 version usually requires longer buffer, because some category are written using national characters. sol_MaxLexemLen8 is the best way to get the required size in this case.

The name of grammatical attribute in a category can be received via sol_GetCoordStateName.

Dictionary instance is a result of sol_CreateGrammarEngine or sol_LoadDictionary call.

C++ sample:

#include "solarix_grammar_engine.h"

// ...

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

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

C# sample:

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

// ...
StringBuilder buffer = new StringBuilder( SolarixGrammarEngineNET.GrammarEngine.sol_MaxLexemLen(gren) );
SolarixGrammarEngineNET.GrammarEngine.GetCoordName( gren, CASE_ru, buffer );
// ...

Related topics

Purchase the Grammatical Dictionary SDK

Russian version of this page

Coordinate class - grammatical category in ORM library

API layer C++ source code: grammar_engine_api.cpp

Back to the list of API calls

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