Open Chinese Convert: opencc::AnnotatedConversion Struct Reference

Open Chinese Convert 1.4.2+g71621a0e1.dirty A project for conversion between Traditional and Simplified Chinese

Loading...
Searching...
No Matches
Public Attributes | List of all members
opencc::AnnotatedConversion Struct Reference

Result of ConvertWithAmbiguities(): the converted text plus the spans where the conversion is one-to-many. More...

`#include <src/ConversionAmbiguities.hpp>`

## Public Attributes
std::string | output
std::vector< std::string > | sources
std::vector< AmbiguousSpan > | ambiguities
bool | analyzed = true
| False when the converter could not be analyzed (no single conversion chain, e.g.

## Detailed Description

Result of ConvertWithAmbiguities(): the converted text plus the spans where the conversion is one-to-many.

`output` is byte-identical to Converter::Convert() on the same input. `sources` holds the deduplicated input slices that produced ambiguous spans, in order of first appearance; input text repeats heavily in practice, so spans reference sources by index instead of embedding a copy (and callers can memoize GetAllConversions() per unique source). `ambiguities` is sorted by outputOffset and spans do not overlap.

For a converter with a normalization pre-pass (e.g. s2t.json), sources are slices of the normalized input, mirroring GetAllConversions().

## Member Data Documentation

## ◆ analyzed

bool opencc::AnnotatedConversion::analyzed = true

False when the converter could not be analyzed (no single conversion chain, e.g.

PipelineConverter): output is still the plain conversion result, but empty ambiguities then means "unknown", not "none".

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

- ConversionAmbiguities.hpp