https://github.com/hackerb9/hyphenate
Command line hyphenation of words using libhyphen
https://github.com/hackerb9/hyphenate
Last synced: 11 months ago
JSON representation
Command line hyphenation of words using libhyphen
- Host: GitHub
- URL: https://github.com/hackerb9/hyphenate
- Owner: hackerb9
- License: lgpl-2.1
- Created: 2018-02-18T23:50:56.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-06T12:03:36.000Z (over 7 years ago)
- Last Synced: 2025-03-23T19:16:19.127Z (about 1 year ago)
- Language: C
- Size: 23.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING.LGPL
Awesome Lists containing this project
README
# hyphenate
Command line hyphenation of words using libhyphen
## Example
$ hyphenate example
ex=am=ple
$ hyphenate hyphenate
hy=phen=ate
$ hyphenate transubstantiation
tran=sub=stan=ti=a=tion
## Example? Example.c!
This is almost purely the `example.c` that comes with the source for
libhyphen. I just cleaned it up and changed it to work nicely from the
command line. I also fixed the UTF-8 multibyte character support
(isn't that the "spiffi=est"!).
## Installation
git clone http://github.com/hackerb9/hyphenation
cd hyphenation
sudo apt install libhyphen-dev libhyphen0 hyphen-en-us
make
make install
## About hyphenation dictionaries and libhyphen
If you don't have the dictionaries, you can install them on most
Debian derivatives like so:
apt install hyphen-en-us
You can see what dictionaries you have installed on your computer by
checking `/usr/share/hyphen/`. If you have LibreOffice installed on
your machine, you already have the necessary hyphenation dictionaries
and libraries.
### Alternate language dictionaries are available.
You can install the hyphenation patterns for whatever language you
prefer, from Afrikaans to Zulu. For example, for German:
apt install hyphen-de
If you have your computer set up for a different locale (e.g.,
`LANG="de_DE"`), this program should automatically look for the correct
hyphenation dictionary. However, this has not been tested by a real
user. If it doesn't work, please file a bug report.
## Note of surprise
How can there not have been a standard Unix utility to do this before?
Originally, I wasn't going to write this, because I presumed that, at
the worst, I'd just use `groff`. Unfortunately, while it hyphenates
great, there's no way to get the raw hyphenation before it gets
converted into a PDF or whatever. (You can use the "-a" option to
peek, but then you lose UTF-8).