Git Product home page Git Product logo

hypher's Introduction

hypher

Crates.io Documentation

hypher separates words into syllables.

[dependencies]
hypher = "0.1"

Features

  • All-inclusive: Hyphenation patterns are embedded into the binary as efficiently encoded finite automata at build time.
  • Zero load time: Hyphenation automata operate directly over the embedded binary data with no up-front decoding.
  • No allocations unless when hyphenating very long words (>= 39 bytes). You can disable the alloc feature, but then overly long words lead to a panic.
  • Support for many languages.
  • No unsafe code, no dependencies, no std.

Example

use hypher::{hyphenate, Lang};

let syllables = hyphenate("extensive", Lang::English);
assert_eq!(syllables.join("-"), "ex-ten-sive");

Languages

By default, this crate supports hyphenating more than 30 languages. Embedding automata for all these languages will add ~1.1 MiB to your binary. Alternatively, you can disable support for all languages and manually choose which ones get added:

[dependencies]
hypher = { version = "0.1", default-features = false, features = ["english", "greek"] }

Each language added individually contributes:

Language Space
Afrikaans 60 KiB
Belarusian 3.9 KiB
Bulgarian 13 KiB
Danish 5.7 KiB
German 192 KiB
Greek 2.0 KiB
English 27 KiB
Spanish 14 KiB
Estonian 19 KiB
Finnish 1.3 KiB
French 6.9 KiB
Croatian 2.0 KiB
Hungarian 346 KiB
Icelandic 21 KiB
Italian 1.6 KiB
Georgian 11 KiB
Kurmanji 1.4 KiB
Latin 1003 B
Lithuanian 6.5 KiB
Mongolian 4.9 KiB
Dutch 63 KiB
Norwegian 153 KiB
Portuguese 343 B
Russian 33 KiB
Serbian 13 KiB
Slovak 13 KiB
Slovenian 5.5 KiB
Albanian 1.4 KiB
Swedish 24 KiB
Turkmen 1.4 KiB
Turkish 526 B
Ukrainian 21 KiB

Benchmarks

Task hypher hyphenation
Hyphenating extensive (english) 356ns 698ns
Hyphenating διαμερίσματα (greek) 503ns 1121ns
Loading the english patterns 0us 151us
Loading the greek patterns 0us 0.826us

Benchmarks were executed on ARM, Apple M1.

License

The code of this crate is dual-licensed under the MIT and Apache 2.0 licenses.

The files in patterns/ are subject to the individual licenses stated therein. The patterns are processed at build time and then embedded (i.e. statically linked) into your binary. However, hypher includes only patterns that are available under permissive licenses. Patterns licenses include the LPPL, MPL, MIT, BSD-3.

hypher's People

Contributors

grantm11235 avatar ilyvion avatar laurmaedje avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.