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

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

#include <Converter.hpp>

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

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:

Member Function Documentation

◆ Convert()

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

Converts text and returns the result.

Parameters
textUTF-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: