Packages

Compile-time generated set of modules to ease an access to a predefined subset of UTF8 symbols.

Current section

Files

Jump to
string_naming README.md
Raw

README.md

# StringNaming
**Compile-time generated set of modules to ease an access to a predefined subset of UTF8 symbols.**
## Installation
```elixir
def deps do
[{:string_naming, "~> 0.7"}]
end
```
## Warning
**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](https://github.com/am-kantox/string_naming/blob/master/config/config.exs).
Basically, leading `'#'` and `'='` in front of group names are treated as comments.
## How it works
The code parses the [`NamesList.txt`](http://www.unicode.org/Public/UCD/latest/ucd/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.
```elixir
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.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:
```elixir
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](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/string_naming](https://hexdocs.pm/string_naming).