Open Chinese Convert
1.3.2+gad37fd0a6.dirty
A project for conversion between Traditional and Simplified Chinese
Toggle main menu visibility
Loading...
Searching...
No Matches
OpenCC-ver.1.3.2
src
Conversion.hpp
1
/*
2
* Open Chinese Convert
3
*
4
* Copyright 2010-2014 Carbo Kuo <byvoid@byvoid.com>
5
*
6
* Licensed under the Apache License, Version 2.0 (the "License");
7
* you may not use this file except in compliance with the License.
8
* You may obtain a copy of the License at
9
*
10
* http://www.apache.org/licenses/LICENSE-2.0
11
*
12
* Unless required by applicable law or agreed to in writing, software
13
* distributed under the License is distributed on an "AS IS" BASIS,
14
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
* See the License for the specific language governing permissions and
16
* limitations under the License.
17
*/
18
19
#pragma once
20
21
#include <string_view>
22
23
#include "Common.hpp"
24
#include "Segmentation.hpp"
25
26
namespace
opencc {
27
class
PrefixMatch
;
28
43
class
OPENCC_EXPORT
Conversion
{
44
public
:
46
Conversion
(DictPtr _dict);
47
52
std::string
Convert
(std::string_view phrase)
const
;
53
58
std::string
Convert
(
const
char
* phrase)
const
;
59
66
void
AppendConverted
(std::string_view phrase, std::string* output)
const
;
67
73
void
AppendConverted
(
const
char
* phrase, std::string* output)
const
;
74
79
SegmentsPtr
Convert
(
const
SegmentsPtr& input)
const
;
80
82
const
DictPtr
GetDict
()
const
{
return
dict; }
83
84
private
:
85
const
DictPtr dict;
86
const
std::shared_ptr<PrefixMatch> prefixMatch;
87
};
88
}
// namespace opencc
opencc::Conversion::GetDict
const DictPtr GetDict() const
Returns the backing dictionary.
Definition
Conversion.hpp:82
opencc::Conversion::Conversion
Conversion(DictPtr _dict)
Constructs a Conversion backed by dict.
Definition
Conversion.cpp:26
opencc::Conversion::AppendConverted
void AppendConverted(std::string_view phrase, std::string *output) const
Converts phrase and appends the result to output.
Definition
Conversion.cpp:29
opencc::Conversion::Convert
std::string Convert(std::string_view phrase) const
Converts phrase using prefix-match replacement and returns the result.
Definition
Conversion.cpp:66
opencc::PrefixMatch
Definition
PrefixMatch.hpp:26
Generated on
for Open Chinese Convert by
1.17.0