Skip to content

Commit

Permalink
✨ なんじゃ、なんや、なんだに対応いたしましたわ (close #18)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiro4989 committed Jun 23, 2022
1 parent 1706003 commit fdab98c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ojosama_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,13 @@ func TestConvert(t *testing.T) {
opt: nil,
wantErr: false,
},
{
desc: "正常系: なん(じゃ|や|だ)は、いずれも「なんですの」に変換いたしますわ",
src: "なんじゃこれ。なんだこれ。なんやこれ。",
want: "なんですのこちら。なんですのこちら。なんですのこちら。",
opt: nil,
wantErr: false,
},
}

for _, tt := range tests {
Expand Down
24 changes: 24 additions & 0 deletions rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,28 @@ var (
newCond([]string{"助詞", "終助詞"}, "よ"),
},
},

{
Value: "なんですの",
Conditions: []convertConditions{
newCond(pronounGeneral, "なん"),
newCond(verbsSubAssistant, "じゃ"),
},
},
{
Value: "なんですの",
Conditions: []convertConditions{
newCond(pronounGeneral, "なん"),
newCond(auxiliaryVerb, "だ"),
},
},
{
Value: "なんですの",
Conditions: []convertConditions{
newCond(pronounGeneral, "なん"),
newCond(assistantParallel, "や"),
},
},
}

// excludeRules は変換処理を無視するルール。
Expand Down Expand Up @@ -695,6 +717,8 @@ var (
verbs = []string{"感動詞"}
verbIndependence = []string{"動詞", "自立"}
sentenceEndingParticle = []string{"助詞", "終助詞"}
verbsSubAssistant = []string{"助詞", "副助詞"}
assistantParallel = []string{"助詞", "並立助詞"}
auxiliaryVerb = []string{"助動詞"}
nounsSaDynamic = []string{"名詞", "サ変接続"}
)
Expand Down

0 comments on commit fdab98c

Please sign in to comment.