LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
test.cpp
Go to the documentation of this file.
1#include "fastText/src/fasttext.h"
2#include "langDetector.h"
3#include <iostream>
4
5using namespace std;
6
7int main(int argc, char *argv[]) {
8 LangDetector* ld = new LangDetector("../model/lid.176.ftz");
9 cout << "Checking example with french: ";
10 if(ld->detectLang("Je suis un éxemple.")=="__label__fr"){
11 cout << "PASS\n";
12 }
13 else{
14 cout << "ERROR\n";
15 }
16 cout << "Checking counter example with french: ";
17 if(ld->detectLang("I am not in french.")!="__label__fr"){
18 cout << "PASS\n";
19 }
20 else{
21 cout << "ERROR\n";
22 }
23 cout << "Checking example with english: ";
24 if(ld->detectLang("This is an example.")=="__label__en"){
25 cout << "PASS\n";
26 }
27 else{
28 cout << "ERROR\n";
29 }
30 cout << "Checking example with chinese: ";
31 if(ld->detectLang("我是一个例子")=="__label__zh"){
32 cout << "PASS\n";
33 }
34 else{
35 cout << "ERROR\n";
36 }
37 cout << "Checking string conversion : ";
38 if(ld->labelToPrintable("__label__fr") == "fr"){
39 cout << "PASS\n";
40 }
41 else{
42 cout << "ERROR\n";
43 }
44 return 0;
45}
STL namespace.
int main(int argc, char *argv[])
Definition test.cpp:7