WordSegmenter.dictionaryWithContentLocale constructor

WordSegmenter.dictionaryWithContentLocale(
  1. Locale locale
)

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

Throws DataError on failure.

Implementation

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