text-hyphen 1.0.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +23 -0
- data/COPYING.txt +339 -0
- data/History.txt +23 -0
- data/{LICENCE → LICENCE.txt} +9 -9
- data/Manifest.txt +44 -0
- data/README.txt +82 -0
- data/Rakefile +16 -108
- data/bin/hyphen +3 -1
- data/lib/text-hyphen.rb +1 -0
- data/lib/text/hyphen.rb +135 -134
- data/lib/text/hyphen/language.rb +13 -9
- data/lib/text/hyphen/language/cs.rb +363 -363
- data/lib/text/hyphen/language/da.rb +1 -1
- data/lib/text/hyphen/language/de.rb +1 -0
- data/lib/text/hyphen/language/de1.rb +8 -6
- data/lib/text/hyphen/language/de2.rb +7 -6
- data/lib/text/hyphen/language/en_uk.rb +1 -1
- data/lib/text/hyphen/language/et.rb +1 -1
- data/lib/text/hyphen/language/hsb.rb +1 -1
- data/lib/text/hyphen/language/hu1.rb +1 -1
- data/lib/text/hyphen/language/hu2.rb +1 -1
- data/lib/text/hyphen/language/is.rb +1 -1
- data/lib/text/hyphen/language/mn.rb +1 -1
- data/lib/text/hyphen/language/pl.rb +1 -1
- data/test/test_bugs.rb +26 -0
- data/{tests/tc_text_hyphen.rb → test/test_text_hyphen.rb} +2 -8
- data/text-hyphen.gemspec +63 -0
- metadata +214 -82
- data/ChangeLog +0 -4
- data/Changelog +0 -4
- data/INSTALL +0 -6
- data/README +0 -56
data/ChangeLog
DELETED
data/Changelog
DELETED
data/INSTALL
DELETED
data/README
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
Text::Hyphen README
|
2
|
-
===================
|
3
|
-
|
4
|
-
Text::Hyphen will properly hyphenate various words according to the rules of
|
5
|
-
the language the word is written in. The algorithm is based on that of the TeX
|
6
|
-
typesetting system by Donald E. Knuth. This is originally based on the Perl
|
7
|
-
implementation of TeX::Hyphen[1] and the Ruby port TeX::Hyphen[2]. The
|
8
|
-
language hyphenation pattern files are based on the sources available from
|
9
|
-
CTAN[3] as of 2004.12.19 and have been translated by Austin Ziegler.
|
10
|
-
|
11
|
-
This release is 1.0, the initial release of Text::Hyphen, representing a
|
12
|
-
significant improvement over its predecessor, TeX::Hyphen.
|
13
|
-
|
14
|
-
require 'text/hyphen'
|
15
|
-
hh = Text::Hyphen.new(:language => 'en_us', :left => 2, :right => 2)
|
16
|
-
# Defaults to the above
|
17
|
-
hh = TeX::Hyphen.new
|
18
|
-
|
19
|
-
word = "representation"
|
20
|
-
points = hyp.hyphenate(word) #=> [3, 5, 8, 10]
|
21
|
-
puts hyp.visualize(word) #=> rep-re-sen-ta-tion
|
22
|
-
|
23
|
-
Text::Hyphen is truly multilingual in nature[4]. As an example, consider the
|
24
|
-
difference between the following:
|
25
|
-
|
26
|
-
require 'text/hyphen'
|
27
|
-
# Using left and right minimum values of 0 ensures that you will see all
|
28
|
-
# possible hyphenation points, not just those that meet the minimum
|
29
|
-
# width requirements.
|
30
|
-
en = Text::Hyphen.new(:left => 0, :right => 0)
|
31
|
-
fr = Text::Hyphen.new(:language = "fr", :left => 0, :right => 0)
|
32
|
-
|
33
|
-
puts en.visualise("organiser") #=> or-gan-iser
|
34
|
-
puts fr.visualise("organiser") #=> or-ga-ni-ser
|
35
|
-
|
36
|
-
As you can see, the hyphenation is distinct between the two hyphenators.
|
37
|
-
Additional improvements over TeX::Hyphen include thread safety (except for
|
38
|
-
debug control) and support for UTF-8.
|
39
|
-
|
40
|
-
It is very important to read the LICENCE file and each language file desired,
|
41
|
-
as some languages may be held under a more strict licence than that granted by
|
42
|
-
LICENCE.
|
43
|
-
|
44
|
-
Copyright
|
45
|
-
=========
|
46
|
-
# Copyright 2004 Austin Ziegler <text-hyphen@halostatue.ca>
|
47
|
-
# See the LICENCE file for more information.
|
48
|
-
|
49
|
-
[1] <http://search.cpan.org/author/JANPAZ/TeX-Hyphen-0.140/lib/TeX/Hyphen.pm>
|
50
|
-
Maintained by Jan Pazdziora.
|
51
|
-
[2] Available at <http://rubyforge.org/projects/text-format>.
|
52
|
-
[3] <http://www.ctan.org>
|
53
|
-
[4] There are some bugs and design decisions in the original Perl
|
54
|
-
implementation of TeX::Hyphen that make it unsuitable for most
|
55
|
-
multilingual implementations that carried over to the Ruby port of
|
56
|
-
TeX::Hyphen.
|