lib/util/lemmatizer: init
This commit is contained in:
46
lib/cli/commands/lemmatize.dart
Normal file
46
lib/cli/commands/lemmatize.dart
Normal file
@@ -0,0 +1,46 @@
|
||||
// import 'dart:io';
|
||||
|
||||
// import 'package:jadb/_data_ingestion/open_local_db.dart';
|
||||
import 'package:jadb/cli/args.dart';
|
||||
|
||||
import 'package:args/command_runner.dart';
|
||||
import 'package:jadb/util/lemmatizer/lemmatizer.dart';
|
||||
|
||||
class Lemmatize extends Command {
|
||||
final name = "lemmatize";
|
||||
final description = "Lemmatize a word using the Jadb lemmatizer";
|
||||
|
||||
Lemmatize() {
|
||||
addLibsqliteArg(argParser);
|
||||
addJadbArg(argParser);
|
||||
argParser.addOption(
|
||||
'word',
|
||||
abbr: 'w',
|
||||
help: 'The word to search for.',
|
||||
valueHelp: 'WORD',
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> run() async {
|
||||
// if (argResults!.option('libsqlite') == null ||
|
||||
// argResults!.option('jadb') == null) {
|
||||
// print(argParser.usage);
|
||||
// exit(64);
|
||||
// }
|
||||
|
||||
// final db = await openLocalDb(
|
||||
// jadbPath: argResults!.option('jadb')!,
|
||||
// libsqlitePath: argResults!.option('libsqlite')!,
|
||||
// );
|
||||
|
||||
final String searchWord = argResults!.option('word') ?? '食べたくない';
|
||||
|
||||
final time = Stopwatch()..start();
|
||||
final result = lemmatize(searchWord);
|
||||
time.stop();
|
||||
|
||||
print(result.toString());
|
||||
|
||||
print("Lemmatization took ${time.elapsedMilliseconds}ms");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user