lemmatizer/rules: name all rules as separate static variables

This commit is contained in:
2026-03-01 11:34:53 +09:00
parent 1d9928ade1
commit c06fff9e5a
3 changed files with 821 additions and 697 deletions
+480 -428
View File
@@ -1,457 +1,509 @@
import 'package:jadb/util/lemmatizer/lemmatizer.dart'; import 'package:jadb/util/lemmatizer/lemmatizer.dart';
List<LemmatizationRule> godanVerbLemmatizationRules = [ final LemmatizationRule godanVerbBase = LemmatizationRule(
LemmatizationRule( name: 'Godan verb - base form',
name: 'Godan verb - base form', terminal: true,
terminal: true, pattern: AllomorphPattern(
pattern: AllomorphPattern( patterns: {
patterns: { '': [''],
'': [''], '': [''],
'': [''], '': [''],
'': [''], '': [''],
'': [''], '': [''],
'': [''], '': [''],
'': [''], '': [''],
'': [''], '': [''],
'': [''], '': [''],
'': [''], },
}, type: LemmatizationRuleType.suffix,
type: LemmatizationRuleType.suffix,
),
validChildClasses: [WordClass.godanVerb],
wordClass: WordClass.godanVerb,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - negative form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'わない': [''], final LemmatizationRule godanVerbNegative = LemmatizationRule(
'かない': [''], name: 'Godan verb - negative form',
'がない': [''], pattern: AllomorphPattern(
'さない': [''], patterns: {
'ない': [''], 'ない': [''],
'ない': [''], 'ない': [''],
'ない': [''], 'ない': [''],
'ない': [''], 'ない': [''],
'ない': [''], 'ない': [''],
}, 'なない': [''],
type: LemmatizationRuleType.suffix, 'ばない': [''],
), 'まない': [''],
validChildClasses: [WordClass.godanVerb], 'らない': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - past form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'した': [''], final LemmatizationRule godanVerbPast = LemmatizationRule(
'った': ['', '', ''], name: 'Godan verb - past form',
'んだ': ['', '', ''], pattern: AllomorphPattern(
'いだ': [''], patterns: {
'': [''], '': [''],
}, 'った': ['', '', ''],
type: LemmatizationRuleType.suffix, 'んだ': ['', '', ''],
), 'いだ': [''],
validChildClasses: [WordClass.godanVerb], 'いた': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - te-form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'いて': ['', ''], final LemmatizationRule godanVerbTe = LemmatizationRule(
'して': [''], name: 'Godan verb - te-form',
'って': ['', '', ''], pattern: AllomorphPattern(
'んで': ['', '', ''], patterns: {
}, 'いて': ['', ''],
type: LemmatizationRuleType.suffix, 'して': [''],
), 'って': ['', '', ''],
validChildClasses: [WordClass.godanVerb], 'んで': ['', '', ''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - te-form with いる', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'いている': ['', ''], final LemmatizationRule godanVerbTeiru = LemmatizationRule(
'している': [''], name: 'Godan verb - te-form with いる',
'っている': ['', '', ''], pattern: AllomorphPattern(
'んでいる': ['', '', ''], patterns: {
}, 'いている': ['', ''],
type: LemmatizationRuleType.suffix, 'している': [''],
), 'っている': ['', '', ''],
validChildClasses: [WordClass.godanVerb], 'んでいる': ['', '', ''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - te-form with いた', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'いていた': ['', ''], final LemmatizationRule godanVerbTeita = LemmatizationRule(
'していた': [''], name: 'Godan verb - te-form with いた',
'っていた': ['', '', ''], pattern: AllomorphPattern(
'んでいた': ['', '', ''], patterns: {
}, 'いていた': ['', ''],
type: LemmatizationRuleType.suffix, 'していた': [''],
), 'っていた': ['', '', ''],
validChildClasses: [WordClass.godanVerb], 'んでいた': ['', '', ''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - conditional form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'けば': [''], final LemmatizationRule godanVerbConditional = LemmatizationRule(
'げば': [''], name: 'Godan verb - conditional form',
'せば': [''], pattern: AllomorphPattern(
'てば': ['', '', ''], patterns: {
'': [''], '': [''],
'': [''], '': [''],
'': [''], '': [''],
}, 'てば': ['', '', ''],
type: LemmatizationRuleType.suffix, 'ねば': [''],
), 'べば': [''],
validChildClasses: [WordClass.godanVerb], 'めば': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - volitional form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'おう': [''], final LemmatizationRule godanVerbVolitional = LemmatizationRule(
'こう': [''], name: 'Godan verb - volitional form',
'ごう': [''], pattern: AllomorphPattern(
'そう': [''], patterns: {
'': ['', '', ''], '': [''],
'': [''], '': [''],
'': [''], '': [''],
'': [''], '': [''],
}, 'とう': ['', '', ''],
type: LemmatizationRuleType.suffix, 'のう': [''],
), 'ぼう': [''],
validChildClasses: [WordClass.godanVerb], 'もう': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - potential form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'ける': [''], final LemmatizationRule godanVerbPotential = LemmatizationRule(
'げる': [''], name: 'Godan verb - potential form',
'せる': [''], pattern: AllomorphPattern(
'てる': ['', '', ''], patterns: {
'': [''], '': [''],
'': [''], '': [''],
'': [''], '': [''],
}, 'てる': ['', '', ''],
type: LemmatizationRuleType.suffix, 'ねる': [''],
), 'べる': [''],
validChildClasses: [WordClass.godanVerb], 'める': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - passive form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'かれる': [''], final LemmatizationRule godanVerbPassive = LemmatizationRule(
'がれる': [''], name: 'Godan verb - passive form',
'される': [''], pattern: AllomorphPattern(
'たれる': ['', '', ''], patterns: {
'れる': [''], 'れる': [''],
'れる': [''], 'れる': [''],
'れる': [''], 'れる': [''],
}, 'たれる': ['', '', ''],
type: LemmatizationRuleType.suffix, 'なれる': [''],
), 'ばれる': [''],
validChildClasses: [WordClass.godanVerb], 'まれる': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - causative form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'かせる': [''], final LemmatizationRule godanVerbCausative = LemmatizationRule(
'がせる': [''], name: 'Godan verb - causative form',
'させる': [''], pattern: AllomorphPattern(
'たせる': ['', '', ''], patterns: {
'せる': [''], 'せる': [''],
'せる': [''], 'せる': [''],
'せる': [''], 'せる': [''],
}, 'たせる': ['', '', ''],
type: LemmatizationRuleType.suffix, 'なせる': [''],
), 'ばせる': [''],
validChildClasses: [WordClass.godanVerb], 'ませる': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - causative-passive form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'かされる': [''], final LemmatizationRule godanVerbCausativePassive = LemmatizationRule(
'がされる': [''], name: 'Godan verb - causative-passive form',
'される': [''], pattern: AllomorphPattern(
'たされる': ['', '', ''], patterns: {
'される': [''], 'される': [''],
'される': [''], 'される': [''],
'される': [''], 'される': [''],
}, 'たされる': ['', '', ''],
type: LemmatizationRuleType.suffix, 'なされる': [''],
), 'ばされる': [''],
validChildClasses: [WordClass.godanVerb], 'まされる': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - imperative form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'': [''], final LemmatizationRule godanVerbImperative = LemmatizationRule(
'': [''], name: 'Godan verb - imperative form',
'': [''], pattern: AllomorphPattern(
'': [''], patterns: {
'': ['', '', ''], '': [''],
'': [''], '': [''],
'': [''], '': [''],
'': [''], '': [''],
}, '': ['', '', ''],
type: LemmatizationRuleType.suffix, '': [''],
), '': [''],
validChildClasses: [WordClass.godanVerb], '': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - negative past form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'わなかった': [''], final LemmatizationRule godanVerbNegativePast = LemmatizationRule(
'かなかった': [''], name: 'Godan verb - negative past form',
'がなかった': [''], pattern: AllomorphPattern(
'さなかった': [''], patterns: {
'なかった': [''], 'なかった': [''],
'なかった': [''], 'なかった': [''],
'なかった': [''], 'なかった': [''],
'なかった': [''], 'なかった': [''],
'なかった': [''], 'なかった': [''],
}, 'ななかった': [''],
type: LemmatizationRuleType.suffix, 'ばなかった': [''],
), 'まなかった': [''],
validChildClasses: [WordClass.godanVerb], 'らなかった': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - negative te-form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'わなくて': [''], final LemmatizationRule godanVerbNegativeTe = LemmatizationRule(
'かなくて': [''], name: 'Godan verb - negative te-form',
'がなくて': [''], pattern: AllomorphPattern(
'さなくて': [''], patterns: {
'なくて': [''], 'なくて': [''],
'なくて': [''], 'なくて': [''],
'なくて': [''], 'なくて': [''],
'なくて': [''], 'なくて': [''],
'なくて': [''], 'なくて': [''],
}, 'ななくて': [''],
type: LemmatizationRuleType.suffix, 'ばなくて': [''],
), 'まなくて': [''],
validChildClasses: [WordClass.godanVerb], 'らなくて': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - negative conditional form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'わなければ': [''], final LemmatizationRule godanVerbNegativeConditional = LemmatizationRule(
'かなければ': [''], name: 'Godan verb - negative conditional form',
'がなければ': [''], pattern: AllomorphPattern(
'さなければ': [''], patterns: {
'なければ': [''], 'なければ': [''],
'なければ': [''], 'なければ': [''],
'なければ': [''], 'なければ': [''],
'なければ': [''], 'なければ': [''],
'なければ': [''], 'なければ': [''],
}, 'ななければ': [''],
type: LemmatizationRuleType.suffix, 'ばなければ': [''],
), 'まなければ': [''],
validChildClasses: [WordClass.godanVerb], 'らなければ': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - negative volitional form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'うまい': [''], final LemmatizationRule godanVerbNegativeVolitional = LemmatizationRule(
'くまい': [''], name: 'Godan verb - negative volitional form',
'ぐまい': [''], pattern: AllomorphPattern(
'すまい': [''], patterns: {
'まい': ['', '', ''], 'まい': [''],
'まい': [''], 'まい': [''],
'まい': [''], 'まい': [''],
'まい': [''], 'まい': [''],
}, 'つまい': ['', '', ''],
type: LemmatizationRuleType.suffix, 'ぬまい': [''],
), 'ぶまい': [''],
validChildClasses: [WordClass.godanVerb], 'むまい': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - negative potential form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'けない': [''], final LemmatizationRule godanVerbNegativePotential = LemmatizationRule(
'げない': [''], name: 'Godan verb - negative potential form',
'せない': [''], pattern: AllomorphPattern(
'てない': ['', '', ''], patterns: {
'ない': [''], 'ない': [''],
'ない': [''], 'ない': [''],
'ない': [''], 'ない': [''],
}, 'てない': ['', '', ''],
type: LemmatizationRuleType.suffix, 'ねない': [''],
), 'べない': [''],
validChildClasses: [WordClass.godanVerb], 'めない': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - negative passive form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'かれない': [''], final LemmatizationRule godanVerbNegativePassive = LemmatizationRule(
'がれない': [''], name: 'Godan verb - negative passive form',
'されない': [''], pattern: AllomorphPattern(
'たれない': ['', '', ''], patterns: {
'れない': [''], 'れない': [''],
'れない': [''], 'れない': [''],
'れない': [''], 'れない': [''],
}, 'たれない': ['', '', ''],
type: LemmatizationRuleType.suffix, 'なれない': [''],
), 'ばれない': [''],
validChildClasses: [WordClass.godanVerb], 'まれない': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - negative causative form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'かせない': [''], final LemmatizationRule godanVerbNegativeCausative = LemmatizationRule(
'がせない': [''], name: 'Godan verb - negative causative form',
'させない': [''], pattern: AllomorphPattern(
'たせない': ['', '', ''], patterns: {
'せない': [''], 'せない': [''],
'せない': [''], 'せない': [''],
'せない': [''], 'せない': [''],
}, 'たせない': ['', '', ''],
type: LemmatizationRuleType.suffix, 'なせない': [''],
), 'ばせない': [''],
validChildClasses: [WordClass.godanVerb], 'ませない': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - negative causative-passive form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'かされない': [''], final LemmatizationRule godanVerbNegativeCausativePassive = LemmatizationRule(
'がされない': [''], name: 'Godan verb - negative causative-passive form',
'されない': [''], pattern: AllomorphPattern(
'たされない': ['', '', ''], patterns: {
'されない': [''], 'されない': [''],
'されない': [''], 'されない': [''],
'されない': [''], 'されない': [''],
}, 'たされない': ['', '', ''],
type: LemmatizationRuleType.suffix, 'なされない': [''],
), 'ばされない': [''],
validChildClasses: [WordClass.godanVerb], 'まされない': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - negative imperative form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'うな': [''], final LemmatizationRule godanVerbNegativeImperative = LemmatizationRule(
'くな': [''], name: 'Godan verb - negative imperative form',
'ぐな': [''], pattern: AllomorphPattern(
'すな': [''], patterns: {
'': [''], '': [''],
'': [''], '': [''],
'': [''], '': [''],
'': [''], '': [''],
'': [''], '': [''],
}, 'ぬな': [''],
type: LemmatizationRuleType.suffix, 'ぶな': [''],
), 'むな': [''],
validChildClasses: [WordClass.godanVerb], 'るな': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - desire form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'きたい': [''], final LemmatizationRule godanVerbDesire = LemmatizationRule(
'ぎたい': [''], name: 'Godan verb - desire form',
'したい': [''], pattern: AllomorphPattern(
'ちたい': [''], patterns: {
'たい': [''], 'たい': [''],
'たい': [''], 'たい': [''],
'たい': [''], 'たい': [''],
'たい': [''], 'たい': [''],
}, 'にたい': [''],
type: LemmatizationRuleType.suffix, 'びたい': [''],
), 'みたい': [''],
validChildClasses: [WordClass.godanVerb], 'りたい': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - negative desire form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'いたくない': [''], final LemmatizationRule godanVerbNegativeDesire = LemmatizationRule(
'きたくない': [''], name: 'Godan verb - negative desire form',
'ぎたくない': [''], pattern: AllomorphPattern(
'したくない': [''], patterns: {
'たくない': [''], 'たくない': [''],
'たくない': [''], 'たくない': [''],
'たくない': [''], 'たくない': [''],
'たくない': [''], 'たくない': [''],
'たくない': [''], 'たくない': [''],
}, 'にたくない': [''],
type: LemmatizationRuleType.suffix, 'びたくない': [''],
), 'みたくない': [''],
validChildClasses: [WordClass.godanVerb], 'りたくない': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - past desire form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'きたかった': [''], final LemmatizationRule godanVerbPastDesire = LemmatizationRule(
'ぎたかった': [''], name: 'Godan verb - past desire form',
'したかった': [''], pattern: AllomorphPattern(
'ちたかった': [''], patterns: {
'たかった': [''], 'たかった': [''],
'たかった': [''], 'たかった': [''],
'たかった': [''], 'たかった': [''],
'たかった': [''], 'たかった': [''],
}, 'にたかった': [''],
type: LemmatizationRuleType.suffix, 'びたかった': [''],
), 'みたかった': [''],
validChildClasses: [WordClass.godanVerb], 'りたかった': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
LemmatizationRule( validChildClasses: [WordClass.godanVerb],
name: 'Godan verb - negative past desire form', wordClass: WordClass.godanVerb,
pattern: AllomorphPattern( );
patterns: {
'いたくなかった': [''], final LemmatizationRule godanVerbNegativePastDesire = LemmatizationRule(
'きたくなかった': [''], name: 'Godan verb - negative past desire form',
'ぎたくなかった': [''], pattern: AllomorphPattern(
'したくなかった': [''], patterns: {
'たくなかった': [''], 'たくなかった': [''],
'たくなかった': [''], 'たくなかった': [''],
'たくなかった': [''], 'たくなかった': [''],
'たくなかった': [''], 'たくなかった': [''],
'たくなかった': [''], 'たくなかった': [''],
}, 'にたくなかった': [''],
type: LemmatizationRuleType.suffix, 'びたくなかった': [''],
), 'みたくなかった': [''],
validChildClasses: [WordClass.godanVerb], 'りたくなかった': [''],
wordClass: WordClass.godanVerb, },
type: LemmatizationRuleType.suffix,
), ),
validChildClasses: [WordClass.godanVerb],
wordClass: WordClass.godanVerb,
);
final List<LemmatizationRule> godanVerbLemmatizationRules = [
godanVerbBase,
godanVerbNegative,
godanVerbPast,
godanVerbTe,
godanVerbTeiru,
godanVerbTeita,
godanVerbConditional,
godanVerbVolitional,
godanVerbPotential,
godanVerbPassive,
godanVerbCausative,
godanVerbCausativePassive,
godanVerbImperative,
godanVerbNegativePast,
godanVerbNegativeTe,
godanVerbNegativeConditional,
godanVerbNegativeVolitional,
godanVerbNegativePotential,
godanVerbNegativePassive,
godanVerbNegativeCausative,
godanVerbNegativeCausativePassive,
godanVerbNegativeImperative,
godanVerbDesire,
godanVerbNegativeDesire,
godanVerbPastDesire,
godanVerbNegativePastDesire,
]; ];
+74 -58
View File
@@ -1,61 +1,77 @@
import 'package:jadb/util/lemmatizer/lemmatizer.dart'; import 'package:jadb/util/lemmatizer/lemmatizer.dart';
List<LemmatizationRule> iAdjectiveLemmatizationRules = [ final LemmatizationRule iAdjectiveBase = LemmatizationRule.simple(
LemmatizationRule.simple( name: 'I adjective - base form',
name: 'I adjective - base form', terminal: true,
terminal: true, pattern: '',
pattern: '', replacement: '',
replacement: '', validChildClasses: [WordClass.iAdjective],
validChildClasses: [WordClass.iAdjective], wordClass: WordClass.iAdjective,
wordClass: WordClass.iAdjective, );
),
LemmatizationRule.simple( final LemmatizationRule iAdjectiveNegative = LemmatizationRule.simple(
name: 'I adjective - negative form', name: 'I adjective - negative form',
pattern: 'くない', pattern: 'くない',
replacement: '', replacement: '',
validChildClasses: [WordClass.iAdjective], validChildClasses: [WordClass.iAdjective],
wordClass: WordClass.iAdjective, wordClass: WordClass.iAdjective,
), );
LemmatizationRule.simple(
name: 'I adjective - past form', final LemmatizationRule iAdjectivePast = LemmatizationRule.simple(
pattern: 'かった', name: 'I adjective - past form',
replacement: '', pattern: 'かった',
validChildClasses: [WordClass.iAdjective], replacement: '',
wordClass: WordClass.iAdjective, validChildClasses: [WordClass.iAdjective],
), wordClass: WordClass.iAdjective,
LemmatizationRule.simple( );
name: 'I adjective - negative past form',
pattern: 'くなかった', final LemmatizationRule iAdjectiveNegativePast = LemmatizationRule.simple(
replacement: '', name: 'I adjective - negative past form',
validChildClasses: [WordClass.iAdjective], pattern: 'くなかった',
wordClass: WordClass.iAdjective, replacement: '',
), validChildClasses: [WordClass.iAdjective],
LemmatizationRule.simple( wordClass: WordClass.iAdjective,
name: 'I adjective - te-form', );
pattern: 'くて',
replacement: '', final LemmatizationRule iAdjectiveTe = LemmatizationRule.simple(
validChildClasses: [WordClass.iAdjective], name: 'I adjective - te-form',
wordClass: WordClass.iAdjective, pattern: 'くて',
), replacement: '',
LemmatizationRule.simple( validChildClasses: [WordClass.iAdjective],
name: 'I adjective - conditional form', wordClass: WordClass.iAdjective,
pattern: 'ければ', );
replacement: '',
validChildClasses: [WordClass.iAdjective], final LemmatizationRule iAdjectiveConditional = LemmatizationRule.simple(
wordClass: WordClass.iAdjective, name: 'I adjective - conditional form',
), pattern: 'ければ',
LemmatizationRule.simple( replacement: '',
name: 'I adjective - volitional form', validChildClasses: [WordClass.iAdjective],
pattern: 'かろう', wordClass: WordClass.iAdjective,
replacement: '', );
validChildClasses: [WordClass.iAdjective],
wordClass: WordClass.iAdjective, final LemmatizationRule iAdjectiveVolitional = LemmatizationRule.simple(
), name: 'I adjective - volitional form',
LemmatizationRule.simple( pattern: 'かろう',
name: 'I adjective - continuative form', replacement: '',
pattern: '', validChildClasses: [WordClass.iAdjective],
replacement: '', wordClass: WordClass.iAdjective,
validChildClasses: [WordClass.iAdjective], );
wordClass: WordClass.iAdjective,
), final LemmatizationRule iAdjectiveContinuative = LemmatizationRule.simple(
name: 'I adjective - continuative form',
pattern: '',
replacement: '',
validChildClasses: [WordClass.iAdjective],
wordClass: WordClass.iAdjective,
);
final List<LemmatizationRule> iAdjectiveLemmatizationRules = [
iAdjectiveBase,
iAdjectiveNegative,
iAdjectivePast,
iAdjectiveNegativePast,
iAdjectiveTe,
iAdjectiveConditional,
iAdjectiveVolitional,
iAdjectiveContinuative,
]; ];
+267 -211
View File
@@ -1,7 +1,7 @@
import 'package:jadb/util/lemmatizer/lemmatizer.dart'; import 'package:jadb/util/lemmatizer/lemmatizer.dart';
import 'package:jadb/util/text_filtering.dart'; import 'package:jadb/util/text_filtering.dart';
List<Pattern> lookBehinds = [ final List<Pattern> _lookBehinds = [
kanjiRegex, kanjiRegex,
'', '',
'', '',
@@ -28,214 +28,270 @@ List<Pattern> lookBehinds = [
'', '',
]; ];
List<LemmatizationRule> ichidanVerbLemmatizationRules = [ final LemmatizationRule ichidanVerbBase = LemmatizationRule.simple(
LemmatizationRule.simple( name: 'Ichidan verb - base form',
name: 'Ichidan verb - base form', terminal: true,
terminal: true, pattern: '',
pattern: '', replacement: '',
replacement: '', lookAheadBehind: _lookBehinds,
lookAheadBehind: lookBehinds, validChildClasses: [WordClass.ichidanVerb],
validChildClasses: [WordClass.ichidanVerb], wordClass: WordClass.ichidanVerb,
wordClass: WordClass.ichidanVerb, );
),
LemmatizationRule.simple( final LemmatizationRule ichidanVerbNegative = LemmatizationRule.simple(
name: 'Ichidan verb - negative form', name: 'Ichidan verb - negative form',
pattern: 'ない', pattern: 'ない',
replacement: '', replacement: '',
lookAheadBehind: lookBehinds, lookAheadBehind: _lookBehinds,
validChildClasses: [WordClass.ichidanVerb], validChildClasses: [WordClass.ichidanVerb],
wordClass: WordClass.ichidanVerb, wordClass: WordClass.ichidanVerb,
), );
LemmatizationRule.simple( final LemmatizationRule ichidanVerbPast = LemmatizationRule.simple(
name: 'Ichidan verb - past form', name: 'Ichidan verb - past form',
pattern: '', pattern: '',
replacement: '', replacement: '',
lookAheadBehind: lookBehinds, lookAheadBehind: _lookBehinds,
validChildClasses: [WordClass.ichidanVerb], validChildClasses: [WordClass.ichidanVerb],
wordClass: WordClass.ichidanVerb, wordClass: WordClass.ichidanVerb,
), );
LemmatizationRule.simple(
name: 'Ichidan verb - te-form', final LemmatizationRule ichidanVerbTe = LemmatizationRule.simple(
pattern: '', name: 'Ichidan verb - te-form',
replacement: '', pattern: '',
lookAheadBehind: lookBehinds, replacement: '',
validChildClasses: [WordClass.ichidanVerb], lookAheadBehind: _lookBehinds,
wordClass: WordClass.ichidanVerb, validChildClasses: [WordClass.ichidanVerb],
), wordClass: WordClass.ichidanVerb,
LemmatizationRule.simple( );
name: 'Ichidan verb - te-form with いる',
pattern: 'ている', final LemmatizationRule ichidanVerbTeiru = LemmatizationRule.simple(
replacement: '', name: 'Ichidan verb - te-form with い',
lookAheadBehind: lookBehinds, pattern: 'ている',
validChildClasses: [WordClass.ichidanVerb], replacement: '',
wordClass: WordClass.ichidanVerb, lookAheadBehind: _lookBehinds,
), validChildClasses: [WordClass.ichidanVerb],
LemmatizationRule.simple( wordClass: WordClass.ichidanVerb,
name: 'Ichidan verb - te-form with いた', );
pattern: 'ていた',
replacement: '', final LemmatizationRule ichidanVerbTeita = LemmatizationRule.simple(
lookAheadBehind: lookBehinds, name: 'Ichidan verb - te-form with いた',
validChildClasses: [WordClass.ichidanVerb], pattern: 'ていた',
wordClass: WordClass.ichidanVerb, replacement: '',
), lookAheadBehind: _lookBehinds,
LemmatizationRule.simple( validChildClasses: [WordClass.ichidanVerb],
name: 'Ichidan verb - conditional form', wordClass: WordClass.ichidanVerb,
pattern: 'れば', );
replacement: '',
lookAheadBehind: lookBehinds, final LemmatizationRule ichidanVerbConditional = LemmatizationRule.simple(
validChildClasses: [WordClass.ichidanVerb], name: 'Ichidan verb - conditional form',
wordClass: WordClass.ichidanVerb, pattern: 'れば',
), replacement: '',
LemmatizationRule.simple( lookAheadBehind: _lookBehinds,
name: 'Ichidan verb - volitional form', validChildClasses: [WordClass.ichidanVerb],
pattern: 'よう', wordClass: WordClass.ichidanVerb,
replacement: '', );
lookAheadBehind: lookBehinds,
validChildClasses: [WordClass.ichidanVerb], final LemmatizationRule ichidanVerbVolitional = LemmatizationRule.simple(
wordClass: WordClass.ichidanVerb, name: 'Ichidan verb - volitional form',
), pattern: 'よう',
LemmatizationRule.simple( replacement: '',
name: 'Ichidan verb - potential form', lookAheadBehind: _lookBehinds,
pattern: 'られる', validChildClasses: [WordClass.ichidanVerb],
replacement: '', wordClass: WordClass.ichidanVerb,
lookAheadBehind: lookBehinds, );
validChildClasses: [WordClass.ichidanVerb],
wordClass: WordClass.ichidanVerb, final LemmatizationRule ichidanVerbPotential = LemmatizationRule.simple(
), name: 'Ichidan verb - potential form',
LemmatizationRule.simple( pattern: 'られる',
name: 'Ichidan verb - passive form', replacement: '',
pattern: 'られる', lookAheadBehind: _lookBehinds,
replacement: '', validChildClasses: [WordClass.ichidanVerb],
lookAheadBehind: lookBehinds, wordClass: WordClass.ichidanVerb,
validChildClasses: [WordClass.ichidanVerb], );
wordClass: WordClass.ichidanVerb,
), final LemmatizationRule ichidanVerbPassive = LemmatizationRule.simple(
LemmatizationRule.simple( name: 'Ichidan verb - passive form',
name: 'Ichidan verb - causative form', pattern: 'られる',
pattern: 'させ', replacement: '',
replacement: '', lookAheadBehind: _lookBehinds,
lookAheadBehind: lookBehinds, validChildClasses: [WordClass.ichidanVerb],
validChildClasses: [WordClass.ichidanVerb], wordClass: WordClass.ichidanVerb,
wordClass: WordClass.ichidanVerb, );
),
LemmatizationRule.simple( final LemmatizationRule ichidanVerbCausative = LemmatizationRule.simple(
name: 'Ichidan verb - causative passive form', name: 'Ichidan verb - causative form',
pattern: 'させられ', pattern: 'させる',
replacement: '', replacement: '',
lookAheadBehind: lookBehinds, lookAheadBehind: _lookBehinds,
validChildClasses: [WordClass.ichidanVerb], validChildClasses: [WordClass.ichidanVerb],
wordClass: WordClass.ichidanVerb, wordClass: WordClass.ichidanVerb,
), );
LemmatizationRule.simple(
name: 'Ichidan verb - imperative form', final LemmatizationRule ichidanVerbCausativePassive = LemmatizationRule.simple(
pattern: '', name: 'Ichidan verb - causative passive form',
replacement: '', pattern: 'させられ',
lookAheadBehind: lookBehinds, replacement: '',
validChildClasses: [WordClass.ichidanVerb], lookAheadBehind: _lookBehinds,
wordClass: WordClass.ichidanVerb, validChildClasses: [WordClass.ichidanVerb],
), wordClass: WordClass.ichidanVerb,
LemmatizationRule.simple( );
name: 'Ichidan verb - negative past form',
pattern: 'なかった', final LemmatizationRule ichidanVerbImperative = LemmatizationRule.simple(
replacement: '', name: 'Ichidan verb - imperative form',
lookAheadBehind: lookBehinds, pattern: '',
validChildClasses: [WordClass.ichidanVerb], replacement: '',
wordClass: WordClass.ichidanVerb, lookAheadBehind: _lookBehinds,
), validChildClasses: [WordClass.ichidanVerb],
LemmatizationRule.simple( wordClass: WordClass.ichidanVerb,
name: 'Ichidan verb - negative te-form', );
pattern: 'なくて',
replacement: '', final LemmatizationRule ichidanVerbNegativePast = LemmatizationRule.simple(
lookAheadBehind: lookBehinds, name: 'Ichidan verb - negative past form',
validChildClasses: [WordClass.ichidanVerb], pattern: 'なかった',
wordClass: WordClass.ichidanVerb, replacement: '',
), lookAheadBehind: _lookBehinds,
LemmatizationRule.simple( validChildClasses: [WordClass.ichidanVerb],
name: 'Ichidan verb - negative conditional form', wordClass: WordClass.ichidanVerb,
pattern: 'なければ', );
replacement: '',
lookAheadBehind: lookBehinds, final LemmatizationRule ichidanVerbNegativeTe = LemmatizationRule.simple(
validChildClasses: [WordClass.ichidanVerb], name: 'Ichidan verb - negative te-form',
wordClass: WordClass.ichidanVerb, pattern: 'なくて',
), replacement: '',
LemmatizationRule.simple( lookAheadBehind: _lookBehinds,
name: 'Ichidan verb - negative volitional form', validChildClasses: [WordClass.ichidanVerb],
pattern: 'なかろう', wordClass: WordClass.ichidanVerb,
replacement: '', );
lookAheadBehind: lookBehinds,
validChildClasses: [WordClass.ichidanVerb], final LemmatizationRule ichidanVerbNegativeConditional =
wordClass: WordClass.ichidanVerb, LemmatizationRule.simple(
), name: 'Ichidan verb - negative conditional form',
LemmatizationRule.simple( pattern: 'なければ',
name: 'Ichidan verb - negative potential form', replacement: '',
pattern: 'られない', lookAheadBehind: _lookBehinds,
replacement: '', validChildClasses: [WordClass.ichidanVerb],
lookAheadBehind: lookBehinds, wordClass: WordClass.ichidanVerb,
validChildClasses: [WordClass.ichidanVerb], );
wordClass: WordClass.ichidanVerb,
), final LemmatizationRule ichidanVerbNegativeVolitional =
LemmatizationRule.simple( LemmatizationRule.simple(
name: 'Ichidan verb - negative passive form', name: 'Ichidan verb - negative volitional form',
pattern: 'られない', pattern: 'なかろう',
replacement: '', replacement: '',
lookAheadBehind: lookBehinds, lookAheadBehind: _lookBehinds,
validChildClasses: [WordClass.ichidanVerb], validChildClasses: [WordClass.ichidanVerb],
wordClass: WordClass.ichidanVerb, wordClass: WordClass.ichidanVerb,
), );
LemmatizationRule.simple(
name: 'Ichidan verb - negative causative form', final LemmatizationRule ichidanVerbNegativePotential = LemmatizationRule.simple(
pattern: 'させない', name: 'Ichidan verb - negative potential form',
replacement: '', pattern: 'られない',
lookAheadBehind: lookBehinds, replacement: '',
validChildClasses: [WordClass.ichidanVerb], lookAheadBehind: _lookBehinds,
wordClass: WordClass.ichidanVerb, validChildClasses: [WordClass.ichidanVerb],
), wordClass: WordClass.ichidanVerb,
LemmatizationRule.simple( );
name: 'Ichidan verb - negative causative passive form',
pattern: 'させられない', final LemmatizationRule ichidanVerbNegativePassive = LemmatizationRule.simple(
replacement: '', name: 'Ichidan verb - negative passive form',
lookAheadBehind: lookBehinds, pattern: 'られない',
validChildClasses: [WordClass.ichidanVerb], replacement: '',
wordClass: WordClass.ichidanVerb, lookAheadBehind: _lookBehinds,
), validChildClasses: [WordClass.ichidanVerb],
LemmatizationRule.simple( wordClass: WordClass.ichidanVerb,
name: 'Ichidan verb - negative imperative form', );
pattern: 'るな',
replacement: '', final LemmatizationRule ichidanVerbNegativeCausative = LemmatizationRule.simple(
lookAheadBehind: lookBehinds, name: 'Ichidan verb - negative causative form',
validChildClasses: [WordClass.ichidanVerb], pattern: 'させない',
wordClass: WordClass.ichidanVerb, replacement: '',
), lookAheadBehind: _lookBehinds,
LemmatizationRule.simple( validChildClasses: [WordClass.ichidanVerb],
name: 'Ichidan verb - desire form', wordClass: WordClass.ichidanVerb,
pattern: 'たい', );
replacement: '',
lookAheadBehind: lookBehinds, final LemmatizationRule ichidanVerbNegativeCausativePassive =
validChildClasses: [WordClass.ichidanVerb], LemmatizationRule.simple(
wordClass: WordClass.ichidanVerb, name: 'Ichidan verb - negative causative passive form',
), pattern: 'させられない',
LemmatizationRule.simple( replacement: '',
name: 'Ichidan verb - negative desire form', lookAheadBehind: _lookBehinds,
pattern: 'たくない', validChildClasses: [WordClass.ichidanVerb],
replacement: '', wordClass: WordClass.ichidanVerb,
lookAheadBehind: lookBehinds, );
validChildClasses: [WordClass.ichidanVerb],
wordClass: WordClass.ichidanVerb, final LemmatizationRule ichidanVerbNegativeImperative =
), LemmatizationRule.simple(
LemmatizationRule.simple( name: 'Ichidan verb - negative imperative form',
name: 'Ichidan verb - past desire form', pattern: 'るな',
pattern: 'たかった', replacement: '',
replacement: '', lookAheadBehind: _lookBehinds,
lookAheadBehind: lookBehinds, validChildClasses: [WordClass.ichidanVerb],
validChildClasses: [WordClass.ichidanVerb], wordClass: WordClass.ichidanVerb,
wordClass: WordClass.ichidanVerb, );
),
LemmatizationRule.simple( final LemmatizationRule ichidanVerbDesire = LemmatizationRule.simple(
name: 'Ichidan verb - negative past desire form', name: 'Ichidan verb - desire form',
pattern: 'くなかった', pattern: '',
replacement: '', replacement: '',
lookAheadBehind: lookBehinds, lookAheadBehind: _lookBehinds,
validChildClasses: [WordClass.ichidanVerb], validChildClasses: [WordClass.ichidanVerb],
wordClass: WordClass.ichidanVerb, wordClass: WordClass.ichidanVerb,
), );
final LemmatizationRule ichidanVerbNegativeDesire = LemmatizationRule.simple(
name: 'Ichidan verb - negative desire form',
pattern: 'たくない',
replacement: '',
lookAheadBehind: _lookBehinds,
validChildClasses: [WordClass.ichidanVerb],
wordClass: WordClass.ichidanVerb,
);
final LemmatizationRule ichidanVerbPastDesire = LemmatizationRule.simple(
name: 'Ichidan verb - past desire form',
pattern: 'たかった',
replacement: '',
lookAheadBehind: _lookBehinds,
validChildClasses: [WordClass.ichidanVerb],
wordClass: WordClass.ichidanVerb,
);
final LemmatizationRule ichidanVerbNegativePastDesire =
LemmatizationRule.simple(
name: 'Ichidan verb - negative past desire form',
pattern: 'たくなかった',
replacement: '',
lookAheadBehind: _lookBehinds,
validChildClasses: [WordClass.ichidanVerb],
wordClass: WordClass.ichidanVerb,
);
final List<LemmatizationRule> ichidanVerbLemmatizationRules = [
ichidanVerbBase,
ichidanVerbNegative,
ichidanVerbPast,
ichidanVerbTe,
ichidanVerbTeiru,
ichidanVerbTeita,
ichidanVerbConditional,
ichidanVerbVolitional,
ichidanVerbPotential,
ichidanVerbPassive,
ichidanVerbCausative,
ichidanVerbCausativePassive,
ichidanVerbImperative,
ichidanVerbNegativePast,
ichidanVerbNegativeTe,
ichidanVerbNegativeConditional,
ichidanVerbNegativeVolitional,
ichidanVerbNegativePotential,
ichidanVerbNegativePassive,
ichidanVerbNegativeCausative,
ichidanVerbNegativeCausativePassive,
ichidanVerbNegativeImperative,
ichidanVerbDesire,
ichidanVerbNegativeDesire,
ichidanVerbPastDesire,
ichidanVerbNegativePastDesire,
]; ];