Open Chinese Convert 1.3.2+gad37fd0a6.dirty
A project for conversion between Traditional and Simplified Chinese
Loading...
Searching...
No Matches
opencc::PipelineConverter Class Reference

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 <PipelineConverter.hpp>

Inheritance diagram for opencc::PipelineConverter:
opencc::Converter

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)
inlineexplicit
Parameters
stagesOrdered list of converters to apply in sequence.

Member Function Documentation

◆ Convert()

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

Converts text and returns the result.

Parameters
textUTF-8 input; need not be null-terminated.

Implements opencc::Converter.

◆ GetConversionChain()

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

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

Implements opencc::Converter.

◆ GetSegmentation()

SegmentationPtr PipelineConverter::GetSegmentation ( ) const
overridevirtual

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

Implements opencc::Converter.

◆ Inspect()

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

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: