WordSegmenter.lstmWithContentLocale constructor

WordSegmenter.lstmWithContentLocale(
  1. Locale locale
)

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

Throws DataError on failure.

Implementation

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