WordSegmenter.dictionaryWithContentLocaleAndProvider constructor

WordSegmenter.dictionaryWithContentLocaleAndProvider(
  1. DataProvider provider,
  2. Locale locale
)

Construct an 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 for more information.

Throws DataError on failure.

Implementation

factory WordSegmenter.dictionaryWithContentLocaleAndProvider(DataProvider provider, Locale locale) {
  final result = _icu4x_WordSegmenter_create_dictionary_with_content_locale_and_provider_mv1(provider._ffi, locale._ffi);
  if (!result.isOk) {
    throw DataError.values[result.union.err];
  }
  return WordSegmenter._fromFfi(result.union.ok, []);
}