#include "components/language_detection//core/language_detection_model.h"
#include <algorithm>
#include <vector>
#include "base/containers/span.h"
#include "base/feature_list.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_detection/core/language_detection_resolver.h"
#include "components/optimization_guide/core/optimization_guide_features.h"
#include "components/translate/core/common/translate_constants.h"
#include "third_party/tflite_support/src/tensorflow_lite_support/cc/task/text/nlclassifier/nl_classifier.h"
namespace {
constexpr char kTFLiteModelVersion[] = …;
class ScopedLanguageDetectionModelStateRecorder { … };
}
namespace language_detection {
#if !BUILDFLAG(IS_WIN)
BASE_FEATURE(…);
#endif
Prediction TopPrediction(const std::vector<Prediction>& predictions) { … }
LanguageDetectionModel::LanguageDetectionModel()
: … { … }
LanguageDetectionModel::~LanguageDetectionModel() = default;
std::vector<Prediction> LanguageDetectionModel::Predict(
const std::u16string& contents,
bool truncate) const { … }
void LanguageDetectionModel::UpdateWithFile(base::File model_file) { … }
bool LanguageDetectionModel::IsAvailable() const { … }
std::string LanguageDetectionModel::GetModelVersion() const { … }
}