Search for N-gram frequency


int sol_Seek1Grams( HGREN hEngine, int Type, const wchar_t * Word1 )

int sol_Seek1Grams8( HGREN hEngine, int Type, const char * Word1Utf8 )


int sol_Seek1Grams( IntPtr hEngine, int Type, string Word1 )


function sol_Seek1Grams( hEngine: PInteger; Flags: Integer; Word1: PWideChar ): Integer;


hEngine - grammatical dictionary instance handle.

Type - 0 for literal, 1 for lemmatized patterns.

Word1 - 1-gram word.

Return value:

The word frequency.


The following functions can be used to get the frequency of particular N-gram: sol_Seek2Grams, sol_Seek3Grams, sol_Seek4Grams, sol_Seek5Grams.

Total number of N-grams can be get via sol_CountNGrams.

There are different types of N-grams database storage. Grammatical dictionary reads the database parameters from dictionary configuration file.


C++ sample code:

#include "solarix_grammar_engine.h"

int freq11 = sol_Seek1Grams8( hEngine, 0, "СОБАКА" ); // без лемматизации
int freq12 = sol_Seek1Grams8( hEngine, 1, "СОБАКА" ); // с лемматизацией

C# sample code:

IntPtr hEngine = GrammarEngine.sol_CreateGrammarEngineW("..\\..\\..\\..\\..\\..\\..\\bin-windows\\dictionary.xml");
int freq11 = GrammarEngine.sol_Seek1Grams( hEngine, 0, "СОБАКА" ); // без лемматизации
int freq12 = GrammarEngine.sol_Seek1Grams( hEngine, 1, "СОБАКА" ); // с лемматизацией

Delphi sample:

program Project1;

uses SysUtils, Windows,
  _sg_api in '..\..\..\..\..\include\lem\solarix\pro\_sg_api.pas',
  GrammarEngineApi in '..\..\..\..\..\include\lem\solarix\GrammarEngineApi.pas';

var hEngine: PInteger;
var freq11, freq12: integer;

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

 freq11 := sol_Seek1Grams( hEngine, 0, 'СОБАКА' ); // без лемматизации
 freq12 := sol_Seek1Grams( hEngine, 1, 'СОБАКА' ); // с лемматизацией
 { ... }
 rc := sol_DeleteGrammarEngine(hEngine);



Purchase the Grammatical Dictionary SDK

Russian version of this page

N-grams database assembler

API layer C++ source code: grammar_engine_api.cpp

Back to API functions list

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