Lingua...phenate(3pm)
π Lingua::EN::Hyphenate β the perl manual page, but make it cute π
okay bestie so this is the page for Lingua::EN::Hyphenate, part of the User Contributed Perl Documentation set, and it's giving "tiny module, big haiku energy". come sit with me, we're breaking words apart at the syllables. π
β¨ NAME β¨
Lingua::EN::Hyphenate β a Perl extension for syllable-based hyphenation π¦
πΈ SYNOPSIS πΈ
use Lingua::EN::Hyphenate qw( hyphenate syllables def_syl def_hyph );
my $word = 'intromission';
my $syllables = syllables($word); # 'in~tro~mis~sion'
my @syllables = syllables($word); # ('in','tro','mis','sion')
($end_of_line_1, $start_of_line_2) # ('intro-','mission')
= hyphenate($word, 6); # Break word at or before 6th char
($end_of_line_1, $start_of_line_2) # ('intromis-','sion')
= hyphenate($word, 8); # Break word at or before 8th char
my $hyphen = '...';
($end_of_line_1, $start_of_line_2) # ('intro...','mission')
= hyphenate($word, 8, $hyphen); # Use specified hyphen (not '-')
def_syl('here~say'); # Where the syllables are
def_syl('he~re~sy'); # Where the syllables are
def_hyph('here~say'); # Where the word may be broken
def_hyph('her~esy'); # Where the word may be broken
π DESCRIPTION π
the exportable subroutines of Lingua::EN::Hyphenate are a whole little toolkit, fr fr. they let you:
- chop words up into syllables π§
- hyphenate words right at the syllable boundaries π
- and redefine the syllables or the hyphenation for specific words when the algorithm is doing too much π
π syllables
this one takes a single string argument and goes to town breaking it into syllables.
- in scalar context: hands you back a string with the syllables separated by
'~'characters β¨ - in list context: hands you back a list of the syllables π
that's it, that's the whole vibe. no cap.
π¦ hyphenate
this subroutine takes:
- a word to be broken π
- an integer saying the maximum number of characters allowed before the break π’
- (optional) a third argument specifying the hyphenation marker β and yeah,
'-'is the default π
it returns a list of two elements:
- the characters before the break, including the hyphenation marker π
- the rest of the word πΈ
and bestie, hear me: the first element is guaranteed to be no longer than the length you gave as the second argument. the module is not out here lying to you about that. periodt.
β def_syl and def_hyph
these two let you specify a specific syllabic decomposition or hyphenation pattern (respectively, iykyk) to be used for the specified word. π«Ά
the syllables or hyphenation fragments are separated by '~' characters β check the examples up in the synopsis, they ate. π
π AUTHOR π
Damian Conway (damian@conway.org) β an actual icon, we stan π
π BUGS AND IRRITATIONS π
okay so the tea. β
the syllable extraction is algorithmic, not table-driven. which means the module is very short π but ALSO means it can be very inaccurate. it's okay for haiku, but it should not be used for serious work. if you need real accuracy, go look at Lingua::EN::Syllable or TeX::Hyphen instead. π
there are undoubtedly serious bugs lurking somewhere in this code β if only because it gives the impression of understanding a great deal more about English than it actually does. π (it's giving overconfident. it's giving fake-it-till-you-make-it.)
bug reports and other feedback are most welcome though!! send them in bestie π«Ά
π COPYRIGHT π
Copyright (c) 1997-2000, Damian Conway. All Rights Reserved.
This module is free software. It may be used, redistributed
and/or modified under the terms of the Perl Artistic License
(see http://www.perl.com/perl/misc/Artistic.html)
and that's the whole page, bestie!! π this one came to you as perl v5.36.0, dated 2022-11-19, and it lives in the perl docs as Lingua...phenate(3pm) β go forth and hyphenate responsibly, mwah π
β¨
π¦ where this page comes from
- debian bookworm: libcoy-perl 0.06-10 Β· Artistic-1.0-Perl
- debian trixie: libcoy-perl 0.06-10 Β· Artistic-1.0-Perl
- ubuntu noble: libcoy-perl 0.06-10 Β· Artistic-1.0-Perl
- ubuntu resolute: libcoy-perl 0.06-10 Β· Artistic-1.0-Perl
- ubuntu stonking: libcoy-perl 0.06-10 Β· Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms