Kevin Ryde > Math-NumSeq-Alpha-3 > Math::NumSeq::AlphabeticalLength

Math-NumSeq-Alpha-3.tar.gz

Dependencies

Annotate this POD

Website

# CPAN RT

 Open 0
View/Report Bugs
Module Version: 3

# NAME

Math::NumSeq::AlphabeticalLength -- length of numbers written in words

# SYNOPSIS

``` use Math::NumSeq::AlphabeticalLength;
my \$seq = Math::NumSeq::AlphabeticalLength->new;
my (\$i, \$value) = \$seq->next;```

# DESCRIPTION

This sequence is how many letters when i is written out in words.

```    starting i=1
3, 3, 5, 4, 4, 3, 5, 5, 4, 3, 6, 6, 8, 8, 7, 7, 9, 8, 8, ...```

For example i=3 is value 5 because "three" has 5 letters. Only letters are counted. Spaces, hyphenation or accenting is ignored.

## Lang

The default is English, or the `lang` option can select anything known to Lingua::Any::Numbers. For example French, where i=2 has value 4 for 4 letters for "deux".

```    lang => 'fr'
2, 4, 5, 6, 4, 3, 4, 4, 4, 3, 4, 5, 6, 8, ...```

## Conjunctions

The default is to include "and" conjunctions, but the `conjunctions` option can exclude them

```    conjunctions => 0
... 10, 10, 13, 13, ...```

The first difference is at i=101 which is "one hundred one" value 13, whereas with conjunctions it's "one hundred and one" value 16.

# FUNCTIONS

See "FUNCTIONS" in Math::NumSeq for behaviour common to all sequence classes.

`\$seq = Math::NumSeq::AlphabeticalLength->new ()`
`\$seq = Math::NumSeq::AlphabeticalLength->new (lang => \$str)`

Create and return a new sequence object.

## Random Access

`\$value = \$seq->ith(\$i)`

Return the number of letters in `\$i` written out in the selected language.

# BUGS

Some of the modules used by `Lingua::Any::Numbers` return utf-8 bytes and the `length()` of word chars (regexp "\w") in that case is not the length in letters. The current code decodes utf-8 from "Lingua::SV::Numbers", but other language modules might give incorrect lengths.

Lingua::Any::Numbers

http://user42.tuxfamily.org/math-numseq/index.html