UDPipe Flutter

NLP tokenization, POS tagging and dependency parsing using UDPipe 1 UDPipe 1 github, built with Flutter.

Native FFI on desktop and mobile. WebAssembly via Emscripten on the web.

Platforms

Platform Status
Android βœ…
Web βœ…
Windows βœ…
Linux βœ…
macOS 🚧 Built but untested
iOS 🚧 Built but untested

Features

  • Tokenization, lemmatization, POS tagging and dependency parsing
  • Runs fully on-device (no server required)
  • Separable verb detection for German
  • 50+ pre-trained language models available from ÚFAL
  • Async batch processing keeps the UI thread free

Live Demo

https://konyshevgmbh.github.io/udpipe_flutter/

pub.dev

https://pub.dev/packages/udpipe_flutter

Getting Started

git clone --recursive https://github.com/konyshevgmbh/udpipe_flutter.git
flutter pub get
flutter run -d windows         # Windows desktop
flutter run -d linux           # Linux desktop
flutter run -d macos           # macOS desktop
flutter run                    # Android (device or emulator)

Web (WASM)

Build the WebAssembly module first, then run on Chrome:

make run-web                   # builds WASM via Docker, then launches Chrome

Requires Docker Desktop.

Model files

Download models from ufal.mff.cuni.cz/udpipe/1/models and place them in assets/models/:

Model ID File Size
gsd german-gsd.udpipe ~20 MB
hdt german-hdt.udpipe ~60 MB

Library API

import 'package:udpipe_flutter/udpipe_flutter.dart';

final svc = UDPipeService();

// Load a model once per session
await svc.init(modelId: 'gsd');

// Process text (synchronous)
final result = svc.process('Er steigt aus dem Bus aus.');

for (final sentence in result.sentences) {
  for (final token in sentence.tokens) {
    // form β†’ base form (lemma)  [POS tag]
    print('${token.form} β†’ ${token.lemma}  [${token.upos}]');
    // Er β†’ er  [PRON]
    // steigt β†’ steigen  [VERB]
    // Bus β†’ Bus  [NOUN]
  }
  for (final sv in sentence.sepVerbs) {
    print('sep.verb: ${sv.particle}+${sv.verbForm} β†’ ${sv.fullLemma}');
    // sep.verb: aus+steigt β†’ aussteigen
  }
}

// Async batch β€” runs in a background isolate
final results = await svc.processAllBlocksAsync(['Block one.', 'Block two.']);

Architecture

lib/udpipe/
  udpipe_flutter.dart          β€” public API
  src/
    conllu_parser.dart         β€” CoNLL-U parser (pure Dart)
    udpipe_types.dart          β€” data classes and result builders
    udpipe_bindings.dart       β€” dart:ffi bindings
    udpipe_service.dart        β€” conditional export (native vs web)
    udpipe_service_native.dart β€” FFI service (Windows / Linux / macOS / Android)
    udpipe_service_web.dart    β€” WASM/JS service (web)

native/
  CMakeLists.txt               β€” builds udpipe_flutter.dll / .so / .dylib
  udpipe_ffi.cpp               β€” thin C wrapper around UDPipe
  udpipe_src/                  β€” git submodule: ufal/udpipe
  build_web.sh                 β€” Emscripten build script

Tech Stack

Component Library
UI Flutter 3.x + Material 3
Native bindings ffi
NLP engine UDPipe 1 (C++, MPL 2.0)
Web engine Emscripten WASM

License

Wrapper code β€” MIT
UDPipe Β© ÚFAL MFF UK β€” MPL 2.0