Open Chinese Convert: opencc::Converter Class Reference

Open Chinese Convert 1.3.2+gad37fd0a6.dirty A project for conversion between Traditional and Simplified Chinese

Loading...
Searching...
No Matches
Public Member Functions | List of all members
opencc::Converter Class Referenceabstract
OpenCC C++ Comprehensive API

Abstract base for full-text converters. More...

`#include <Converter.hpp>`

Inheritance diagram for opencc::Converter:

## Public Member Functions
virtual std::string | Convert (std::string_view text) const =0
| Converts `text` and returns the result.
virtual ConversionInspectionResult | Inspect (std::string_view text) const =0
| Converts `text` and returns a detailed inspection result that includes the initial segmentation, per-stage intermediate segments, and final output.
virtual SegmentationPtr | GetSegmentation () const =0
| Returns the segmentation used by this converter, or `nullptr` if the converter has no single segmentation (e.g.
virtual ConversionChainPtr | GetConversionChain () const =0
| Returns the conversion chain used by this converter, or `nullptr` if the converter has no single chain (e.g.

## Detailed Description

Abstract base for full-text converters.

A `Converter` accepts a complete UTF-8 string and returns the converted result. Internally it coordinates `Segmentation` (splitting text into words) and a `ConversionChain` (applying one or more dictionaries to each segment). Two concrete implementations are provided:

- `SingleStageConverter` — one segmentation pass + one `ConversionChain`.
- `PipelineConverter` — passes text through a sequence of `Converter` stages in order, each with its own segmentation and chain.

## Member Function Documentation

## ◆ Convert()

virtual std::string opencc::Converter::Convert | ( | std::string_view | text | ) | const
| pure virtual

Converts `text` and returns the result.

Parameters

  text | UTF-8 input; need not be null-terminated.

Implemented in opencc::PipelineConverter, and opencc::SingleStageConverter.

## ◆ GetConversionChain()

virtual ConversionChainPtr opencc::Converter::GetConversionChain | ( |  | ) | const
| pure virtual

Returns the conversion chain used by this converter, or `nullptr` if the converter has no single chain (e.g.

`PipelineConverter`).

Implemented in opencc::PipelineConverter, and opencc::SingleStageConverter.

## ◆ GetSegmentation()

virtual SegmentationPtr opencc::Converter::GetSegmentation | ( |  | ) | const
| pure virtual

Returns the segmentation used by this converter, or `nullptr` if the converter has no single segmentation (e.g.

`PipelineConverter`).

Implemented in opencc::PipelineConverter, and opencc::SingleStageConverter.

## ◆ Inspect()

virtual ConversionInspectionResult opencc::Converter::Inspect | ( | std::string_view | text | ) | const
| pure virtual

Converts `text` and returns a detailed inspection result that includes the initial segmentation, per-stage intermediate segments, and final output.

Intended for debugging and tooling rather than production conversion.

Implemented in opencc::PipelineConverter, and opencc::SingleStageConverter.

The documentation for this class was generated from the following file:

- Converter.hpp