File Coverage

blib/lib/Lingua/LO/Transform.pm
Criterion Covered Total %
statement 23 30 76.6
branch n/a
condition n/a
subroutine 8 11 72.7
pod 3 3 100.0
total 34 44 77.2


line stmt bran cond sub pod time code
1             package Lingua::LO::Transform;
2 1     1   716 use strict;
  1         1  
  1         23  
3 1     1   3 use warnings;
  1         1  
  1         17  
4 1     1   13 use 5.012000;
  1         2  
5 1     1   3 use utf8;
  1         1  
  1         5  
6 1     1   16 use feature 'unicode_strings';
  1         2  
  1         54  
7 1     1   3 use version 0.77; our $VERSION = version->declare('v0.0.1_004');
  1         11  
  1         5  
8 1     1   57 use Lingua::LO::Transform::Syllables;
  1         1  
  1         5  
9 1     1   16 use Lingua::LO::Transform::Analyze;
  1         2  
  1         4  
10              
11             =encoding UTF-8
12              
13             =head1 NAME
14              
15             Lingua::LO::Transform - Various Lao text processing functions
16              
17             =head1 SYNOPSIS
18              
19             use Lingua::LO::Transform;
20             use Data::Dumper;
21             use utf8;
22             my $laotr = Lingua::LO::Transform->new;
23             my @syllables = $laotr->split_to_syllables("ສະບາຍດີ"); # qw( ສະ ບາຍ ດີ )
24             print Dumper(\@syllables);
25             for my $syl (@syllables) {
26             my $clas = $laotr->analyze_syllable($syl);
27             printf "%s: %s\n", $clas->syllable, $clas->tone;
28             # ສະ: TONE_HIGH_STOP
29             # ບາຍ: TONE_LOW
30             # ດີ: TONE_LOW
31             }
32              
33             =head1 DESCRIPTION
34              
35             This module provides various functions for processing Lao text. Currently it can
36              
37             =over 4
38              
39             =item Split Lao text (usually written without blanks between words) into syllables
40              
41             =item Analyze syllables
42              
43             =back
44              
45             =head1 METHODS
46              
47             =head2 new
48              
49             C value, ...)>
50              
51             The object constructor currently does nothing; there are no options. However,
52             it is likely that there will be in future versions, therefore it is highly
53             recommended to call methods as object methods so your code won't break when I
54             introduce them.
55              
56             =cut
57             sub new {
58 0     0 1   my $class = shift;
59 0           my %opts = @_;
60 0           return bless \%opts, $class;
61             }
62              
63             =head2 split_to_syllables
64              
65             Csplit_to_syllables($text);>
66              
67             Split Lao text into its syllables. Uses a regexp modelled after Phissamay,
68             Dalaloy and Durrani: "Syllabification of Lao Script for Line Breaking". Takes
69             as its only parameter a character string to split and returns a list of
70             syllables.
71              
72             =cut
73             sub split_to_syllables {
74 0     0 1   my ($self, $text) = @_;
75 0           return Lingua::LO::Transform::Syllables::split_to_syllables($text);
76             }
77              
78             =head2 analyze_syllable
79              
80             Canalyze_syllable($syllable);>
81              
82             Returns a L object that allows you to query
83             various syllable properties such as core consonant, tone mark, vowel length and
84             tone. See there for details.
85              
86             =cut
87             sub analyze_syllable {
88 0     0 1   my ($self, $syllable) = @_;
89 0           return Lingua::LO::Transform::Analyze->new($syllable);
90             }
91