-
-
Save mwgamera/854fded72f648f65098fbf2daff4b2de to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use utf8; | |
use Unicode::Normalize; | |
# Expand horizontal Kana iteration marks | |
# 例: いすゞ→いすず ところゞゝゝ→ところどころ | |
sub expand_kanaiter { | |
local $_ = NFKD($_[0]); | |
s{( | |
[あ-んア-ンー][\x{3099}\x{309a}]? | |
(|(?1)) | |
[ゝヽ][\x{3099}\x{309a}]? | |
)}{ | |
local $_ = $1; | |
pos = $-[3] | |
while s/ | |
\G([あ-んア-ンー]) | |
([\x{3099}\x{309a}]?) | |
([^ゝヽ]*)[ゝヽ] | |
([\x{3099}\x{309a}]?) | |
/$1$2$3$1$4/x; | |
$_ | |
}xge; | |
NFC($_); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment