module Chivi::Util

Extended Modules

Defined in:

chivi/util.cr
chivi/util/normalize.cr

Constant Summary

NORMALIZE = {'《' => '⟨', '》' => '⟩', '\u3000' => ' ', 'ˉ' => '¯', '‥' => '¨', '‧' => '·', '•' => '·', '‵' => '`', '`' => '`', '。' => '.', '﹒' => '.', '.' => '.', '﹐' => ',', ',' => ',', '﹑' => ',', '、' => ',', '︰' => ':', '∶' => ':', '﹔' => ';', ';' => ';', '﹕' => ':', ':' => ':', '﹖' => '?', '?' => '?', '﹗' => '!', '!' => '!', '﹙' => '(', '(' => '(', '﹚' => ')', ')' => ')', '﹛' => '{', '{' => '{', '﹜' => '}', '}' => '}', '【' => '[', '﹝' => '[', '[' => '[', '】' => ']', '﹞' => ']', ']' => ']', '^' => '^', '﹟' => '#', '#' => '#', '﹠' => '&', '&' => '&', '﹡' => '*', '*' => '*', '﹢' => '+', '+' => '+', '﹣' => '-', '-' => '-', '﹤' => '<', '<' => '<', '﹥' => '>', '>' => '>', '﹦' => '=', '=' => '=', '﹩' => '$', '$' => '$', '﹪' => '%', '%' => '%', '﹫' => '@', '@' => '@', '≒' => '≈', '≦' => '≤', '≧' => '≥', '︱' => '|', '|' => '|', '︳' => '|', '︿' => '∧', '﹀' => '∨', '/' => '/', '\' => '\\', '╴' => '_', '_' => '_', '「' => '“', '」' => '”', '『' => '‘', '』' => '’', '"' => '"', '~' => '~', '⦅' => '(', '⦆' => ')', 'a' => 'a', 'b' => 'b', 'c' => 'c', 'd' => 'd', 'e' => 'e', 'f' => 'f', 'g' => 'g', 'h' => 'h', 'i' => 'i', 'j' => 'j', 'k' => 'k', 'l' => 'l', 'm' => 'm', 'n' => 'n', 'o' => 'o', 'p' => 'p', 'q' => 'q', 'r' => 'r', 's' => 's', 't' => 't', 'u' => 'u', 'v' => 'v', 'w' => 'w', 'x' => 'x', 'y' => 'y', 'z' => 'z', 'A' => 'A', 'B' => 'B', 'C' => 'C', 'D' => 'D', 'E' => 'E', 'F' => 'F', 'G' => 'G', 'H' => 'H', 'I' => 'I', 'J' => 'J', 'K' => 'K', 'L' => 'L', 'M' => 'M', 'N' => 'N', 'O' => 'O', 'P' => 'P', 'Q' => 'Q', 'R' => 'R', 'S' => 'S', 'T' => 'T', 'U' => 'U', 'V' => 'V', 'W' => 'W', 'X' => 'X', 'Y' => 'Y', 'Z' => 'Z', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '0' => '0'}

Instance Method Summary

Instance Method Detail

def capitalize(str : String) : String #

don't downcase extra characters


[View source]
def hanzi_int(input : String) #

convert chinese numbers to latin numbers

TODO Handle bigger numbers


[View source]
def normalize(char : Char) : Char #

Convert chinese punctuations to english punctuations and full width characters to ascii characters


[View source]
def normalize(input : Array(Char)) : Array(Char) #

[View source]
def normalize(input : String) : Array(Char) #

[View source]
def slugify(input : String, no_accent = true) #

[View source]
def titleize(input : String) #

capitalize all words


[View source]
def unaccent(input : String) #

[View source]