| 1 | package Text::Info::Sentence; | ||
| 2 | 6 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 6 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 6 | extends 'Text::Info::BASE'; | |
| 6 | |||
| 7 | =encoding utf-8 | ||
| 8 | |||
| 9 | =head1 NAME | ||
| 10 | |||
| 11 | Text::Info::Sentence - An object-oriented representation of a sentence. | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | You should never instantiate objects of this class directly, but instead | ||
| 16 | use L<Text::Info> to create a general text object and retrieve the | ||
| 17 | L<Text::Info::Sentence> objects from that with its C<sentences()> method. | ||
| 18 | |||
| 19 | =head1 METHODS | ||
| 20 | |||
| 21 | =over | ||
| 22 | |||
| 23 | =item words() | ||
| 24 | |||
| 25 | Returns an array reference containing the sentence's words. This method is | ||
| 26 | derived from L<Text::Info::BASE>. | ||
| 27 | |||
| 28 | =item word_count() | ||
| 29 | |||
| 30 | Returns the number of words in the sentence. This is a helper method and is | ||
| 31 | derived from L<Text::Info::BASE>. | ||
| 32 | |||
| 33 | =item avg_word_length() | ||
| 34 | |||
| 35 | Returns the average length of the words in the sentence. This is a helper | ||
| 36 | method and is derived from L<Text::Info::BASE>. | ||
| 37 | |||
| 38 | =item ngrams( $size ) | ||
| 39 | |||
| 40 | Returns an array reference containing the sentence's ngrams of size C<$size>. | ||
| 41 | Default size is 2 (i.e. bigrams). This method is derived from | ||
| 42 | L<Text::Info::BASE>. | ||
| 43 | |||
| 44 | =item unigrams() | ||
| 45 | |||
| 46 | Returns an array reference containing the sentence's unigrams, i.e. the same | ||
| 47 | as C<ngrams(1)>. This is a helper method and is derived from L<Text::Info::BASE>. | ||
| 48 | |||
| 49 | =item bigrams() | ||
| 50 | |||
| 51 | Returns an array reference containing the sentence's bigrams, i.e. the same | ||
| 52 | as C<ngrams(2)>. This is a helper method and is derived from L<Text::Info::BASE>. | ||
| 53 | |||
| 54 | =item trigrams() | ||
| 55 | |||
| 56 | Returns an array reference containing the sentence's trigrams, i.e. the same | ||
| 57 | as C<ngrams(3)>. This is a helper method and is derived from L<Text::Info::BASE>. | ||
| 58 | |||
| 59 | =item quadgrams() | ||
| 60 | |||
| 61 | Returns an array reference containing the sentence's quadgrams, i.e. the same | ||
| 62 | as C<ngrams(4)>. This is a helper method and is derived from L<Text::Info::BASE>. | ||
| 63 | |||
| 64 | =cut | ||
| 65 | |||
| 66 | 6 | __PACKAGE__->meta->make_immutable; | |
| 67 | |||
| 68 | 6 | 1; | |
| 69 | |||
| 70 | =back | ||
| 71 | |||
| 72 | =head1 SEE ALSO | ||
| 73 | |||
| 74 | =over 4 | ||
| 75 | |||
| 76 | =item * L<Text::Info> | ||
| 77 | |||
| 78 | =back | ||
| 79 | |||
| 80 | =head1 AUTHOR | ||
| 81 | |||
| 82 | Tore Aursand, C<< <toreau at gmail.com> >> | ||
| 83 | |||
| 84 | =head1 LICENSE AND COPYRIGHT | ||
| 85 | |||
| 86 | Copyright 2015 Tore Aursand. | ||
| 87 | |||
| 88 | This program is free software; you can redistribute it and/or modify it | ||
| 89 | under the terms of the the Artistic License (2.0). You may obtain a | ||
| 90 | copy of the full license at: | ||
| 91 | |||
| 92 | L<http://www.perlfoundation.org/artistic_license_2_0> | ||
| 93 | |||
| 94 | Any use, modification, and distribution of the Standard or Modified | ||
| 95 | Versions is governed by this Artistic License. By using, modifying or | ||
| 96 | distributing the Package, you accept this license. Do not use, modify, | ||
| 97 | or distribute the Package, if you do not accept this license. | ||
| 98 | |||
| 99 | If your Modified Version has been derived from a Modified Version made | ||
| 100 | by someone other than you, you are nevertheless required to ensure that | ||
| 101 | your Modified Version complies with the requirements of this license. | ||
| 102 | |||
| 103 | This license does not grant you the right to use any trademark, service | ||
| 104 | mark, tradename, or logo of the Copyright Holder. | ||
| 105 | |||
| 106 | This license includes the non-exclusive, worldwide, free-of-charge | ||
| 107 | patent license to make, have made, use, offer to sell, sell, import and | ||
| 108 | otherwise transfer the Package with respect to any patent claims | ||
| 109 | licensable by the Copyright Holder that are necessarily infringed by the | ||
| 110 | Package. If you institute patent litigation (including a cross-claim or | ||
| 111 | counterclaim) against any party alleging that the Package constitutes | ||
| 112 | direct or contributory patent infringement, then this Artistic License | ||
| 113 | to you shall terminate on the date that such litigation is filed. | ||
| 114 | |||
| 115 | Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER | ||
| 116 | AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. | ||
| 117 | THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||
| 118 | PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY | ||
| 119 | YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR | ||
| 120 | CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR | ||
| 121 | CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, | ||
| 122 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||