chromium/third_party/mediapipe/src/mediapipe/tasks/cc/text/text_classifier/text_classifier.cc

/* Copyright 2022 The MediaPipe Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#include "mediapipe/tasks/cc/text/text_classifier/text_classifier.h"

#include <map>
#include <memory>
#include <string>
#include <utility>

#include "absl/status/statusor.h"
#include "absl/strings/string_view.h"
#include "mediapipe/framework/api2/builder.h"
#include "mediapipe/framework/packet.h"
#include "mediapipe/tasks/cc/components/containers/classification_result.h"
#include "mediapipe/tasks/cc/components/containers/proto/classifications.pb.h"
#include "mediapipe/tasks/cc/components/processors/proto/classifier_options.pb.h"
#include "mediapipe/tasks/cc/core/task_api_factory.h"
#include "mediapipe/tasks/cc/text/text_classifier/proto/text_classifier_graph_options.pb.h"
#include "tensorflow/lite/core/api/op_resolver.h"

namespace mediapipe {
namespace tasks {
namespace text {
namespace text_classifier {

namespace {

ConvertToClassificationResult;
using ::mediapipe::tasks::components::containers::proto::ClassificationResult;

constexpr char kTextStreamName[] =;
constexpr char kTextTag[] =;
constexpr char kClassificationsStreamName[] =;
constexpr char kClassificationsTag[] =;
constexpr char kSubgraphTypeName[] =;

// Creates a MediaPipe graph config that only contains a single subgraph node of
// type "TextClassifierGraph".
CalculatorGraphConfig CreateGraphConfig(
    std::unique_ptr<proto::TextClassifierGraphOptions> options) {}

// Converts the user-facing TextClassifierOptions struct to the internal
// TextClassifierGraphOptions proto.
std::unique_ptr<proto::TextClassifierGraphOptions>
ConvertTextClassifierOptionsToProto(TextClassifierOptions* options) {}

}  // namespace

absl::StatusOr<std::unique_ptr<TextClassifier>> TextClassifier::Create(
    std::unique_ptr<TextClassifierOptions> options) {}

absl::StatusOr<TextClassifierResult> TextClassifier::Classify(
    absl::string_view text) {}

}  // namespace text_classifier
}  // namespace text
}  // namespace tasks
}  // namespace mediapipe