WordSegmenter.lstmWithContentLocaleAndProvider constructor

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

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

Throws DataError on failure.

Implementation

factory WordSegmenter.lstmWithContentLocaleAndProvider(DataProvider provider, Locale locale) {
  final result = _icu4x_WordSegmenter_create_lstm_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, []);
}