#include "components/translate/core/language_detection/language_detection_model.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/histogram_macros_local.h"
#include "base/metrics/metrics_hashes.h"
#include "base/timer/elapsed_timer.h"
#include "base/trace_event/trace_event.h"
#include "components/language/core/common/language_util.h"
#include "components/language_detection/core/language_detection_model.h"
#include "components/translate/core/common/translate_constants.h"
#include "components/translate/core/common/translate_util.h"
#include "components/translate/core/language_detection/language_detection_util.h"
namespace {
constexpr size_t kTextSampleLength = …;
constexpr int kNumTextSamples = …;
}
namespace translate {
BASE_FEATURE(…);
LanguageDetectionModel::LanguageDetectionModel(
language_detection::LanguageDetectionModel* tflite_model_)
: … { … }
LanguageDetectionModel::~LanguageDetectionModel() = default;
void LanguageDetectionModel::UpdateWithFile(base::File model_file) { … }
bool LanguageDetectionModel::IsAvailable() const { … }
std::pair<std::string, float> LanguageDetectionModel::DetectTopLanguage(
const std::u16string& sampled_str) const { … }
std::string LanguageDetectionModel::DeterminePageLanguage(
const std::string& code,
const std::string& html_lang,
const std::u16string& contents,
std::string* predicted_language,
bool* is_prediction_reliable,
float& prediction_reliability_score) const { … }
language_detection::Prediction LanguageDetectionModel::DetectLanguage(
const std::u16string& contents) const { … }
std::string LanguageDetectionModel::GetModelVersion() const { … }
}