#include <stdio.h>
#include "string.h"
#include <string>
#import "../../bin/graphan.tlb"
int main(int argc, char* argv[])
{
if (argc != 2)
{
printf ("TestComGraphan, Test for Dialing Graphematical Analysis(COM)(www.aot.ru)\n");
printf ("Usage: TestComGraphan <file>\n");
printf ("where file is an text or html file\n");
return 1;
};
CoInitialize(NULL);
GRAPHANLib::IGraphmatFilePtr piGraphan;
HRESULT hr = piGraphan.CreateInstance(__uuidof(GRAPHANLib::GraphmatFile));
if (FAILED (hr))
{
printf ("Graphan is not registered");
CoUninitialize();
return 1;
};
hr = piGraphan->LoadDicts();
piGraphan->Language = 1;
piGraphan->GraOutputFile = "out.gra";
piGraphan->XmlMacSynOutputFile = "out.xml";
printf ("Loading file %s\n", argv[1]);
piGraphan->LoadFileToGraphan(argv[1]);
size_t Count = piGraphan->GetLineCount();
printf ("Found Units %i\n", Count);
for (size_t i =0; i< Count; i++)
if (piGraphan->HasDescr(i,GRAPHANLib::OLLE) == TRUE)
{
std::string s = (const char*) piGraphan->GetWord (i);
printf ("%s\n", s.c_str());
};
piGraphan = 0;
CoUninitialize();
return 0;
}