Open Chinese Convert: opencc::SingleStageConverter Class Reference

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

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

A `Converter` that performs one segmentation pass followed by one `ConversionChain`. More...

`#include <SingleStageConverter.hpp>`

Inheritance diagram for opencc::SingleStageConverter:

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

## Detailed Description

A `Converter` that performs one segmentation pass followed by one `ConversionChain`.

This is the standard converter produced by loading a single JSON config file. It:

1. Segments the input using the supplied `Segmentation` (or treats the entire input as one segment when `segmentation` is `nullptr`).
2. Passes each segment through the `ConversionChain`, which applies one or more dictionaries in order.

## Constructor & Destructor Documentation

## ◆ SingleStageConverter()

opencc::SingleStageConverter::SingleStageConverter | ( | SegmentationPtr | segmentation,
|  | ConversionChainPtr | conversionChain )
| inline

Parameters

  segmentation | Segmentation strategy to use, or `nullptr` to skip segmentation and treat the whole input as a single segment.
  conversionChain | Ordered dictionary chain applied to each segment.

## Member Function Documentation

## ◆ Convert()

std::string SingleStageConverter::Convert | ( | std::string_view | text | ) | const
| overridevirtual

Converts `text` and returns the result.

Parameters

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

Implements opencc::Converter.

## ◆ GetConversionChain()

ConversionChainPtr opencc::SingleStageConverter::GetConversionChain | ( |  | ) | const
| inlineoverridevirtual

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

`PipelineConverter`).

Implements opencc::Converter.

## ◆ GetSegmentation()

SegmentationPtr opencc::SingleStageConverter::GetSegmentation | ( |  | ) | const
| inlineoverridevirtual

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

`PipelineConverter`).

Implements opencc::Converter.

## ◆ Inspect()

ConversionInspectionResult SingleStageConverter::Inspect | ( | std::string_view | text | ) | const
| overridevirtual

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.

Implements opencc::Converter.

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

- SingleStageConverter.hpp
- SingleStageConverter.cpp