ringo 0.0.2 copy "ringo: ^0.0.2" to clipboard
ringo: ^0.0.2 copied to clipboard

Morphological analysis of Japanese sentences. This Flutter plugin helps you to analyze Japanese sentences.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:ringo/ringo.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  Ringo _ringo;

  final tokenized = StringBuffer();
  final controller = TextEditingController();

  @override
  void initState() {
    super.initState();
    _initRingo();
    controller.addListener(_controllerListener);
    //_ringo = await Ringo.init();

    //final result = _ringo.tokenize('吾輩はRingoである');
    //print(result);
  }

  Future _initRingo() async {
    _ringo = await Ringo.init();

  }

  void _controllerListener() {
    tokenized.clear();
    final words = _ringo.tokenize(controller.text);
    for (final word in words) {
      tokenized.write('$word\n');
      setState(() {});
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Ringo'),
        ),
        body: Padding(
          padding: EdgeInsets.all(10),
          child: Column(
            children: [
              TextField(
                controller: controller,
              ),
              Padding(padding: EdgeInsets.all(10)),
              Center(
                child: Text(
                  'result\n\n$tokenized',
                  textAlign: TextAlign.center,
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
7
likes
140
points
26
downloads

Publisher

verified publisherkawa.dev

Weekly Downloads

Morphological analysis of Japanese sentences. This Flutter plugin helps you to analyze Japanese sentences.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on ringo