Loading...
Searching...
No Matches
opencc::ConfigBasedConverter Class Reference

A `Converter` produced by loading a JSON config that includes a `normalization` pre-pass. More...

`#include <src/ConfigBasedConverter.hpp>`

Inheritance diagram for opencc::ConfigBasedConverter:

## Public Member Functions

| ConfigBasedConverter (ConverterPtr normConverter, ConverterPtr mainConverter)
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` produced by loading a JSON config that includes a `normalization` pre-pass.

Internally it runs `normConverter` then `mainConverter`, exactly like a two-stage `PipelineConverter`. The difference is that `GetConversionChain()` and `GetSegmentation()` delegate to `mainConverter` rather than returning `nullptr`, so that external consumers (e.g. librime) that introspect the converter see the config's primary conversion chain instead of a null pointer.

## Member Function Documentation

## Convert()

std::string opencc::ConfigBasedConverter::Convert | ( | std::string_view | text | ) | const

inline override virtual

Converts `text` and returns the result.

Parameters

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

Implements opencc::Converter.

## GetConversionChain()

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

inline override virtual

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::ConfigBasedConverter::GetSegmentation | ( |  | ) | const

inline override virtual

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

`PipelineConverter`).

Implements opencc::Converter.

## Inspect()

ConversionInspectionResult opencc::ConfigBasedConverter::Inspect | ( | std::string_view | text | ) | const

inline override 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.

Implements opencc::Converter.

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

- ConfigBasedConverter.hpp