WordSegmenter.autoWithContentLocale constructor

WordSegmenter.autoWithContentLocale(
  1. Locale locale
)

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

Throws DataError on failure.

Implementation

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