Taggerscript: Standardize Japanese CV artist credit whitespace and punctuation

Japanese websites tend to present CV artist credits without any whitespace between:

  1. the character and the opening parentheses
  2. CV and the seiyuu
  3. comma and the next character

Some editors standardize to this more common syntax. Other editors insist on inserting whitespace. Since we can’t agree, here are 2 taggerscripts (“A” and “B”) to standardize your personal library.

"A" - Remove extraneous whitespace:

$foreach(albumartist; artist,
  $if($rsearch($get(%_loop_value%),[(\\\(][CcCc][\\..]{0\,1}[VvVv][:\\.:.\\s]),$set(_cvMatch,1),$set(_cvMatch,))
  $if(%_cvMatch%,
    $noop(Remove whitespace from both sides that isn't typically present in Japanese text)
    $set(%_loop_value%,$rreplace($get(%_loop_value%),\\s\([(\\\(]\)\([CcCc][\\..]{0\,1}[VvVv]\)\([:\\.:.]\),\\1\\2\\3))
    $set(%_loop_value%,$rreplace($get(%_loop_value%),\([(\\\(]\)\([CcCc][\\..]{0\,1}[VvVv]\)\([:\\.:.]\)\\s,\\1\\2\\3))

    $noop(Extra: Change fullwidth punctuation to halfwidth punctuation)
    $set(%_loop_value%,$replace($get(%_loop_value%),(,\())
    $set(%_loop_value%,$replace($get(%_loop_value%),),\)))
    $set(%_loop_value%,$replace($get(%_loop_value%),:,:))
    $set(%_loop_value%,$replace($get(%_loop_value%),.,.))
    $set(%_loop_value%,$replace($get(%_loop_value%),&,&))
    $noop(Extra: Change whitespace CV delimiter to colon)
    $set(%_loop_value%,$replace($get(%_loop_value%),\(CV ,\(CV:))
    $noop(Extra: Change non-Japanese comma at the right of closing parentheses to the Japanese comma)
    $set(%_loop_value%,$replace($get(%_loop_value%),\)\, ,\)、))
    $set(%_loop_value%,$replace($get(%_loop_value%),\)\,,\)、))
  )
)

"B" - Add whitespace before the opening parentheses, before the seiyuu, and before the next character:

$foreach(albumartist; artist,
  $if($rsearch($get(%_loop_value%),[(\\\(][CcCc][\\..]{0\,1}[VvVv][:\\.:.\\s]),$set(_cvMatch,1),$set(_cvMatch,))
  $if(%_cvMatch%,
    $noop(Add whitespace around punctuation even though most Japanese do not do so)
    $set(%_loop_value%,$rreplace($get(%_loop_value%),\([(\\\(]\)\([CcCc][\\..]{0\,1}[VvVv]\)\([:\\.:.]\), \\1\\2\\3 ))
    $set(%_loop_value%,$rreplace($get(%_loop_value%),\\s\\s\([(\\\(]\)\([CcCc][\\..]{0\,1}[VvVv]\)\([:\\.:.]\), \\1\\2\\3))
    $set(%_loop_value%,$rreplace($get(%_loop_value%),\([(\\\(]\)\([CcCc][\\..]{0\,1}[VvVv]\)\([:\\.:.]\)\\s\\s,\\1\\2\\3 ))

    $noop(Extra: Change fullwidth punctuation to halfwidth punctuation)
    $set(%_loop_value%,$replace($get(%_loop_value%),(,\())
    $set(%_loop_value%,$replace($get(%_loop_value%),),\)))
    $set(%_loop_value%,$replace($get(%_loop_value%),:,:))
    $set(%_loop_value%,$replace($get(%_loop_value%),.,.))
    $set(%_loop_value%,$replace($get(%_loop_value%),&,&))
    $noop(Extra: Change whitespace CV delimiter to colon)
    $set(%_loop_value%,$replace($get(%_loop_value%),\(CV ,\(CV:))
    $noop(Extra: Change Japanese comma at the right of closing parentheses to ascii comma with whitespace padding)
    $set(%_loop_value%,$replace($get(%_loop_value%),\)、,\)\, ))
  )
)
7 Likes

I just added the script for the opposing viewpoint (the one I don’t use).

1 Like

Updated both scripts for an uncommon syntax used by Lantis in 2007.

1 Like