StringNaming
Compile-time generated set of modules to ease an access to a predefined subset of UTF8 symbols.
Installation
def deps do
[{:string_naming, "~> 0.7"}]
endWarning
The initial compilation of the module in the default configuration takes โ 10 sec.
The compilation of the whole UTF8 symbol set requires โ 10 min.
config/confix.exs
The configuration of what is to be compiled could be changed accordingly to
what might be found in default config.
Basically, leading '#' and '=' in front of group names are treated as comments.
How it works
The code parses the NamesList.txt
file provided by Consortium. It builds the set of nested modules under StringNaming.
Each nested module is granted with __all__/0 function that returns all the
available symbols in that particular namespace.
iex|1 โถ StringNaming.AnimalSymbols.__all__
[ant: "๐", bat: "๐ฆ", bird: "๐ฆ", blowfish: "๐ก", boar: "๐",
bug: "๐", butterfly: "๐ฆ", cat: "๐", chicken: "๐", chipmunk: "๐ฟ",
cow: "๐", crab: "๐ฆ", crocodile: "๐", deer: "๐ฆ", dog: "๐",
dolphin: "๐ฌ", dragon: "๐", duck: "๐ฆ", eagle: "๐ฆ
", elephant: "๐",
fish: "๐", goat: "๐", gorilla: "๐ฆ", honeybee: "๐", horse: "๐",
koala: "๐จ", leopard: "๐", lizard: "๐ฆ", monkey: "๐", mouse: "๐",
octopus: "๐", owl: "๐ฆ", ox: "๐", penguin: "๐ง", pig: "๐",
poodle: "๐ฉ", rabbit: "๐", ram: "๐", rat: "๐", rhinoceros: "๐ฆ",
rooster: "๐", scorpion: "๐ฆ", shark: "๐ฆ", sheep: "๐",
shrimp: "๐ฆ", snail: "๐", snake: "๐", spider: "๐ท", squid: "๐ฆ",
tiger: "๐
", ...]
iex|2 โถ StringNaming.AnimalSymbols.monkey
"๐"Changelog
0.7.3
Predefined defaults for spaces, digits, and punctuation
0.7.0
ยกNB! for Elixir < v1.10, use v0.6.0
- Added all ASCII set
- Allowed grepping by functions
-
Updated
NamesList.txt(v13 โย v14)
0.6.0
Updated NamesList.txt (v9 โย v13)
0.4.0
Added StringNaming.graphemes/1 function that receives a regular expression and
returns the list of matched characters:
iex> StringNaming.graphemes ~r/\Aspace/i
[
space_medium_mathematical_space: "โ",
spaces_em_quad: "โ",
spaces_em_space: "โ",
spaces_en_quad: "โ",
spaces_en_space: "โ",
spaces_figure_space: "โ",
spaces_four_per_em_space: "โ
",
spaces_hair_space: "โ",
spaces_punctuation_space: "โ",
spaces_six_per_em_space: "โ",
spaces_thin_space: "โ",
spaces_three_per_em_space: "โ"
]Is it of any good?
Sure it is.
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/string_naming.