DocWire SDK
DocWire SDK: Award-winning modern data processing in C++20. SourceForge Community Choice & Microsoft support. AI-driven processing. Supports nearly 100 data formats, including email boxes and OCR. Boost efficiency in text extraction, web data extraction, data mining, document analysis. Offline processing possible for security and confidentiality
ct2_runner.h
1 /*********************************************************************************************************************************************/
2 /* DocWire SDK: Award-winning modern data processing in C++20. SourceForge Community Choice & Microsoft support. AI-driven processing. */
3 /* Supports nearly 100 data formats, including email boxes and OCR. Boost efficiency in text extraction, web data extraction, data mining, */
4 /* document analysis. Offline processing possible for security and confidentiality */
5 /* */
6 /* Copyright (c) SILVERCODERS Ltd, http://silvercoders.com */
7 /* Project homepage: https://github.com/docwire/docwire */
8 /* */
9 /* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-DocWire-Commercial */
10 /*********************************************************************************************************************************************/
11 
12 #ifndef DOCWIRE_AI_CT2_RUNNER_H
13 #define DOCWIRE_AI_CT2_RUNNER_H
14 
15 #include "ai_ct2_export.h"
16 #include "pimpl.h"
17 #include <filesystem>
18 #include <vector>
19 #include <string>
20 #include "ai_runner.h"
21 
22 namespace docwire::ai::ct2
23 {
24 
32 class DOCWIRE_AI_CT2_EXPORT ct2_runner : public ai_runner, public with_pimpl<ct2_runner>
33 {
34 public:
39  ct2_runner(const std::filesystem::path& model_data_path);
40 
46  std::string process(const std::string& input) override;
47 
53  std::vector<double> embed(const std::string& input) override;
54 
59  virtual void unload() override;
60 };
61 
62 } // namespace docwire::ai::ct2
63 
64 #endif // DOCWIRE_AI_CT2_RUNNER_H
Abstract interface for AI model runners.
Definition: ai_runner.h:42
Class representing the CTranslate2 AI model loaded to memory.
Definition: ct2_runner.h:33
std::string process(const std::string &input) override
Process input text using the model.
std::vector< double > embed(const std::string &input) override
Create embedding for the input text using the model.
ct2_runner(const std::filesystem::path &model_data_path)
Constructor. Loads model to memory.
virtual void unload() override
Unload the model and free associated resources. –!Must be thread-safe!– and safe to call concurrently...