Cómo usar friso en mysql
¿Cómo usar friso en mysql?
¿Código C/C++?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "friso/friso.h"
#include "friso/friso_API.h"
friso_t friso;
friso_task_t tarea;
typedef friso_t(*pfun_friso_new_from_ifile)(string);
typedef friso_task_t(*pfun_friso_new_task)();
typedef void(*pfun_friso_set_text )(friso_task_t,string);
typedef friso_hits_t(*pfun_friso_next)(friso_t,friso_mode_t,friso_task_t);
typedef void(*pfun_friso_free_task)(friso_task_t);
typedef void(*pfun_friso_free)(friso_t);
HINSTANCE hdll = LoadLibrary("friso\\friso.dll");
pfun_friso_new_from_ifile newfriso = (pfun_friso_new_from_ifile)GetProcAddress(hdll ,"friso_new_from_ifile");
pfun_friso_new_task newtask = (pfun_friso_new_task)GetProcAddress(hdll,"friso_new_task");
pfun_friso_set_text frisosettext = (pfun_friso_set_text)GetProcAddress(hdll,"friso_set_text");
pfun_friso_next frisonext = (pfun_friso_next)GetProcAddress(hdll,"friso_next");
pfun_friso_free_task freetask = (pfun_friso_free_task)GetProcAddress(hdll,"friso_free_task");
pfun_friso_free freefriso = (pfun_friso_fr
ee)GetProcAddress(hdll,"friso_free");
LPSTR ini = "friso\\friso.ini";
friso = newfriso(ini);
task = newtask();
LPSTR txt = "Prueba: friso es un segmentador de palabras chino desarrollado en lenguaje C e implementado utilizando el popular algoritmo mmseg. Completamente basado en un diseño e implementación modular, puede ser muy conveniente Integrado en otros programas, como: MySQL, PHP, etc. ";
frisosettext(task,txt);
while((frisonext(friso,friso->mode, task))!=NULL)
{
OutputDebugString(task->hits->word);//La primera salida no es "test" sino "friso"
OutputDebugString(" ");
if(task->hits->type==__FRISO_NEW_WORDS__)
{
// Depurar el error después de ejecutarlo por primera vez
//Mensaje de error: HEAP[fenci.exe]: Dirección no válida especificada en RtlValidateHeap( 00030000, 003954D0 )
FRISO_FREE(task-> hits- >palabra);
}
}
OutputDebugString("\r\n");
freetask(tarea) ;
freefriso(friso);