1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#ifndef icu4x_WordSegmenter_D_HPP
#define icu4x_WordSegmenter_D_HPP
#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <memory>
#include <functional>
#include <optional>
#include <cstdlib>
#include "../diplomat_runtime.hpp"
namespace icu4x {
namespace capi { struct DataProvider; }
class DataProvider;
namespace capi { struct Locale; }
class Locale;
namespace capi { struct WordBreakIteratorLatin1; }
class WordBreakIteratorLatin1;
namespace capi { struct WordBreakIteratorUtf16; }
class WordBreakIteratorUtf16;
namespace capi { struct WordBreakIteratorUtf8; }
class WordBreakIteratorUtf8;
namespace capi { struct WordSegmenter; }
class WordSegmenter;
class DataError;
}
namespace icu4x {
namespace capi {
struct WordSegmenter;
} // namespace capi
} // namespace
namespace icu4x {
/**
* An ICU4X word-break segmenter, capable of finding word breakpoints in strings.
*
* See the [Rust documentation for `WordSegmenter`](https://docs.rs/icu/2.0.0/icu/segmenter/struct.WordSegmenter.html) for more information.
*/
class WordSegmenter {
public:
/**
* Construct an {@link WordSegmenter} with automatically selecting the best available LSTM
* or dictionary payload data, using compiled data. This does not assume any content locale.
*
* Note: currently, it uses dictionary for Chinese and Japanese, and LSTM for Burmese,
* Khmer, Lao, and Thai.
*
* See the [Rust documentation for `new_auto`](https://docs.rs/icu/2.0.0/icu/segmenter/struct.WordSegmenter.html#method.new_auto) for more information.
*/
inline static std::unique_ptr<icu4x::WordSegmenter> create_auto();
/**
* Construct an {@link WordSegmenter} with automatically selecting the best available LSTM
* or dictionary payload data, using compiled data.
*
* Note: currently, it uses dictionary for Chinese and Japanese, and LSTM for Burmese,
* Khmer, Lao, and Thai.
*
* See the [Rust documentation for `try_new_auto`](https://docs.rs/icu/2.0.0/icu/segmenter/struct.WordSegmenter.html#method.try_new_auto) for more information.
*/
inline static diplomat::result<std::unique_ptr<icu4x::WordSegmenter>, icu4x::DataError> create_auto_with_content_locale(const icu4x::Locale& locale);
/**
* Construct an {@link WordSegmenter} with automatically selecting the best available LSTM
* or dictionary payload data, using a particular data source.
*
* Note: currently, it uses dictionary for Chinese and Japanese, and LSTM for Burmese,
* Khmer, Lao, and Thai.
*
* See the [Rust documentation for `try_new_auto`](https://docs.rs/icu/2.0.0/icu/segmenter/struct.WordSegmenter.html#method.try_new_auto) for more information.
*/
inline static diplomat::result<std::unique_ptr<icu4x::WordSegmenter>, icu4x::DataError> create_auto_with_content_locale_and_provider(const icu4x::DataProvider& provider, const icu4x::Locale& locale);
/**
* Construct an {@link WordSegmenter} with LSTM payload data for Burmese, Khmer, Lao, and
* Thai, using compiled data. This does not assume any content locale.
*
* Note: currently, it uses dictionary for Chinese and Japanese, and LSTM for Burmese,
* Khmer, Lao, and Thai.
*
* See the [Rust documentation for `new_lstm`](https://docs.rs/icu/2.0.0/icu/segmenter/struct.WordSegmenter.html#method.new_lstm) for more information.
*/
inline static std::unique_ptr<icu4x::WordSegmenter> create_lstm();
/**
* Construct an {@link WordSegmenter} with LSTM payload data for Burmese, Khmer, Lao, and
* Thai, using compiled data.
*
* Note: currently, it uses dictionary for Chinese and Japanese, and LSTM for Burmese,
* Khmer, Lao, and Thai.
*
* See the [Rust documentation for `try_new_lstm`](https://docs.rs/icu/2.0.0/icu/segmenter/struct.WordSegmenter.html#method.try_new_lstm) for more information.
*/
inline static diplomat::result<std::unique_ptr<icu4x::WordSegmenter>, icu4x::DataError> create_lstm_with_content_locale(const icu4x::Locale& locale);
/**
* Construct an {@link WordSegmenter} with LSTM payload data for Burmese, Khmer, Lao, and
* Thai, using a particular data source.
*
* Note: currently, it uses dictionary for Chinese and Japanese, and LSTM for Burmese,
* Khmer, Lao, and Thai.
*
* See the [Rust documentation for `try_new_lstm`](https://docs.rs/icu/2.0.0/icu/segmenter/struct.WordSegmenter.html#method.try_new_lstm) for more information.
*/
inline static diplomat::result<std::unique_ptr<icu4x::WordSegmenter>, icu4x::DataError> create_lstm_with_content_locale_and_provider(const icu4x::DataProvider& provider, const icu4x::Locale& locale);
/**
* Construct an {@link WordSegmenter} with with dictionary payload data for Chinese, Japanese,
* Burmese, Khmer, Lao, and Thai, using compiled data. This does not assume any content locale.
*
* Note: currently, it uses dictionary for Chinese and Japanese, and dictionary for Burmese,
* Khmer, Lao, and Thai.
*
* See the [Rust documentation for `new_dictionary`](https://docs.rs/icu/2.0.0/icu/segmenter/struct.WordSegmenter.html#method.new_dictionary) for more information.
*/
inline static std::unique_ptr<icu4x::WordSegmenter> create_dictionary();
/**
* Construct an {@link WordSegmenter} with dictionary payload data for Chinese, Japanese,
* Burmese, Khmer, Lao, and Thai, using compiled data.
*
* Note: currently, it uses dictionary for Chinese and Japanese, and dictionary for Burmese,
* Khmer, Lao, and Thai.
*
* See the [Rust documentation for `try_new_dictionary`](https://docs.rs/icu/2.0.0/icu/segmenter/struct.WordSegmenter.html#method.try_new_dictionary) for more information.
*/
inline static diplomat::result<std::unique_ptr<icu4x::WordSegmenter>, icu4x::DataError> create_dictionary_with_content_locale(const icu4x::Locale& locale);
/**
* Construct an {@link WordSegmenter} with dictionary payload data for Chinese, Japanese,
* Burmese, Khmer, Lao, and Thai, using a particular data source.
*
* Note: currently, it uses dictionary for Chinese and Japanese, and dictionary for Burmese,
* Khmer, Lao, and Thai.
*
* See the [Rust documentation for `try_new_dictionary`](https://docs.rs/icu/2.0.0/icu/segmenter/struct.WordSegmenter.html#method.try_new_dictionary) for more information.
*/
inline static diplomat::result<std::unique_ptr<icu4x::WordSegmenter>, icu4x::DataError> create_dictionary_with_content_locale_and_provider(const icu4x::DataProvider& provider, const icu4x::Locale& locale);
/**
* Segments a string.
*
* Ill-formed input is treated as if errors had been replaced with REPLACEMENT CHARACTERs according
* to the WHATWG Encoding Standard.
*
* See the [Rust documentation for `segment_utf8`](https://docs.rs/icu/2.0.0/icu/segmenter/struct.WordSegmenterBorrowed.html#method.segment_utf8) for more information.
*/
inline std::unique_ptr<icu4x::WordBreakIteratorUtf8> segment(std::string_view input) const;
/**
* Segments a string.
*
* Ill-formed input is treated as if errors had been replaced with REPLACEMENT CHARACTERs according
* to the WHATWG Encoding Standard.
*
* See the [Rust documentation for `segment_utf16`](https://docs.rs/icu/2.0.0/icu/segmenter/struct.WordSegmenterBorrowed.html#method.segment_utf16) for more information.
*/
inline std::unique_ptr<icu4x::WordBreakIteratorUtf16> segment16(std::u16string_view input) const;
/**
* Segments a Latin-1 string.
*
* See the [Rust documentation for `segment_latin1`](https://docs.rs/icu/2.0.0/icu/segmenter/struct.WordSegmenterBorrowed.html#method.segment_latin1) for more information.
*/
inline std::unique_ptr<icu4x::WordBreakIteratorLatin1> segment_latin1(diplomat::span<const uint8_t> input) const;
inline const icu4x::capi::WordSegmenter* AsFFI() const;
inline icu4x::capi::WordSegmenter* AsFFI();
inline static const icu4x::WordSegmenter* FromFFI(const icu4x::capi::WordSegmenter* ptr);
inline static icu4x::WordSegmenter* FromFFI(icu4x::capi::WordSegmenter* ptr);
inline static void operator delete(void* ptr);
private:
WordSegmenter() = delete;
WordSegmenter(const icu4x::WordSegmenter&) = delete;
WordSegmenter(icu4x::WordSegmenter&&) noexcept = delete;
WordSegmenter operator=(const icu4x::WordSegmenter&) = delete;
WordSegmenter operator=(icu4x::WordSegmenter&&) noexcept = delete;
static void operator delete[](void*, size_t) = delete;
};
} // namespace
#endif // icu4x_WordSegmenter_D_HPP