| 1 | # Copyright 2012, 2013, 2015, 2020 Kevin Ryde | ||
| 2 | |||
| 3 | # This file is part of Math-NumSeq-Alpha. | ||
| 4 | # | ||
| 5 | # Math-NumSeq-Alpha is free software; you can redistribute it and/or modify | ||
| 6 | # it under the terms of the GNU General Public License as published by the | ||
| 7 | # Free Software Foundation; either version 3, or (at your option) any later | ||
| 8 | # version. | ||
| 9 | # | ||
| 10 | # Math-NumSeq-Alpha is distributed in the hope that it will be useful, but | ||
| 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
| 12 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 13 | # for more details. | ||
| 14 | # | ||
| 15 | # You should have received a copy of the GNU General Public License along | ||
| 16 | # with Math-NumSeq-Alpha. If not, see <http://www.gnu.org/licenses/>. | ||
| 17 | |||
| 18 | package Math::NumSeq::OEIS::Catalogue::Plugin::Alpha; | ||
| 19 | use 5.004; | ||
| 20 | use strict; | ||
| 21 | |||
| 22 | use vars '$VERSION', '@ISA'; | ||
| 23 | $VERSION = 4; | ||
| 24 | use Math::NumSeq::OEIS::Catalogue::Plugin; | ||
| 25 | @ISA = ('Math::NumSeq::OEIS::Catalogue::Plugin'); | ||
| 26 | |||
| 27 | use constant::defer info_arrayref => sub { | ||
| 28 | # Lingua::Any::Numbers before version 0.45 fails to load in "perl -T" | ||
| 29 | # taint mode. Might like to treat that as no languages available, but | ||
| 30 | # can't trap a taint error with an eval{}. If you're using taint mode | ||
| 31 | # then get Lingua::Any::Numbers version 0.45. | ||
| 32 | require Lingua::Any::Numbers; | ||
| 33 | my @available = Lingua::Any::Numbers::available(); | ||
| 34 | |||
| 35 | my %available; | ||
| 36 | @available{@available} = (); | ||
| 37 | |||
| 38 | return [ | ||
| 39 | { | ||
| 40 | # A005589 excludes conjunctions, so 101 = "one hundred one" = 13 | ||
| 41 | # letters. Not explicitly noted, but can be seen in the | ||
| 42 | # a000027.txt linked and in the Pari code by M. F. Hasler. | ||
| 43 | # | ||
| 44 | anum => 'A005589', | ||
| 45 | class => 'Math::NumSeq::AlphabeticalLength', | ||
| 46 | parameters => [ i_start => 0, conjunctions => 0 ], | ||
| 47 | }, | ||
| 48 | { | ||
| 49 | anum => 'A006944', | ||
| 50 | class => 'Math::NumSeq::AlphabeticalLength', | ||
| 51 | parameters => [ number_type => 'ordinal', | ||
| 52 | i_start => 1, conjunctions => 0 ], | ||
| 53 | }, | ||
| 54 | { | ||
| 55 | anum => 'A016037', | ||
| 56 | class => 'Math::NumSeq::AlphabeticalLengthSteps', | ||
| 57 | parameters => [ i_start => 0, conjunctions => 0 ], | ||
| 58 | }, | ||
| 59 | |||
| 60 | (exists $available{'ES'} | ||
| 61 | ? { | ||
| 62 | anum => 'A011762', | ||
| 63 | class => 'Math::NumSeq::AlphabeticalLength', | ||
| 64 | parameters => [ lang => 'es', i_start => 0 ], | ||
| 65 | } | ||
| 66 | : ()), | ||
| 67 | |||
| 68 | (exists $available{'EO'} # Esperanto | ||
| 69 | ? { | ||
| 70 | anum => 'A057853', | ||
| 71 | class => 'Math::NumSeq::AlphabeticalLength', | ||
| 72 | parameters => [ lang => 'eo', i_start => 0 ], | ||
| 73 | } | ||
| 74 | : ()), | ||
| 75 | |||
| 76 | # premiere ? | ||
| 77 | # (exists $available{'FR'} | ||
| 78 | # ? { | ||
| 79 | # anum => 'A006969', | ||
| 80 | # class => 'Math::NumSeq::AlphabeticalLength', | ||
| 81 | # parameters => [ lang => 'fr', | ||
| 82 | # number_type => 'ordinal', | ||
| 83 | # i_start => 1 ], | ||
| 84 | # } | ||
| 85 | # : ()), | ||
| 86 | |||
| 87 | # egy ? | ||
| 88 | # (exists $available{'HU'} | ||
| 89 | # ? { | ||
| 90 | # anum => 'A007292', | ||
| 91 | # class => 'Math::NumSeq::AlphabeticalLength', | ||
| 92 | # parameters => [ lang => 'hu', i_start => 1 ], | ||
| 93 | # } | ||
| 94 | # : ()), | ||
| 95 | |||
| 96 | # centottanta in A026858 vs centoottanta in Lingua | ||
| 97 | # (exists $available{'IT'} | ||
| 98 | # ? { | ||
| 99 | # anum => 'A026858', | ||
| 100 | # class => 'Math::NumSeq::AlphabeticalLength', | ||
| 101 | # parameters => [ lang => 'it', i_start => 0 ], | ||
| 102 | # } | ||
| 103 | # : ()), | ||
| 104 | |||
| 105 | # (exists $available{'JA'} | ||
| 106 | # ? { | ||
| 107 | # anum => 'A030166', | ||
| 108 | # class => 'Math::NumSeq::AlphabeticalLength', | ||
| 109 | # parameters => [ lang => 'ja', i_start => 0 ], | ||
| 110 | # } | ||
| 111 | # : ()), | ||
| 112 | |||
| 113 | # pos=17 is n=18 is OEIS 8 for "achttien" | ||
| 114 | # cf Lingua::NL::Numbers "achtien" | ||
| 115 | # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ||
| 116 | # 3, 4, 4, 4, 4, 3, 5, 4, 5, 4, 3, 6, 7, 8, 8, 7, 9, 8, 9, 7, | ||
| 117 | # (exists $available{'NL'} | ||
| 118 | # ? { | ||
| 119 | # anum => 'A090589', | ||
| 120 | # class => 'Math::NumSeq::AlphabeticalLength', | ||
| 121 | # parameters => [ lang => 'nl', i_start => 1 ], | ||
| 122 | # } | ||
| 123 | # : ()), | ||
| 124 | |||
| 125 | # (exists $available{'NO'} | ||
| 126 | # ? { | ||
| 127 | # anum => 'A014656', | ||
| 128 | # class => 'Math::NumSeq::AlphabeticalLength', | ||
| 129 | # parameters => [ lang => 'no', i_start => 1 ], | ||
| 130 | # } | ||
| 131 | # : ()), | ||
| 132 | |||
| 133 | # (exists $available{'PL'} | ||
| 134 | # ? { | ||
| 135 | # anum => 'A008962', | ||
| 136 | # class => 'Math::NumSeq::AlphabeticalLength', | ||
| 137 | # parameters => [ lang => 'pl', i_start => 0 ], | ||
| 138 | # } | ||
| 139 | # : ()), | ||
| 140 | |||
| 141 | # No, Brazilian Portuguese "catorze" cf PT "quatorze" | ||
| 142 | # # A057696 values start n=1 but OFFSET=0 | ||
| 143 | # (exists $available{'PT'} | ||
| 144 | # ? { | ||
| 145 | # anum => 'A057696', | ||
| 146 | # class => 'Math::NumSeq::AlphabeticalLength', | ||
| 147 | # parameters => [ lang => 'pt', i_start => 1 ], | ||
| 148 | # } | ||
| 149 | # : ()), | ||
| 150 | |||
| 151 | # No, Lingua::RU::Number 0.05 is money amounts only. | ||
| 152 | # (exists $available{'RU'} | ||
| 153 | # ? { | ||
| 154 | # anum => 'A006994', | ||
| 155 | # class => 'Math::NumSeq::AlphabeticalLength', | ||
| 156 | # parameters => [ lang => 'ru', i_start => 0 ], | ||
| 157 | # } | ||
| 158 | # : ()), | ||
| 159 | |||
| 160 | (exists $available{'SV'} | ||
| 161 | ? { | ||
| 162 | anum => 'A059124', | ||
| 163 | class => 'Math::NumSeq::AlphabeticalLength', | ||
| 164 | parameters => [ lang => 'sv', i_start => 0 ], | ||
| 165 | } | ||
| 166 | : ()), | ||
| 167 | |||
| 168 | (exists $available{'TR'} | ||
| 169 | ? { | ||
| 170 | anum => 'A057435', | ||
| 171 | class => 'Math::NumSeq::AlphabeticalLength', | ||
| 172 | parameters => [ lang => 'tr', i_start => 1 ], | ||
| 173 | } | ||
| 174 | : ()), | ||
| 175 | |||
| 176 | |||
| 177 | # SevenSegments | ||
| 178 | { | ||
| 179 | anum => 'A063720', | ||
| 180 | class => 'Math::NumSeq::SevenSegments', | ||
| 181 | parameters => [ six => 5 ], | ||
| 182 | }, | ||
| 183 | { | ||
| 184 | anum => 'A006942', | ||
| 185 | class => 'Math::NumSeq::SevenSegments', | ||
| 186 | parameters => [ nine => 6 ], | ||
| 187 | }, | ||
| 188 | { | ||
| 189 | anum => 'A074458', | ||
| 190 | class => 'Math::NumSeq::SevenSegments', | ||
| 191 | parameters => [ seven => 4 ], | ||
| 192 | }, | ||
| 193 | { | ||
| 194 | anum => 'A010371', | ||
| 195 | class => 'Math::NumSeq::SevenSegments', | ||
| 196 | parameters => [ seven => 4, nine => 6 ], | ||
| 197 | }, | ||
| 198 | { | ||
| 199 | anum => 'A277116', | ||
| 200 | class => 'Math::NumSeq::SevenSegments', | ||
| 201 | parameters => [ ], | ||
| 202 | }, | ||
| 203 | |||
| 204 | ]; | ||
| 205 | }; | ||
| 206 | |||
| 207 | 1; | ||
| 208 | __END__ |