An open API service indexing awesome lists of open source software.

https://github.com/am-kantox/string_naming

Compiled support for the whole UTF8 symbols by their names
https://github.com/am-kantox/string_naming

Last synced: 6 months ago
JSON representation

Compiled support for the whole UTF8 symbols by their names

Awesome Lists containing this project

README

          

# 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.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:

```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).