Skip to content

Commit

Permalink
濁音と半濁音の変換を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
sharl authored and theoria24 committed Mar 26, 2022
1 parent 6ae609a commit 1eb342b
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions dajarep.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,31 @@ func fixWord(text string) string {
text = strings.Replace(text, "ゥ", "[ウゥ]?", -1)
text = strings.Replace(text, "ェ", "[エェ]?", -1)
text = strings.Replace(text, "ォ", "[オォ]?", -1)
text = strings.Replace(text, "ズ", "[ズヅ]", -1)
text = strings.Replace(text, "ヅ", "[ズヅ]", -1)
text = strings.Replace(text, "ヂ", "[ジヂ]", -1)
text = strings.Replace(text, "ジ", "[ジヂ]", -1)
text = strings.Replace(text, "ズ", "[スズヅ]", -1)
text = strings.Replace(text, "ヅ", "[ツズヅ]", -1)
text = strings.Replace(text, "ヂ", "[チジヂ]", -1)
text = strings.Replace(text, "ジ", "[シジヂ]", -1)
text = strings.Replace(text, "ガ", "[カガ]", -1)
text = strings.Replace(text, "ギ", "[キギ]", -1)
text = strings.Replace(text, "グ", "[クグ]", -1)
text = strings.Replace(text, "ゲ", "[ケゲ]", -1)
text = strings.Replace(text, "ゴ", "[コゴ]", -1)
text = strings.Replace(text, "ザ", "[サザ]", -1)
text = strings.Replace(text, "ゼ", "[セゼ]", -1)
text = strings.Replace(text, "ゾ", "[ソゾ]", -1)
text = strings.Replace(text, "ダ", "[タダ]", -1)
text = strings.Replace(text, "デ", "[テデ]", -1)
text = strings.Replace(text, "ド", "[トド]", -1)
text = strings.Replace(text, "バ", "[ハバパ]", -1)
text = strings.Replace(text, "ビ", "[ヒビピ]", -1)
text = strings.Replace(text, "ブ", "[フブプ]", -1)
text = strings.Replace(text, "ベ", "[ヘベペ]", -1)
text = strings.Replace(text, "ボ", "[ホボポ]", -1)
text = strings.Replace(text, "パ", "[ハバパ]", -1)
text = strings.Replace(text, "ピ", "[ヒビピ]", -1)
text = strings.Replace(text, "プ", "[フブプ]", -1)
text = strings.Replace(text, "ペ", "[ヘベペ]", -1)
text = strings.Replace(text, "ポ", "[ホボポ]", -1)
re := regexp.MustCompile("([アカサタナハマヤラワャ])ー")
text = re.ReplaceAllString(text, "$1[アァ]?")
re = regexp.MustCompile("([イキシチニヒミリ])ー")
Expand Down

0 comments on commit 1eb342b

Please sign in to comment.