This source file includes following definitions.
- DetectLanguage
- DetectLanguageSummary
- DetectLanguageSummary
- ExtDetectLanguageSummary
- ExtDetectLanguageSummary
- ExtDetectLanguageSummary
- DetectLanguageVersion
#include "encodings/compact_lang_det/compact_lang_det.h"
#include "encodings/compact_lang_det/compact_lang_det_impl.h"
#include "encodings/compact_lang_det/win/cld_basictypes.h"
static const char* kDetectLanguageVersion = "V1.6 - 20081121";
Language CompactLangDet::DetectLanguage(
const DetectionTables* tables,
const char* buffer,
int buffer_length,
bool is_plain_text,
bool* is_reliable) {
bool allow_extended_lang = false;
Language language3[3];
int percent3[3];
double normalized_score3[3];
int text_bytes;
int flags = 0;
Language plus_one = UNKNOWN_LANGUAGE;
const char* tld_hint = "";
int encoding_hint = UNKNOWN_ENCODING;
Language language_hint = UNKNOWN_LANGUAGE;
Language lang = CompactLangDetImpl::DetectLanguageSummaryV25(
tables,
buffer,
buffer_length,
is_plain_text,
tld_hint,
encoding_hint,
language_hint,
allow_extended_lang,
flags,
plus_one,
language3,
percent3,
normalized_score3,
&text_bytes,
is_reliable);
if (lang == UNKNOWN_LANGUAGE) {
lang = ENGLISH;
}
return lang;
}
Language CompactLangDet::DetectLanguageSummary(
const DetectionTables* tables,
const char* buffer,
int buffer_length,
bool is_plain_text,
Language* language3,
int* percent3,
int* text_bytes,
bool* is_reliable) {
double normalized_score3[3];
bool allow_extended_lang = false;
int flags = 0;
Language plus_one = UNKNOWN_LANGUAGE;
const char* tld_hint = "";
int encoding_hint = UNKNOWN_ENCODING;
Language language_hint = UNKNOWN_LANGUAGE;
Language lang = CompactLangDetImpl::DetectLanguageSummaryV25(
tables,
buffer,
buffer_length,
is_plain_text,
tld_hint,
encoding_hint,
language_hint,
allow_extended_lang,
flags,
plus_one,
language3,
percent3,
normalized_score3,
text_bytes,
is_reliable);
if (lang == UNKNOWN_LANGUAGE) {
lang = ENGLISH;
}
return lang;
}
Language CompactLangDet::DetectLanguageSummary(
const DetectionTables* tables,
const char* buffer,
int buffer_length,
bool is_plain_text,
const char* tld_hint,
int encoding_hint,
Language language_hint,
Language* language3,
int* percent3,
int* text_bytes,
bool* is_reliable) {
double normalized_score3[3];
bool allow_extended_lang = false;
int flags = 0;
Language plus_one = UNKNOWN_LANGUAGE;
Language lang = CompactLangDetImpl::DetectLanguageSummaryV25(
tables,
buffer,
buffer_length,
is_plain_text,
tld_hint,
encoding_hint,
language_hint,
allow_extended_lang,
flags,
plus_one,
language3,
percent3,
normalized_score3,
text_bytes,
is_reliable);
if (lang == UNKNOWN_LANGUAGE) {
lang = ENGLISH;
}
return lang;
}
Language CompactLangDet::ExtDetectLanguageSummary(
const DetectionTables* tables,
const char* buffer,
int buffer_length,
bool is_plain_text,
Language* language3,
int* percent3,
int* text_bytes,
bool* is_reliable) {
double normalized_score3[3];
bool allow_extended_lang = true;
int flags = 0;
Language plus_one = UNKNOWN_LANGUAGE;
const char* tld_hint = "";
int encoding_hint = UNKNOWN_ENCODING;
Language language_hint = UNKNOWN_LANGUAGE;
Language lang = CompactLangDetImpl::DetectLanguageSummaryV25(
tables,
buffer,
buffer_length,
is_plain_text,
tld_hint,
encoding_hint,
language_hint,
allow_extended_lang,
flags,
plus_one,
language3,
percent3,
normalized_score3,
text_bytes,
is_reliable);
return lang;
}
Language CompactLangDet::ExtDetectLanguageSummary(
const DetectionTables* tables,
const char* buffer,
int buffer_length,
bool is_plain_text,
const char* tld_hint,
int encoding_hint,
Language language_hint,
Language* language3,
int* percent3,
int* text_bytes,
bool* is_reliable) {
double normalized_score3[3];
bool allow_extended_lang = true;
int flags = 0;
Language plus_one = UNKNOWN_LANGUAGE;
Language lang = CompactLangDetImpl::DetectLanguageSummaryV25(
tables,
buffer,
buffer_length,
is_plain_text,
tld_hint,
encoding_hint,
language_hint,
allow_extended_lang,
flags,
plus_one,
language3,
percent3,
normalized_score3,
text_bytes,
is_reliable);
return lang;
}
Language CompactLangDet::ExtDetectLanguageSummary(
const DetectionTables* tables,
const char* buffer,
int buffer_length,
bool is_plain_text,
const char* tld_hint,
int encoding_hint,
Language language_hint,
Language* language3,
int* percent3,
double* normalized_score3,
int* text_bytes,
bool* is_reliable) {
bool allow_extended_lang = true;
int flags = 0;
Language plus_one = UNKNOWN_LANGUAGE;
Language lang = CompactLangDetImpl::DetectLanguageSummaryV25(
tables,
buffer,
buffer_length,
is_plain_text,
tld_hint,
encoding_hint,
language_hint,
allow_extended_lang,
flags,
plus_one,
language3,
percent3,
normalized_score3,
text_bytes,
is_reliable);
return lang;
}
const char* CompactLangDet::DetectLanguageVersion() {
return kDetectLanguageVersion;
}