Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
lib/Text/ | H | 03-May-2022 | - | 603 | 435 | |
t/ | H | 03-May-2022 | - | 113 | 75 | |
Build.PL | H A D | 06-Oct-2015 | 1.6 KiB | 66 | 46 | |
Changes | H A D | 06-Oct-2015 | 695 | 22 | 16 | |
LICENSE | H A D | 06-Oct-2015 | 1.6 KiB | 35 | 26 | |
MANIFEST | H A D | 06-Oct-2015 | 159 | 14 | 14 | |
META.json | H A D | 06-Oct-2015 | 1.8 KiB | 79 | 78 | |
META.yml | H A D | 06-Oct-2015 | 984 | 42 | 41 | |
README.md | H A D | 06-Oct-2015 | 2.9 KiB | 109 | 63 | |
cpanfile | H A D | 06-Oct-2015 | 168 | 11 | 8 |
README.md
1# NAME 2 3Text::Hyphen - determine positions for hyphens inside words 4 5# SYNOPSIS 6 7This module implements Knuth-Liang algorithm to find positions inside 8words where it is possible to insert hyphens to break a line. 9 10The original Knuth patterns for English language are built-in. 11If you need to hyphenate other languages, please see Text::Hyphen::\* 12modules on CPAN. 13 14 use Text::Hyphen; 15 16 my $hyphenator = new Text::Hyphen; 17 18 print $hyp->hyphenate('representation', '-'); 19 # prints rep-re-sen-ta-tion 20 21 print map "($_)", $hyp->hyphenate('multiple'); 22 # prints "(mul)(ti)(ple)" 23 24# EXPORT 25 26This version does not export anything and uses OOP interface. 27 28# FUNCTIONS 29 30## new(%options) 31 32Creates the hyphenator object. 33 34You can pass several options: 35 36- min\_word 37 38 Minimum length of word to be hyphenated. Shorter words are returned 39 right away. Defaults to 5 for English. 40 41- min\_prefix 42 43 Minimal prefix to leave without any hyphens. Defaults to 2 for 44 English. 45 46- min\_suffix 47 48 Minimal suffix to leave wothout any hyphens. Defaults to 2 for 49 English. 50 51## hyphenate($word, \[$delim\]) 52 53Hyphenates the `$word`. 54 55If $delim is undefined then in list context this method will break the word 56into pieces on hyphenation positions and return the list of the pieces. 57In scalar context it will return the $word with "-" inserted into suggested 58hyphenation positions. 59 60If $delim is defined this methods returns the $word with $delim inserted 61into hyphenation positions. 62 63Basically, it tries to DWIM. 64 65# AUTHOR 66 67Alex Kapranoff, `<kappa at cpan.org>` 68 69# BUGS AND SUPPORT 70 71This code is hoste don Github, please see [https://github.com/kappa/Text-Hyphen](https://github.com/kappa/Text-Hyphen). 72 73Please report any bugs or feature requests to GitHub issues. 74 75You can also look for information at: 76 77- AnnoCPAN: Annotated CPAN documentation 78 79 [http://annocpan.org/dist/Text-Hyphen](http://annocpan.org/dist/Text-Hyphen) 80 81- CPAN Ratings 82 83 [http://cpanratings.perl.org/d/Text-Hyphen](http://cpanratings.perl.org/d/Text-Hyphen) 84 85- Search CPAN 86 87 [http://search.cpan.org/dist/Text-Hyphen](http://search.cpan.org/dist/Text-Hyphen) 88 89# ACKNOWLEDGEMENTS 90 91Donald Knuth and Frank Liang for the algorithm. 92 93Alexander Lebedev for all his valuable work on russian ispell 94dictionaries and russian hyphenation patterns. See his archive 95at [ftp://scon155.phys.msu.ru/pub/russian/](ftp://scon155.phys.msu.ru/pub/russian/). 96 97Mark-Jason Dominus and Jan Pazdziora for [Text::Hyphenate](https://metacpan.org/pod/Text::Hyphenate) and [TeX::Hyphenate](https://metacpan.org/pod/TeX::Hyphenate) 98modules on CPAN. 99 100Ned Batchelder for his public domain Python implementation of 101Knuth-Liang algorithm available at [http://nedbatchelder.com/code/modules/hyphenate.html](http://nedbatchelder.com/code/modules/hyphenate.html). 102 103# COPYRIGHT & LICENSE 104 105Copyright 2008-2015 Alex Kapranoff. 106 107This is free software; you can redistribute it and/or modify it under 108the terms GNU General Public License version 3. 109