https://github.com/preciz/fast_ngram
A fast and unicode aware letter N-gram library written in Elixir
https://github.com/preciz/fast_ngram
elixir ngrams
Last synced: 2 months ago
JSON representation
A fast and unicode aware letter N-gram library written in Elixir
- Host: GitHub
- URL: https://github.com/preciz/fast_ngram
- Owner: preciz
- License: mit
- Created: 2019-10-07T15:28:25.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-07-20T23:05:50.000Z (11 months ago)
- Last Synced: 2025-03-24T09:21:19.048Z (3 months ago)
- Topics: elixir, ngrams
- Language: Elixir
- Homepage: https://hex.pm/packages/fast_ngram
- Size: 36.1 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FastNgram
[](https://github.com/preciz/fast_ngram/actions/workflows/test.yml)
A fast and unicode aware letter & word N-gram library written in Elixir.
## Installation
The package can be installed by adding `fast_ngram` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:fast_ngram, "~> 1.0"}
]
end
```## Usage
```elixir
iex> FastNgram.letter_ngrams("abcde", 2)
["ab", "bc", "cd", "de"]
iex> FastNgram.letter_ngrams("¥ · € · $", 3)
["¥ ·", " · ", "· €", " € ", "€ ·", " · ", "· $"]
iex> FastNgram.letter_ngrams("", 2)
[]
iex> FastNgram.word_ngrams("the bus came to a halt", 2)
["the bus", "bus came", "came to", "to a", "a halt"]
iex> FastNgram.word_ngrams("the bus came to a halt", 3)
["the bus came", "bus came to", "came to a", "to a halt"]
iex> FastNgram.word_ngrams("", 2)
[]
```## Documentation
Documentation can be found at [https://hexdocs.pm/fast_ngram](https://hexdocs.pm/fast_ngram).
## License
FastNgram is [MIT licensed](LICENSE).