52 lines
1.2 KiB
Dart
52 lines
1.2 KiB
Dart
import 'package:jadb/util/lemmatizer/lemmatizer.dart';
|
|
import 'package:jadb/util/lemmatizer/rules/godan_verbs.dart';
|
|
import 'package:jadb/util/lemmatizer/rules/ichidan_verbs.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
const List<String> ichidanVerbs = [
|
|
'食べる',
|
|
'食べた',
|
|
'食べさせられた',
|
|
'食べたい',
|
|
'食べたくない',
|
|
'食べたくなかった',
|
|
];
|
|
const List<String> godanVerbs = [
|
|
'泳ぐ',
|
|
'泳いだ',
|
|
'泳げる',
|
|
// '泳げれた',
|
|
];
|
|
|
|
bool findRuleRecursively(Lemmatized result, LemmatizationRule expectedRule) {
|
|
if (result.rule == expectedRule) {
|
|
return true;
|
|
}
|
|
|
|
for (final c in result.children) {
|
|
if (findRuleRecursively(c, expectedRule)) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
void main() {
|
|
group('Lemmatize Ichidan Verbs', () {
|
|
for (final v in ichidanVerbs) {
|
|
test('Lemmatize Ichidan Verb $v', () {
|
|
expect(findRuleRecursively(lemmatize(v), ichidanVerbBase), true);
|
|
});
|
|
}
|
|
});
|
|
|
|
group('Lemmatize Godan Verbs', () {
|
|
for (final v in godanVerbs) {
|
|
test('Lemmatize Godan Verb $v', () {
|
|
expect(findRuleRecursively(lemmatize(v), godanVerbBase), true);
|
|
});
|
|
}
|
|
});
|
|
}
|