Lexicon API - searching for the word entry

int sol_FindEntry( HGREN hEngine, const wchar_t * EntryName, int PartOfSpeechID, int LanguageID )

int sol_FindEntry8( HGREN hEngine, const char * EntryNameUtf8, int PartOfSpeechID, int LanguageID )

Parameters:

hEngine - grammatical dictionary instance handle.

EntryName - word entry name.

PartOfSpeechID - ID of the part of speech; set this parameter to -1 in orer to match any part of speech.

LanguageID - ID of the language; -1 disables the language filter.

Return value:

-1 - there is no matching word entry.

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

Remarks

The only difference between sol_FindEntry and sol_FindEntry8 is a word entry name encoding encoding. sol_FindEntry8 requires the name in utf-8.

There are symbolic constants for the IDs of almost all parts of speech and languages. They are declared in _sg_api.* files for C, C++, C# and Delphi languages.

Dictionary instance is a result of sol_CreateGrammarEngine or sol_LoadDictionary call.

The functions are thread-safe.

ORM Library includes the WordEntry class, the representation of word entry.

Examples

C++ sample - search for the Russian noun:

#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 );
if( entry_id==-1 )
 {
  printf( "Russian lexicon is missing.\n" );
  // ...
 }

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

// ...

int entry_id = SolarixGrammarEngineNET.GrammarEngine.sol_FindEntry( hEngine, "МАМА", SolarixGrammarEngineNET.GrammarEngineAPI.NOUN_ru, SolarixGrammarEngineNET.GrammarEngineAPI.RUSSIAN_LANGUAGE );
if( entry_id==-1 )
 throw new ApplicationException( "Russian lexicon is missing" );

Related topics

Purchase the Grammatical Dictionary SDK

WordEntry class - word 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