Loading...
Searching...
No Matches
opencc::PipelineConverter Class Reference
OpenCC C++ Comprehensive API

A `Converter` that passes text through a sequence of `Converter` stages in order, feeding the output of each stage as input to the next. More...

`#include <src/PipelineConverter.hpp>`

Inheritance diagram for opencc::PipelineConverter:

## Public Member Functions

| PipelineConverter (std::vector< ConverterPtr > stages)
std::string | Convert (std::string_view text) const override
| Converts `text` and returns the result.
ConversionInspectionResult | Inspect (std::string_view text) const override
| Returns an inspection result with `input` and `output` populated.
SegmentationPtr | GetSegmentation () const override
| Returns the last stage's segmentation, or `nullptr` for an empty pipeline.
ConversionChainPtr | GetConversionChain () const override
| Always returns `nullptr`; a pipeline has no single conversion chain.

## Detailed Description

A `Converter` that passes text through a sequence of `Converter` stages in order, feeding the output of each stage as input to the next.

This enables multi-step conversion schemes where different segmentation strategies or dictionary sets are needed at each step. For example, the `s2twp` config first converts Simplified to Traditional (stage 1) and then applies Taiwan-specific phrase substitution (stage 2).

Note
  `GetConversionChain()` always returns `nullptr` because a pipeline has no single chain. `GetSegmentation()` returns the last stage's segmentation as a best-effort representative.

## Constructor & Destructor Documentation

## PipelineConverter()

opencc::PipelineConverter::PipelineConverter | ( | std::vector< ConverterPtr > | stages | ) |

inline explicit

Parameters

  stages | Ordered list of converters to apply in sequence.

## Member Function Documentation

## Convert()

std::string PipelineConverter::Convert | ( | std::string_view | text | ) | const

override virtual

Converts `text` and returns the result.

Parameters

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

Implements opencc::Converter.

## GetConversionChain()

ConversionChainPtr opencc::PipelineConverter::GetConversionChain | ( |  | ) | const

inline override virtual

Always returns `nullptr`; a pipeline has no single conversion chain.

Implements opencc::Converter.

## GetSegmentation()

SegmentationPtr PipelineConverter::GetSegmentation | ( |  | ) | const

override virtual

Returns the last stage's segmentation, or `nullptr` for an empty pipeline.

Implements opencc::Converter.

## Inspect()

ConversionInspectionResult PipelineConverter::Inspect | ( | std::string_view | text | ) | const

override virtual

Returns an inspection result with `input` and `output` populated.

Per-stage segment detail is not available at the pipeline level.

Implements opencc::Converter.

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

- PipelineConverter.hpp
- PipelineConverter.cpp