feat(unitproc/bkt-replace_apos) Handle more replacement cases
authorSteven Baltakatei Sandoval <baltakatei@gmail.com>
Fri, 26 Jan 2024 00:47:17 +0000 (00:47 +0000)
committerSteven Baltakatei Sandoval <baltakatei@gmail.com>
Fri, 26 Jan 2024 00:47:17 +0000 (00:47 +0000)
- possessive `bossʼs` and `bossʼ`
- general name, e.g. `Trinʼeba`

unitproc/bkt-replace_apos

index 15714a713b452877b722da2a50397835fc59494a..1e0cfd33ac365fbc99dec44c127c6c650ced0670 100644 (file)
@@ -7,7 +7,7 @@ function replace_apos() {
     # Input: stdin
     #        arg1   file path
     # Output: stdout
-    # Version: 1.1.2 (BK-2020-03)
+    # Version: 1.2.0 (BK-2020-03)
     # Depends: GNU sed 4.8
 
     # Check input
@@ -64,7 +64,7 @@ function replace_apos() {
         -e "s/(she|She|SHE)'(d|D|ll|LL|s|S)/\1ʼ\2/g" \
         -e "s/(shan|Shan|SHAN)'(t|T)/\1ʼ\2/g" \
         -e "s/'(s|S)\b/ʼ\1/g" \
-        -e "s/(s|S)'( |$)/\1ʼ\2/g" \
+        -e "s/(s|S)'( |,|.|$)/\1ʼ\2/g" \
         -e "s/(oughtn|Oughtn|OUGHTN)'(t|T)'(ve|VE)/\1ʼ\2ʼ\3/g" \
         -e "s/(oughtn|Oughtn|OUGHTN)'(t|T)/\1ʼ\2/g" \
         -e "s/(o|O)'(clock|CLOCK)/\1ʼ\2/g" \
@@ -90,6 +90,7 @@ function replace_apos() {
         -e "s/(hadn|Hadn|HADN)'(t|T)/\1ʼ\2/g" \
         -e "s/'(em\b)/ʼ\1/g" \
         -e "s/(d|D)'(ya|YA|you|YOU)/\1ʼ\2/g" \
+        -e "s/([[:alnum:]])'(d|D)/\1ʼ\2/g" \
         -e "s/(don|Don|DON)'(t|T)/\1ʼ\2/g" \
         -e "s/(doesn|Doesn|DOESN)'(t|T)/\1ʼ\2/g" \
         -e "s/(didn|Didn|DIDN)'(t|T)/\1ʼ\2/g" \
@@ -104,6 +105,7 @@ function replace_apos() {
         -e "s/(aren|Aren|AREN)'(t|T)/\1ʼ\2/g" \
         -e "s/(ate|Ate|ATE)'(nt|NT)/\1ʼ\2/g" \
         -e "s/(ain|Ain|AIN)'(t|T)/\1ʼ\2/g" \
+        -e "s/([[:alpha:]])'([[:alpha:]])/\1ʼ\2/g" \
         "$input"
 }; # replace ' with ʼ