giancap61 commited on
Commit
187968b
·
verified ·
1 Parent(s): ec07f4a

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. TTS/Kokoro/.venv/Lib/site-packages/num2words-0.5.14.dist-info/COPYING +145 -0
  2. TTS/Kokoro/.venv/Lib/site-packages/num2words-0.5.14.dist-info/INSTALLER +1 -0
  3. TTS/Kokoro/.venv/Lib/site-packages/num2words-0.5.14.dist-info/METADATA +398 -0
  4. TTS/Kokoro/.venv/Lib/site-packages/num2words-0.5.14.dist-info/RECORD +131 -0
  5. TTS/Kokoro/.venv/Lib/site-packages/num2words-0.5.14.dist-info/WHEEL +5 -0
  6. TTS/Kokoro/.venv/Lib/site-packages/num2words-0.5.14.dist-info/top_level.txt +1 -0
  7. TTS/Kokoro/.venv/Lib/site-packages/num2words/__init__.py +111 -0
  8. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_FR_CH.py +48 -0
  9. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_FR_DZ.py +33 -0
  10. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_HE.py +327 -0
  11. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_HU.py +165 -0
  12. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_ID.py +204 -0
  13. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_IS.py +127 -0
  14. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_IT.py +241 -0
  15. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_JA.py +590 -0
  16. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_KN.py +182 -0
  17. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_KO.py +148 -0
  18. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_KZ.py +133 -0
  19. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_LT.py +182 -0
  20. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_LV.py +189 -0
  21. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_NL.py +158 -0
  22. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_NO.py +122 -0
  23. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_PL.py +272 -0
  24. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_PT.py +241 -0
  25. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_PT_BR.py +115 -0
  26. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_RO.py +174 -0
  27. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_RU.py +501 -0
  28. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_SK.py +160 -0
  29. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_SL.py +171 -0
  30. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_SR.py +219 -0
  31. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_SV.py +117 -0
  32. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_TE.py +169 -0
  33. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_TET.py +251 -0
  34. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_TG.py +149 -0
  35. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_TH.py +183 -0
  36. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_TR.py +856 -0
  37. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_UK.py +1067 -0
  38. TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_VI.py +101 -0
  39. TTS/Kokoro/.venv/Lib/site-packages/num2words/utils.py +35 -0
  40. TTS/Kokoro/.venv/Lib/site-packages/numpy-2.4.2.dist-info/DELVEWHEEL +2 -0
  41. TTS/Kokoro/.venv/Lib/site-packages/numpy-2.4.2.dist-info/INSTALLER +1 -0
  42. TTS/Kokoro/.venv/Lib/site-packages/numpy-2.4.2.dist-info/METADATA +139 -0
  43. TTS/Kokoro/.venv/Lib/site-packages/numpy-2.4.2.dist-info/RECORD +0 -0
  44. TTS/Kokoro/.venv/Lib/site-packages/numpy-2.4.2.dist-info/REQUESTED +0 -0
  45. TTS/Kokoro/.venv/Lib/site-packages/numpy-2.4.2.dist-info/WHEEL +4 -0
  46. TTS/Kokoro/.venv/Lib/site-packages/numpy-2.4.2.dist-info/entry_points.txt +13 -0
  47. TTS/Kokoro/.venv/Lib/site-packages/numpy/__config__.py +170 -0
  48. TTS/Kokoro/.venv/Lib/site-packages/numpy/__config__.pyi +108 -0
  49. TTS/Kokoro/.venv/Lib/site-packages/numpy/__init__.cython-30.pxd +1242 -0
  50. TTS/Kokoro/.venv/Lib/site-packages/numpy/__init__.pxd +1155 -0
TTS/Kokoro/.venv/Lib/site-packages/num2words-0.5.14.dist-info/COPYING ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU Lesser General Public License
2
+
3
+ Version 2.1, February 1999
4
+
5
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
6
+
7
+ [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.]
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.
12
+
13
+ This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.
14
+
15
+ When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.
16
+
17
+ To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.
18
+
19
+ For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.
20
+
21
+ We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.
22
+
23
+ To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.
24
+
25
+ Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.
26
+
27
+ Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.
28
+
29
+ When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.
30
+
31
+ We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.
32
+
33
+ For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.
34
+
35
+ In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.
36
+
37
+ Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.
38
+
39
+ The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run.
40
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
41
+
42
+ 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you".
43
+
44
+ A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.
45
+
46
+ The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".)
47
+
48
+ "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.
49
+
50
+ Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.
51
+
52
+ 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.
53
+
54
+ You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
55
+
56
+ 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
57
+
58
+ a) The modified work must itself be a software library.
59
+
60
+ b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.
61
+
62
+ c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.
63
+
64
+ d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.
65
+
66
+ (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)
67
+
68
+ These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
69
+
70
+ Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.
71
+
72
+ In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
73
+
74
+ 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.
75
+
76
+ Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.
77
+
78
+ This option is useful when you wish to copy part of the code of the Library into a program that is not a library.
79
+
80
+ 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange.
81
+
82
+ If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code.
83
+
84
+ 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.
85
+
86
+ However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.
87
+
88
+ When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.
89
+
90
+ If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)
91
+
92
+ Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.
93
+
94
+ 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.
95
+
96
+ You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:
97
+
98
+ a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)
99
+
100
+ b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.
101
+
102
+ c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.
103
+
104
+ d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.
105
+
106
+ e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy.
107
+
108
+ For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
109
+
110
+ It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.
111
+
112
+ 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:
113
+
114
+ a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.
115
+
116
+ b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
117
+
118
+ 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
119
+
120
+ 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.
121
+
122
+ 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.
123
+
124
+ 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.
125
+
126
+ If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.
127
+
128
+ It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
129
+
130
+ This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
131
+
132
+ 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
133
+
134
+ 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
135
+
136
+ Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.
137
+
138
+ 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
139
+
140
+ NO WARRANTY
141
+
142
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
143
+
144
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
145
+ END OF TERMS AND CONDITIONS
TTS/Kokoro/.venv/Lib/site-packages/num2words-0.5.14.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
TTS/Kokoro/.venv/Lib/site-packages/num2words-0.5.14.dist-info/METADATA ADDED
@@ -0,0 +1,398 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: num2words
3
+ Version: 0.5.14
4
+ Summary: Modules to convert numbers to words. Easily extensible.
5
+ Home-page: https://github.com/savoirfairelinux/num2words
6
+ Author: Taro Ogawa <tso at users sourceforge net>
7
+ Author-email: tos@users.sourceforge.net
8
+ Maintainer: Savoir-faire Linux inc.
9
+ Maintainer-email: support@savoirfairelinux.com
10
+ License: LGPL
11
+ Keywords: number word numbers words convert conversion i18n localisation localization internationalisation internationalization
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
15
+ Classifier: Programming Language :: Python :: 3.7
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Software Development :: Internationalization
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Software Development :: Localization
24
+ Classifier: Topic :: Text Processing :: Linguistic
25
+ Description-Content-Type: text/markdown
26
+ License-File: COPYING
27
+ Requires-Dist: docopt>=0.6.2
28
+
29
+ num2words library - Convert numbers to words in multiple languages
30
+ ==================================================================
31
+
32
+ .. image:: https://img.shields.io/pypi/v/num2words.svg
33
+ :target: https://pypi.python.org/pypi/num2words
34
+
35
+ .. image:: https://travis-ci.org/savoirfairelinux/num2words.svg?branch=master
36
+ :target: https://travis-ci.org/savoirfairelinux/num2words
37
+
38
+ .. image:: https://coveralls.io/repos/github/savoirfairelinux/num2words/badge.svg?branch=master
39
+ :target: https://coveralls.io/github/savoirfairelinux/num2words?branch=master
40
+
41
+
42
+ ``num2words`` is a library that converts numbers like ``42`` to words like ``forty-two``.
43
+ It supports multiple languages (see the list below for full list
44
+ of languages) and can even generate ordinal numbers like ``forty-second``
45
+ (although this last feature is a bit buggy for some languages at the moment).
46
+
47
+ The project is hosted on GitHub_. Contributions are welcome.
48
+
49
+ .. _GitHub: https://github.com/savoirfairelinux/num2words
50
+
51
+ Installation
52
+ ------------
53
+
54
+ The easiest way to install ``num2words`` is to use pip::
55
+
56
+ pip install num2words
57
+
58
+ Otherwise, you can download the source package and then execute::
59
+
60
+ python setup.py install
61
+
62
+ The test suite in this library is new, so it's rather thin, but it can be run with::
63
+
64
+ python setup.py test
65
+
66
+ To run the full CI test suite which includes linting and multiple python environments::
67
+
68
+ pip install tox
69
+ tox
70
+
71
+ Usage
72
+ -----
73
+ Command line::
74
+
75
+ $ num2words 10001
76
+ ten thousand and one
77
+ $ num2words 24,120.10
78
+ twenty-four thousand, one hundred and twenty point one
79
+ $ num2words 24,120.10 -l es
80
+ veinticuatro mil ciento veinte punto uno
81
+ $num2words 2.14 -l es --to currency
82
+ dos euros con catorce céntimos
83
+
84
+ In code there's only one function to use::
85
+
86
+ >>> from num2words import num2words
87
+ >>> num2words(42)
88
+ forty-two
89
+ >>> num2words(42, to='ordinal')
90
+ forty-second
91
+ >>> num2words(42, lang='fr')
92
+ quarante-deux
93
+
94
+ Besides the numerical argument, there are two main optional arguments, ``to:`` and ``lang:``
95
+
96
+ **to:** The converter to use. Supported values are:
97
+
98
+ * ``cardinal`` (default)
99
+ * ``ordinal``
100
+ * ``ordinal_num``
101
+ * ``year``
102
+ * ``currency``
103
+
104
+ **lang:** The language in which to convert the number. Supported values are:
105
+
106
+ * ``en`` (English, default)
107
+ * ``am`` (Amharic)
108
+ * ``ar`` (Arabic)
109
+ * ``az`` (Azerbaijani)
110
+ * ``be`` (Belarusian)
111
+ * ``bn`` (Bangladeshi)
112
+ * ``ca`` (Catalan)
113
+ * ``ce`` (Chechen)
114
+ * ``cs`` (Czech)
115
+ * ``cy`` (Welsh)
116
+ * ``da`` (Danish)
117
+ * ``de`` (German)
118
+ * ``en_GB`` (English - Great Britain)
119
+ * ``en_IN`` (English - India)
120
+ * ``en_NG`` (English - Nigeria)
121
+ * ``es`` (Spanish)
122
+ * ``es_CO`` (Spanish - Colombia)
123
+ * ``es_CR`` (Spanish - Costa Rica)
124
+ * ``es_GT`` (Spanish - Guatemala)
125
+ * ``es_VE`` (Spanish - Venezuela)
126
+ * ``eu`` (EURO)
127
+ * ``fa`` (Farsi)
128
+ * ``fi`` (Finnish)
129
+ * ``fr`` (French)
130
+ * ``fr_BE`` (French - Belgium)
131
+ * ``fr_CH`` (French - Switzerland)
132
+ * ``fr_DZ`` (French - Algeria)
133
+ * ``he`` (Hebrew)
134
+ * ``hu`` (Hungarian)
135
+ * ``id`` (Indonesian)
136
+ * ``is`` (Icelandic)
137
+ * ``it`` (Italian)
138
+ * ``ja`` (Japanese)
139
+ * ``kn`` (Kannada)
140
+ * ``ko`` (Korean)
141
+ * ``kz`` (Kazakh)
142
+ * ``lt`` (Lithuanian)
143
+ * ``lv`` (Latvian)
144
+ * ``nl`` (Dutch)
145
+ * ``no`` (Norwegian)
146
+ * ``pl`` (Polish)
147
+ * ``pt`` (Portuguese)
148
+ * ``pt_BR`` (Portuguese - Brazilian)
149
+ * ``ro`` (Romanian)
150
+ * ``ru`` (Russian)
151
+ * ``sl`` (Slovene)
152
+ * ``sk`` (Slovak)
153
+ * ``sr`` (Serbian)
154
+ * ``sv`` (Swedish)
155
+ * ``te`` (Telugu)
156
+ * ``tet`` (Tetum)
157
+ * ``tg`` (Tajik)
158
+ * ``tr`` (Turkish)
159
+ * ``th`` (Thai)
160
+ * ``uk`` (Ukrainian)
161
+ * ``vi`` (Vietnamese)
162
+
163
+ You can supply values like ``fr_FR``; if the country doesn't exist but the
164
+ language does, the code will fall back to the base language (i.e. ``fr``). If
165
+ you supply an unsupported language, ``NotImplementedError`` is raised.
166
+ Therefore, if you want to call ``num2words`` with a fallback, you can do::
167
+
168
+ try:
169
+ return num2words(42, lang=mylang)
170
+ except NotImplementedError:
171
+ return num2words(42, lang='en')
172
+
173
+ Additionally, some converters and languages support other optional arguments
174
+ that are needed to make the converter useful in practice.
175
+
176
+ Wiki
177
+ ----
178
+ For additional information on some localization please check the Wiki_.
179
+ And feel free to propose wiki enhancement.
180
+
181
+ .. _Wiki: https://github.com/savoirfairelinux/num2words/wiki
182
+
183
+ History
184
+ -------
185
+
186
+ ``num2words`` is based on an old library, ``pynum2word``, created by Taro Ogawa
187
+ in 2003. Unfortunately, the library stopped being maintained and the author
188
+ can't be reached. There was another developer, Marius Grigaitis, who in 2011
189
+ added Lithuanian support, but didn't take over maintenance of the project.
190
+
191
+ I am thus basing myself on Marius Grigaitis' improvements and re-publishing
192
+ ``pynum2word`` as ``num2words``.
193
+
194
+ Virgil Dupras, Savoir-faire Linux
195
+
196
+ Changelog
197
+ =========
198
+
199
+ Version 0.5.14 -- 2024/12/16
200
+ ----------------------------
201
+
202
+ * Fixed a typo in PL (#466)
203
+ * Run tests against Python 3.12 (#544)
204
+ * ADD num2words: es_CR language (#565)
205
+ * New languages: Welsh (Celtic) and Chechen (Nakho-Dagestanian) (#543)
206
+ * Add catalan language support (#581)
207
+ * Adding Tetum Language (#576)
208
+ * FIX ISO code for Belarusian language is be, not by. (#574)
209
+ * Add test to improve coverage (#595)
210
+ * Added Bangla language support to num2word for Bangladesh. (#589)
211
+ * Czech language ISO 639-1 code fix (#587)
212
+ * Added support for Tunisian Dinar (#593)
213
+ * Change danish language code to DA (#596)
214
+
215
+
216
+ Version 0.5.13 -- 2023/10/18
217
+ ---------------------------
218
+
219
+ * Fix a problem in Brazilian Portuguese code referred to thousands when the hundreds are exact. (#421)
220
+ * Fix issue with the hundreds of millions, billions, ... when the hundreds of those are exact. (#436)
221
+ * Fix negative number problem (#477)
222
+ * Fix lang_DK issues (#366)
223
+ * Norwegian uplift (#484)
224
+ * BYN to EU and RU (#439)
225
+ * Change python3.6 to python3.11 because deprecation in ubuntu 22.04 (#494)
226
+ * Add support for Azerbaijani language (#495)
227
+ * Add Icelandic (#380)
228
+ * Hebrew long-form spelling, gender, ordinals, fractions, maxval=1e66, construct forms (#490)
229
+ * Fix 15, 16, 17, 18, 19 issue (#505)
230
+ * Added support for the Nigerian Naira (#507)
231
+ * Fix several issues with num2words in Arabic (#512)
232
+ * Guatemalan currency support (#510)
233
+ * Fix #508: Handle string inputs in Italian to_ordinal (#518)
234
+ * Add Slovak language support (#533)
235
+ * Add gender and morphological cases support for Ukrainian (#530)
236
+ * Adding genders for Russian language (#503)
237
+ * Lang By Added (#506)
238
+ * Add Saudi Riyal to english (#531)
239
+
240
+ Version 0.5.12 -- 2022/08/19
241
+ ----------------------------
242
+
243
+ * Support Japanese Reiwa (令和/れいわ) era. (#412)
244
+ * Add basic farsi support (#354)
245
+ * Added Tajik language support (#406)
246
+ * Fix Amharic language support (#465)
247
+ * Fix Hebrew pluralize and implement to_currency (#330)
248
+ * Add support to translate some currencies in italian language (#434)
249
+ * Fix Polish twenties (#345)
250
+ * Add uzs for ru and en (#422)
251
+ * Added support for Esperanto numbers. (#387)
252
+ * [ADD] to ordinal number for Turkish (#468)
253
+ * Fix zeroth in Dutch to nulde fixing (#326)
254
+
255
+ Version 0.5.11 -- 2022/08/03
256
+ ----------------------------
257
+
258
+ * Add KZT and UAH currencies to lang RU (#264)
259
+ * Add es_NI currency (#276)
260
+ * Update .gitignore to add .eggs/ directory (#280)
261
+ * Fix Hebrew support (#289)
262
+ * Update test_tr.py to increase coverage (#298)
263
+ * Add ordinal 12,345 to ES test suite to increase coverage (#287)
264
+ * Add simple tests for lang_DK.py (#286)
265
+ * Add testcase for lang_EN.py (#288)
266
+ * Add more tests to base.py (#283)
267
+ * Fixed misspelling of 21 (cardinal and ordinal number) in IT language (#270)
268
+ * Romanian issues 259 (#260)
269
+ * Adding Language Support for Telugu / Bug Fix in Kannada (#263)
270
+ * Add support of Kazakh language (KZ) (#306)
271
+ * Update README.rst (#307)
272
+ * Added support for Hungarian language (#310)
273
+ * [UPD] Readme file (#363)
274
+ * [ADD] num2words: add traslation to spanish of several currencies (#356)
275
+ * added swedish language including test cases (#352)
276
+ * Remove dupplicated line in lang_PT_BR (#355)
277
+ * Fix ordinal_num output for Dutch (NL) (#369)
278
+ * Polishordinals (#367)
279
+ * [tr] return Turkish 0 ordinal and cardinal (#347)
280
+ * Improve Ukrainian support and minor fixes in CZ, KZ, LT, LV, PL, RU, SR languages (#400)
281
+ * feat: ci: replace travis by github workflows (#448)
282
+ * [ES] Added missing accents ("dieciséis", "dólar", "dólares", "veintiún"), improved currency gender handling, fixed pound cent names (#443)
283
+
284
+ Version 0.5.10 -- 2019/05/12
285
+ ----------------------------
286
+
287
+ * Add Kannada language localization (#243)
288
+ * Revert some copyrights changed by mistake (#254)
289
+ * Add indian rupee to the supported currencies (#248)
290
+ * Improve currency functions for German and French (#247)
291
+ * Improve Slovene localization (#246)
292
+ * Improve Spanish localization (#240)
293
+ * Fix typo 'seperator' on source code (#238)
294
+ * Convert string to decimal values (#223)
295
+ * Improve German localization and test coverage (#237)
296
+ * Improve Polish localization (#233)
297
+ * Fix ordinal number for French ending on 1 (#236)
298
+
299
+ Version 0.5.9 -- 2019/01/10
300
+ ---------------------------
301
+
302
+ * Fix encoding issue on release 0.5.8 (#229)
303
+ * Improve Polish localization (#228)
304
+
305
+
306
+ Version 0.5.8 -- 2018/11/17
307
+ ---------------------------
308
+
309
+ * Add Portuguese (Portugal) localization (#198)
310
+ * Add a command line tool to use num2words
311
+ * Use language iso code for Vietnamese
312
+ * Improve Korean localization (#219)
313
+ * Improve Serbian (Latin) localization (#207)
314
+ * Improve testing setup (#220)
315
+ * Improve German localization (#214) (#222)
316
+ * Improve Romanian localization (#215)
317
+ * Improve Spanish localization (#187) (#200)
318
+ * Improve Russian localization (#211) (#212)
319
+ * Improve French localization (23902ab)
320
+ * Improve Arabic localization (#176)
321
+ * Improve Lithuanian and Latvian localization (#185)
322
+ * Improve Ukrainian localization (#183)
323
+
324
+
325
+ Version 0.5.7 -- 2018/06/27
326
+ ---------------------------
327
+
328
+ * Add Finnish localization. (#170)
329
+ * Add Japanese localization. (#171)
330
+ * Add belgian-french localization. (#151)
331
+ * Add Czech localization. (#154)
332
+ * Add Thai localization. (#139)
333
+ * Improve English localization. (#144)
334
+ * Improve Spanish localization. (#167)
335
+ * Improve Italian localization. (#143)
336
+ * Improve documentation. (#155, #145, #174)
337
+
338
+ Version 0.5.6 -- 2017/11/22
339
+ ---------------------------
340
+
341
+ * Refactor to_currency (#135)
342
+ * Allow the use of other convertes to_currency, to_year (#95)
343
+ * Fix code to respect PEP8 (#98, #105)
344
+ * Add Slovene localization (#97)
345
+ * Add Ukrainian localization (#93)
346
+ * Add Dutch localization (#91)
347
+ * Add Algeria-French localization (#86)
348
+ * Add Turkish localization (#85)
349
+
350
+ Version 0.5.5 -- 2017/07/02
351
+ ---------------------------
352
+
353
+ * Add Arabic localization (#72)
354
+ * Add Spanish-Colombian and Spanish-Venezuelan localization (#67)
355
+ * Add VietNam localization (#61)
356
+ * Add Italian localization (#56, #59)
357
+ * Improve Russian localization (#62)
358
+ * Improve Polish localization (#58)
359
+
360
+ Version 0.5.4 -- 2016/10/18
361
+ ---------------------------
362
+
363
+ * Tons of new languages!
364
+ * Add Polish localization. (#23)
365
+ * Add Swiss-French localization. (#38)
366
+ * Add Russian localization. (#28, #46, #48)
367
+ * Add Indonesian localization. (#29)
368
+ * Add Norwegian localization. (#33)
369
+ * Add Danish localization. (#40)
370
+ * Add Brazilian localization. (#37, #47)
371
+ * Improve German localization. (#25, #27, #49)
372
+ * Improve Lithuanian localization. (#52)
373
+ * Improve floating point spelling. (#24)
374
+
375
+ Version 0.5.3 -- 2015/06/09
376
+ ---------------------------
377
+
378
+ * Fix packaging issues. (#21, #22)
379
+
380
+ Version 0.5.2 -- 2015/01/23
381
+ ---------------------------
382
+
383
+ * Added Latvian localization. (#9)
384
+ * Improved Spanish localization. (#10, #13, #14)
385
+ * Improved Lithuanian localization. (#12)
386
+
387
+ Version 0.5.1 -- 2014/03/14
388
+ ---------------------------
389
+
390
+ * Added Python 3 support with 2to3. (#3)
391
+ * Fixed big numbers in spanish. (#2)
392
+ * Fixed bugs in tanslation from 30 to 40 in spanish. (#4)
393
+ * Fixed word joining in english. (#8)
394
+
395
+ Version 0.5.0 -- 2013/05/28
396
+ ---------------------------
397
+
398
+ * Created ``num2words`` based on the old ``pynum2word`` project.
TTS/Kokoro/.venv/Lib/site-packages/num2words-0.5.14.dist-info/RECORD ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ../../Scripts/num2words,sha256=7zjYklXXBbCQBIiwaLYpDZegOd1mUFvIaBqo1nJum5Y,3039
2
+ num2words-0.5.14.dist-info/COPYING,sha256=FFegPZKK6wavPqde8GXFF-kV1-QSg9VQ3U-hirIM2hI,23995
3
+ num2words-0.5.14.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
4
+ num2words-0.5.14.dist-info/METADATA,sha256=e1uSF9sYJ02w_bdcHn3ug8Yb5PQIvk2deWoiU9VXht8,13164
5
+ num2words-0.5.14.dist-info/RECORD,,
6
+ num2words-0.5.14.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
7
+ num2words-0.5.14.dist-info/top_level.txt,sha256=TCTV-xtX6whCC1B0WTe4hTqpAqJaPmEHFsuNOrfbaq0,10
8
+ num2words/__init__.py,sha256=uphwgHFsS5kIyjjyDyhYSyvwyf0ML7lKWCTCrryCUeU,4270
9
+ num2words/__pycache__/__init__.cpython-312.pyc,,
10
+ num2words/__pycache__/base.cpython-312.pyc,,
11
+ num2words/__pycache__/compat.cpython-312.pyc,,
12
+ num2words/__pycache__/currency.cpython-312.pyc,,
13
+ num2words/__pycache__/lang_AM.cpython-312.pyc,,
14
+ num2words/__pycache__/lang_AR.cpython-312.pyc,,
15
+ num2words/__pycache__/lang_AZ.cpython-312.pyc,,
16
+ num2words/__pycache__/lang_BE.cpython-312.pyc,,
17
+ num2words/__pycache__/lang_BN.cpython-312.pyc,,
18
+ num2words/__pycache__/lang_CA.cpython-312.pyc,,
19
+ num2words/__pycache__/lang_CE.cpython-312.pyc,,
20
+ num2words/__pycache__/lang_CS.cpython-312.pyc,,
21
+ num2words/__pycache__/lang_CY.cpython-312.pyc,,
22
+ num2words/__pycache__/lang_DA.cpython-312.pyc,,
23
+ num2words/__pycache__/lang_DE.cpython-312.pyc,,
24
+ num2words/__pycache__/lang_EN.cpython-312.pyc,,
25
+ num2words/__pycache__/lang_EN_IN.cpython-312.pyc,,
26
+ num2words/__pycache__/lang_EN_NG.cpython-312.pyc,,
27
+ num2words/__pycache__/lang_EO.cpython-312.pyc,,
28
+ num2words/__pycache__/lang_ES.cpython-312.pyc,,
29
+ num2words/__pycache__/lang_ES_CO.cpython-312.pyc,,
30
+ num2words/__pycache__/lang_ES_CR.cpython-312.pyc,,
31
+ num2words/__pycache__/lang_ES_GT.cpython-312.pyc,,
32
+ num2words/__pycache__/lang_ES_NI.cpython-312.pyc,,
33
+ num2words/__pycache__/lang_ES_VE.cpython-312.pyc,,
34
+ num2words/__pycache__/lang_EU.cpython-312.pyc,,
35
+ num2words/__pycache__/lang_FA.cpython-312.pyc,,
36
+ num2words/__pycache__/lang_FI.cpython-312.pyc,,
37
+ num2words/__pycache__/lang_FR.cpython-312.pyc,,
38
+ num2words/__pycache__/lang_FR_BE.cpython-312.pyc,,
39
+ num2words/__pycache__/lang_FR_CH.cpython-312.pyc,,
40
+ num2words/__pycache__/lang_FR_DZ.cpython-312.pyc,,
41
+ num2words/__pycache__/lang_HE.cpython-312.pyc,,
42
+ num2words/__pycache__/lang_HU.cpython-312.pyc,,
43
+ num2words/__pycache__/lang_ID.cpython-312.pyc,,
44
+ num2words/__pycache__/lang_IS.cpython-312.pyc,,
45
+ num2words/__pycache__/lang_IT.cpython-312.pyc,,
46
+ num2words/__pycache__/lang_JA.cpython-312.pyc,,
47
+ num2words/__pycache__/lang_KN.cpython-312.pyc,,
48
+ num2words/__pycache__/lang_KO.cpython-312.pyc,,
49
+ num2words/__pycache__/lang_KZ.cpython-312.pyc,,
50
+ num2words/__pycache__/lang_LT.cpython-312.pyc,,
51
+ num2words/__pycache__/lang_LV.cpython-312.pyc,,
52
+ num2words/__pycache__/lang_NL.cpython-312.pyc,,
53
+ num2words/__pycache__/lang_NO.cpython-312.pyc,,
54
+ num2words/__pycache__/lang_PL.cpython-312.pyc,,
55
+ num2words/__pycache__/lang_PT.cpython-312.pyc,,
56
+ num2words/__pycache__/lang_PT_BR.cpython-312.pyc,,
57
+ num2words/__pycache__/lang_RO.cpython-312.pyc,,
58
+ num2words/__pycache__/lang_RU.cpython-312.pyc,,
59
+ num2words/__pycache__/lang_SK.cpython-312.pyc,,
60
+ num2words/__pycache__/lang_SL.cpython-312.pyc,,
61
+ num2words/__pycache__/lang_SR.cpython-312.pyc,,
62
+ num2words/__pycache__/lang_SV.cpython-312.pyc,,
63
+ num2words/__pycache__/lang_TE.cpython-312.pyc,,
64
+ num2words/__pycache__/lang_TET.cpython-312.pyc,,
65
+ num2words/__pycache__/lang_TG.cpython-312.pyc,,
66
+ num2words/__pycache__/lang_TH.cpython-312.pyc,,
67
+ num2words/__pycache__/lang_TR.cpython-312.pyc,,
68
+ num2words/__pycache__/lang_UK.cpython-312.pyc,,
69
+ num2words/__pycache__/lang_VI.cpython-312.pyc,,
70
+ num2words/__pycache__/utils.cpython-312.pyc,,
71
+ num2words/base.py,sha256=UjVvFxf3w5J8FfFexC9nBjW_ovMi7Q68pqtIeR1SSbQ,10022
72
+ num2words/compat.py,sha256=XjAqKKpuP6NZgcGzg6f3NsdaXMlz2L_54P8Zr9U4clY,1040
73
+ num2words/currency.py,sha256=arQf4Fbqm2lvrDwniwure1HLBsV6UNv4SXfeUDvlkck,1761
74
+ num2words/lang_AM.py,sha256=vqWBs2PfEdNFC82OVyEK28TprXBufvdzH1paaG9SAZs,5614
75
+ num2words/lang_AR.py,sha256=koOZLRxSy-4sjPC3udbV1GwAGjG5G1_I6nDEPiVZhbg,18436
76
+ num2words/lang_AZ.py,sha256=25ClKjhLk-S3K1_XqyjFZhMoOUL7Laq09z2pIm7m8lI,6315
77
+ num2words/lang_BE.py,sha256=h-4VNv8Ur4Qn3XgYU2U50YYPkSA2g7ArNnEblnAiv3Y,11850
78
+ num2words/lang_BN.py,sha256=8OkS3_dfZ-8gUtmqmJwQHOOhk4ZOAqfwnbAV5p3NqoM,8746
79
+ num2words/lang_CA.py,sha256=ju-XADqgjqQnWRbTM4KLVjk3mczF6ANsyKlaivt_wgA,18855
80
+ num2words/lang_CE.py,sha256=i4yQA-iv7iooLPktRCEPJaflPhpaWoPJ3LQiSsM2zLg,16032
81
+ num2words/lang_CS.py,sha256=L_sxsWjNqJgBWM4ydIXa21HQ23UI1_Tk-NrapKbP8Hg,4301
82
+ num2words/lang_CY.py,sha256=Jwzgvoi4W_gU1_FvCkrmZOZgRr0WkAyX9ZlKaORmut4,20093
83
+ num2words/lang_DA.py,sha256=TyJTeiCPesza5DG28jS-UywZefnJwpfjEJKCS58pP2M,5107
84
+ num2words/lang_DE.py,sha256=dPzUZTaOiPTh8-3I1uR9rmi3McXJbjjOPnkSS0D5wHg,6166
85
+ num2words/lang_EN.py,sha256=4toqx0cH4I-to0DSrZN9HZRiWQitxLtCMWVG0_lS4W4,4410
86
+ num2words/lang_EN_IN.py,sha256=giFHJPjJie7s3FKTi0XidlzPSzY19NglMGoOAx7t_4Q,1098
87
+ num2words/lang_EN_NG.py,sha256=w7Y9EPae2ltD_5KAxPf852TCU4JbhyQNgWP3SakS2Ms,1402
88
+ num2words/lang_EO.py,sha256=63owo5IeQPIWW1wo3quFa9FDcmoyjxjjMBltgAaZhzM,4835
89
+ num2words/lang_ES.py,sha256=MQzB6aUqUFVyJJa95rcHriUCIJ4XUYA1EX48whkOn0A,19705
90
+ num2words/lang_ES_CO.py,sha256=-Gw4FitaMY68wFA2EjxnY2BO-iYxpQZX36DOjcIPzas,1324
91
+ num2words/lang_ES_CR.py,sha256=xBPn1muwYEOio5nnvLXANoLf84DOR45CXXy_HWp8jjY,1388
92
+ num2words/lang_ES_GT.py,sha256=t1kGcHpK61nCT1Pl96GkytoCMsqRZNdU-XIm3wEg-1k,1406
93
+ num2words/lang_ES_NI.py,sha256=wbkRVUMzEkKqq92sadTfoJei185U9MML2nWqgCA-Nb8,1415
94
+ num2words/lang_ES_VE.py,sha256=hYRijWDWmnJTh3ZLVozq3b3b81DKtr5rZtGqygHOYFg,1390
95
+ num2words/lang_EU.py,sha256=ADf9Fx18OFHyDTF4IcJ-9YZnV1Up82dsZrkb18KRQYo,3868
96
+ num2words/lang_FA.py,sha256=Zb-xK7ITlunV-eUQkSTHqe3CanMpRwzqFqJqmBhsKuU,4880
97
+ num2words/lang_FI.py,sha256=I1sIz2vMms-3OmhVfoNUHJiLWDS-i4d65UIS0xGRTUw,23855
98
+ num2words/lang_FR.py,sha256=p-Z-hcfjhYilseG7F2dWg0xiJLiBWLVcP5BKt6WsCAY,4257
99
+ num2words/lang_FR_BE.py,sha256=hhlPKqU5-5YDUlnH-JVe_6sDfHu4jsHQQPXzHh61LEs,1942
100
+ num2words/lang_FR_CH.py,sha256=4APdDhfHmgH7w-SuaKo0g6-yKtNfMmBHiivOVTyF6Yo,1937
101
+ num2words/lang_FR_DZ.py,sha256=pHJ7-x--0ZNRX0tUG6kzsEKCeqabZsPzIQ-AR-JiD3M,1373
102
+ num2words/lang_HE.py,sha256=XPfzYclZzAH8VecwPHjydQgAdKzxoxC2f6C8hcjmJas,11583
103
+ num2words/lang_HU.py,sha256=l5nmKAozvjx1P9XskLOqeqlp4iFlBuz44HBeXGk_kxc,6068
104
+ num2words/lang_ID.py,sha256=wwtBMR-9ZgELcDzHkhteh5hxG7sN3N6rZSJrD_dShSQ,6431
105
+ num2words/lang_IS.py,sha256=idBsMdRdizjUMUHSpZSFBijqFQ21kwXywMbF2MmBWOw,4634
106
+ num2words/lang_IT.py,sha256=x0cU-FajOQgEh_hyt_3oxdHsfwsjAv5YB5mbSXrssbI,8838
107
+ num2words/lang_JA.py,sha256=vByBHXsdpo521G_KQYzmcenzAcBE4qHgZhHFnxNPct0,22325
108
+ num2words/lang_KN.py,sha256=LQ6cq14q7qgWJEIFsmACUgX58BhkZfLlqHuYSJElXFE,7223
109
+ num2words/lang_KO.py,sha256=5szKHGTp1qE6At2feb3u8ErHLy3_ixX3Nja8qwCN35E,5212
110
+ num2words/lang_KZ.py,sha256=T-BuTcjYe8MVa6JbRWEa6-Q-auFkMq0OOdf3kOGJWPA,3501
111
+ num2words/lang_LT.py,sha256=rtcm2FKI0jF28otw0VPsDb3_hBh4Rwindo7wTA8-4MY,5301
112
+ num2words/lang_LV.py,sha256=evZ0pupMUOV8rBJyhTNIw2KibcXQHdl62HtF2SgzSaU,5900
113
+ num2words/lang_NL.py,sha256=CXnjn3zw8t_SGLlo05Wxp6iz_QGtCnfvEU4F7jbR5h8,5690
114
+ num2words/lang_NO.py,sha256=rNuUk_7lULl0PywHKSS0wnrFwFvzPlwuGOOj9Edxe-o,4952
115
+ num2words/lang_PL.py,sha256=K46fLsvyew4JPGm_fECSF-l-iZhbjPeWcXB4DqlH6yc,7874
116
+ num2words/lang_PT.py,sha256=ebNkDRXkqfAcAt1_DuZmE1vwwJEhzti-yx7b5F9qAkE,8503
117
+ num2words/lang_PT_BR.py,sha256=hnyaYeQyL-vyDoC5s4Fj9tk827pHVXU_0zRgDygVoSg,3772
118
+ num2words/lang_RO.py,sha256=XH3Q9mrpfdn-Deoch_vzutCPkqh1fGp4aE8ZDTJ704Q,6817
119
+ num2words/lang_RU.py,sha256=3cjf9gl6xLz8nln4IbPBLGFHDHOlenCgY1ZvAcwoADc,21338
120
+ num2words/lang_SK.py,sha256=Kett5iEm7PagLoB42ThlGRB73A9n5_AF5-hPhtOoTTA,4629
121
+ num2words/lang_SL.py,sha256=02hBPN19fEVpzFiieMoanpsCQ2hkRLzNYzi3cvWsQWM,6322
122
+ num2words/lang_SR.py,sha256=gqGSn_fzZV6PsGzhlMILV9zoYjrjXG03CWgHcytBMNc,6689
123
+ num2words/lang_SV.py,sha256=ZEtiPY_MiAh9NsYQAnYdy8Tl1KWYj8D9ykL--EhDg4k,4625
124
+ num2words/lang_TE.py,sha256=jUdTF61vsw_rljdBqVBvddi1CktisXLA7cC2B-vCACI,6390
125
+ num2words/lang_TET.py,sha256=PWcDNE27LlKDZgD-yvCD70yLn2LgWv3Y7QdbYwLUgA0,8479
126
+ num2words/lang_TG.py,sha256=_4jf4p0X9VS24_ZkpAUaguIIjtkNKs7W6C6uIXUCQ0A,5076
127
+ num2words/lang_TH.py,sha256=925dUlzTqyA4WF1UIWpbK3BgQjsL56CsRzxLvxFNwNQ,5771
128
+ num2words/lang_TR.py,sha256=WU8LZKDyCwI2qUZNVcopBFSF_PpzUqtcyFf0otQlAZQ,40168
129
+ num2words/lang_UK.py,sha256=CubgZMVFOXMp5-aRzbclLvgpbKSkKn55fw17uyNYybY,40900
130
+ num2words/lang_VI.py,sha256=Z_AxFOW4MSTW0zb4GZyVlPFBzKlXTleb--5j16FTM4E,4151
131
+ num2words/utils.py,sha256=Wkz6OQRku0E0-RlNESYb_ZuFAhsMCvD-LdoOxs6lvYE,1360
TTS/Kokoro/.venv/Lib/site-packages/num2words-0.5.14.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.6.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
TTS/Kokoro/.venv/Lib/site-packages/num2words-0.5.14.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ num2words
TTS/Kokoro/.venv/Lib/site-packages/num2words/__init__.py ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import unicode_literals
19
+
20
+ from . import (lang_AM, lang_AR, lang_AZ, lang_BE, lang_BN, lang_CA, lang_CE,
21
+ lang_CS, lang_CY, lang_DA, lang_DE, lang_EN, lang_EN_IN,
22
+ lang_EN_NG, lang_EO, lang_ES, lang_ES_CO, lang_ES_CR,
23
+ lang_ES_GT, lang_ES_NI, lang_ES_VE, lang_FA, lang_FI, lang_FR,
24
+ lang_FR_BE, lang_FR_CH, lang_FR_DZ, lang_HE, lang_HU, lang_ID,
25
+ lang_IS, lang_IT, lang_JA, lang_KN, lang_KO, lang_KZ, lang_LT,
26
+ lang_LV, lang_NL, lang_NO, lang_PL, lang_PT, lang_PT_BR,
27
+ lang_RO, lang_RU, lang_SK, lang_SL, lang_SR, lang_SV, lang_TE,
28
+ lang_TET, lang_TG, lang_TH, lang_TR, lang_UK, lang_VI)
29
+
30
+ CONVERTER_CLASSES = {
31
+ 'am': lang_AM.Num2Word_AM(),
32
+ 'ar': lang_AR.Num2Word_AR(),
33
+ 'az': lang_AZ.Num2Word_AZ(),
34
+ 'be': lang_BE.Num2Word_BE(),
35
+ 'bn': lang_BN.Num2Word_BN(),
36
+ 'ca': lang_CA.Num2Word_CA(),
37
+ 'ce': lang_CE.Num2Word_CE(),
38
+ 'cs': lang_CS.Num2Word_CS(),
39
+ 'cy': lang_CY.Num2Word_CY(),
40
+ 'en': lang_EN.Num2Word_EN(),
41
+ 'en_IN': lang_EN_IN.Num2Word_EN_IN(),
42
+ 'en_NG': lang_EN_NG.Num2Word_EN_NG(),
43
+ 'fa': lang_FA.Num2Word_FA(),
44
+ 'fr': lang_FR.Num2Word_FR(),
45
+ 'fr_CH': lang_FR_CH.Num2Word_FR_CH(),
46
+ 'fr_BE': lang_FR_BE.Num2Word_FR_BE(),
47
+ 'fr_DZ': lang_FR_DZ.Num2Word_FR_DZ(),
48
+ 'de': lang_DE.Num2Word_DE(),
49
+ 'fi': lang_FI.Num2Word_FI(),
50
+ 'eo': lang_EO.Num2Word_EO(),
51
+ 'es': lang_ES.Num2Word_ES(),
52
+ 'es_CO': lang_ES_CO.Num2Word_ES_CO(),
53
+ 'es_CR': lang_ES_CR.Num2Word_ES_CR(),
54
+ 'es_GT': lang_ES_GT.Num2Word_ES_GT(),
55
+ 'es_NI': lang_ES_NI.Num2Word_ES_NI(),
56
+ 'es_VE': lang_ES_VE.Num2Word_ES_VE(),
57
+ 'id': lang_ID.Num2Word_ID(),
58
+ 'ja': lang_JA.Num2Word_JA(),
59
+ 'kn': lang_KN.Num2Word_KN(),
60
+ 'ko': lang_KO.Num2Word_KO(),
61
+ 'kz': lang_KZ.Num2Word_KZ(),
62
+ 'lt': lang_LT.Num2Word_LT(),
63
+ 'lv': lang_LV.Num2Word_LV(),
64
+ 'pl': lang_PL.Num2Word_PL(),
65
+ 'ro': lang_RO.Num2Word_RO(),
66
+ 'ru': lang_RU.Num2Word_RU(),
67
+ 'sk': lang_SK.Num2Word_SK(),
68
+ 'sl': lang_SL.Num2Word_SL(),
69
+ 'sr': lang_SR.Num2Word_SR(),
70
+ 'sv': lang_SV.Num2Word_SV(),
71
+ 'no': lang_NO.Num2Word_NO(),
72
+ 'da': lang_DA.Num2Word_DA(),
73
+ 'pt': lang_PT.Num2Word_PT(),
74
+ 'pt_BR': lang_PT_BR.Num2Word_PT_BR(),
75
+ 'he': lang_HE.Num2Word_HE(),
76
+ 'it': lang_IT.Num2Word_IT(),
77
+ 'vi': lang_VI.Num2Word_VI(),
78
+ 'tg': lang_TG.Num2Word_TG(),
79
+ 'th': lang_TH.Num2Word_TH(),
80
+ 'tr': lang_TR.Num2Word_TR(),
81
+ 'nl': lang_NL.Num2Word_NL(),
82
+ 'uk': lang_UK.Num2Word_UK(),
83
+ 'te': lang_TE.Num2Word_TE(),
84
+ 'tet': lang_TET.Num2Word_TET(),
85
+ 'hu': lang_HU.Num2Word_HU(),
86
+ 'is': lang_IS.Num2Word_IS(),
87
+ }
88
+
89
+ CONVERTES_TYPES = ['cardinal', 'ordinal', 'ordinal_num', 'year', 'currency']
90
+
91
+
92
+ def num2words(number, ordinal=False, lang='en', to='cardinal', **kwargs):
93
+ # We try the full language first
94
+ if lang not in CONVERTER_CLASSES:
95
+ # ... and then try only the first 2 letters
96
+ lang = lang[:2]
97
+ if lang not in CONVERTER_CLASSES:
98
+ raise NotImplementedError()
99
+ converter = CONVERTER_CLASSES[lang]
100
+
101
+ if isinstance(number, str):
102
+ number = converter.str_to_number(number)
103
+
104
+ # backwards compatible
105
+ if ordinal:
106
+ to = 'ordinal'
107
+
108
+ if to not in CONVERTES_TYPES:
109
+ raise NotImplementedError()
110
+
111
+ return getattr(converter, 'to_{}'.format(to))(number, **kwargs)
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_FR_CH.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+ from __future__ import print_function, unicode_literals
18
+
19
+ from .lang_FR import Num2Word_FR
20
+
21
+
22
+ class Num2Word_FR_CH(Num2Word_FR):
23
+ def setup(self):
24
+ Num2Word_FR.setup(self)
25
+
26
+ self.mid_numwords = [(1000, "mille"), (100, "cent"), (90, "nonante"),
27
+ (80, "huitante"), (70, "septante"),
28
+ (60, "soixante"), (50, "cinquante"),
29
+ (40, "quarante"), (30, "trente")]
30
+
31
+ def merge(self, curr, next):
32
+ ctext, cnum, ntext, nnum = curr + next
33
+
34
+ if cnum == 1:
35
+ if nnum < 1000000:
36
+ return next
37
+
38
+ if cnum < 1000 and nnum != 1000 and\
39
+ ntext[-1] != "s" and not nnum % 100:
40
+ ntext += "s"
41
+
42
+ if nnum < cnum < 100:
43
+ if nnum % 10 == 1:
44
+ return ("%s et %s" % (ctext, ntext), cnum + nnum)
45
+ return ("%s-%s" % (ctext, ntext), cnum + nnum)
46
+ if nnum > cnum:
47
+ return ("%s %s" % (ctext, ntext), cnum * nnum)
48
+ return ("%s %s" % (ctext, ntext), cnum + nnum)
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_FR_DZ.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import unicode_literals
19
+
20
+ from .lang_FR import Num2Word_FR
21
+
22
+
23
+ class Num2Word_FR_DZ(Num2Word_FR):
24
+ CURRENCY_FORMS = {
25
+ 'DIN': (('dinard', 'dinards'), ('centime', 'centimes')),
26
+ }
27
+
28
+ def to_currency(self, val, currency='DIN', cents=True, separator=' et',
29
+ adjective=False):
30
+ result = super(Num2Word_FR, self).to_currency(
31
+ val, currency=currency, cents=cents, separator=separator,
32
+ adjective=adjective)
33
+ return result
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_HE.py ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+
19
+ from __future__ import print_function, unicode_literals
20
+
21
+ from .base import Num2Word_Base
22
+ from .compat import to_s
23
+ from .currency import parse_currency_parts
24
+ from .utils import get_digits, splitbyx
25
+
26
+ ZERO = (u'אפס',)
27
+
28
+ ONES = {
29
+ 1: (u'אחת', u'אחד', u'אחת', u'אחד',
30
+ u'ראשונה', u'ראשון', u'ראשונות', u'ראשונים'),
31
+ 2: (u'שתיים', u'שניים', u'שתי', u'שני',
32
+ u'שנייה', u'שני', u'שניות', u'שניים'),
33
+ 3: (u'שלוש', u'שלושה', u'שלוש', u'שלושת',
34
+ u'שלישית', u'שלישי', u'שלישיות', u'שלישיים'),
35
+ 4: (u'ארבע', u'ארבעה', u'ארבע', u'ארבעת',
36
+ u'רביעית', u'רביעי', u'רביעיות', u'רביעיים'),
37
+ 5: (u'חמש', u'חמישה', u'חמש', u'חמשת',
38
+ u'חמישית', u'חמישי', u'חמישיות', u'חמישיים'),
39
+ 6: (u'שש', u'שישה', u'שש', u'ששת',
40
+ u'שישית', u'שישי', u'שישיות', u'שישיים'),
41
+ 7: (u'שבע', u'שבעה', u'שבע', u'שבעת',
42
+ u'שביעית', u'שביעי', u'שביעיות', u'שביעיים'),
43
+ 8: (u'שמונה', u'שמונה', u'שמונה', u'שמונת',
44
+ u'שמינית', u'שמיני', u'שמיניות', u'שמיניים'),
45
+ 9: (u'תשע', u'תשעה', u'תשע', u'תשעת',
46
+ u'תשיעית', u'תשיעי', u'תשיעיות', u'תשיעיים'),
47
+ }
48
+
49
+ TENS = {
50
+ 0: (u'עשר', u'עשרה', u'עשר', u'עשרת',
51
+ u'עשירית', u'עשירי', u'עשיריות', u'עשיריים'),
52
+ 1: (u'עשרה', u'עשר'),
53
+ 2: (u'שתים עשרה', u'שנים עשר'),
54
+ }
55
+
56
+ TWENTIES = {
57
+ 2: (u'עשרים',),
58
+ 3: (u'שלושים',),
59
+ 4: (u'ארבעים',),
60
+ 5: (u'חמישים',),
61
+ 6: (u'שישים',),
62
+ 7: (u'שבעים',),
63
+ 8: (u'שמונים',),
64
+ 9: (u'תשעים',),
65
+ }
66
+
67
+ HUNDREDS = {
68
+ 1: (u'מאה', u'מאת'),
69
+ 2: (u'מאתיים',),
70
+ 3: (u'מאות',)
71
+ }
72
+
73
+ THOUSANDS = {
74
+ 1: (u'אלף',),
75
+ 2: (u'אלפיים',),
76
+ 3: (u'אלפים', 'אלפי'),
77
+ }
78
+
79
+ LARGE = {
80
+ 1: (u'מיליון', u'מיליוני'),
81
+ 2: (u'מיליארד', u'מיליארדי'),
82
+ 3: (u'טריליון', u'טריליוני'),
83
+ 4: (u'קוודריליון', u'קוודריליוני'),
84
+ 5: (u'קווינטיליון', u'קווינטיליוני'),
85
+ 6: (u'סקסטיליון', u'סקסטיליוני'),
86
+ 7: (u'ספטיליון', u'ספטיליוני'),
87
+ 8: (u'אוקטיליון', u'אוקטיליוני'),
88
+ 9: (u'נוניליון', u'נוניליוני'),
89
+ 10: (u'דסיליון', u'דסיליוני'),
90
+ 11: (u'אונדסיליון', u'אונדסיליוני'),
91
+ 12: (u'דואודסיליון', u'דואודסיליוני'),
92
+ 13: (u'טרדסיליון', u'טרדסיליוני'),
93
+ 14: (u'קווטואורדסיליון', u'קווטואורדסיליוני'),
94
+ 15: (u'קווינדסיליון', u'קווינדסיליוני'),
95
+ 16: (u'סקסדסיליון', u'סקסדסיליוני'),
96
+ 17: (u'ספטנדסיליון', u'ספטנדסיליוני'),
97
+ 18: (u'אוקטודסיליון', u'אוקטודסיליוני'),
98
+ 19: (u'נובמדסיליון', u'נובמדסיליוני'),
99
+ 20: (u'ויגינטיליון', u'ויגינטיליוני')
100
+ }
101
+
102
+ AND = u'ו'
103
+
104
+ DEF = u'ה'
105
+
106
+ MAXVAL = int('1' + '0'*66)
107
+
108
+
109
+ def chunk2word(n, i, x, gender='f', construct=False,
110
+ ordinal=False, plural=False):
111
+ words = []
112
+ n1, n2, n3 = get_digits(x)
113
+
114
+ if n3 > 0:
115
+ if construct and n == 100:
116
+ words.append(HUNDREDS[n3][1])
117
+ elif n3 <= 2:
118
+ words.append(HUNDREDS[n3][0])
119
+ else:
120
+ words.append(ONES[n3][0] + ' ' + HUNDREDS[3][0])
121
+
122
+ if n2 > 1:
123
+ words.append(TWENTIES[n2][0])
124
+
125
+ if i == 0 or x >= 11:
126
+ male = gender == 'm' or i > 0
127
+ cop = (2*(construct and i == 0)+4*ordinal+2*plural) * (n < 11)
128
+ if n2 == 1:
129
+ if n1 == 0:
130
+ words.append(TENS[n1][male + cop])
131
+ elif n1 == 2:
132
+ words.append(TENS[n1][male])
133
+ else:
134
+ words.append(ONES[n1][male] + ' ' + TENS[1][male])
135
+ elif n1 > 0:
136
+ words.append(ONES[n1][male + cop])
137
+
138
+ construct_last = construct and (n % 1000 ** i == 0)
139
+
140
+ if i == 1:
141
+ if x >= 11:
142
+ words[-1] = words[-1] + ' ' + THOUSANDS[1][0]
143
+ elif n1 == 0:
144
+ words.append(TENS[0][3] + ' ' + THOUSANDS[3][construct_last])
145
+ elif n1 <= 2:
146
+ words.append(THOUSANDS[n1][0])
147
+ else:
148
+ words.append(ONES[n1][3] + ' ' + THOUSANDS[3][construct_last])
149
+
150
+ elif i > 1:
151
+ if x >= 11:
152
+ words[-1] = words[-1] + ' ' + LARGE[i - 1][construct_last]
153
+ elif n1 == 0:
154
+ words.append(TENS[0][1 + 2*construct_last] + ' ' +
155
+ LARGE[i - 1][construct_last])
156
+ elif n1 == 1:
157
+ words.append(LARGE[i - 1][0])
158
+ else:
159
+ words.append(ONES[n1][1 + 2*(construct_last or x == 2)] + ' ' +
160
+ LARGE[i - 1][construct_last])
161
+
162
+ return words
163
+
164
+
165
+ def int2word(n, gender='f', construct=False,
166
+ ordinal=False, definite=False, plural=False):
167
+ assert n == int(n)
168
+ assert not construct or not ordinal
169
+ assert ordinal or (not definite and not plural)
170
+ if n >= MAXVAL:
171
+ raise OverflowError('abs(%s) must be less than %s.' % (n, MAXVAL))
172
+
173
+ if n == 0:
174
+ if ordinal:
175
+ return DEF + ZERO[0]
176
+ return ZERO[0]
177
+
178
+ words = []
179
+
180
+ chunks = list(splitbyx(str(n), 3))
181
+ i = len(chunks)
182
+ for x in chunks:
183
+ i -= 1
184
+
185
+ if x == 0:
186
+ continue
187
+
188
+ words += chunk2word(n, i, x, gender=gender, construct=construct,
189
+ ordinal=ordinal, plural=plural)
190
+
191
+ # https://hebrew-academy.org.il/2017/01/30/%D7%95-%D7%94%D7%97%D7%99%D7%91%D7%95%D7%A8-%D7%91%D7%9E%D7%A1%D7%A4%D7%A8%D7%99%D7%9D # noqa
192
+ if len(words) > 1:
193
+ words[-1] = AND + words[-1]
194
+
195
+ if ordinal and (n >= 11 or definite):
196
+ words[0] = DEF + words[0]
197
+
198
+ return ' '.join(words)
199
+
200
+
201
+ class Num2Word_HE(Num2Word_Base):
202
+ CURRENCY_FORMS = {
203
+ 'ILS': ((u'שקל', u'שקלים'), (u'אגורה', u'אגורות')),
204
+ 'EUR': ((u'אירו', u'אירו'), (u'סנט', u'סנטים')),
205
+ 'USD': ((u'דולר', u'דולרים'), (u'סנט', u'סנטים')),
206
+ }
207
+
208
+ CURRENCY_GENDERS = {
209
+ 'ILS': ('m', 'f'),
210
+ 'EUR': ('m', 'm'),
211
+ 'USD': ('m', 'm'),
212
+ }
213
+
214
+ def __init__(self, makaf='-'):
215
+ super(Num2Word_HE, self).__init__()
216
+ self.makaf = makaf
217
+
218
+ def setup(self):
219
+ super(Num2Word_HE, self).setup()
220
+ self.negword = u'מינוס'
221
+ self.pointword = u'נקודה'
222
+ self.MAXVAL = MAXVAL
223
+
224
+ def to_cardinal_float(self, value, gender='f'):
225
+ try:
226
+ float(value) == value
227
+ except (ValueError, TypeError, AssertionError, AttributeError):
228
+ raise TypeError(self.errmsg_nonnum % value)
229
+
230
+ pre, post = self.float2tuple(float(value))
231
+
232
+ post = str(post)
233
+ post = '0'*(self.precision - len(post)) + post
234
+
235
+ out = [self.to_cardinal(pre, gender=gender)]
236
+ if self.precision:
237
+ out.append(self.title(self.pointword))
238
+
239
+ for i in range(self.precision):
240
+ curr = int(post[i])
241
+ out.append(to_s(self.to_cardinal(curr)))
242
+
243
+ return ' '.join(out)
244
+
245
+ def to_cardinal(self, value, gender='f', construct=False):
246
+ try:
247
+ assert int(value) == value
248
+ except (ValueError, TypeError, AssertionError):
249
+ # https://hebrew-academy.org.il/2019/12/03/%D7%A2%D7%9C-%D7%94%D7%91%D7%A2%D7%AA-%D7%94%D7%9E%D7%A1%D7%A4%D7%A8-%D7%94%D7%9E%D7%A2%D7%95%D7%A8%D7%91 # noqa
250
+ return self.to_cardinal_float(value, gender=gender)
251
+
252
+ out = ""
253
+ if value < 0:
254
+ value = abs(value)
255
+ out = "%s " % self.negword.strip()
256
+
257
+ if value >= self.MAXVAL:
258
+ raise OverflowError(self.errmsg_toobig % (value, self.MAXVAL))
259
+
260
+ return out + int2word(int(value), gender=gender, construct=construct)
261
+
262
+ def to_ordinal(self, value, gender='m', definite=False, plural=False):
263
+ self.verify_ordinal(value)
264
+
265
+ if value >= self.MAXVAL:
266
+ raise OverflowError(self.errmsg_toobig % (value, self.MAXVAL))
267
+
268
+ return int2word(int(value), gender=gender, ordinal=True,
269
+ definite=definite, plural=plural)
270
+
271
+ def pluralize(self, n, forms, currency=None, prefer_singular=False):
272
+ assert n == int(n)
273
+ form = 1
274
+ if n == 1 or prefer_singular and (
275
+ abs(n) >= 11 or n == 0 or currency != 'ILS'):
276
+ form = 0
277
+ return forms[form]
278
+
279
+ def to_currency(self, val, currency='ILS', cents=True,
280
+ separator=AND, adjective=False,
281
+ prefer_singular=False, prefer_singular_cents=False):
282
+ left, right, is_negative = parse_currency_parts(val)
283
+
284
+ if not separator.startswith(' '):
285
+ separator = ' ' + separator
286
+
287
+ try:
288
+ cr1, cr2 = self.CURRENCY_FORMS[currency]
289
+
290
+ except KeyError:
291
+ raise NotImplementedError(
292
+ 'Currency code "%s" not implemented for "%s"' %
293
+ (currency, self.__class__.__name__))
294
+
295
+ minus_str = "%s " % self.negword.strip() if is_negative else ""
296
+ try:
297
+ gender1, gender2 = self.CURRENCY_GENDERS[currency]
298
+ except KeyError:
299
+ gender1 = gender2 = ''
300
+
301
+ money_str = self.to_cardinal(left, gender=gender1,
302
+ construct=left == 2)
303
+ if cents:
304
+ cents_str = self.to_cardinal(right, gender=gender2,
305
+ construct=right == 2)
306
+ else:
307
+ cents_str = self._cents_terse(right, currency)
308
+ sep_parts = separator.split()
309
+ if sep_parts and sep_parts[-1] == AND:
310
+ separator += self.makaf
311
+
312
+ strings = [
313
+ minus_str,
314
+ money_str,
315
+ self.pluralize(left, cr1, currency=currency,
316
+ prefer_singular=prefer_singular),
317
+ separator,
318
+ cents_str,
319
+ self.pluralize(right, cr2, currency=currency,
320
+ prefer_singular=prefer_singular_cents)
321
+ ]
322
+ if left == 1:
323
+ strings[1], strings[2] = strings[2], strings[1]
324
+ if right == 1:
325
+ strings[4], strings[5] = strings[5], strings[4]
326
+ # In Hebrew the separator is along with the following word
327
+ return u'%s%s %s%s%s %s' % tuple(strings)
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_HU.py ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import division, print_function, unicode_literals
19
+
20
+ from . import lang_EU
21
+
22
+ ZERO = 'nulla'
23
+
24
+
25
+ class Num2Word_HU(lang_EU.Num2Word_EU):
26
+ GIGA_SUFFIX = "illiárd"
27
+ MEGA_SUFFIX = "illió"
28
+
29
+ def setup(self):
30
+ super(Num2Word_HU, self).setup()
31
+
32
+ self.negword = "mínusz "
33
+ self.pointword = "egész"
34
+
35
+ self.mid_numwords = [(1000, "ezer"), (100, "száz"), (90, "kilencven"),
36
+ (80, "nyolcvan"), (70, "hetven"), (60, "hatvan"),
37
+ (50, "ötven"), (40, "negyven"), (30, "harminc")]
38
+
39
+ low_numwords = ["kilenc", "nyolc", "hét", "hat", "öt", "négy", "három",
40
+ "kettő", "egy"]
41
+ self.low_numwords = (['tizen' + w for w in low_numwords]
42
+ + ['tíz']
43
+ + low_numwords)
44
+ self.low_numwords = (['huszon' + w for w in low_numwords]
45
+ + ['húsz']
46
+ + self.low_numwords
47
+ + [ZERO])
48
+
49
+ self.partial_ords = {
50
+ 'nulla': 'nullad',
51
+ 'egy': 'egyed',
52
+ 'kettő': 'ketted',
53
+ 'három': 'harmad',
54
+ 'négy': 'negyed',
55
+ 'öt': 'ötöd',
56
+ 'hat': 'hatod',
57
+ 'hét': 'heted',
58
+ 'nyolc': 'nyolcad',
59
+ 'kilenc': 'kilenced',
60
+ 'tíz': 'tized',
61
+ 'húsz': 'huszad',
62
+ 'harminc': 'harmincad',
63
+ 'negyven': 'negyvened',
64
+ 'ötven': 'ötvened',
65
+ 'hatvan': 'hatvanad',
66
+ 'hetven': 'hetvened',
67
+ 'nyolcvan': 'nyolcvanad',
68
+ 'kilencven': 'kilencvened',
69
+ 'száz': 'század',
70
+ 'ezer': 'ezred',
71
+ 'illió': 'milliomod',
72
+ 'illiárd': 'milliárdod'
73
+ }
74
+
75
+ def to_cardinal(self, value, zero=ZERO):
76
+ if int(value) != value:
77
+ return self.to_cardinal_float(value)
78
+ elif value < 0:
79
+ out = self.negword + self.to_cardinal(-value)
80
+ elif value == 0:
81
+ out = zero
82
+ elif zero == '' and value == 2:
83
+ out = 'két'
84
+ elif value < 30:
85
+ out = self.cards[value]
86
+ elif value < 100:
87
+ out = self.tens_to_cardinal(value)
88
+ elif value < 1000:
89
+ out = self.hundreds_to_cardinal(value)
90
+ elif value < 10**6:
91
+ out = self.thousands_to_cardinal(value)
92
+ else:
93
+ out = self.big_number_to_cardinal(value)
94
+ return out
95
+
96
+ def tens_to_cardinal(self, value):
97
+ try:
98
+ return self.cards[value]
99
+ except KeyError:
100
+ return self.cards[value // 10 * 10] + self.to_cardinal(value % 10)
101
+
102
+ def hundreds_to_cardinal(self, value):
103
+ hundreds = value // 100
104
+ prefix = "száz"
105
+ if hundreds != 1:
106
+ prefix = self.to_cardinal(hundreds, zero="") + prefix
107
+ postfix = self.to_cardinal(value % 100, zero="")
108
+ return prefix + postfix
109
+
110
+ def thousands_to_cardinal(self, value):
111
+ thousands = value // 1000
112
+ prefix = "ezer"
113
+ if thousands != 1:
114
+ prefix = self.to_cardinal(thousands, zero="") + prefix
115
+ postfix = self.to_cardinal(value % 1000, zero="")
116
+ return prefix + ('' if value <= 2000 or not postfix else '-') + postfix
117
+
118
+ def big_number_to_cardinal(self, value):
119
+ digits = len(str(value))
120
+ digits = digits if digits % 3 != 0 else digits - 2
121
+ exp = 10 ** (digits // 3 * 3)
122
+ rest = self.to_cardinal(value % exp, '')
123
+ return (self.to_cardinal(value // exp, '') + self.cards[exp]
124
+ + ('-' + rest if rest else ''))
125
+
126
+ def to_ordinal(self, value):
127
+ if value < 0:
128
+ return self.negword + self.to_ordinal(-value)
129
+ if value == 1:
130
+ return 'első'
131
+ elif value == 2:
132
+ return 'második'
133
+ else:
134
+ out = self.to_cardinal(value)
135
+ for card_word, ord_word in self.partial_ords.items():
136
+ if out[-len(card_word):] == card_word:
137
+ out = out[:-len(card_word)] + ord_word
138
+ break
139
+ return out + 'ik'
140
+
141
+ def to_ordinal_num(self, value):
142
+ self.verify_ordinal(value)
143
+ return str(value) + '.'
144
+
145
+ def to_year(self, val, suffix=None, longval=True):
146
+ # suffix is prefix here
147
+ prefix = ''
148
+ if val < 0 or suffix is not None:
149
+ val = abs(val)
150
+ prefix = (suffix + ' ' if suffix is not None else 'i. e. ')
151
+ return prefix + self.to_cardinal(val)
152
+
153
+ def to_currency(self, val, currency='HUF', cents=True, separator=',',
154
+ adjective=False):
155
+ return super(Num2Word_HU, self).to_currency(
156
+ val, currency, cents, separator, adjective)
157
+
158
+ def to_cardinal_float(self, value):
159
+ if abs(value) != value:
160
+ return self.negword + self.to_cardinal_float(-value)
161
+ left, right = str(value).split('.')
162
+ return (self.to_cardinal(int(left))
163
+ + ' egész '
164
+ + self.to_cardinal(int(right))
165
+ + ' ' + self.partial_ords[self.cards[10 ** len(right)]])
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_ID.py ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import print_function, unicode_literals
19
+
20
+
21
+ class Num2Word_ID():
22
+ BASE = {0: [],
23
+ 1: ["satu"],
24
+ 2: ["dua"],
25
+ 3: ["tiga"],
26
+ 4: ["empat"],
27
+ 5: ["lima"],
28
+ 6: ["enam"],
29
+ 7: ["tujuh"],
30
+ 8: ["delapan"],
31
+ 9: ["sembilan"]}
32
+
33
+ TENS_TO = {3: "ribu",
34
+ 6: "juta",
35
+ 9: "miliar",
36
+ 12: "triliun",
37
+ 15: "kuadriliun",
38
+ 18: "kuantiliun",
39
+ 21: "sekstiliun",
40
+ 24: "septiliun",
41
+ 27: "oktiliun",
42
+ 30: "noniliun",
43
+ 33: "desiliun"}
44
+
45
+ errmsg_floatord = "Cannot treat float number as ordinal"
46
+ errmsg_negord = "Cannot treat negative number as ordinal"
47
+ errmsg_toobig = "Number is too large to convert to words (abs(%s) > %s)."
48
+ MAXVAL = 10 ** 36
49
+
50
+ def split_by_koma(self, number):
51
+ return str(number).split('.')
52
+
53
+ def split_by_3(self, number):
54
+ """
55
+ starting here, it groups the number by three from the tail
56
+ '1234567' -> (('1',),('234',),('567',))
57
+ :param number:str
58
+ :rtype:tuple
59
+ """
60
+ blocks = ()
61
+ length = len(number)
62
+
63
+ if length < 3:
64
+ blocks += ((number,),)
65
+ else:
66
+ len_of_first_block = length % 3
67
+
68
+ if len_of_first_block > 0:
69
+ first_block = number[0:len_of_first_block],
70
+ blocks += first_block,
71
+
72
+ for i in range(len_of_first_block, length, 3):
73
+ next_block = (number[i:i + 3],),
74
+ blocks += next_block
75
+
76
+ return blocks
77
+
78
+ def spell(self, blocks):
79
+ """
80
+ it adds the list of spelling to the blocks
81
+ (
82
+ ('1',),('034',)) -> (('1',['satu']),('234',['tiga', 'puluh', 'empat'])
83
+ )
84
+ :param blocks: tuple
85
+ :rtype: tuple
86
+ """
87
+ word_blocks = ()
88
+ first_block = blocks[0]
89
+ if len(first_block[0]) == 1:
90
+ if first_block[0] == '0':
91
+ spelling = ['nol']
92
+ else:
93
+ spelling = self.BASE[int(first_block[0])]
94
+ elif len(first_block[0]) == 2:
95
+ spelling = self.puluh(first_block[0])
96
+ else:
97
+ spelling = (
98
+ self.ratus(first_block[0][0]) + self.puluh(first_block[0][1:3])
99
+ )
100
+
101
+ word_blocks += (first_block[0], spelling),
102
+
103
+ for block in blocks[1:]:
104
+ spelling = self.ratus(block[0][0]) + self.puluh(block[0][1:3])
105
+ block += spelling,
106
+ word_blocks += block,
107
+
108
+ return word_blocks
109
+
110
+ def ratus(self, number):
111
+ # it is used to spell
112
+ if number == '1':
113
+ return ['seratus']
114
+ elif number == '0':
115
+ return []
116
+ else:
117
+ return self.BASE[int(number)] + ['ratus']
118
+
119
+ def puluh(self, number):
120
+ # it is used to spell
121
+ if number[0] == '1':
122
+ if number[1] == '0':
123
+ return ['sepuluh']
124
+ elif number[1] == '1':
125
+ return ['sebelas']
126
+ else:
127
+ return self.BASE[int(number[1])] + ['belas']
128
+ elif number[0] == '0':
129
+ return self.BASE[int(number[1])]
130
+ else:
131
+ return (
132
+ self.BASE[int(number[0])] + ['puluh']
133
+ + self.BASE[int(number[1])]
134
+ )
135
+
136
+ def spell_float(self, float_part):
137
+ # spell the float number
138
+ word_list = []
139
+ for n in float_part:
140
+ if n == '0':
141
+ word_list += ['nol']
142
+ continue
143
+ word_list += self.BASE[int(n)]
144
+ return ' '.join(['', 'koma'] + word_list)
145
+
146
+ def join(self, word_blocks, float_part):
147
+ """
148
+ join the words by first join lists in the tuple
149
+ :param word_blocks: tuple
150
+ :rtype: str
151
+ """
152
+ word_list = []
153
+ length = len(word_blocks) - 1
154
+ first_block = word_blocks[0],
155
+ start = 0
156
+
157
+ if length == 1 and first_block[0][0] == '1':
158
+ word_list += ['seribu']
159
+ start = 1
160
+
161
+ for i in range(start, length + 1, 1):
162
+ word_list += word_blocks[i][1]
163
+ if not word_blocks[i][1]:
164
+ continue
165
+ if i == length:
166
+ break
167
+ word_list += [self.TENS_TO[(length - i) * 3]]
168
+
169
+ return ' '.join(word_list) + float_part
170
+
171
+ def to_cardinal(self, number):
172
+ if number >= self.MAXVAL:
173
+ raise OverflowError(self.errmsg_toobig % (number, self.MAXVAL))
174
+ minus = ''
175
+ if number < 0:
176
+ minus = 'min '
177
+ float_word = ''
178
+ n = self.split_by_koma(abs(number))
179
+ if len(n) == 2:
180
+ float_word = self.spell_float(n[1])
181
+ return minus + self.join(self.spell(self.split_by_3(n[0])), float_word)
182
+
183
+ def to_ordinal(self, number):
184
+ self.verify_ordinal(number)
185
+ out_word = self.to_cardinal(number)
186
+ if out_word == "satu":
187
+ return "pertama"
188
+ return "ke" + out_word
189
+
190
+ def to_ordinal_num(self, number):
191
+ self.verify_ordinal(number)
192
+ return "ke-" + str(number)
193
+
194
+ def to_currency(self, value):
195
+ return self.to_cardinal(value) + " rupiah"
196
+
197
+ def to_year(self, value):
198
+ return self.to_cardinal(value)
199
+
200
+ def verify_ordinal(self, value):
201
+ if not value == int(value):
202
+ raise TypeError(self.errmsg_floatord % value)
203
+ if not abs(value) == value:
204
+ raise TypeError(self.errmsg_negord % value)
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_IS.py ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import division, print_function, unicode_literals
19
+
20
+ from . import lang_EU
21
+
22
+ # Genders
23
+ KK = 0 # Karlkyn (male)
24
+ KVK = 1 # Kvenkyn (female)
25
+ HK = 2 # Hvorugkyn (neuter)
26
+
27
+ GENDERS = {
28
+ "einn": ("einn", "ein", "eitt"),
29
+ "tveir": ("tveir", "tvær", "tvö"),
30
+ "þrír": ("þrír", "þrjár", "þrjú"),
31
+ "fjórir": ("fjórir", "fjórar", "fjögur"),
32
+ }
33
+
34
+ PLURALS = {
35
+ "hundrað": ("hundrað", "hundruð"),
36
+ }
37
+
38
+
39
+ class Num2Word_IS(lang_EU.Num2Word_EU):
40
+
41
+ GIGA_SUFFIX = "illjarður"
42
+ MEGA_SUFFIX = "illjón"
43
+
44
+ def setup(self):
45
+ lows = ["okt", "sept", "sext", "kvint", "kvaðr", "tr", "b", "m"]
46
+ self.high_numwords = self.gen_high_numwords([], [], lows)
47
+
48
+ self.negword = "mínus "
49
+ self.pointword = "komma"
50
+
51
+ # All words should be excluded, title case is not used in Icelandic
52
+ self.exclude_title = ["og", "komma", "mínus"]
53
+
54
+ self.mid_numwords = [(1000, "þúsund"), (100, "hundrað"),
55
+ (90, "níutíu"), (80, "áttatíu"), (70, "sjötíu"),
56
+ (60, "sextíu"), (50, "fimmtíu"), (40, "fjörutíu"),
57
+ (30, "þrjátíu")]
58
+ self.low_numwords = ["tuttugu", "nítján", "átján", "sautján",
59
+ "sextán", "fimmtán", "fjórtán", "þrettán",
60
+ "tólf", "ellefu", "tíu", "níu", "átta",
61
+ "sjö", "sex", "fimm", "fjórir", "þrír",
62
+ "tveir", "einn", "núll"]
63
+ self.ords = {"einn": "fyrsti",
64
+ "tveir": "annar",
65
+ "þrír": "þriðji",
66
+ "fjórir": "fjórði",
67
+ "fimm": "fimmti",
68
+ "sex": "sjötti",
69
+ "sjö": "sjöundi",
70
+ "átta": "áttundi",
71
+ "níu": "níundi",
72
+ "tíu": "tíundi",
73
+ "ellefu": "ellefti",
74
+ "tólf": "tólfti"}
75
+
76
+ def pluralize(self, n, noun):
77
+ form = 0 if (n % 10 == 1 and n % 100 != 11) else 1
78
+ if form == 0:
79
+ return noun
80
+ elif self.GIGA_SUFFIX in noun:
81
+ return noun.replace(self.GIGA_SUFFIX, "illjarðar")
82
+ elif self.MEGA_SUFFIX in noun:
83
+ return noun.replace(self.MEGA_SUFFIX, "illjónir")
84
+ elif noun not in PLURALS:
85
+ return noun
86
+ return PLURALS[noun][form]
87
+
88
+ def genderize(self, adj, noun):
89
+ last = adj.split()[-1]
90
+ if last not in GENDERS:
91
+ return adj
92
+ gender = KK
93
+ if "hund" in noun or "þús" in noun:
94
+ gender = HK
95
+ elif "illjarð" in noun:
96
+ gender = KK
97
+ elif "illjón" in noun:
98
+ gender = KVK
99
+ return adj.replace(last, GENDERS[last][gender])
100
+
101
+ def merge(self, lpair, rpair):
102
+ ltext, lnum = lpair
103
+ rtext, rnum = rpair
104
+
105
+ if lnum == 1 and rnum < 100:
106
+ return (rtext, rnum)
107
+ elif lnum < rnum:
108
+ rtext = self.pluralize(lnum, rtext)
109
+ ltext = self.genderize(ltext, rtext)
110
+ return ("%s %s" % (ltext, rtext), lnum * rnum)
111
+ elif lnum > rnum and rnum in self.cards:
112
+ rtext = self.pluralize(lnum, rtext)
113
+ ltext = self.genderize(ltext, rtext)
114
+ return ("%s og %s" % (ltext, rtext), lnum + rnum)
115
+ return ("%s %s" % (ltext, rtext), lnum + rnum)
116
+
117
+ def to_ordinal(self, value):
118
+ raise NotImplementedError
119
+
120
+ def to_ordinal_num(self, value):
121
+ raise NotImplementedError
122
+
123
+ def to_year(self, val, suffix=None, longval=True):
124
+ raise NotImplementedError
125
+
126
+ def to_currency(self, val, longval=True):
127
+ raise NotImplementedError
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_IT.py ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2018-2019, Filippo Costa. All Rights Reserved.
3
+
4
+ # This library is free software; you can redistribute it and/or
5
+ # modify it under the terms of the GNU Lesser General Public
6
+ # License as published by the Free Software Foundation; either
7
+ # version 2.1 of the License, or (at your option) any later version.
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ # You should have received a copy of the GNU Lesser General Public
13
+ # License along with this library; if not, write to the Free Software
14
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
15
+ # MA 02110-1301 USA
16
+
17
+ from __future__ import unicode_literals
18
+
19
+ from .lang_EU import Num2Word_EU
20
+
21
+ # Globals
22
+ # -------
23
+
24
+ ZERO = "zero"
25
+
26
+ CARDINAL_WORDS = [
27
+ ZERO, "uno", "due", "tre", "quattro", "cinque", "sei", "sette", "otto",
28
+ "nove", "dieci", "undici", "dodici", "tredici", "quattordici", "quindici",
29
+ "sedici", "diciassette", "diciotto", "diciannove"
30
+ ]
31
+
32
+ ORDINAL_WORDS = [
33
+ ZERO, "primo", "secondo", "terzo", "quarto", "quinto", "sesto", "settimo",
34
+ "ottavo", "nono", "decimo", "undicesimo", "dodicesimo", "tredicesimo",
35
+ "quattordicesimo", "quindicesimo", "sedicesimo", "diciassettesimo",
36
+ "diciottesimo", "diciannovesimo"
37
+ ]
38
+
39
+ # The script can extrapolate the missing numbers from the base forms.
40
+ STR_TENS = {2: "venti", 3: "trenta", 4: "quaranta", 6: "sessanta"}
41
+
42
+ # These prefixes are used for extremely big numbers.
43
+ EXPONENT_PREFIXES = [
44
+ ZERO, "m", "b", "tr", "quadr", "quint", "sest", "sett", "ott", "nov", "dec"
45
+ ]
46
+
47
+
48
+ GENERIC_DOLLARS = ('dollaro', 'dollari')
49
+ GENERIC_CENTS = ('centesimo', 'centesimi')
50
+ CURRENCIES_UNA = ('GBP')
51
+
52
+
53
+ # Main class
54
+ # ==========
55
+
56
+ class Num2Word_IT(Num2Word_EU):
57
+ CURRENCY_FORMS = {
58
+ 'EUR': (('euro', 'euro'), GENERIC_CENTS),
59
+ 'USD': (GENERIC_DOLLARS, GENERIC_CENTS),
60
+ 'GBP': (('sterlina', 'sterline'), ('penny', 'penny')),
61
+ 'CNY': (('yuan', 'yuan'), ('fen', 'fen')),
62
+ }
63
+ MINUS_PREFIX_WORD = "meno "
64
+ FLOAT_INFIX_WORD = " virgola "
65
+
66
+ def setup(self):
67
+ Num2Word_EU.setup(self)
68
+
69
+ def __init__(self):
70
+ pass
71
+
72
+ def float_to_words(self, float_number, ordinal=False):
73
+ if ordinal:
74
+ prefix = self.to_ordinal(int(float_number))
75
+ else:
76
+ prefix = self.to_cardinal(int(float_number))
77
+ float_part = str(float_number).split('.')[1]
78
+ postfix = " ".join(
79
+ # Drops the trailing zero and comma
80
+ [self.to_cardinal(int(c)) for c in float_part]
81
+ )
82
+ return prefix + Num2Word_IT.FLOAT_INFIX_WORD + postfix
83
+
84
+ def tens_to_cardinal(self, number):
85
+ tens = number // 10
86
+ units = number % 10
87
+ if tens in STR_TENS:
88
+ prefix = STR_TENS[tens]
89
+ else:
90
+ prefix = CARDINAL_WORDS[tens][:-1] + "anta"
91
+ postfix = omitt_if_zero(CARDINAL_WORDS[units])
92
+ return phonetic_contraction(prefix + postfix)
93
+
94
+ def hundreds_to_cardinal(self, number):
95
+ hundreds = number // 100
96
+ prefix = "cento"
97
+ if hundreds != 1:
98
+ prefix = CARDINAL_WORDS[hundreds] + prefix
99
+ postfix = omitt_if_zero(self.to_cardinal(number % 100))
100
+ return phonetic_contraction(prefix + postfix)
101
+
102
+ def thousands_to_cardinal(self, number):
103
+ thousands = number // 1000
104
+ if thousands == 1:
105
+ prefix = "mille"
106
+ else:
107
+ prefix = self.to_cardinal(thousands) + "mila"
108
+ postfix = omitt_if_zero(self.to_cardinal(number % 1000))
109
+ # "mille" and "mila" don't need any phonetic contractions
110
+ return prefix + postfix
111
+
112
+ def big_number_to_cardinal(self, number):
113
+ digits = [c for c in str(number)]
114
+ length = len(digits)
115
+ if length >= 66:
116
+ raise NotImplementedError("The given number is too large.")
117
+ # This is how many digits come before the "illion" term.
118
+ # cento miliardi => 3
119
+ # dieci milioni => 2
120
+ # un miliardo => 1
121
+ predigits = length % 3 or 3
122
+ multiplier = digits[:predigits]
123
+ exponent = digits[predigits:]
124
+ # Default infix string: "milione", "biliardo", "sestilione", ecc.
125
+ infix = exponent_length_to_string(len(exponent))
126
+ if multiplier == ["1"]:
127
+ prefix = "un "
128
+ else:
129
+ prefix = self.to_cardinal(int("".join(multiplier)))
130
+ # Plural form ~~~~~~~~~~~
131
+ infix = " " + infix[:-1] + "i"
132
+ # Read as: Does the value of exponent equal 0?
133
+ if set(exponent) != set("0"):
134
+ postfix = self.to_cardinal(int("".join(exponent)))
135
+ if " e " in postfix:
136
+ infix += ", "
137
+ else:
138
+ infix += " e "
139
+ else:
140
+ postfix = ""
141
+ return prefix + infix + postfix
142
+
143
+ def to_cardinal(self, number):
144
+ if number < 0:
145
+ string = Num2Word_IT.MINUS_PREFIX_WORD + self.to_cardinal(-number)
146
+ elif isinstance(number, float):
147
+ string = self.float_to_words(number)
148
+ elif number < 20:
149
+ string = CARDINAL_WORDS[int(number)]
150
+ elif number < 100:
151
+ string = self.tens_to_cardinal(int(number))
152
+ elif number < 1000:
153
+ string = self.hundreds_to_cardinal(int(number))
154
+ elif number < 1000000:
155
+ string = self.thousands_to_cardinal(int(number))
156
+ else:
157
+ string = self.big_number_to_cardinal(number)
158
+ return accentuate(string)
159
+
160
+ def to_ordinal(self, number):
161
+ tens = number % 100
162
+ # Italian grammar is poorly defined here ¯\_(ツ)_/¯:
163
+ # centodecimo VS centodieciesimo VS centesimo decimo?
164
+ is_outside_teens = not 10 < tens < 20
165
+ if number < 0:
166
+ return Num2Word_IT.MINUS_PREFIX_WORD + self.to_ordinal(-number)
167
+ elif number % 1 != 0:
168
+ return self.float_to_words(number, ordinal=True)
169
+ elif number < 20:
170
+ return ORDINAL_WORDS[int(number)]
171
+ elif is_outside_teens and tens % 10 == 3:
172
+ # Gets rid of the accent
173
+ return self.to_cardinal(number)[:-1] + "eesimo"
174
+ elif is_outside_teens and tens % 10 == 6:
175
+ return self.to_cardinal(number) + "esimo"
176
+ else:
177
+ string = self.to_cardinal(number)[:-1]
178
+ if string[-3:] == "mil":
179
+ string += "l"
180
+ return string + "esimo"
181
+
182
+ def to_currency(self, val, currency='EUR', cents=True, separator=' e',
183
+ adjective=False):
184
+ result = super(Num2Word_IT, self).to_currency(
185
+ val, currency=currency, cents=cents, separator=separator,
186
+ adjective=adjective)
187
+ # Handle exception. In italian language is "un euro",
188
+ # "un dollaro" etc. (not "uno euro", "uno dollaro").
189
+ # There is an exception, some currencies need "una":
190
+ # e.g. "una sterlina"
191
+ if currency in CURRENCIES_UNA:
192
+ list_result = result.split(" ")
193
+ if list_result[0] == "uno":
194
+ list_result[0] = list_result[0].replace("uno", "una")
195
+ result = " ".join(list_result)
196
+ result = result.replace("uno", "un")
197
+ return result
198
+
199
+ # Utils
200
+ # =====
201
+
202
+
203
+ def phonetic_contraction(string):
204
+ return (string
205
+ .replace("oo", "o") # ex. "centootto"
206
+ .replace("ao", "o") # ex. "settantaotto"
207
+ .replace("io", "o") # ex. "ventiotto"
208
+ .replace("au", "u") # ex. "trentauno"
209
+ .replace("iu", "u") # ex. "ventiunesimo"
210
+ )
211
+
212
+
213
+ def exponent_length_to_string(exponent_length):
214
+ # We always assume `exponent` to be a multiple of 3. If it's not true, then
215
+ # Num2Word_IT.big_number_to_cardinal did something wrong.
216
+ prefix = EXPONENT_PREFIXES[exponent_length // 6]
217
+ if exponent_length % 6 == 0:
218
+ return prefix + "ilione"
219
+ else:
220
+ return prefix + "iliardo"
221
+
222
+
223
+ def accentuate(string):
224
+ # This is inefficient: it may do several rewritings when deleting
225
+ # half-sentence accents. However, it is the easiest method and speed is
226
+ # not crucial (duh), so...
227
+ return " ".join(
228
+ # Deletes half-sentence accents and accentuates the last "tre"
229
+ [w.replace("tré", "tre")[:-3] + "tré"
230
+ # We shouldn't accentuate a single "tre": is has to be a composite
231
+ # word. ~~~~~~~~~~
232
+ if w[-3:] == "tre" and len(w) > 3
233
+ # Deletes half-sentence accents anyway
234
+ # ~~~~~~~~~~~~~~~~~~~~~~
235
+ else w.replace("tré", "tre")
236
+ for w in string.split()
237
+ ])
238
+
239
+
240
+ def omitt_if_zero(number_to_string):
241
+ return "" if number_to_string == ZERO else number_to_string
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_JA.py ADDED
@@ -0,0 +1,590 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import division, print_function, unicode_literals
19
+
20
+ from .base import Num2Word_Base
21
+ from .compat import strtype, to_s
22
+ from .currency import parse_currency_parts, prefix_currency
23
+
24
+
25
+ def select_text(text, reading=False, prefer=None):
26
+ """Select the correct text from the Japanese number, reading and
27
+ alternatives"""
28
+ # select kanji number or kana reading
29
+ if reading:
30
+ text = text[1]
31
+ else:
32
+ text = text[0]
33
+
34
+ # select the preferred one or the first one from multiple alternatives
35
+ if not isinstance(text, strtype):
36
+ common = set(text) & set(prefer or set())
37
+ if len(common) == 1:
38
+ text = common.pop()
39
+ else:
40
+ text = text[0]
41
+
42
+ return text
43
+
44
+
45
+ def rendaku_merge_pairs(lpair, rpair):
46
+ """Merge lpair < rpair while applying semi-irregular rendaku rules"""
47
+ ltext, lnum = lpair
48
+ rtext, rnum = rpair
49
+ if lnum > rnum:
50
+ raise ValueError
51
+
52
+ if rpair == ("ひゃく", 100):
53
+ if lpair == ("さん", 3):
54
+ rtext = "びゃく"
55
+ elif lpair == ("ろく", 6):
56
+ ltext = "ろっ"
57
+ rtext = "ぴゃく"
58
+ elif lpair == ("はち", 8):
59
+ ltext = "はっ"
60
+ rtext = "ぴゃく"
61
+ elif rpair == ("せん", 1000):
62
+ if lpair == ("さん", 3):
63
+ rtext = "ぜん"
64
+ elif lpair == ("はち", 8):
65
+ ltext = "はっ"
66
+ elif rpair == ("ちょう", 10**12):
67
+ if lpair == ("いち", 1):
68
+ ltext = "いっ"
69
+ elif lpair == ("はち", 8):
70
+ ltext = "はっ"
71
+ elif lpair == ("じゅう", 10):
72
+ ltext = "じゅっ"
73
+ elif rpair == ("けい", 10**16):
74
+ if lpair == ("いち", 1):
75
+ ltext = "いっ"
76
+ elif lpair == ("ろく", 6):
77
+ ltext = "ろっ"
78
+ elif lpair == ("はち", 8):
79
+ ltext = "はっ"
80
+ elif lpair == ("じゅう", 10):
81
+ ltext = "じゅっ"
82
+ elif lpair == ("ひゃく", 100):
83
+ ltext = "ひゃっ"
84
+
85
+ return ("%s%s" % (ltext, rtext), lnum * rnum)
86
+
87
+
88
+ # Source: https://www.sljfaq.org/afaq/era-list.html
89
+ # if there are multiple eras for the same year, use the last one
90
+ ERA_START = [
91
+ (645, ("大化", "たいか")),
92
+ (650, ("白雉", "はくち")),
93
+ (686, ("朱鳥", "しゅちょう")),
94
+ (701, ("大宝", "たいほう")),
95
+ (704, ("慶雲", "けいうん")),
96
+ (708, ("和銅", "わどう")),
97
+ (715, ("霊亀", "れいき")),
98
+ (717, ("養老", "ようろう")),
99
+ (724, ("神亀", "じんき")),
100
+ (729, ("天平", "てんぴょう")),
101
+ (749, ("天平感宝", "てんぴょうかんぽう")),
102
+ (749, ("天平勝宝", "てんぴょうしょうほう")),
103
+ (757, ("天平宝字", "てんぴょうじょうじ")),
104
+ (765, ("天平神護", "てんぴょうじんご")),
105
+ (767, ("神護景雲", "じんごけいうん")),
106
+ (770, ("宝亀", "ほうき")),
107
+ (781, ("天応", "てんおう")),
108
+ (782, ("延暦", "えんりゃく")),
109
+ (806, ("大同", "だいどう")),
110
+ (810, ("弘仁", "こうにん")),
111
+ (823, ("天長", "てんちょう")),
112
+ (834, ("承和", "じょうわ")),
113
+ (848, ("嘉祥", "かしょう")),
114
+ (851, ("仁寿", "にんじゅ")),
115
+ (855, ("斉衡", "さいこう")),
116
+ (857, ("天安", "てんあん")),
117
+ (859, ("貞観", "じょうがん")),
118
+ (877, ("元慶", "がんぎょう")),
119
+ (885, ("仁和", "にんな")),
120
+ (889, ("寛平", "かんぴょう")),
121
+ (898, ("昌泰", "しょうたい")),
122
+ (901, ("延喜", "えんぎ")),
123
+ (923, ("延長", "えんちょう")),
124
+ (931, ("承平", "じょうへい")),
125
+ (938, ("天慶", "てんぎょう")),
126
+ (947, ("天暦", "てんりゃく")),
127
+ (957, ("天徳", "てんとく")),
128
+ (961, ("応和", "おうわ")),
129
+ (964, ("康保", "こうほう")),
130
+ (968, ("安和", "あんな")),
131
+ (970, ("天禄", "てんろく")),
132
+ (974, ("天延", "てんえん")),
133
+ (976, ("貞元", "じょうげん")),
134
+ (979, ("天元", "てんげん")),
135
+ (983, ("永観", "えいかん")),
136
+ (985, ("寛和", "かんな")),
137
+ (987, ("永延", "えいえん")),
138
+ (989, ("永祚", "えいそ")),
139
+ (990, ("正暦", "しょうりゃく")),
140
+ (995, ("長徳", "ちょうとく")),
141
+ (999, ("長保", "ちょうほう")),
142
+ (1004, ("寛弘", "かんこう")),
143
+ (1013, ("長和", "ちょうわ")),
144
+ (1017, ("寛仁", "かんにん")),
145
+ (1021, ("治安", "じあん")),
146
+ (1024, ("万寿", "まんじゅ")),
147
+ (1028, ("長元", "ちょうげん")),
148
+ (1037, ("長暦", "ちょうりゃく")),
149
+ (1040, ("長久", "ちょうきゅう")),
150
+ (1045, ("寛徳", "かんとく")),
151
+ (1046, ("永承", "えいしょう")),
152
+ (1053, ("天喜", "てんぎ")),
153
+ (1058, ("康平", "こうへい")),
154
+ (1065, ("治暦", "じりゃく")),
155
+ (1069, ("延久", "えんきゅう")),
156
+ (1074, ("承保", "じょうほう")),
157
+ (1078, ("承暦", "じょうりゃく")),
158
+ (1081, ("永保", "えいほう")),
159
+ (1084, ("応徳", "おうとく")),
160
+ (1087, ("寛治", "かんじ")),
161
+ (1095, ("嘉保", "かほう")),
162
+ (1097, ("永長", "えいちょう")),
163
+ (1098, ("承徳", "じょうとく")),
164
+ (1099, ("康和", "こうわ")),
165
+ (1104, ("長治", "ちょうじ")),
166
+ (1106, ("嘉承", "かじょう")),
167
+ (1108, ("天仁", "てんにん")),
168
+ (1110, ("天永", "てんねい")),
169
+ (1113, ("永久", "えいきゅう")),
170
+ (1118, ("元永", "げんえい")),
171
+ (1120, ("保安", "ほうあん")),
172
+ (1124, ("天治", "てんじ")),
173
+ (1126, ("大治", "だいじ")),
174
+ (1131, ("天承", "てんしょう")),
175
+ (1132, ("長承", "ちょうしょう")),
176
+ (1135, ("保延", "ほうえん")),
177
+ (1141, ("永治", "えいじ")),
178
+ (1142, ("康治", "こうじ")),
179
+ (1144, ("天養", "てんよう")),
180
+ (1145, ("久安", "きゅうあん")),
181
+ (1151, ("仁平", "にんぺい")),
182
+ (1154, ("久寿", "きゅうじゅ")),
183
+ (1156, ("保元", "ほうげん")),
184
+ (1159, ("平治", "へいじ")),
185
+ (1160, ("永暦", "えいりゃく")),
186
+ (1161, ("応保", "おうほう")),
187
+ (1163, ("長寛", "ちょうかん")),
188
+ (1165, ("永万", "えいまん")),
189
+ (1166, ("仁安", "にんあん")),
190
+ (1169, ("嘉応", "かおう")),
191
+ (1171, ("承安", "しょうあん")),
192
+ (1175, ("安元", "あんげん")),
193
+ (1177, ("治承", "じしょう")),
194
+ (1181, ("養和", "ようわ")),
195
+ (1182, ("寿永", "じゅえい")),
196
+ (1184, ("元暦", "げんりゃく")),
197
+ (1185, ("文治", "ぶんじ")),
198
+ (1190, ("建久", "けんきゅう")),
199
+ (1199, ("正治", "しょうじ")),
200
+ (1201, ("建仁", "けんにん")),
201
+ (1204, ("元久", "げんきゅう")),
202
+ (1206, ("建永", "けんえい")),
203
+ (1207, ("承元", "じょうげん")),
204
+ (1211, ("建暦", "けんりゃく")),
205
+ (1214, ("建保", "けんぽう")),
206
+ (1219, ("承久", "じょうきゅう")),
207
+ (1222, ("貞応", "じょうおう")),
208
+ (1225, ("元仁", "げんにん")),
209
+ (1225, ("嘉禄", "かろく")),
210
+ (1228, ("安貞", "あんてい")),
211
+ (1229, ("寛喜", "かんき")),
212
+ (1232, ("貞永", "じょうえい")),
213
+ (1233, ("天福", "てんぷく")),
214
+ (1235, ("文暦", "ぶんりゃく")),
215
+ (1235, ("嘉禎", "かてい")),
216
+ (1239, ("暦仁", "りゃくにん")),
217
+ (1239, ("延応", "えんおう")),
218
+ (1240, ("仁治", "にんじ")),
219
+ (1243, ("寛元", "かんげん")),
220
+ (1247, ("宝治", "ほうじ")),
221
+ (1249, ("建長", "けんちょう")),
222
+ (1256, ("康元", "こうげん")),
223
+ (1257, ("正嘉", "しょうか")),
224
+ (1259, ("正元", "しょうげん")),
225
+ (1260, ("文応", "ぶんおう")),
226
+ (1261, ("弘長", "こうちょう")),
227
+ (1264, ("文永", "ぶんえい")),
228
+ (1275, ("健治", "けんじ")),
229
+ (1278, ("弘安", "こうあん")),
230
+ (1288, ("正応", "しょうおう")),
231
+ (1293, ("永仁", "えいにん")),
232
+ (1299, ("正安", "しょうあん")),
233
+ (1303, ("乾元", "けんげん")),
234
+ (1303, ("嘉元", "かげん")),
235
+ (1307, ("徳治", "とくじ")),
236
+ (1308, ("延慶", "えんきょう")),
237
+ (1311, ("応長", "おうちょう")),
238
+ (1312, ("正和", "しょうわ")),
239
+ (1317, ("文保", "ぶんぽう")),
240
+ (1319, ("元応", "げんおう")),
241
+ (1321, ("元亨", "げんこう")),
242
+ (1325, ("正中", "しょうちゅ")),
243
+ (1326, ("嘉暦", "かりゃく")),
244
+ (1329, ("元徳", "げんとく")),
245
+ (1331, ("元弘", "げんこう")),
246
+ (1332, ("正慶", "しょうけい")),
247
+ (1334, ("建武", "けんむ")),
248
+ (1336, ("延元", "えいげん")),
249
+ (1338, ("暦応", "りゃくおう")),
250
+ (1340, ("興国", "こうこく")),
251
+ (1342, ("康永", "こうえい")),
252
+ (1345, ("貞和", "じょうわ")),
253
+ (1347, ("正平", "しょうへい")),
254
+ (1350, ("観応", "かんおう")),
255
+ (1352, ("文和", "ぶんな")),
256
+ (1356, ("延文", "えんぶん")),
257
+ (1361, ("康安", "こうあん")),
258
+ (1362, ("貞治", "じょうじ")),
259
+ (1368, ("応安", "おうあん")),
260
+ (1370, ("建徳", "けんとく")),
261
+ (1372, ("文中", "ぶんちゅう")),
262
+ (1375, ("永和", "えいわ")),
263
+ (1375, ("天授", "てんじゅ")),
264
+ (1379, ("康暦", "こうりゃく")),
265
+ (1381, ("永徳", "えいとく")),
266
+ (1381, ("弘和", "こうわ")),
267
+ (1384, ("至徳", "しとく")),
268
+ (1384, ("元中", "げんちゅう")),
269
+ (1387, ("嘉慶", "かけい")),
270
+ (1389, ("康応", "こうおう")),
271
+ (1390, ("明徳", "めいとく")),
272
+ (1394, ("応永", "おうえい")),
273
+ (1428, ("正長", "しょうちょう")),
274
+ (1429, ("永享", "えいきょう")),
275
+ (1441, ("嘉吉", "かきつ")),
276
+ (1444, ("文安", "ぶんあん")),
277
+ (1449, ("宝徳", "ほうとく")),
278
+ (1452, ("享徳", "きょうとく")),
279
+ (1455, ("康正", "こうしょう")),
280
+ (1457, ("長禄", "ちょうろく")),
281
+ (1461, ("寛正", "かんしょう")),
282
+ (1466, ("文正", "ぶんしょう")),
283
+ (1467, ("応仁", "おうにん")),
284
+ (1469, ("文明", "ぶんめい")),
285
+ (1487, ("長享", "ちょうきょう")),
286
+ (1489, ("延徳", "えんとく")),
287
+ (1492, ("明応", "めいおう")),
288
+ (1501, ("文亀", "ぶんき")),
289
+ (1504, ("永正", "えいしょう")),
290
+ (1521, ("大永", "だいえい")),
291
+ (1528, ("享禄", "きょうろく")),
292
+ (1532, ("天文", "てんぶん")),
293
+ (1555, ("弘治", "こうじ")),
294
+ (1558, ("永禄", "えいろく")),
295
+ (1570, ("元亀", "げんき")),
296
+ (1573, ("天正", "てんしょう")),
297
+ (1593, ("文禄", "ぶんろく")),
298
+ (1596, ("慶長", "けいちょう")),
299
+ (1615, ("元和", "げんな")),
300
+ (1624, ("寛永", "かんえい")),
301
+ (1645, ("正保", "しょうほう")),
302
+ (1648, ("慶安", "けいあん")),
303
+ (1652, ("承応", "じょうおう")),
304
+ (1655, ("明暦", "めいれき")),
305
+ (1658, ("万治", "まんじ")),
306
+ (1661, ("寛文", "かんぶん")),
307
+ (1673, ("延宝", "えんぽう")),
308
+ (1681, ("天和", "てんな")),
309
+ (1684, ("貞享", "じょうきょう")),
310
+ (1688, ("元禄", "げんろく")),
311
+ (1704, ("宝永", "ほうえい")),
312
+ (1711, ("正徳", "しょうとく")),
313
+ (1716, ("享保", "きょうほう")),
314
+ (1736, ("元文", "げんぶん")),
315
+ (1741, ("寛保", "かんぽう")),
316
+ (1744, ("延享", "えんきょう")),
317
+ (1748, ("寛延", "かんえん")),
318
+ (1751, ("宝暦", "ほうれき")),
319
+ (1764, ("明和", "めいわ")),
320
+ (1773, ("安永", "あんえい")),
321
+ (1781, ("天明", "てんめい")),
322
+ (1801, ("寛政", "かんせい")),
323
+ (1802, ("享和", "きょうわ")),
324
+ (1804, ("文化", "ぶんか")),
325
+ (1818, ("文政", "ぶんせい")),
326
+ (1831, ("天保", "てんぽう")),
327
+ (1845, ("弘化", "こうか")),
328
+ (1848, ("嘉永", "かえい")),
329
+ (1855, ("安政", "あんせい")),
330
+ (1860, ("万延", "まんえい")),
331
+ (1861, ("文久", "ぶんきゅう")),
332
+ (1864, ("元治", "げんじ")),
333
+ (1865, ("慶応", "けいおう")),
334
+ (1868, ("明治", "めいじ")),
335
+ (1912, ("大正", "たいしょう")),
336
+ (1926, ("昭和", "しょうわ")),
337
+ (1989, ("平成", "へいせい")),
338
+ (2019, ("令和", "れいわ")),
339
+ ]
340
+
341
+
342
+ class Num2Word_JA(Num2Word_Base):
343
+ CURRENCY_FORMS = {
344
+ 'JPY': (('円', 'えん'), ()),
345
+ }
346
+
347
+ def set_high_numwords(self, high):
348
+ max = 4 * len(high)
349
+ for word, n in zip(high, range(max, 0, -4)):
350
+ self.cards[10 ** n] = word
351
+
352
+ def setup(self):
353
+ self.negword = "マイナス"
354
+ self.pointword = ("点", "てん")
355
+ self.exclude_title = ["点", "マイナス"]
356
+
357
+ self.high_numwords = [
358
+ ("万", "まん"), # 10**4 man
359
+ ("億", "おく"), # 10**8 oku
360
+ ("兆", "ちょう"), # 10**12 chō
361
+ ("京", "けい"), # 10**16 kei
362
+ ("垓", "がい"), # 10**20 gai
363
+ ("秭", "し"), # 10**24 shi
364
+ ("穣", "じょう"), # 10**28 jō
365
+ ("溝", "こう"), # 10**32 kō
366
+ ("澗", "かん"), # 10**36 kan
367
+ ("正", "せい"), # 10**40 sei
368
+ ("載", "さい"), # 10**44 sai
369
+ ("極", "ごく"), # 10**48 goku
370
+ ]
371
+
372
+ self.high_numwords.reverse()
373
+
374
+ self.mid_numwords = [
375
+ (1000, ("千", "せん")),
376
+ (100, ("百", "ひゃく")),
377
+ ]
378
+
379
+ self.low_numwords = [
380
+ ("十", "じゅう"), # 10 jū
381
+ ("九", "きゅう"), # 9 kyū
382
+ ("八", "はち"), # 8 hachi
383
+ ("七", ("なな", "しち")), # 7 nana, shichi
384
+ ("六", "ろく"), # 6 roku
385
+ ("五", "ご"), # 5 go
386
+ ("四", ("よん", "し")), # 4 yon, shi
387
+ ("三", "さん"), # 3 san
388
+ ("二", "に"), # 2 ni
389
+ ("一", "いち"), # 1 ichi
390
+ # both are alternatives, 零 doesn't map to ゼロ or 〇 to れい
391
+ (("零", "〇"), ("ゼロ", "れい")), # 0 ZERO, rei
392
+ ]
393
+
394
+ def merge(self, lpair, rpair):
395
+ ltext, lnum = lpair
396
+ rtext, rnum = rpair
397
+
398
+ fmt = "%s%s"
399
+ # ignore lpair if lnum is 1 and rnum is less than 10000
400
+ if lnum == 1 and rnum < 10000:
401
+ return rpair
402
+ # rnum is added to lnum
403
+ elif lnum > rnum:
404
+ return (fmt % (ltext, rtext), lnum + rnum)
405
+ # rnum is multiplied by lnum
406
+ elif lnum < rnum:
407
+ return rendaku_merge_pairs(lpair, rpair)
408
+
409
+ def _ordinal_suffix(self, reading, counter):
410
+ if reading:
411
+ if counter == "番":
412
+ return "ばんめ"
413
+ else:
414
+ raise NotImplementedError(
415
+ "Reading not implemented for %s" % counter)
416
+ else:
417
+ return counter + "目"
418
+
419
+ def to_ordinal(self, value, reading=False, prefer=None, counter="番"):
420
+ self.verify_ordinal(value)
421
+ base = self.to_cardinal(value, reading=reading, prefer=prefer)
422
+ return "%s%s" % (base, self._ordinal_suffix(reading, counter))
423
+
424
+ def to_ordinal_num(self, value, reading=False, counter="番"):
425
+ return "%s%s" % (value, self._ordinal_suffix(reading, counter))
426
+
427
+ def to_year(self, val, suffix=None, longval=True, reading=False,
428
+ prefer=None, era=True):
429
+ year = val
430
+ # Gregorian calendar
431
+ if not era:
432
+ prefix = ""
433
+ if year < 0:
434
+ year = abs(year)
435
+ prefix = "きげんぜん" if reading else "紀元前"
436
+
437
+ year_words = self.to_cardinal(year, reading=reading, prefer=prefer)
438
+ if reading and year % 10 == 9:
439
+ year_words = year_words[:-3] + "く"
440
+
441
+ return "%s%s%s" % (prefix, year_words, "ねん" if reading else "年")
442
+
443
+ # Era calendar (default)
444
+ min_year = ERA_START[0][0]
445
+ last_era_idx = len(ERA_START) - 1
446
+ if year < min_year:
447
+ raise ValueError(
448
+ "Can't convert years less than %s to era" % min_year)
449
+
450
+ first = 0
451
+ last = last_era_idx
452
+ era_idx = None
453
+ while era_idx is None:
454
+ mid = (first + last) // 2
455
+ if mid == last_era_idx or (ERA_START[mid][0] <= year and
456
+ ERA_START[mid + 1][0] > year):
457
+ era_idx = mid
458
+ # if an era lasting less than a year is preferred, choose it
459
+ if prefer:
460
+ i = mid - 1
461
+ while i >= 0 and ERA_START[i][0] == year:
462
+ # match kanji or hiragana
463
+ if set(ERA_START[i][1]) & set(prefer):
464
+ era_idx = i
465
+ break
466
+ i -= 1
467
+
468
+ # ends up at the last index where year >= ERA_START[mid][0]
469
+ if year < ERA_START[mid][0]:
470
+ last = mid - 1
471
+ else:
472
+ first = mid + 1
473
+
474
+ era = ERA_START[era_idx]
475
+ era_name = era[1][0]
476
+ era_year = year - era[0] + 1
477
+ fmt = "%s%s年"
478
+ if reading == "arabic":
479
+ era_year_words = str(era_year)
480
+ elif reading:
481
+ era_name = era[1][1]
482
+ era_year_words = (self.to_cardinal(era_year, reading=True,
483
+ prefer=prefer)
484
+ if era_year != 1 else "がん")
485
+ if era_year % 10 == 9:
486
+ era_year_words = era_year_words[:-3] + "く"
487
+ fmt = "%s%sねん"
488
+ else:
489
+ era_year_words = (self.to_cardinal(era_year, reading=False,
490
+ prefer=prefer)
491
+ if era_year != 1 else "元")
492
+
493
+ return fmt % (era_name, era_year_words)
494
+
495
+ def to_currency(self, val, currency="JPY", cents=False, separator="",
496
+ adjective=False, reading=False, prefer=None):
497
+ left, right, is_negative = parse_currency_parts(
498
+ val, is_int_with_cents=cents)
499
+
500
+ try:
501
+ cr1, cr2 = self.CURRENCY_FORMS[currency]
502
+ if (cents or abs(val) != left) and not cr2:
503
+ raise ValueError('Decimals not supported for "%s"' % currency)
504
+ except KeyError:
505
+ raise NotImplementedError(
506
+ 'Currency code "%s" not implemented for "%s"' %
507
+ (currency, self.__class__.__name__))
508
+
509
+ if adjective and currency in self.CURRENCY_ADJECTIVES:
510
+ cr1 = prefix_currency(self.CURRENCY_ADJECTIVES[currency], cr1)
511
+
512
+ minus_str = self.negword if is_negative else ""
513
+
514
+ return '%s%s%s%s%s' % (
515
+ minus_str,
516
+ self.to_cardinal(left, reading=reading, prefer=prefer),
517
+ cr1[1] if reading else cr1[0],
518
+ self.to_cardinal(right, reading=reading, prefer=prefer)
519
+ if cr2 else '',
520
+ (cr2[1] if reading else cr2[0]) if cr2 else '',
521
+ )
522
+
523
+ def splitnum(self, value, reading, prefer):
524
+ for elem in self.cards:
525
+ if elem > value:
526
+ continue
527
+
528
+ out = []
529
+ if value == 0:
530
+ div, mod = 1, 0
531
+ else:
532
+ div, mod = divmod(value, elem)
533
+
534
+ if div == 1:
535
+ out.append((select_text(self.cards[1], reading, prefer), 1))
536
+ else:
537
+ if div == value: # The system tallies, eg Roman Numerals
538
+ return [(
539
+ div * select_text(self.cards[elem], reading, prefer),
540
+ div * elem)]
541
+ out.append(self.splitnum(div, reading, prefer))
542
+
543
+ out.append((select_text(self.cards[elem], reading, prefer), elem))
544
+
545
+ if mod:
546
+ out.append(self.splitnum(mod, reading, prefer))
547
+
548
+ return out
549
+
550
+ def to_cardinal(self, value, reading=False, prefer=None):
551
+ try:
552
+ assert int(value) == value
553
+ except (ValueError, TypeError, AssertionError):
554
+ return self.to_cardinal_float(value, reading=reading,
555
+ prefer=prefer)
556
+
557
+ out = ""
558
+ if value < 0:
559
+ value = abs(value)
560
+ out = self.negword
561
+
562
+ if value >= self.MAXVAL:
563
+ raise OverflowError(self.errmsg_toobig % (value, self.MAXVAL))
564
+
565
+ val = self.splitnum(value, reading, prefer)
566
+ words, _ = self.clean(val)
567
+ return self.title(out + words)
568
+
569
+ def to_cardinal_float(self, value, reading=False, prefer=None):
570
+ prefer = prefer or ["れい"]
571
+ try:
572
+ float(value) == value
573
+ except (ValueError, TypeError, AssertionError):
574
+ raise TypeError(self.errmsg_nonnum % value)
575
+
576
+ pre, post = self.float2tuple(float(value))
577
+
578
+ post = str(post)
579
+ post = '0' * (self.precision - len(post)) + post
580
+
581
+ out = [self.to_cardinal(pre, reading=reading, prefer=prefer)]
582
+ if self.precision:
583
+ out.append(self.title(self.pointword[1 if reading else 0]))
584
+
585
+ for i in range(self.precision):
586
+ curr = int(post[i])
587
+ out.append(to_s(
588
+ self.to_cardinal(curr, reading=reading, prefer=prefer)))
589
+
590
+ return "".join(out)
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_KN.py ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- encoding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import unicode_literals
19
+
20
+ from .lang_EU import Num2Word_EU
21
+
22
+
23
+ class Num2Word_KN(Num2Word_EU):
24
+ def set_high_numwords(self, high):
25
+ for n, word in self.high_numwords:
26
+ self.cards[10**n] = word
27
+
28
+ def setup(self):
29
+ self.low_numwords = [
30
+ "ತೊಂಬತ್ತೊಂಬತ್ತು",
31
+ "ತೊಂಬತ್ತೆಂಟು",
32
+ "ತೊಂಬತ್ತೇಳು",
33
+ "ತೊಂಬತ್ತಾರು",
34
+ "ತೊಂಬತ್ತೈದು",
35
+ "ತೊಂಬತ್ತ ನಾಲ್ಕು",
36
+ "ತೊಂಬತ್ತ ಮೂರು",
37
+ "ತೊಂಬತ್ತೆರಡು",
38
+ "ತೊಂಬತ್ತೊಂದು",
39
+ "ತೊಂಬತ್ತು",
40
+ "ಎಂಬತ್ತೊಂಬತ್ತು",
41
+ "ಎಂಬತ್ತೆಂಟು",
42
+ "ಎಂಬತ್ತೇಳು",
43
+ "ಎಂಬತ್ತಾರು",
44
+ "ಎಂಬತ್ತೈದು",
45
+ "ಎಂಬತ್ತ್ ನಾಲ್ಕು",
46
+ "ಎಂಬತ್ತ್ ಮೂರು",
47
+ "ಎಂಬತ್ತೆರಡು",
48
+ "ಎಂಬತ್ತೊಂದು",
49
+ "ಎಂಬತ್ತು",
50
+ "ಎಪ್ಪತ್ತೊಂಬತ್ತು",
51
+ "ಎಪ್ಪತ್ತೆಂಟು",
52
+ "ಎಪ್ಪತ್ತೇಳು",
53
+ "ಎಪ್ಪತ್ತಾರು",
54
+ "ಎಪ್ಪತ್ತೈದು",
55
+ "ಎಪ್ಪತ್ತ್ ನಾಲ್ಕು",
56
+ "ಎಪ್ಪತ್ತ್ ಮೂರು",
57
+ "ಎಪ್ಪತ್ತೆರಡು",
58
+ "ಎಪ್ಪತ್ತೊಂದು",
59
+ "ಎಪ್ಪತ್ತು",
60
+ "ಅರವತ್ತೊಂಬತ್ತು",
61
+ "ಅರವತ್ತೆಂಟು",
62
+ "ಅರವತ್ತೇಳು",
63
+ "ಅರವತ್ತಾರು",
64
+ "ಅರವತ್ತೈದು",
65
+ "ಅರವತ್ತ್ ನಾಲ್ಕು",
66
+ "ಅರವತ್ತ್ ಮೂರು",
67
+ "ಅರವತ್ತೆರಡು",
68
+ "ಅರವತ್ತೊಂದು",
69
+ "ಅರವತ್ತು",
70
+ "ಐವತ್ತೊಂಬತ್ತು",
71
+ "ಐವತ್ತೆಂಟು",
72
+ "ಐವತ್ತೇಳು",
73
+ "ಐವತ್ತಾರು",
74
+ "ಐವತ್ತೈದು",
75
+ "ಐವತ್ತ್ನಾಲ್ಕು",
76
+ "ಐವತ್ತಮೂರು",
77
+ "ಐವತ್ತೆರಡು",
78
+ "ಐವತ್ತೊಂದು",
79
+ "ಐವತ್ತು",
80
+ "ನಲವತ್ತೊಂಬತ್ತು",
81
+ "ನಲವತ್ತೆಂಟು",
82
+ "ನಲವತ್ತೇಳು",
83
+ "ನಲವತ್ತಾರು",
84
+ "ನಲವತ್ತೈದು",
85
+ "ನಲವತ್ತ್ ನಾಲ್ಕು",
86
+ "ನಲವತ್ತ್ ಮೂರು",
87
+ "ನಲವತ್ತ್ ಎರಡು",
88
+ "ನಲವತ್ತೊಂದು",
89
+ "ನಲವತ್ತು",
90
+ "ಮೂವತ್ತ್ ಒಂಬತ್ತು",
91
+ "ಮೂವತ್ಎಂಟು",
92
+ "ಮೂವತ್ಏಳು",
93
+ "ಮೂವತ್ಆರು",
94
+ "ಮೂವತ್ತ್ ಐದು",
95
+ "ಮೂವತ್ತ್ ನಾಲ್ಕು",
96
+ "ಮೂವತ್ತ್ ಮೂರು",
97
+ "ಮೂವತ್ತ್ಎರಡು",
98
+ "ಮೂವತ್ತ್ಒಂದು",
99
+ "ಮೂವತ್ತು",
100
+ "ಇಪ್ಪತ್ತ್ಒಂಬತ್ತು",
101
+ "ಇಪ್ಪತ್ತ್ಎಂಟು",
102
+ "ಇಪ್ಪತ್ತ್ಏಳು",
103
+ "ಇಪ್ಪತ್ತ್ಆರು",
104
+ "ಇಪ್ಪತ್ತ್ ಐದು",
105
+ "ಇಪ್ಪತ್ತ್ ನಾಲ್ಕು",
106
+ "ಇಪ್ಪತ್ತ್ ಮೂರು",
107
+ "ಇಪ್ಪತ್ತ್ ಎರಡು",
108
+ "ಇಪ್ಪತ್ತ್ ಒಂದು",
109
+ "ಇಪ್ಪತ್ತು",
110
+ "ಹತ್��ೊಂಬತ್ತು",
111
+ "ಹದಿನೆಂಟು",
112
+ "ಹದಿನೇಳು",
113
+ "ಹದಿನಾರು",
114
+ "ಹದಿನೈದು",
115
+ "ಹದಿನಾಲ್ಕು",
116
+ "ಹದಿಮೂರು",
117
+ "ಹನ್ನೆರಡು",
118
+ "ಹನ್ನೊಂದು",
119
+ "ಹತ್ತು",
120
+ "ಒಂಬತ್ತು",
121
+ "ಎಂಟು",
122
+ "ಏಳು",
123
+ "ಆರು",
124
+ "ಐದು",
125
+ "ನಾಲ್ಕು",
126
+ "ಮೂರು",
127
+ "ಎರಡು",
128
+ "ಒಂದು",
129
+ "ಸೊನ್ನೆ",
130
+ ]
131
+
132
+ self.mid_numwords = [(100, "ನೂರು")]
133
+
134
+ self.high_numwords = [(7, "ಕೋಟಿ"), (5, "ಒಂದು ಲಕ್ಷ"), (3, "ಸಾವಿರ")]
135
+
136
+ self.pointword = "ಬಿಂದು"
137
+
138
+ self.modifiers = [
139
+ "್",
140
+ "ಾ",
141
+ "ಿ",
142
+ "ೀ",
143
+ "ೀ",
144
+ "ು",
145
+ "ೂ",
146
+ "ೃ",
147
+ "ೆ",
148
+ "ೇ",
149
+ "ೈ",
150
+ "ೊ",
151
+ "ೋ",
152
+ "ೌ",
153
+ "ೕ",
154
+ ]
155
+
156
+ def merge(self, lpair, rpair):
157
+ ltext, lnum = lpair
158
+ rtext, rnum = rpair
159
+ if lnum == 1 and rnum < 100:
160
+ return (rtext, rnum)
161
+ elif 100 > lnum > rnum:
162
+ return ("%s-%s" % (ltext, rtext), lnum + rnum)
163
+ elif lnum >= 100 > rnum:
164
+ if ltext[-1] in self.modifiers:
165
+ return ("%s %s" % (ltext[:-1], rtext), lnum + rnum)
166
+ else:
167
+ return ("%s %s" % (ltext + "ದ", rtext), lnum + rnum)
168
+ elif rnum > lnum:
169
+ return ("%s %s" % (ltext, rtext), lnum * rnum)
170
+ return ("%s %s" % (ltext, rtext), lnum + rnum)
171
+
172
+ def to_ordinal_num(self, value):
173
+ self.verify_ordinal(value)
174
+ return "%s%s" % (value, self.to_ordinal(value))
175
+
176
+ def to_ordinal(self, value):
177
+ self.verify_ordinal(value)
178
+ outwords = self.to_cardinal(value)
179
+ if outwords[-1] in self.modifiers:
180
+ outwords = outwords[:-1]
181
+ ordinal_num = outwords + "ನೇ"
182
+ return ordinal_num
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_KO.py ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import division, print_function, unicode_literals
19
+
20
+ from .base import Num2Word_Base
21
+ from .currency import parse_currency_parts
22
+
23
+
24
+ class Num2Word_KO(Num2Word_Base):
25
+ CURRENCY_FORMS = {
26
+ 'KRW': ('원', None),
27
+ 'USD': ('달러', '센트'),
28
+ 'JPY': ('엔', None)
29
+ }
30
+
31
+ def set_high_numwords(self, high):
32
+ max = 4 * len(high)
33
+ for word, n in zip(high, range(max, 0, -4)):
34
+ self.cards[10 ** n] = word
35
+
36
+ def setup(self):
37
+ super(Num2Word_KO, self).setup()
38
+
39
+ self.negword = "마이너스 "
40
+ self.pointword = "점"
41
+
42
+ self.high_numwords = [
43
+ '무량대수',
44
+ '불가사의',
45
+ '나유타',
46
+ '아승기',
47
+ '항하사',
48
+ '극',
49
+ '재',
50
+ '정',
51
+ '간',
52
+ '구',
53
+ '양',
54
+ '자',
55
+ '해',
56
+ '경',
57
+ '조',
58
+ '억',
59
+ '만']
60
+ self.mid_numwords = [(1000, "천"), (100, "백")]
61
+ self.low_numwords = ["십", "구", "팔", "칠", "육", "오", "사", "삼", "이",
62
+ "일", "영"]
63
+ self.ords = {"일": "한",
64
+ "이": "두",
65
+ "삼": "세",
66
+ "사": "네",
67
+ "오": "다섯",
68
+ "육": "여섯",
69
+ "칠": "일곱",
70
+ "팔": "여덟",
71
+ "구": "아홉",
72
+ "십": "열",
73
+ "이십": "스물",
74
+ "삼십": "서른",
75
+ "사십": "마흔",
76
+ "오십": "쉰",
77
+ "육십": "예순",
78
+ "칠십": "일흔",
79
+ "팔십": "여든",
80
+ "구십": "아흔"}
81
+
82
+ def merge(self, lpair, rpair):
83
+ ltext, lnum = lpair
84
+ rtext, rnum = rpair
85
+ if lnum == 1 and rnum <= 10000:
86
+ return rpair
87
+ elif 10000 > lnum > rnum:
88
+ return ("%s%s" % (ltext, rtext), lnum + rnum)
89
+ elif lnum >= 10000 and lnum > rnum:
90
+ return ("%s %s" % (ltext, rtext), lnum + rnum)
91
+ else:
92
+ return ("%s%s" % (ltext, rtext), lnum * rnum)
93
+
94
+ def to_ordinal(self, value):
95
+ self.verify_ordinal(value)
96
+ if value == 1:
97
+ return "첫 번째"
98
+ outwords = self.to_cardinal(value).split(" ")
99
+ lastwords = outwords[-1].split("백")
100
+ if "십" in lastwords[-1]:
101
+ ten_one = lastwords[-1].split("십")
102
+ ten_one[0] = self.ords[ten_one[0] + "십"]
103
+ try:
104
+ ten_one[1] = self.ords[ten_one[1]]
105
+ ten_one[0] = ten_one[0].replace("스무", "스물")
106
+ except KeyError:
107
+ pass
108
+ lastwords[-1] = ''.join(ten_one)
109
+ else:
110
+ lastwords[-1] = self.ords[lastwords[-1]]
111
+ outwords[-1] = "백 ".join(lastwords)
112
+ return " ".join(outwords) + " 번째"
113
+
114
+ def to_ordinal_num(self, value):
115
+ self.verify_ordinal(value)
116
+ return "%s 번째" % (value)
117
+
118
+ def to_year(self, val, suffix=None, longval=True):
119
+ if val < 0:
120
+ val = abs(val)
121
+ suffix = '기원전' if not suffix else suffix
122
+ valtext = self.to_cardinal(val)
123
+ return ("%s년" % valtext if not suffix
124
+ else "%s %s년" % (suffix, valtext))
125
+
126
+ def to_currency(self, val, currency="KRW", cents=False, separator="",
127
+ adjective=False):
128
+ left, right, is_negative = parse_currency_parts(
129
+ val, is_int_with_cents=cents)
130
+
131
+ try:
132
+ cr1, cr2 = self.CURRENCY_FORMS[currency]
133
+ if (cents or right) and not cr2:
134
+ raise ValueError('Decimals not supported for "%s"' % currency)
135
+ except KeyError:
136
+ raise NotImplementedError(
137
+ 'Currency code "%s" not implemented for "%s"' %
138
+ (currency, self.__class__.__name__))
139
+
140
+ minus_str = self.negword if is_negative else ""
141
+ return '%s%s%s%s%s' % (
142
+ minus_str,
143
+ ''.join(self.to_cardinal(left).split()),
144
+ cr1,
145
+ ' ' + self.to_cardinal(right)
146
+ if cr2 else '',
147
+ cr2 if cr2 else '',
148
+ )
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_KZ.py ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import unicode_literals
19
+
20
+ from .base import Num2Word_Base
21
+ from .utils import get_digits, splitbyx
22
+
23
+ ZERO = 'нөл'
24
+
25
+ ONES = {
26
+ 1: 'бір',
27
+ 2: 'екі',
28
+ 3: 'үш',
29
+ 4: 'төрт',
30
+ 5: 'бес',
31
+ 6: 'алты',
32
+ 7: 'жеті',
33
+ 8: 'сегіз',
34
+ 9: 'тоғыз',
35
+ }
36
+
37
+ TEN = 'он'
38
+
39
+ TWENTIES = {
40
+ 2: 'жиырма',
41
+ 3: 'отыз',
42
+ 4: 'қырық',
43
+ 5: 'елу',
44
+ 6: 'алпыс',
45
+ 7: 'жетпіс',
46
+ 8: 'сексен',
47
+ 9: 'тоқсан',
48
+ }
49
+
50
+ HUNDRED = 'жүз'
51
+
52
+ THOUSANDS = {
53
+ 1: 'мың',
54
+ 2: 'миллион',
55
+ 3: 'миллиард',
56
+ 4: 'триллион',
57
+ 5: 'квадриллион',
58
+ 6: 'квинтиллион',
59
+ 7: 'секстиллион',
60
+ 8: 'септиллион',
61
+ 9: 'октиллион',
62
+ 10: 'нониллион',
63
+ }
64
+
65
+
66
+ class Num2Word_KZ(Num2Word_Base):
67
+ CURRENCY_FORMS = {
68
+ 'USD': ('доллар', 'цент'),
69
+ 'KZT': ('теңге', 'тиын'),
70
+ }
71
+
72
+ def setup(self):
73
+ self.negword = "минус"
74
+ self.pointword = "бүтін"
75
+
76
+ def to_cardinal(self, number):
77
+ n = str(number).replace(',', '.')
78
+ if '.' in n:
79
+ left, right = n.split('.')
80
+ leading_zero_count = len(right) - len(right.lstrip('0'))
81
+ return u'%s %s %s' % (
82
+ self._int2word(int(left)),
83
+ self.pointword,
84
+ (ZERO + ' ') * leading_zero_count + self._int2word(int(right))
85
+ )
86
+ else:
87
+ return self._int2word(int(n))
88
+
89
+ def pluralize(self, n, form):
90
+ return form
91
+
92
+ def _cents_verbose(self, number, currency):
93
+ return self._int2word(number, currency == 'KZT')
94
+
95
+ def _int2word(self, n, feminine=False):
96
+ if n < 0:
97
+ return ' '.join([self.negword, self._int2word(abs(n))])
98
+
99
+ if n == 0:
100
+ return ZERO
101
+
102
+ words = []
103
+ chunks = list(splitbyx(str(n), 3))
104
+ i = len(chunks)
105
+ for x in chunks:
106
+ i -= 1
107
+
108
+ if x == 0:
109
+ continue
110
+
111
+ n1, n2, n3 = get_digits(x)
112
+
113
+ if n3 > 0:
114
+ if n3 > 1:
115
+ words.append(ONES[n3])
116
+ words.append(HUNDRED)
117
+
118
+ if n2 == 1:
119
+ words.append(TEN)
120
+ elif n2 > 1:
121
+ words.append(TWENTIES[n2])
122
+
123
+ if n1 > 0:
124
+ words.append(ONES[n1])
125
+
126
+ if i > 0:
127
+ words.append(THOUSANDS[i])
128
+
129
+ return ' '.join(words)
130
+
131
+ def to_ordinal(self, number):
132
+ # TODO: Implement to_ordinal
133
+ raise NotImplementedError()
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_LT.py ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import unicode_literals
19
+
20
+ from .base import Num2Word_Base
21
+ from .utils import get_digits, splitbyx
22
+
23
+ ZERO = ('nulis',)
24
+
25
+ ONES_FEMININE = {
26
+ 1: ('viena',),
27
+ 2: ('dvi',),
28
+ 3: ('trys',),
29
+ 4: ('keturios',),
30
+ 5: ('penkios',),
31
+ 6: ('šešios',),
32
+ 7: ('septynios',),
33
+ 8: ('aštuonios',),
34
+ 9: ('devynios',),
35
+ }
36
+
37
+ ONES = {
38
+ 1: ('vienas',),
39
+ 2: ('du',),
40
+ 3: ('trys',),
41
+ 4: ('keturi',),
42
+ 5: ('penki',),
43
+ 6: ('šeši',),
44
+ 7: ('septyni',),
45
+ 8: ('aštuoni',),
46
+ 9: ('devyni',),
47
+ }
48
+
49
+ TENS = {
50
+ 0: ('dešimt',),
51
+ 1: ('vienuolika',),
52
+ 2: ('dvylika',),
53
+ 3: ('trylika',),
54
+ 4: ('keturiolika',),
55
+ 5: ('penkiolika',),
56
+ 6: ('šešiolika',),
57
+ 7: ('septyniolika',),
58
+ 8: ('aštuoniolika',),
59
+ 9: ('devyniolika',),
60
+ }
61
+
62
+ TWENTIES = {
63
+ 2: ('dvidešimt',),
64
+ 3: ('trisdešimt',),
65
+ 4: ('keturiasdešimt',),
66
+ 5: ('penkiasdešimt',),
67
+ 6: ('šešiasdešimt',),
68
+ 7: ('septyniasdešimt',),
69
+ 8: ('aštuoniasdešimt',),
70
+ 9: ('devyniasdešimt',),
71
+ }
72
+
73
+ HUNDRED = ('šimtas', 'šimtai')
74
+
75
+ THOUSANDS = {
76
+ 1: ('tūkstantis', 'tūkstančiai', 'tūkstančių'),
77
+ 2: ('milijonas', 'milijonai', 'milijonų'),
78
+ 3: ('milijardas', 'milijardai', 'milijardų'),
79
+ 4: ('trilijonas', 'trilijonai', 'trilijonų'),
80
+ 5: ('kvadrilijonas', 'kvadrilijonai', 'kvadrilijonų'),
81
+ 6: ('kvintilijonas', 'kvintilijonai', 'kvintilijonų'),
82
+ 7: ('sikstilijonas', 'sikstilijonai', 'sikstilijonų'),
83
+ 8: ('septilijonas', 'septilijonai', 'septilijonų'),
84
+ 9: ('oktilijonas', 'oktilijonai', 'oktilijonų'),
85
+ 10: ('naintilijonas', 'naintilijonai', 'naintilijonų'),
86
+ }
87
+
88
+ GENERIC_CENTS = ('centas', 'centai', 'centų')
89
+
90
+
91
+ class Num2Word_LT(Num2Word_Base):
92
+ CURRENCY_FORMS = {
93
+ 'LTL': (('litas', 'litai', 'litų'), GENERIC_CENTS),
94
+ 'EUR': (('euras', 'eurai', 'eurų'), GENERIC_CENTS),
95
+ 'USD': (('doleris', 'doleriai', 'dolerių'), GENERIC_CENTS),
96
+ 'GBP': (
97
+ ('svaras sterlingų', 'svarai sterlingų', 'svarų sterlingų'),
98
+ ('pensas', 'pensai', 'pensų')
99
+ ),
100
+ 'PLN': (
101
+ ('zlotas', 'zlotai', 'zlotų'),
102
+ ('grašis', 'grašiai', 'grašių')),
103
+ 'RUB': (
104
+ ('rublis', 'rubliai', 'rublių'),
105
+ ('kapeika', 'kapeikos', 'kapeikų')
106
+ ),
107
+ }
108
+
109
+ def setup(self):
110
+ self.negword = "minus"
111
+ self.pointword = "kablelis"
112
+
113
+ def pluralize(self, n, forms):
114
+ n1, n2, n3 = get_digits(n)
115
+ if n2 == 1 or n1 == 0 or n == 0:
116
+ return forms[2]
117
+ elif n1 == 1:
118
+ return forms[0]
119
+ else:
120
+ return forms[1]
121
+
122
+ def to_cardinal(self, number):
123
+ n = str(number).replace(',', '.')
124
+ base_str, n = self.parse_minus(n)
125
+ if '.' in n:
126
+ left, right = n.split('.')
127
+ leading_zero_count = len(right) - len(right.lstrip('0'))
128
+ decimal_part = ((ZERO[0] + ' ') * leading_zero_count +
129
+ self._int2word(int(right)))
130
+ return '%s%s %s %s' % (
131
+ base_str,
132
+ self._int2word(int(left)),
133
+ self.pointword,
134
+ decimal_part
135
+ )
136
+ else:
137
+ return "%s%s" % (base_str, self._int2word(int(n)))
138
+
139
+ def to_ordinal(self, number):
140
+ raise NotImplementedError()
141
+
142
+ def _cents_verbose(self, number, currency):
143
+ return self._int2word(number, currency == 'RUB')
144
+
145
+ def _int2word(self, n, feminine=False):
146
+ if n == 0:
147
+ return ZERO[0]
148
+
149
+ words = []
150
+ chunks = list(splitbyx(str(n), 3))
151
+ i = len(chunks)
152
+
153
+ for x in chunks:
154
+ i -= 1
155
+
156
+ if x == 0:
157
+ continue
158
+
159
+ n1, n2, n3 = get_digits(x)
160
+
161
+ if n3 > 0:
162
+ words.append(ONES[n3][0])
163
+ if n3 > 1:
164
+ words.append(HUNDRED[1])
165
+ else:
166
+ words.append(HUNDRED[0])
167
+
168
+ if n2 > 1:
169
+ words.append(TWENTIES[n2][0])
170
+
171
+ if n2 == 1:
172
+ words.append(TENS[n1][0])
173
+ elif n1 > 0:
174
+ if (i == 1 or feminine and i == 0) and n < 1000:
175
+ words.append(ONES_FEMININE[n1][0])
176
+ else:
177
+ words.append(ONES[n1][0])
178
+
179
+ if i > 0:
180
+ words.append(self.pluralize(x, THOUSANDS[i]))
181
+
182
+ return ' '.join(words)
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_LV.py ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import unicode_literals
19
+
20
+ from .base import Num2Word_Base
21
+ from .utils import get_digits, splitbyx
22
+
23
+ ZERO = ('nulle',)
24
+
25
+ ONES = {
26
+ 1: ('viens',),
27
+ 2: ('divi',),
28
+ 3: ('trīs',),
29
+ 4: ('četri',),
30
+ 5: ('pieci',),
31
+ 6: ('seši',),
32
+ 7: ('septiņi',),
33
+ 8: ('astoņi',),
34
+ 9: ('deviņi',),
35
+ }
36
+
37
+ TENS = {
38
+ 0: ('desmit',),
39
+ 1: ('vienpadsmit',),
40
+ 2: ('divpadsmit',),
41
+ 3: ('trīspadsmit',),
42
+ 4: ('četrpadsmit',),
43
+ 5: ('piecpadsmit',),
44
+ 6: ('sešpadsmit',),
45
+ 7: ('septiņpadsmit',),
46
+ 8: ('astoņpadsmit',),
47
+ 9: ('deviņpadsmit',),
48
+ }
49
+
50
+ TWENTIES = {
51
+ 2: ('divdesmit',),
52
+ 3: ('trīsdesmit',),
53
+ 4: ('četrdesmit',),
54
+ 5: ('piecdesmit',),
55
+ 6: ('sešdesmit',),
56
+ 7: ('septiņdesmit',),
57
+ 8: ('astoņdesmit',),
58
+ 9: ('deviņdesmit',),
59
+ }
60
+
61
+ HUNDRED = ('simts', 'simti', 'simtu')
62
+
63
+ THOUSANDS = {
64
+ 1: ('tūkstotis', 'tūkstoši', 'tūkstošu'),
65
+ 2: ('miljons', 'miljoni', 'miljonu'),
66
+ 3: ('miljards', 'miljardi', 'miljardu'),
67
+ 4: ('triljons', 'triljoni', 'triljonu'),
68
+ 5: ('kvadriljons', 'kvadriljoni', 'kvadriljonu'),
69
+ 6: ('kvintiljons', 'kvintiljoni', 'kvintiljonu'),
70
+ 7: ('sikstiljons', 'sikstiljoni', 'sikstiljonu'),
71
+ 8: ('septiljons', 'septiljoni', 'septiljonu'),
72
+ 9: ('oktiljons', 'oktiljoni', 'oktiljonu'),
73
+ 10: ('nontiljons', 'nontiljoni', 'nontiljonu'),
74
+ }
75
+
76
+ GENERIC_DOLLARS = ('dolārs', 'dolāri', 'dolāru')
77
+ GENERIC_CENTS = ('cents', 'centi', 'centu')
78
+
79
+ GENERIC_KRONA = ('krona', 'kronas', 'kronu')
80
+ GENERIC_ERA = ('ēre', 'ēras', 'ēru')
81
+
82
+
83
+ class Num2Word_LV(Num2Word_Base):
84
+ """
85
+ Sadly we have a legal form (used in legal and finance documents):
86
+ http://www.eiro.lv/files/upload/files/Eiro_rakstiba-1.pdf
87
+ https://likumi.lv/doc.php?id=254741
88
+ http://eur-lex.europa.eu/legal-content/LV/TXT/HTML/?uri=CELEX:31998R0974&from=LV
89
+
90
+ Source: http://publications.europa.eu/code/lv/lv-5000500.htm
91
+ """
92
+ CURRENCY_FORMS = {
93
+ 'AUD': (GENERIC_DOLLARS, GENERIC_CENTS),
94
+ 'CAD': (GENERIC_DOLLARS, GENERIC_CENTS),
95
+ # repalced by EUR
96
+ 'EEK': (GENERIC_KRONA, GENERIC_CENTS),
97
+ 'EUR': (('eiro', 'eiro', 'eiro'), GENERIC_CENTS),
98
+ 'EUR_LEGAL': (('euro', 'euro', 'euro'), GENERIC_CENTS),
99
+ 'GBP': (
100
+ ('sterliņu mārciņa', 'sterliņu mārciņas', 'sterliņu mārciņu'),
101
+ ('penss', 'pensi', 'pensu')),
102
+ # replaced by EUR
103
+ 'LTL': (('lits', 'liti', 'litu'), GENERIC_CENTS),
104
+ # replaced by EUR
105
+ 'LVL': (('lats', 'lati', 'latu'),
106
+ ('santīms', 'santīmi', 'santīmu')),
107
+ 'USD': (GENERIC_DOLLARS, GENERIC_CENTS),
108
+ 'RUB': (('rublis', 'rubļi', 'rubļu'),
109
+ ('kapeika', 'kapeikas', 'kapeiku')),
110
+ 'SEK': (GENERIC_KRONA, GENERIC_ERA),
111
+ 'NOK': (GENERIC_KRONA, GENERIC_ERA),
112
+ 'PLN': (('zlots', 'zloti', 'zlotu'),
113
+ ('grasis', 'graši', 'grašu')),
114
+ }
115
+
116
+ CURRENCY_ADJECTIVES = {
117
+ 'AUD': 'Austrālijas',
118
+ 'CAD': 'Kanādas',
119
+ 'EEK': 'Igaunijas',
120
+ 'USD': 'ASV',
121
+ 'RUB': 'Kreivijas',
122
+ 'SEK': 'Zviedrijas',
123
+ 'NOK': 'Norvēģijas',
124
+ }
125
+
126
+ def setup(self):
127
+ self.negword = "mīnus"
128
+ self.pointword = "komats"
129
+
130
+ def to_cardinal(self, number):
131
+ n = str(number).replace(',', '.')
132
+ base_str, n = self.parse_minus(n)
133
+ if '.' in n:
134
+ left, right = n.split('.')
135
+ leading_zero_count = len(right) - len(right.lstrip('0'))
136
+ decimal_part = ((ZERO[0] + ' ') * leading_zero_count +
137
+ self._int2word(int(right)))
138
+ return '%s%s %s %s' % (
139
+ base_str,
140
+ self._int2word(int(left)),
141
+ self.pointword,
142
+ decimal_part
143
+ )
144
+ else:
145
+ return "%s%s" % (base_str, self._int2word(int(n)))
146
+
147
+ def pluralize(self, n, forms):
148
+ form = 0 if (n % 10 == 1 and n % 100 != 11) else 1 if n != 0 else 2
149
+ return forms[form]
150
+
151
+ def to_ordinal(self, number):
152
+ raise NotImplementedError()
153
+
154
+ def _int2word(self, n):
155
+ if n == 0:
156
+ return ZERO[0]
157
+
158
+ words = []
159
+ chunks = list(splitbyx(str(n), 3))
160
+ i = len(chunks)
161
+ for x in chunks:
162
+ i -= 1
163
+
164
+ if x == 0:
165
+ continue
166
+
167
+ n1, n2, n3 = get_digits(x)
168
+
169
+ if n3 > 0:
170
+ if n3 == 1 and n2 == 0 and n1 > 0:
171
+ words.append(HUNDRED[2])
172
+ elif n3 > 1:
173
+ words.append(ONES[n3][0])
174
+ words.append(HUNDRED[1])
175
+ else:
176
+ words.append(HUNDRED[0])
177
+
178
+ if n2 > 1:
179
+ words.append(TWENTIES[n2][0])
180
+
181
+ if n2 == 1:
182
+ words.append(TENS[n1][0])
183
+ elif n1 > 0 and not (i > 0 and x == 1):
184
+ words.append(ONES[n1][0])
185
+
186
+ if i > 0:
187
+ words.append(self.pluralize(x, THOUSANDS[i]))
188
+
189
+ return ' '.join(words)
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_NL.py ADDED
@@ -0,0 +1,158 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import print_function, unicode_literals
19
+
20
+ from .lang_EU import Num2Word_EU
21
+
22
+
23
+ class Num2Word_NL(Num2Word_EU):
24
+ CURRENCY_FORMS = {
25
+ 'EUR': (('euro', 'euro'), ('cent', 'cent')),
26
+ 'GBP': (('pond', 'pond'), ('penny', 'pence')),
27
+ 'USD': (('dollar', 'dollar'), ('cent', 'cent')),
28
+ 'CNY': (('yuan', 'yuan'), ('jiao', 'fen')),
29
+ }
30
+
31
+ GIGA_SUFFIX = "iljard"
32
+ MEGA_SUFFIX = "iljoen"
33
+
34
+ def setup(self):
35
+ super(Num2Word_NL, self).setup()
36
+
37
+ self.negword = "min "
38
+ self.pointword = "komma"
39
+ # "Cannot treat float %s as ordinal."
40
+ self.errmsg_floatord = (
41
+ "Het zwevende puntnummer %s kan niet omgezet worden " +
42
+ "naar een ordernummer."
43
+ )
44
+ # "type(((type(%s)) ) not in [long, int, float]"
45
+ self.errmsg_nonnum = (
46
+ "Alleen nummers (type (%s)) kunnen naar " +
47
+ "woorden omgezet worden."
48
+ )
49
+ # "Cannot treat negative num %s as ordinal."
50
+ self.errmsg_negord = (
51
+ "Het negatieve getal %s kan niet omgezet " +
52
+ "worden naar een ordernummer."
53
+ )
54
+ # "abs(%s) must be less than %s."
55
+ self.errmsg_toobig = "Het getal %s moet minder zijn dan %s."
56
+ self.exclude_title = []
57
+
58
+ lows = ["non", "okt", "sept", "sext", "quint", "quadr", "tr", "b", "m"]
59
+ units = ["", "un", "duo", "tre", "quattuor", "quin", "sex", "sept",
60
+ "okto", "novem"]
61
+ tens = ["dez", "vigint", "trigint", "quadragint", "quinquagint",
62
+ "sexagint", "septuagint", "oktogint", "nonagint"]
63
+
64
+ self.high_numwords = (
65
+ ["zend"] + self.gen_high_numwords(units, tens, lows))
66
+
67
+ self.mid_numwords = [(1000, "duizend"), (100, "honderd"),
68
+ (90, "negentig"), (80, "tachtig"),
69
+ (70, "zeventig"), (60, "zestig"),
70
+ (50, "vijftig"), (40, "veertig"),
71
+ (30, "dertig")]
72
+
73
+ self.low_numwords = ["twintig", "negentien", "achttien", "zeventien",
74
+ "zestien", "vijftien", "veertien", "dertien",
75
+ "twaalf", "elf", "tien", "negen", "acht", "zeven",
76
+ "zes", "vijf", "vier", "drie", "twee", "één",
77
+ "nul"]
78
+
79
+ # Wiktionary says it is "nulde", not "nulte" or "nule"
80
+ # https://en.wiktionary.org/wiki/nulde
81
+ self.ords = {"nul": "nuld",
82
+ "één": "eerst",
83
+ "twee": "tweed",
84
+ "drie": "derd",
85
+ "vier": "vierd",
86
+ "vijf": "vijfd",
87
+ "zes": "zesd",
88
+ "zeven": "zevend",
89
+ "acht": "achtst",
90
+ "negen": "negend",
91
+ "tien": "tiend",
92
+ "elf": "elfd",
93
+ "twaalf": "twaalfd",
94
+
95
+ "ig": "igst",
96
+ "erd": "erdst",
97
+ "end": "endst",
98
+ "joen": "joenst",
99
+ "rd": "rdst"}
100
+
101
+ def merge(self, curr, next):
102
+ ctext, cnum, ntext, nnum = curr + next
103
+
104
+ if cnum == 1:
105
+ if nnum < 10 ** 6:
106
+ return next
107
+ ctext = "een"
108
+
109
+ if nnum > cnum:
110
+ if nnum >= 10 ** 6:
111
+ ctext += " "
112
+ val = cnum * nnum
113
+ else:
114
+ if nnum < 10 < cnum < 100:
115
+ if nnum == 1:
116
+ ntext = "een"
117
+
118
+ if ntext.endswith("e"):
119
+ ntext += "ën" # "n"
120
+ else:
121
+ ntext += "en"
122
+ ntext, ctext = ctext, ntext # + "en"
123
+ elif cnum >= 10 ** 6:
124
+ ctext += " "
125
+ val = cnum + nnum
126
+
127
+ word = ctext + ntext
128
+ return word, val
129
+
130
+ def to_ordinal(self, value):
131
+ self.verify_ordinal(value)
132
+ outword = self.to_cardinal(value)
133
+ for key in self.ords:
134
+ if outword.endswith(key):
135
+ outword = outword[:len(outword) - len(key)] + self.ords[key]
136
+ break
137
+ return outword + "e"
138
+
139
+ def to_ordinal_num(self, value):
140
+ self.verify_ordinal(value)
141
+ return str(value) + "e"
142
+
143
+ def pluralize(self, n, forms):
144
+ """
145
+ :param n:
146
+ :param forms:
147
+ :return:
148
+
149
+ gettext form is nplurals=2; plural=(n != 1);
150
+ but this claims https://onzetaal.nl/taaladvies/euro-euros/
151
+ not sure if it's applied only to euro
152
+ """
153
+ return forms[0]
154
+
155
+ def to_year(self, val, longval=True):
156
+ if not (val // 100) % 10:
157
+ return self.to_cardinal(val)
158
+ return self.to_splitnum(val, hightxt="honderd", longval=longval)
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_NO.py ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import division, print_function, unicode_literals
19
+
20
+ from . import lang_EU
21
+
22
+
23
+ class Num2Word_NO(lang_EU.Num2Word_EU):
24
+ GIGA_SUFFIX = "illard"
25
+ MEGA_SUFFIX = "illion"
26
+ CURRENCY_FORMS = {'NOK': (('krone', 'kroner'), ('øre', 'øre'))}
27
+
28
+ def set_high_numwords(self, high):
29
+ cap = 3 + 6 * len(high)
30
+
31
+ for word, n in zip(high, range(cap, 3, -6)):
32
+ if self.GIGA_SUFFIX:
33
+ self.cards[10 ** n] = word + self.GIGA_SUFFIX
34
+
35
+ if self.MEGA_SUFFIX:
36
+ self.cards[10 ** (n - 3)] = word + self.MEGA_SUFFIX
37
+
38
+ def setup(self):
39
+ super(Num2Word_NO, self).setup()
40
+
41
+ self.negword = "minus "
42
+ self.pointword = "komma"
43
+ self.exclude_title = ["og", "komma", "minus"]
44
+
45
+ self.mid_numwords = [(1000, "tusen"), (100, "hundre"),
46
+ (90, "nitti"), (80, "\xe5tti"), (70, "sytti"),
47
+ (60, "seksti"), (50, "femti"), (40, "f\xf8rti"),
48
+ (30, "tretti")]
49
+ self.low_numwords = ["tjue", "nitten", "atten", "sytten",
50
+ "seksten", "femten", "fjorten", "tretten",
51
+ "tolv", "elleve", "ti", "ni", "\xe5tte",
52
+ "syv", "seks", "fem", "fire", "tre", "to",
53
+ "en", "null"]
54
+ self.ords_pl = {"to": "andre",
55
+ "tre": "tredje",
56
+ "fire": "fjerde",
57
+ "fem": "femte",
58
+ "seks": "sjette",
59
+ "syv": "syvende",
60
+ "\xe5tte": "\xe5ttende",
61
+ "ni": "niende",
62
+ "ti": "tiende",
63
+ "elleve": "ellevte",
64
+ "tolv": "tolvte",
65
+ "fjorten": "fjortende",
66
+ "femten": "femtende",
67
+ "seksten": "sekstende",
68
+ "sytten": "syttende",
69
+ "atten": "attende",
70
+ "nitten": "nittende",
71
+ "tjue": "tjuende",
72
+ "hundre": "hundrede",
73
+ "tusen": "tusende",
74
+ "million": "millionte"}
75
+ # this needs to be done separately to not block 13-19 to_ordinal
76
+ self.ords_sg = {"en": "f\xf8rste"}
77
+
78
+ def merge(self, lpair, rpair):
79
+ ltext, lnum = lpair
80
+ rtext, rnum = rpair
81
+ if lnum == 1 and rnum < 100:
82
+ return (rtext, rnum)
83
+ elif 100 > lnum > rnum:
84
+ return ("%s%s" % (ltext, rtext), lnum + rnum)
85
+ elif lnum >= 100 > rnum:
86
+ return ("%s og %s" % (ltext, rtext), lnum + rnum)
87
+ elif rnum > lnum:
88
+ return ("%s %s" % (ltext, rtext), lnum * rnum)
89
+ return ("%s %s" % (ltext, rtext), lnum + rnum)
90
+
91
+ def to_ordinal(self, value):
92
+ self.verify_ordinal(value)
93
+ outword = self.to_cardinal(value)
94
+ for key in self.ords_pl:
95
+ if outword.endswith(key):
96
+ outword = outword[:len(outword) - len(key)] + self.ords_pl[key]
97
+ break
98
+ for key in self.ords_sg:
99
+ if outword.endswith(key):
100
+ outword = outword[:len(outword) - len(key)] + self.ords_sg[key]
101
+ break
102
+ return outword
103
+
104
+ def to_ordinal_num(self, value):
105
+ self.verify_ordinal(value)
106
+ return str(value) + "."
107
+
108
+ def to_year(self, val, longval=True):
109
+ if not (val // 100) % 10:
110
+ return self.to_cardinal(val)
111
+ return self.to_splitnum(val, hightxt="hundre", jointxt="og",
112
+ longval=longval)
113
+
114
+ def to_currency(self, val, currency='NOK', cents=True, separator=' og',
115
+ adjective=False):
116
+ result = super(Num2Word_NO, self).to_currency(
117
+ val, currency=currency, cents=cents, separator=separator,
118
+ adjective=adjective)
119
+
120
+ # do not print "og null øre"
121
+ result = result.replace(' og null øre', '')
122
+ return result
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_PL.py ADDED
@@ -0,0 +1,272 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import unicode_literals
19
+
20
+ import itertools
21
+
22
+ from .base import Num2Word_Base
23
+ from .utils import get_digits, splitbyx
24
+
25
+ ZERO = ('zero',)
26
+
27
+ ONES = {
28
+ 1: ('jeden',),
29
+ 2: ('dwa',),
30
+ 3: ('trzy',),
31
+ 4: ('cztery',),
32
+ 5: ('pięć',),
33
+ 6: ('sześć',),
34
+ 7: ('siedem',),
35
+ 8: ('osiem',),
36
+ 9: ('dziewięć',),
37
+ }
38
+
39
+ ONES_ORDINALS = {
40
+ 1: ('pierwszy', "pierwszo"),
41
+ 2: ('drugi', "dwu"),
42
+ 3: ('trzeci', "trzy"),
43
+ 4: ('czwarty', "cztero"),
44
+ 5: ('piąty', "pięcio"),
45
+ 6: ('szósty', "sześcio"),
46
+ 7: ('siódmy', "siedmio"),
47
+ 8: ('ósmy', "ośmio"),
48
+ 9: ('dziewiąty', "dziewięcio"),
49
+ 10: ('dziesiąty', "dziesięcio"),
50
+ 11: ('jedenasty', "jedenasto"),
51
+ 12: ('dwunasty', "dwunasto"),
52
+ 13: ('trzynasty', "trzynasto"),
53
+ 14: ('czternasty', "czternasto"),
54
+ 15: ('piętnasty', "piętnasto"),
55
+ 16: ('szesnasty', "szesnasto"),
56
+ 17: ('siedemnasty', "siedemnasto"),
57
+ 18: ('osiemnasty', "osiemnasto"),
58
+ 19: ('dziewiętnasty', "dziewiętnasto"),
59
+ }
60
+
61
+ TENS = {
62
+ 0: ('dziesięć',),
63
+ 1: ('jedenaście',),
64
+ 2: ('dwanaście',),
65
+ 3: ('trzynaście',),
66
+ 4: ('czternaście',),
67
+ 5: ('piętnaście',),
68
+ 6: ('szesnaście',),
69
+ 7: ('siedemnaście',),
70
+ 8: ('osiemnaście',),
71
+ 9: ('dziewiętnaście',),
72
+ }
73
+
74
+
75
+ TWENTIES = {
76
+ 2: ('dwadzieścia',),
77
+ 3: ('trzydzieści',),
78
+ 4: ('czterdzieści',),
79
+ 5: ('pięćdziesiąt',),
80
+ 6: ('sześćdziesiąt',),
81
+ 7: ('siedemdziesiąt',),
82
+ 8: ('osiemdziesiąt',),
83
+ 9: ('dziewięćdziesiąt',),
84
+ }
85
+
86
+ TWENTIES_ORDINALS = {
87
+ 2: ('dwudziesty', "dwudziesto"),
88
+ 3: ('trzydziesty', "trzydiesto"),
89
+ 4: ('czterdziesty', "czterdziesto"),
90
+ 5: ('pięćdziesiąty', "pięćdziesięcio"),
91
+ 6: ('sześćdziesiąty', "sześćdziesięcio"),
92
+ 7: ('siedemdziesiąty', "siedemdziesięcio"),
93
+ 8: ('osiemdziesiąty', "osiemdziesięcio"),
94
+ 9: ('dziewięćdziesiąty', "dziewięćdziesięcio"),
95
+ }
96
+
97
+ HUNDREDS = {
98
+ 1: ('sto',),
99
+ 2: ('dwieście',),
100
+ 3: ('trzysta',),
101
+ 4: ('czterysta',),
102
+ 5: ('pięćset',),
103
+ 6: ('sześćset',),
104
+ 7: ('siedemset',),
105
+ 8: ('osiemset',),
106
+ 9: ('dziewięćset',),
107
+ }
108
+
109
+ HUNDREDS_ORDINALS = {
110
+ 1: ('setny', "stu"),
111
+ 2: ('dwusetny', "dwustu"),
112
+ 3: ('trzysetny', "trzystu"),
113
+ 4: ('czterysetny', "czterystu"),
114
+ 5: ('pięćsetny', "pięcset"),
115
+ 6: ('sześćsetny', "sześćset"),
116
+ 7: ('siedemsetny', "siedemset"),
117
+ 8: ('osiemsetny', "ośiemset"),
118
+ 9: ('dziewięćsetny', "dziewięćset"),
119
+ }
120
+
121
+ THOUSANDS = {
122
+ 1: ('tysiąc', 'tysiące', 'tysięcy'), # 10^3
123
+ }
124
+
125
+ prefixes_ordinal = {
126
+ 1: "tysięczny",
127
+ 2: "milionowy",
128
+ 3: "milairdowy"
129
+ }
130
+
131
+ prefixes = ( # 10^(6*x)
132
+ "mi", # 10^6
133
+ "bi", # 10^12
134
+ "try", # 10^18
135
+ "kwadry", # 10^24
136
+ "kwinty", # 10^30
137
+ "seksty", # 10^36
138
+ "septy", # 10^42
139
+ "okty", # 10^48
140
+ "nony", # 10^54
141
+ "decy" # 10^60
142
+ )
143
+ suffixes = ("lion", "liard") # 10^x or 10^(x+3)
144
+
145
+ for idx, (p, s) in enumerate(itertools.product(prefixes, suffixes)):
146
+ name = p + s
147
+ THOUSANDS[idx+2] = (name, name + 'y', name + 'ów')
148
+
149
+
150
+ class Num2Word_PL(Num2Word_Base):
151
+ CURRENCY_FORMS = {
152
+ 'PLN': (
153
+ ('złoty', 'złote', 'złotych'), ('grosz', 'grosze', 'groszy')
154
+ ),
155
+ 'EUR': (
156
+ ('euro', 'euro', 'euro'), ('cent', 'centy', 'centów')
157
+ ),
158
+ 'USD': (
159
+ (
160
+ 'dolar amerykański',
161
+ 'dolary amerykańskie',
162
+ 'dolarów amerykańskich'
163
+ ),
164
+ (
165
+ 'cent',
166
+ 'centy',
167
+ 'centów'
168
+ )
169
+ ),
170
+ }
171
+
172
+ def setup(self):
173
+ self.negword = "minus"
174
+ self.pointword = "przecinek"
175
+
176
+ def to_cardinal(self, number):
177
+ n = str(number).replace(',', '.')
178
+ if '.' in n:
179
+ left, right = n.split('.')
180
+ leading_zero_count = len(right) - len(right.lstrip('0'))
181
+ decimal_part = ((ZERO[0] + ' ') * leading_zero_count +
182
+ self._int2word(int(right)))
183
+ return u'%s %s %s' % (
184
+ self._int2word(int(left)),
185
+ self.pointword,
186
+ decimal_part
187
+ )
188
+ else:
189
+ return self._int2word(int(n))
190
+
191
+ def pluralize(self, n, forms):
192
+ if n == 1:
193
+ form = 0
194
+ elif 5 > n % 10 > 1 and (n % 100 < 10 or n % 100 > 20):
195
+ form = 1
196
+ else:
197
+ form = 2
198
+ return forms[form]
199
+
200
+ def last_fragment_to_ordinal(self, last, words, level):
201
+ n1, n2, n3 = get_digits(last)
202
+ last_two = n2*10+n1
203
+ if last_two == 0:
204
+ words.append(HUNDREDS_ORDINALS[n3][level])
205
+ elif level == 1 and last == 1:
206
+ return
207
+ elif last_two < 20:
208
+ if n3 > 0:
209
+ words.append(HUNDREDS[n3][level])
210
+ words.append(ONES_ORDINALS[last_two][level])
211
+ elif last_two % 10 == 0:
212
+ if n3 > 0:
213
+ words.append(HUNDREDS[n3][level])
214
+ words.append(TWENTIES_ORDINALS[n2][level])
215
+ else:
216
+ if n3 > 0:
217
+ words.append(HUNDREDS[n3][0])
218
+ words.append(TWENTIES_ORDINALS[n2][0])
219
+ words.append(ONES_ORDINALS[n1][0])
220
+
221
+ def to_ordinal(self, number):
222
+ if number % 1 != 0:
223
+ raise NotImplementedError()
224
+ words = []
225
+ fragments = list(splitbyx(str(number), 3))
226
+ level = 0
227
+ last = fragments[-1]
228
+ while last == 0:
229
+ level = level+1
230
+ fragments.pop()
231
+ last = fragments[-1]
232
+ if len(fragments) > 1:
233
+ pre_part = self._int2word(number-(last*1000**level))
234
+ words.append(pre_part)
235
+ self.last_fragment_to_ordinal(last, words, 0 if level == 0 else 1)
236
+ output = " ".join(words)
237
+ if last == 1 and level > 0 and output != "":
238
+ output = output + " "
239
+ if level > 0:
240
+ output = output + prefixes_ordinal[level]
241
+ return output
242
+
243
+ def _int2word(self, n):
244
+ if n == 0:
245
+ return ZERO[0]
246
+
247
+ words = []
248
+ chunks = list(splitbyx(str(n), 3))
249
+ i = len(chunks)
250
+ for x in chunks:
251
+ i -= 1
252
+
253
+ if x == 0:
254
+ continue
255
+
256
+ n1, n2, n3 = get_digits(x)
257
+
258
+ if n3 > 0:
259
+ words.append(HUNDREDS[n3][0])
260
+
261
+ if n2 > 1:
262
+ words.append(TWENTIES[n2][0])
263
+
264
+ if n2 == 1:
265
+ words.append(TENS[n1][0])
266
+ elif n1 > 0 and not (i > 0 and x == 1):
267
+ words.append(ONES[n1][0])
268
+
269
+ if i > 0:
270
+ words.append(self.pluralize(x, THOUSANDS[i]))
271
+
272
+ return ' '.join(words)
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_PT.py ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import division, unicode_literals
19
+
20
+ import re
21
+
22
+ from .lang_EU import Num2Word_EU
23
+
24
+ DOLLAR = ('dólar', 'dólares')
25
+ CENTS = ('cêntimo', 'cêntimos')
26
+
27
+
28
+ class Num2Word_PT(Num2Word_EU):
29
+
30
+ CURRENCY_FORMS = {
31
+ 'AUD': (DOLLAR, CENTS),
32
+ 'CAD': (DOLLAR, CENTS),
33
+ 'EUR': (('euro', 'euros'), CENTS),
34
+ 'GBP': (('libra', 'libras'), ('péni', 'pence')),
35
+ 'USD': (DOLLAR, CENTS),
36
+ }
37
+
38
+ GIGA_SUFFIX = None
39
+ MEGA_SUFFIX = "ilião"
40
+
41
+ def setup(self):
42
+ super(Num2Word_PT, self).setup()
43
+ lows = ["quatr", "tr", "b", "m"]
44
+ self.high_numwords = self.gen_high_numwords([], [], lows)
45
+ self.negword = "menos "
46
+ self.pointword = "vírgula"
47
+ self.exclude_title = ["e", "vírgula", "menos"]
48
+
49
+ self.mid_numwords = [
50
+ (1000, "mil"), (100, "cem"), (90, "noventa"),
51
+ (80, "oitenta"), (70, "setenta"), (60, "sessenta"),
52
+ (50, "cinquenta"), (40, "quarenta"), (30, "trinta")
53
+ ]
54
+ self.low_numwords = [
55
+ "vinte", "dezanove", "dezoito", "dezassete", "dezasseis",
56
+ "quinze", "catorze", "treze", "doze", "onze", "dez",
57
+ "nove", "oito", "sete", "seis", "cinco", "quatro", "três", "dois",
58
+ "um", "zero"
59
+ ]
60
+ self.ords = [
61
+ {
62
+ 0: "",
63
+ 1: "primeiro",
64
+ 2: "segundo",
65
+ 3: "terceiro",
66
+ 4: "quarto",
67
+ 5: "quinto",
68
+ 6: "sexto",
69
+ 7: "sétimo",
70
+ 8: "oitavo",
71
+ 9: "nono",
72
+ },
73
+ {
74
+ 0: "",
75
+ 1: "décimo",
76
+ 2: "vigésimo",
77
+ 3: "trigésimo",
78
+ 4: "quadragésimo",
79
+ 5: "quinquagésimo",
80
+ 6: "sexagésimo",
81
+ 7: "septuagésimo",
82
+ 8: "octogésimo",
83
+ 9: "nonagésimo",
84
+ },
85
+ {
86
+ 0: "",
87
+ 1: "centésimo",
88
+ 2: "ducentésimo",
89
+ 3: "tricentésimo",
90
+ 4: "quadrigentésimo",
91
+ 5: "quingentésimo",
92
+ 6: "seiscentésimo",
93
+ 7: "septigentésimo",
94
+ 8: "octigentésimo",
95
+ 9: "nongentésimo",
96
+ },
97
+ ]
98
+ self.thousand_separators = {
99
+ 3: "milésimo",
100
+ 6: "milionésimo",
101
+ 9: "milésimo milionésimo",
102
+ 12: "bilionésimo",
103
+ 15: "milésimo bilionésimo"
104
+ }
105
+ self.hundreds = {
106
+ 1: "cento",
107
+ 2: "duzentos",
108
+ 3: "trezentos",
109
+ 4: "quatrocentos",
110
+ 5: "quinhentos",
111
+ 6: "seiscentos",
112
+ 7: "setecentos",
113
+ 8: "oitocentos",
114
+ 9: "novecentos",
115
+ }
116
+
117
+ def merge(self, curr, next):
118
+ ctext, cnum, ntext, nnum = curr + next
119
+
120
+ if cnum == 1:
121
+ if nnum < 1000000:
122
+ return next
123
+ ctext = "um"
124
+ elif cnum == 100 and not nnum % 1000 == 0:
125
+ ctext = "cento"
126
+
127
+ if nnum < cnum:
128
+ if cnum < 100:
129
+ return ("%s e %s" % (ctext, ntext), cnum + nnum)
130
+ return ("%s e %s" % (ctext, ntext), cnum + nnum)
131
+
132
+ elif (not nnum % 1000000000) and cnum > 1:
133
+ ntext = ntext[:-4] + "liões"
134
+ elif (not nnum % 1000000) and cnum > 1:
135
+ ntext = ntext[:-4] + "lhões"
136
+ # correct "milião" to "milhão"
137
+ if ntext == 'milião':
138
+ ntext = 'milhão'
139
+ if nnum == 100:
140
+ ctext = self.hundreds[cnum]
141
+ ntext = ""
142
+
143
+ else:
144
+ ntext = " " + ntext
145
+
146
+ return (ctext + ntext, cnum * nnum)
147
+
148
+ def to_cardinal(self, value):
149
+ result = super(Num2Word_PT, self).to_cardinal(value)
150
+
151
+ # Transforms "mil e cento e catorze" into "mil cento e catorze"
152
+ # Transforms "cem milhões e duzentos mil e duzentos e dez" em "cem
153
+ # milhões duzentos mil duzentos e dez" but "cem milhões e duzentos
154
+ # mil e duzentos" in "cem milhões duzentos mil e duzentos" and not in
155
+ # "cem milhões duzentos mil duzentos"
156
+ for ext in (
157
+ 'mil', 'milhão', 'milhões', 'mil milhões',
158
+ 'bilião', 'biliões', 'mil biliões'):
159
+ if re.match('.*{} e \\w*entos? (?=.*e)'.format(ext), result):
160
+ result = result.replace(
161
+ '{} e'.format(ext), '{}'.format(ext)
162
+ )
163
+
164
+ return result
165
+
166
+ # for the ordinal conversion the code is similar to pt_BR code,
167
+ # although there are other rules that are probably more correct in
168
+ # Portugal. Concerning numbers from 2000th on, saying "dois
169
+ # milésimos" instead of "segundo milésimo" (the first number
170
+ # would be used in the cardinal form instead of the ordinal) is better.
171
+ # This was not implemented.
172
+ # source:
173
+ # https://ciberduvidas.iscte-iul.pt/consultorio/perguntas/a-forma-por-extenso-de-2000-e-de-outros-ordinais/16428
174
+ def to_ordinal(self, value):
175
+ # Before changing this function remember this is used by pt-BR
176
+ # so act accordingly
177
+ self.verify_ordinal(value)
178
+
179
+ result = []
180
+ value = str(value)
181
+ thousand_separator = ''
182
+
183
+ for idx, char in enumerate(value[::-1]):
184
+ if idx and idx % 3 == 0:
185
+ thousand_separator = self.thousand_separators[idx]
186
+
187
+ if char != '0' and thousand_separator:
188
+ # avoiding "segundo milionésimo milésimo" for 6000000,
189
+ # for instance
190
+ result.append(thousand_separator)
191
+ thousand_separator = ''
192
+
193
+ result.append(self.ords[idx % 3][int(char)])
194
+
195
+ result = ' '.join(result[::-1])
196
+ result = result.strip()
197
+ result = re.sub('\\s+', ' ', result)
198
+
199
+ if result.startswith('primeiro') and value != '1':
200
+ # avoiding "primeiro milésimo", "primeiro milionésimo" and so on
201
+ result = result[9:]
202
+
203
+ return result
204
+
205
+ def to_ordinal_num(self, value):
206
+ # Before changing this function remember this is used by pt-BR
207
+ # so act accordingly
208
+ self.verify_ordinal(value)
209
+ return "%sº" % (value)
210
+
211
+ def to_year(self, val, longval=True):
212
+ # Before changing this function remember this is used by pt-BR
213
+ # so act accordingly
214
+ if val < 0:
215
+ return self.to_cardinal(abs(val)) + ' antes de Cristo'
216
+ return self.to_cardinal(val)
217
+
218
+ def to_currency(self, val, currency='EUR', cents=True, separator=' e',
219
+ adjective=False):
220
+ # change negword because base.to_currency() does not need space after
221
+ backup_negword = self.negword
222
+ self.negword = self.negword[:-1]
223
+ result = super(Num2Word_PT, self).to_currency(
224
+ val, currency=currency, cents=cents, separator=separator,
225
+ adjective=adjective)
226
+ # undo the change on negword
227
+ self.negword = backup_negword
228
+
229
+ # transforms "milhões euros" em "milhões de euros"
230
+ cr1, _ = self.CURRENCY_FORMS[currency]
231
+
232
+ for ext in (
233
+ 'milhão', 'milhões', 'bilião',
234
+ 'biliões', 'trilião', 'triliões'):
235
+ if re.match('.*{} (?={})'.format(ext, cr1[1]), result):
236
+ result = result.replace(
237
+ '{}'.format(ext), '{} de'.format(ext), 1
238
+ )
239
+ # do not print "e zero cêntimos"
240
+ result = result.replace(' e zero cêntimos', '')
241
+ return result
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_PT_BR.py ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+ from __future__ import division, unicode_literals
18
+
19
+ import re
20
+
21
+ from . import lang_PT
22
+
23
+
24
+ class Num2Word_PT_BR(lang_PT.Num2Word_PT):
25
+ def set_high_numwords(self, high):
26
+ max = 3 + 3*len(high)
27
+ for word, n in zip(high, range(max, 3, -3)):
28
+ self.cards[10**n] = word + "ilhão"
29
+
30
+ def setup(self):
31
+ super(Num2Word_PT_BR, self).setup()
32
+
33
+ self.low_numwords[1] = 'dezenove'
34
+ self.low_numwords[3] = 'dezessete'
35
+ self.low_numwords[4] = 'dezesseis'
36
+
37
+ self.thousand_separators = {
38
+ 3: "milésimo",
39
+ 6: "milionésimo",
40
+ 9: "bilionésimo",
41
+ 12: "trilionésimo",
42
+ 15: "quadrilionésimo"
43
+ }
44
+
45
+ def merge(self, curr, next):
46
+ ctext, cnum, ntext, nnum = curr + next
47
+
48
+ if cnum == 1:
49
+ if nnum < 1000000:
50
+ return next
51
+ ctext = "um"
52
+ elif cnum == 100 and nnum % 1000 != 0:
53
+ ctext = "cento"
54
+
55
+ if nnum < cnum:
56
+ if cnum < 100:
57
+ return ("%s e %s" % (ctext, ntext), cnum + nnum)
58
+ return ("%s e %s" % (ctext, ntext), cnum + nnum)
59
+
60
+ elif (not nnum % 1000000) and cnum > 1:
61
+ ntext = ntext[:-4] + "lhões"
62
+
63
+ if nnum == 100:
64
+ ctext = self.hundreds[cnum]
65
+ ntext = ""
66
+
67
+ else:
68
+ ntext = " " + ntext
69
+
70
+ return (ctext + ntext, cnum * nnum)
71
+
72
+ def to_cardinal(self, value):
73
+ result = lang_PT.Num2Word_EU.to_cardinal(self, value)
74
+
75
+ # Transforms "mil E cento e catorze reais" into "mil, cento e catorze
76
+ # reais"
77
+ for ext in (
78
+ 'mil', 'milhão', 'milhões', 'bilhão', 'bilhões',
79
+ 'trilhão', 'trilhões', 'quatrilhão', 'quatrilhões'):
80
+ if re.match('.*{} e \\w*entos? (?=.*e)'.format(ext), result):
81
+ result = result.replace(
82
+ '{} e'.format(ext), '{},'.format(ext), 1
83
+ )
84
+
85
+ return result
86
+
87
+ def to_currency(self, val, longval=True):
88
+ integer_part, decimal_part = ('%.2f' % val).split('.')
89
+
90
+ result = self.to_cardinal(int(integer_part))
91
+
92
+ appended_currency = False
93
+ for ext in (
94
+ 'milhão', 'milhões', 'bilhão', 'bilhões',
95
+ 'trilhão', 'trilhões', 'quatrilhão', 'quatrilhões'):
96
+ if result.endswith(ext):
97
+ result += ' de reais'
98
+ appended_currency = True
99
+
100
+ if result in ['um', 'menos um']:
101
+ result += ' real'
102
+ appended_currency = True
103
+ if not appended_currency:
104
+ result += ' reais'
105
+
106
+ if int(decimal_part):
107
+ cents = self.to_cardinal(int(decimal_part))
108
+ result += ' e ' + cents
109
+
110
+ if cents == 'um':
111
+ result += ' centavo'
112
+ else:
113
+ result += ' centavos'
114
+
115
+ return result
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_RO.py ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import division, print_function, unicode_literals
19
+
20
+ from . import lang_EU
21
+
22
+
23
+ class Num2Word_RO(lang_EU.Num2Word_EU):
24
+ GIGA_SUFFIX = "iliard/e"
25
+ MEGA_SUFFIX = "ilion"
26
+ # inflection for mi/billion follows different rule
27
+ MEGA_SUFFIX_I = "ilioane"
28
+ GIGA_SUFFIX_I = "iliarde"
29
+
30
+ def setup(self):
31
+ super(Num2Word_RO, self).setup()
32
+
33
+ self.negword = "minus "
34
+ self.pointword = "virgulă"
35
+ self.exclude_title = ["și", "virgulă", "minus"]
36
+ self.errmsg_toobig = (
37
+ "Numărul e prea mare pentru a \
38
+ fi convertit în cuvinte (abs(%s) > %s)."
39
+ )
40
+ self.mid_numwords = [(1000, "mie/i"), (100, "sută/e"),
41
+ (90, "nouăzeci"), (80, "optzeci"),
42
+ (70, "șaptezeci"), (60, "șaizeci"),
43
+ (50, "cincizeci"), (40, "patruzeci"),
44
+ (30, "treizeci")]
45
+ self.low_numwords = ["douăzeci", "nouăsprezece", "optsprezece",
46
+ "șaptesprezece", "șaisprezece", "cincisprezece",
47
+ "paisprezece", "treisprezece", "doisprezece",
48
+ "unsprezece", "zece", "nouă", "opt", "șapte",
49
+ "șase", "cinci", "patru", "trei", "doi",
50
+ "unu", "zero"]
51
+ self.gen_numwords = ["", "o", "două", "trei", "patru", "cinci",
52
+ "șase", "șapte", "opt", "nouă"]
53
+ self.gen_numwords_n = ["", "un", "două", "trei", "patru", "cinci",
54
+ "șase", "șapte", "opt", "nouă"]
55
+ self.numwords_inflections = {
56
+ 100: self.gen_numwords,
57
+ 1000: self.gen_numwords,
58
+ 1000000: self.gen_numwords_n,
59
+ 1000000000: self.gen_numwords_n
60
+ }
61
+ self.ords = {"unu": "primul",
62
+ "doi": "al doilea",
63
+ "three": "al treilea",
64
+ "cinci": "al cincilea",
65
+ "opt": "al optulea",
66
+ "nouă": "al nouălea",
67
+ "doisprezece": "al doisprezecelea"}
68
+
69
+ def merge(self, lpair, rpair):
70
+ ltext, lnum = lpair
71
+ rtext, rnum = rpair
72
+ rtext_i = self.inflect(rnum, rtext, lnum)
73
+ if 1 <= lnum < 10:
74
+ if rnum not in self.numwords_inflections:
75
+ return (rtext, rnum)
76
+ else:
77
+ rtext_i = self.inflect(lnum * rnum, rtext, lnum)
78
+ lresult = (self.numwords_inflections[rnum][lnum], rtext_i)
79
+ return ("%s %s" % lresult, rnum)
80
+ elif 10 < lnum < 100:
81
+ if lnum % 10 == 0:
82
+ if rnum in self.numwords_inflections:
83
+ rtext_i = self.inflect(lnum * rnum, rtext, lnum)
84
+ return ("%s %s" % (ltext, rtext_i), lnum * rnum)
85
+ else:
86
+ return ("%s și %s" % (ltext, rtext), lnum + rnum)
87
+ else:
88
+ rtext_i = self.inflect(lnum * rnum, rtext, lnum)
89
+ ltext_i = ltext if lnum % 10 != 2 \
90
+ else ltext.replace("doi", "două")
91
+ return ("%s %s" % (ltext_i, rtext_i), lnum * rnum)
92
+ else:
93
+ if rnum in self.numwords_inflections:
94
+ rtext_i = self.inflect(lnum * rnum, rtext, lnum)
95
+ return ("%s %s" % (ltext, rtext_i), lnum * rnum)
96
+
97
+ def to_ordinal(self, value):
98
+ self.verify_ordinal(value)
99
+ if value == 1:
100
+ return "primul"
101
+ else:
102
+ value = self.to_cardinal(value)
103
+ return "al %slea" % (value)
104
+
105
+ def to_ordinal_num(self, value):
106
+ self.verify_ordinal(value)
107
+ if value == 1:
108
+ return "1-ul"
109
+ return "al %s-lea" % (value)
110
+
111
+ def pluralize(self, n, forms):
112
+ if n == 1:
113
+ form = 0
114
+ elif n == 0 or (n % 100 > 0 and n % 100 < 20):
115
+ form = 1
116
+ else:
117
+ form = 2
118
+ return forms[form]
119
+
120
+ def inflect(self, value, text, side_effect=-1):
121
+ text = text.split("/")
122
+ result = text[0]
123
+ if len(text) > 1:
124
+ forms = [
125
+ text[0],
126
+ text[0][:-1] + text[1],
127
+ "de " + text[0][:-1] + text[1]
128
+ ]
129
+ result = self.pluralize(side_effect, forms)
130
+ # mega inflections are different
131
+ if side_effect > 1 and result.endswith(self.MEGA_SUFFIX):
132
+ result = result.replace(self.MEGA_SUFFIX, self.MEGA_SUFFIX_I)
133
+ elif side_effect > 1 and result.endswith("iliare"):
134
+ result = result.replace("iliare", self.GIGA_SUFFIX_I)
135
+ return result
136
+
137
+ def to_currency(self, val, currency="RON", cents=False, separator=" și",
138
+ adjective=False):
139
+ # romanian currency has a particularity for numeral: one
140
+ self.gen_numwords[1] = "una"
141
+ result = super(Num2Word_RO, self).to_currency(
142
+ int(round(val*100)),
143
+ currency,
144
+ True,
145
+ separator,
146
+ adjective
147
+ )
148
+ self.gen_numwords[1] = "o" # revert numeral
149
+ return result.replace(
150
+ "unu leu", "un leu"
151
+ ).replace(
152
+ "unu ban", "un ban"
153
+ ).replace(
154
+ # if the romanian low text is 0, it is not usually printed
155
+ separator + " zero bani", ""
156
+ )
157
+
158
+ def to_year(self, val, suffix=None, longval=True):
159
+ result = super(Num2Word_RO, self).to_year(
160
+ val,
161
+ longval=longval
162
+ )
163
+ # for years we want the era negation e.g. B.C., in our case
164
+ # it's î.Hr. or î.e.n
165
+ if result.startswith(self.negword):
166
+ result = result.replace(self.negword, "")
167
+ suffix = "î.Hr." if not suffix else suffix
168
+ if suffix:
169
+ result = "".join([
170
+ result,
171
+ " ",
172
+ suffix
173
+ ])
174
+ return result
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_RU.py ADDED
@@ -0,0 +1,501 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import unicode_literals
19
+
20
+ from .base import Num2Word_Base
21
+ from .utils import get_digits, splitbyx
22
+
23
+ GENDER_PLURAL_INDEXES = {
24
+ 'm': 0, 'masculine': 0, 'м': 0, 'мужской': 0,
25
+ 'f': 1, 'feminine': 1, 'ж': 0, 'женский': 0,
26
+ 'n': 2, 'neuter': 2, 'с': 0, 'средний': 0,
27
+ 'p': 3, 'plural': 3
28
+ }
29
+ CASE_INDEXES = {
30
+ 'n': 0, 'nominative': 0, 'и': 0, 'именительный': 0,
31
+ 'g': 1, 'genitive': 1, 'р': 1, 'родительный': 1,
32
+ 'd': 2, 'dative': 2, 'д': 2, 'дательный': 2,
33
+ 'a': 3, 'accusative': 3, 'в': 3, 'винительный': 3,
34
+ 'i': 4, 'instrumental': 4, 'т': 4, 'творительный': 4,
35
+ 'p': 5, 'prepositional': 5, 'п': 5, 'предложный': 5
36
+ }
37
+ # Default values
38
+ D_CASE = 'n'
39
+ D_PLURAL = False
40
+ D_GENDER = 'm'
41
+ D_ANIMATE = True
42
+
43
+
44
+ def get_num_element(cases_dict, num, **kwargs):
45
+ return case_classifier_element(cases_dict[num], **kwargs)
46
+
47
+
48
+ def case_classifier_element(classifier, case=D_CASE, plural=D_PLURAL,
49
+ gender=D_GENDER, animate=D_ANIMATE):
50
+ case = classifier[CASE_INDEXES[case]]
51
+ if isinstance(case, str):
52
+ return case
53
+
54
+ if plural:
55
+ gender = case[GENDER_PLURAL_INDEXES['plural']]
56
+ else:
57
+ gender = case[GENDER_PLURAL_INDEXES[gender]]
58
+ if isinstance(gender, str):
59
+ return gender
60
+
61
+ if animate:
62
+ return gender[0]
63
+ return gender[1]
64
+
65
+
66
+ # format:
67
+ # {n : [case_1 .. case_5]}
68
+ # case: text or [gender_1 .. gender_3 plural_4]
69
+ # gender: text or [animate, inanimate]
70
+ ONES = {
71
+ 0: ['ноль', 'ноля', 'нолю', 'ноль', 'нолём', 'ноле'],
72
+ 1: [['один', 'одна', 'одно', 'одни'],
73
+ ['одного', 'одной', 'одного', 'одних'],
74
+ ['одному', 'одной', 'одному', 'одним'],
75
+ [['одного', 'один'], 'одну', 'одно', ['одних', 'одни']],
76
+ ['одним', 'одной', 'одним', 'одними'],
77
+ ['одном', 'одной', 'одном', 'одних']],
78
+ 2: [['два', 'две', 'два', 'двое'],
79
+ ['двух'] * 3 + ['двоих'],
80
+ ['двум'] * 3 + ['двоим'],
81
+ [['двух', 'два'], ['двух', 'две'], 'два', 'двоих'],
82
+ ['двумя'] * 3 + ['двоими'],
83
+ ['двух'] * 3 + ['двоих']],
84
+ 3: [['три'] * 3 + ['трое'],
85
+ ['трёх'] * 3 + ['троих'],
86
+ ['трём'] * 3 + ['троим'],
87
+ [['трёх', 'три'], ['трёх', 'три'], 'три', 'троих'],
88
+ ['тремя'] * 3 + ['троими'],
89
+ ['трёх'] * 3 + ['троих']],
90
+ 4: [['четыре'] * 3 + ['четверо'],
91
+ ['четырёх'] * 3 + ['четверых'],
92
+ ['четырём'] * 3 + ['четверым'],
93
+ [['четырёх', 'четыре'], ['четырёх', 'четыре'], 'четыре', 'четверых'],
94
+ ['четырьмя'] * 3 + ['четверыми'],
95
+ ['четырёх'] * 3 + ['четверых']],
96
+ 5: ['пять', 'пяти', 'пяти', 'пять', 'пятью', 'пяти'],
97
+ 6: ['шесть', 'шести', 'шести', 'шесть', 'шестью', 'шести'],
98
+ 7: ['семь', 'семи', 'семи', 'семь', 'семью', 'семи'],
99
+ 8: ['восемь', 'восьми', 'восьми', 'восемь', 'восемью', 'восьми'],
100
+ 9: ['девять', 'девяти', 'девяти', 'девять', 'девятью', 'девяти']
101
+ }
102
+
103
+ ONES_ORD_PREFIXES = {0: 'нулев', 1: 'перв', 2: 'втор', 4: 'четвёрт', 5: 'пят',
104
+ 6: 'шест', 7: 'седьм', 8: 'восьм', 9: 'девят'}
105
+ ONES_ORD_POSTFIXES_GROUPS = {0: 0, 1: 1, 2: 0, 4: 1, 5: 1, 6: 0, 7: 0, 8: 0,
106
+ 9: 1}
107
+ CASE_POSTFIXES = [[{0: 'ой', 1: 'ый'}, 'ая', 'ое', 'ые'],
108
+ ['ого', 'ой', 'ого', 'ых'],
109
+ ['ому', 'ой', 'ому', 'ым'],
110
+ [['ого', {0: 'ой', 1: 'ый'}], 'ую', 'ое', ['ых', 'ые']],
111
+ ['ым', 'ой', 'ым', 'ыми'],
112
+ ['ом', 'ой', 'ом', 'ых']]
113
+
114
+
115
+ def get_cases(prefix, post_group):
116
+ return [[
117
+ prefix + postfix if isinstance(postfix, str) else
118
+ [prefix + animate if isinstance(animate, str) else
119
+ prefix + animate[post_group]
120
+ for animate in postfix] if isinstance(postfix, list) else
121
+ prefix + postfix[post_group]
122
+ for postfix in case]
123
+ for case in CASE_POSTFIXES]
124
+
125
+
126
+ def get_ord_classifier(prefixes, post_groups):
127
+ if isinstance(post_groups, int):
128
+ post_groups = {n: post_groups for n, i in prefixes.items()}
129
+ return {
130
+ num: get_cases(prefix, post_groups[num])
131
+ for num, prefix in prefixes.items()
132
+ }
133
+
134
+
135
+ ONES_ORD = {
136
+ 3: [['третий', 'третья', 'третье', 'третьи'],
137
+ ['третьего', 'третьей', 'третьего', 'третьих'],
138
+ ['третьему', 'третьей', 'третьему', 'третьим'],
139
+ [['третьего', 'третий'], 'третью', 'третье', ['третьих', 'третьи']],
140
+ ['третьим', 'третьей', 'третьим', 'третьими'],
141
+ ['третьем', 'третьей', 'третьем', 'третьих']],
142
+ }
143
+ ONES_ORD.update(
144
+ get_ord_classifier(ONES_ORD_PREFIXES, ONES_ORD_POSTFIXES_GROUPS)
145
+ )
146
+
147
+ TENS_PREFIXES = {1: 'один', 2: 'две', 3: 'три', 4: 'четыр', 5: 'пят',
148
+ 6: 'шест', 7: 'сем', 8: 'восем', 9: 'девят'}
149
+ TENS_POSTFIXES = ['надцать', 'надцати', 'надцати', 'надцать', 'надцатью',
150
+ 'надцати']
151
+ TENS = {0: ['десять', 'десяти', 'десяти', 'десять', 'десятью', 'десяти']}
152
+ TENS.update({
153
+ num: [prefix + postfix for postfix in TENS_POSTFIXES]
154
+ for num, prefix in TENS_PREFIXES.items()
155
+ })
156
+
157
+ TENS_ORD_PREFIXES = {0: "десят"}
158
+ TENS_ORD_PREFIXES.update({
159
+ num: prefix + 'надцат' for num, prefix in TENS_PREFIXES.items()
160
+ })
161
+ TENS_ORD = get_ord_classifier(TENS_ORD_PREFIXES, 1)
162
+
163
+ TWENTIES = {
164
+ 2: ['двадцать', 'двадцати', 'двадцати', 'двадцать', 'двадцатью',
165
+ 'двадцати'],
166
+ 3: ['тридцать', 'тридцати', 'тридцати', 'тридцать', 'тридцатью',
167
+ 'тридцати'],
168
+ 4: ['сорок', 'сорока', 'сорока', 'сорок', 'сорока', 'сорока'],
169
+ 5: ['пятьдесят', 'пятидесяти', 'пятидесяти', 'пятьдесят', 'пятьюдесятью',
170
+ 'пятидесяти'],
171
+ 6: ['шестьдесят', 'шестидесяти', 'шестидесяти', 'шестьдесят',
172
+ 'шестьюдесятью', 'шестидесяти'],
173
+ 7: ['семьдесят', 'семидесяти', 'семидесяти', 'семьдесят', 'семьюдесятью',
174
+ 'семидесяти'],
175
+ 8: ['восемьдесят', 'восьмидесяти', 'восьмидесяти', 'восемьдесят',
176
+ 'восемьюдесятью', 'восьмидесяти'],
177
+ 9: ['девяносто', 'девяноста', 'девяноста', 'девяносто', 'девяноста',
178
+ 'девяноста'],
179
+ }
180
+
181
+ TWENTIES_ORD_PREFIXES = {2: 'двадцат', 3: 'тридцат', 4: 'сороков',
182
+ 5: 'пятидесят', 6: 'шестидесят', 7: 'семидесят',
183
+ 8: 'восьмидесят', 9: 'девяност'}
184
+ TWENTIES_ORD_POSTFIXES_GROUPS = {2: 1, 3: 1, 4: 0, 5: 1, 6: 1, 7: 1, 8: 1,
185
+ 9: 1}
186
+ TWENTIES_ORD = get_ord_classifier(TWENTIES_ORD_PREFIXES,
187
+ TWENTIES_ORD_POSTFIXES_GROUPS)
188
+
189
+ HUNDREDS = {
190
+ 1: ['сто', 'ста', 'ста', 'сто', 'ста', 'ста'],
191
+ 2: ['двести', 'двухсот', 'двумстам', 'двести', 'двумястами', 'двухстах'],
192
+ 3: ['триста', 'трёхсот', 'трёмстам', 'триста', 'тремястами', 'трёхстах'],
193
+ 4: ['четыреста', 'четырёхсот', 'четырёмстам', 'четыреста', 'четырьмястами',
194
+ 'четырёхстах'],
195
+ 5: ['пятьсот', 'пятисот', 'пятистам', 'пятьсот', 'пятьюстами', 'пятистах'],
196
+ 6: ['шестьсот', 'шестисот', 'шестистам', 'шестьсот', 'шестьюстами',
197
+ 'шестистах'],
198
+ 7: ['семьсот', 'семисот', 'семистам', 'семьсот', 'семьюстами', 'семистах'],
199
+ 8: ['восемьсот', 'восьмисот', 'восьмистам', 'восемьсот', 'восемьюстами',
200
+ 'восьмистах'],
201
+ 9: ['девятьсот', 'девятисот', 'девятистам', 'девятьсот', 'девятьюстами',
202
+ 'девятистах'],
203
+ }
204
+
205
+ HUNDREDS_ORD_PREFIXES = {
206
+ num: case[1] if num != 1 else 'сот' for num, case in HUNDREDS.items()
207
+ }
208
+ HUNDREDS_ORD = get_ord_classifier(HUNDREDS_ORD_PREFIXES, 1)
209
+
210
+
211
+ THOUSANDS_PREFIXES = {2: 'миллион', 3: 'миллиард', 4: 'триллион',
212
+ 5: 'квадриллион', 6: 'квинтиллион', 7: 'секстиллион',
213
+ 8: 'септиллион', 9: 'октиллион', 10: 'нониллион'}
214
+ THOUSANDS_POSTFIXES = [('', 'а', 'ов'),
215
+ ('а', 'ов', 'ов'),
216
+ ('у', 'ам', 'ам'),
217
+ ('', 'а', 'ов'),
218
+ ('ом', 'ами', 'ами'),
219
+ ('е', 'ах', 'ах')]
220
+ THOUSANDS = {
221
+ 1: [['тысяча', 'тысячи', 'тысяч'],
222
+ ['тысячи', 'тысяч', 'тысяч'],
223
+ ['тысяче', 'тысячам', 'тысячам'],
224
+ ['тысячу', 'тысячи', 'тысяч'],
225
+ ['тысячей', 'тысячами', 'тысячами'],
226
+ ['тысяче', 'тысячах', 'тысячах']]
227
+ }
228
+ THOUSANDS.update({
229
+ num: [
230
+ [prefix + postfix for postfix in case] for case in THOUSANDS_POSTFIXES
231
+ ] for num, prefix in THOUSANDS_PREFIXES.items()
232
+ })
233
+
234
+
235
+ def get_thousands_elements(num, case):
236
+ return THOUSANDS[num][CASE_INDEXES[case]]
237
+
238
+
239
+ THOUSANDS_ORD_PREFIXES = {1: 'тысячн'}
240
+ THOUSANDS_ORD_PREFIXES.update({
241
+ num: prefix + 'н' for num, prefix in THOUSANDS_PREFIXES.items()
242
+ })
243
+ THOUSANDS_ORD = get_ord_classifier(THOUSANDS_ORD_PREFIXES, 1)
244
+
245
+
246
+ class Num2Word_RU(Num2Word_Base):
247
+ CURRENCY_FORMS = {
248
+ 'RUB': (
249
+ ('рубль', 'рубля', 'рублей'), ('копейка', 'копейки', 'копеек')
250
+ ),
251
+ 'EUR': (
252
+ ('евро', 'евро', 'евро'), ('цент', 'цента', 'центов')
253
+ ),
254
+ 'USD': (
255
+ ('доллар', 'доллара', 'долларов'), ('цент', 'цента', 'центов')
256
+ ),
257
+ 'UAH': (
258
+ ('гривна', 'гривны', 'гривен'), ('копейка', 'копейки', 'копеек')
259
+ ),
260
+ 'KZT': (
261
+ ('тенге', 'тенге', 'тенге'), ('тиын', 'тиына', 'тиынов')
262
+ ),
263
+ 'BYN': (
264
+ ('белорусский рубль', 'белорусских рубля', 'белорусских рублей'),
265
+ ('копейка', 'копейки', 'копеек')
266
+ ),
267
+ 'UZS': (
268
+ ('сум', 'сума', 'сумов'), ('тийин', 'тийина', 'тийинов')
269
+ ),
270
+ 'PLN': (
271
+ ('польский злотый', 'польских слотых', 'польских злотых'),
272
+ ('грош', 'гроша', 'грошей')
273
+ ),
274
+ }
275
+
276
+ def setup(self):
277
+ self.negword = "минус"
278
+ self.pointword = ('целая', 'целых', 'целых')
279
+ self.pointword_ord = get_cases("цел", 1)
280
+
281
+ def to_cardinal(self, number, case=D_CASE, plural=D_PLURAL,
282
+ gender=D_GENDER, animate=D_ANIMATE):
283
+ n = str(number).replace(',', '.')
284
+ if '.' in n:
285
+ left, right = n.split('.')
286
+ decimal_part = self._int2word(int(right), cardinal=True,
287
+ gender='f')
288
+ return u'%s %s %s %s' % (
289
+ self._int2word(int(left), cardinal=True, gender='f'),
290
+ self.pluralize(int(left), self.pointword),
291
+ decimal_part,
292
+ self.__decimal_bitness(right)
293
+ )
294
+ else:
295
+ return self._int2word(int(n), cardinal=True, case=case,
296
+ plural=plural, gender=gender,
297
+ animate=animate)
298
+
299
+ def __decimal_bitness(self, n):
300
+ if n[-1] == "1" and n[-2:] != "11":
301
+ return self._int2word(10 ** len(n), cardinal=False, gender='f')
302
+ return self._int2word(10 ** len(n), cardinal=False, case='g',
303
+ plural=True)
304
+
305
+ def pluralize(self, n, forms):
306
+ if n % 100 in (11, 12, 13, 14):
307
+ return forms[2]
308
+ if n % 10 == 1:
309
+ return forms[0]
310
+ if n % 10 in (2, 3, 4):
311
+ return forms[1]
312
+ return forms[2]
313
+
314
+ def to_ordinal(self, number, case=D_CASE, plural=D_PLURAL, gender=D_GENDER,
315
+ animate=D_ANIMATE):
316
+ self.verify_ordinal(number)
317
+ n = str(number).replace(',', '.')
318
+ return self._int2word(int(n), cardinal=False, case=case, plural=plural,
319
+ gender=gender, animate=animate)
320
+
321
+ def _money_verbose(self, number, currency):
322
+ if currency == 'UAH':
323
+ return self._int2word(number, gender='f')
324
+ return self._int2word(number, gender='m')
325
+
326
+ def _cents_verbose(self, number, currency):
327
+ if currency in ('UAH', 'RUB', 'BYN'):
328
+ return self._int2word(number, gender='f')
329
+ return self._int2word(number, gender='m')
330
+
331
+ def _int2word(self, n, feminine=False, cardinal=True, case=D_CASE,
332
+ plural=D_PLURAL, gender=D_GENDER, animate=D_ANIMATE):
333
+ """
334
+ n: number
335
+ feminine: not used - for backward compatibility
336
+ cardinal:True - cardinal
337
+ False - ordinal
338
+ case: 'n' - nominative
339
+ 'g' - genitive
340
+ 'd' - dative
341
+ 'a' - accusative
342
+ 'i' - instrumental
343
+ 'p' - prepositional
344
+ plural: True - plural
345
+ False - singular
346
+ gender: 'f' - masculine
347
+ 'm' - feminine
348
+ 'n' - neuter
349
+ animate: True - animate
350
+ False - inanimate
351
+ """
352
+ # For backward compatibility
353
+ if feminine:
354
+ gender = 'f'
355
+
356
+ kwargs = {'case': case, 'plural': plural, 'gender': gender,
357
+ 'animate': animate}
358
+
359
+ if n < 0:
360
+ return ' '.join([self.negword, self._int2word(abs(n),
361
+ cardinal=cardinal,
362
+ **kwargs)])
363
+
364
+ if n == 0:
365
+ return get_num_element(ONES, 0, **kwargs) if cardinal else \
366
+ get_num_element(ONES_ORD, 0, **kwargs)
367
+
368
+ words = []
369
+ chunks = list(splitbyx(str(n), 3))
370
+ ord_join = chunks[-1] == 0 # join in one word if ending on 'тысячный'
371
+ i = len(chunks)
372
+ rightest_nonzero_chunk_i = i - 1 - max(
373
+ [i for i, e in enumerate(chunks) if e != 0])
374
+ for x in chunks:
375
+ chunk_words = []
376
+ i -= 1
377
+
378
+ if x == 0:
379
+ continue
380
+
381
+ n1, n2, n3 = get_digits(x)
382
+
383
+ if cardinal:
384
+ chunk_words.extend(
385
+ self.__chunk_cardianl(n3, n2, n1, i, **kwargs)
386
+ )
387
+ if i > 0:
388
+ chunk_words.append(
389
+ self.pluralize(x, get_thousands_elements(i, case)))
390
+ # ordinal, not joined like 'двухтысячный'
391
+ elif not (ord_join and rightest_nonzero_chunk_i == i):
392
+ chunk_words.extend(
393
+ self.__chunk_ordinal(n3, n2, n1, i, **kwargs)
394
+ )
395
+ if i > 0:
396
+ t_case = case if rightest_nonzero_chunk_i == i else 'n'
397
+ chunk_words.append(
398
+ self.pluralize(x, get_thousands_elements(i, t_case)))
399
+ # ordinal, joined
400
+ else:
401
+ chunk_words.extend(
402
+ self.__chunk_ordinal_join(n3, n2, n1, i, **kwargs)
403
+ )
404
+ if i > 0:
405
+ chunk_words.append(
406
+ get_num_element(THOUSANDS_ORD, i, **kwargs))
407
+
408
+ chunk_words = [''.join(chunk_words)]
409
+
410
+ words.extend(chunk_words)
411
+
412
+ return ' '.join(words)
413
+
414
+ def __chunk_cardianl(self, hundreds, tens, ones, chunk_num, **kwargs):
415
+ words = []
416
+ if hundreds > 0:
417
+ words.append(get_num_element(HUNDREDS, hundreds, **kwargs))
418
+
419
+ if tens > 1:
420
+ words.append(get_num_element(TWENTIES, tens, **kwargs))
421
+
422
+ if tens == 1:
423
+ words.append(get_num_element(TENS, ones, **kwargs))
424
+ elif ones > 0:
425
+ if chunk_num == 0:
426
+ w_ones = get_num_element(ONES, ones, **kwargs)
427
+ elif chunk_num == 1:
428
+ # Thousands are feminine
429
+ f_kwargs = kwargs.copy()
430
+ f_kwargs['gender'] = 'f'
431
+ w_ones = get_num_element(ONES, ones, **f_kwargs)
432
+ else:
433
+ w_ones = get_num_element(ONES, ones, **kwargs)
434
+
435
+ words.append(w_ones)
436
+ return words
437
+
438
+ def __chunk_ordinal(self, hundreds, tens, ones, chunk_num, **kwargs):
439
+ words = []
440
+ if hundreds > 0:
441
+ if tens == 0 and ones == 0:
442
+ words.append(get_num_element(HUNDREDS_ORD, hundreds, **kwargs))
443
+ else:
444
+ words.append(get_num_element(HUNDREDS, hundreds))
445
+
446
+ if tens > 1:
447
+ if ones == 0:
448
+ words.append(get_num_element(TWENTIES_ORD, tens, **kwargs))
449
+ else:
450
+ words.append(get_num_element(TWENTIES, tens))
451
+
452
+ if tens == 1:
453
+ words.append(get_num_element(TENS_ORD, ones, **kwargs))
454
+ elif ones > 0:
455
+ if chunk_num == 0:
456
+ w_ones = get_num_element(ONES_ORD, ones, **kwargs)
457
+ # тысячный, миллионнный и т.д.
458
+ elif chunk_num > 0 and ones == 1 and hundreds == 0 and tens == 0:
459
+ w_ones = None
460
+ elif chunk_num == 1:
461
+ # Thousands are feminine
462
+ w_ones = get_num_element(ONES, ones, gender='f')
463
+ else:
464
+ w_ones = get_num_element(ONES, ones)
465
+
466
+ if w_ones:
467
+ words.append(w_ones)
468
+
469
+ return words
470
+
471
+ def __chunk_ordinal_join(self, hundreds, tens, ones, chunk_num, **kwargs):
472
+ words = []
473
+
474
+ if hundreds > 1:
475
+ words.append(get_num_element(HUNDREDS, hundreds, case='g'))
476
+ elif hundreds == 1:
477
+ words.append(get_num_element(HUNDREDS, hundreds)) # стО, not стА
478
+
479
+ if tens == 9:
480
+ words.append(get_num_element(TWENTIES, tens)) # девяностО, not А
481
+ elif tens > 1:
482
+ words.append(get_num_element(TWENTIES, tens, case='g'))
483
+
484
+ if tens == 1:
485
+ words.append(get_num_element(TENS, ones, case='g'))
486
+ elif ones > 0:
487
+ if chunk_num == 0:
488
+ w_ones = get_num_element(ONES_ORD, ones, **kwargs)
489
+ # тысячный, миллионнный и т.д., двадцатиодномиллионный
490
+ elif chunk_num > 0 and ones == 1 and tens != 1:
491
+ if tens == 0 and hundreds == 0:
492
+ w_ones = None
493
+ else:
494
+ w_ones = get_num_element(ONES, 1, gender='n')
495
+ else:
496
+ w_ones = get_num_element(ONES, ones, case='g')
497
+
498
+ if w_ones:
499
+ words.append(w_ones)
500
+
501
+ return words
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_SK.py ADDED
@@ -0,0 +1,160 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
3
+
4
+ # This library is free software; you can redistribute it and/or
5
+ # modify it under the terms of the GNU Lesser General Public
6
+ # License as published by the Free Software Foundation; either
7
+ # version 2.1 of the License, or (at your option) any later version.
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ # You should have received a copy of the GNU Lesser General Public
13
+ # License along with this library; if not, write to the Free Software
14
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
15
+ # MA 02110-1301 USA
16
+
17
+ from __future__ import unicode_literals
18
+
19
+ from .base import Num2Word_Base
20
+ from .utils import get_digits, splitbyx
21
+
22
+ ZERO = ('nula',)
23
+
24
+ ONES = {
25
+ 1: ('jeden', 'jeden', set()),
26
+ 2: ('dva', 'dve', {1, 3, 5, 7, 9}),
27
+ 3: ('tri', 'tri', set()),
28
+ 4: ('štyri', 'štyri', set()),
29
+ 5: ('päť', 'päť', set()),
30
+ 6: ('šesť', 'šesť', set()),
31
+ 7: ('sedem', 'sedem', set()),
32
+ 8: ('osem', 'osem', set()),
33
+ 9: ('deväť', 'deväť', set()),
34
+ }
35
+
36
+ TENS = {
37
+ 0: ('desať',),
38
+ 1: ('jedenásť',),
39
+ 2: ('dvanásť',),
40
+ 3: ('trinásť',),
41
+ 4: ('štrnásť',),
42
+ 5: ('pätnásť',),
43
+ 6: ('šestnásť',),
44
+ 7: ('sedemnásť',),
45
+ 8: ('osemnásť',),
46
+ 9: ('devätnásť',),
47
+ }
48
+
49
+ TWENTIES = {
50
+ 2: ('dvadsať',),
51
+ 3: ('tridsať',),
52
+ 4: ('štyridsať',),
53
+ 5: ('päťdesiat',),
54
+ 6: ('šesťdesiat',),
55
+ 7: ('sedemdesiat',),
56
+ 8: ('osemdesiat',),
57
+ 9: ('deväťdesiat',),
58
+ }
59
+
60
+ HUNDREDS = {
61
+ 1: ('sto',),
62
+ 2: ('dvesto',),
63
+ 3: ('tristo',),
64
+ 4: ('štyristo',),
65
+ 5: ('päťsto',),
66
+ 6: ('šesťsto',),
67
+ 7: ('sedemsto',),
68
+ 8: ('osemsto',),
69
+ 9: ('deväťsto',),
70
+ }
71
+
72
+ THOUSANDS = {
73
+ 1: ('tisíc', 'tisíc', 'tisíc'), # 10^3
74
+ 2: ('milión', 'milióny', 'miliónov'), # 10^6
75
+ 3: ('miliarda', 'miliardy', 'miliárd'), # 10^9
76
+ 4: ('bilión', 'bilióny', 'biliónov'), # 10^12
77
+ 5: ('biliarda', 'biliardy', 'biliárd'), # 10^15
78
+ 6: ('trilión', 'trilióny', 'triliónov'), # 10^18
79
+ 7: ('triliarda', 'triliardy', 'triliárd'), # 10^21
80
+ 8: ('kvadrilión', 'kvadrilióny', 'kvadriliónov'), # 10^24
81
+ 9: ('kvadriliarda', 'kvadriliardy', 'kvadriliárd'), # 10^27
82
+ 10: ('kvintilión', 'kvintillióny', 'kvintiliónov'), # 10^30
83
+ }
84
+
85
+
86
+ class Num2Word_SK(Num2Word_Base):
87
+ CURRENCY_FORMS = {
88
+ 'EUR': (
89
+ ('euro', 'eurá', 'eur'), ('cent', 'centy', 'centov')
90
+ ),
91
+ }
92
+
93
+ def setup(self):
94
+ self.negword = "mínus"
95
+ self.pointword = "celých"
96
+
97
+ def to_cardinal(self, number):
98
+ n = str(number).replace(',', '.')
99
+ if '.' in n:
100
+ left, right = n.split('.')
101
+ leading_zero_count = len(right) - len(right.lstrip('0'))
102
+ decimal_part = ((ZERO[0] + ' ') * leading_zero_count +
103
+ self._int2word(int(right)))
104
+ return u'%s %s %s' % (
105
+ self._int2word(int(left)),
106
+ self.pointword,
107
+ decimal_part
108
+ )
109
+ else:
110
+ return self._int2word(int(n))
111
+
112
+ def pluralize(self, n, forms):
113
+ if n == 1:
114
+ form = 0
115
+ elif 0 < n < 5:
116
+ form = 1
117
+ else:
118
+ form = 2
119
+ return forms[form]
120
+
121
+ def to_ordinal(self, value):
122
+ raise NotImplementedError()
123
+
124
+ def _int2word(self, n):
125
+ if n == 0:
126
+ return ZERO[0]
127
+
128
+ words = []
129
+ chunks = list(splitbyx(str(n), 3))
130
+ i = len(chunks)
131
+ for x in chunks:
132
+ i -= 1
133
+
134
+ if x == 0:
135
+ continue
136
+
137
+ n1, n2, n3 = get_digits(x)
138
+
139
+ word_chunk = []
140
+
141
+ if n3 > 0:
142
+ word_chunk.append(HUNDREDS[n3][0])
143
+
144
+ if n2 > 1:
145
+ word_chunk.append(TWENTIES[n2][0])
146
+
147
+ if n2 == 1:
148
+ word_chunk.append(TENS[n1][0])
149
+ elif n1 > 0 and not (i > 0 and x == 1):
150
+ if n2 == 0 and n3 == 0 and i in ONES[n1][2]:
151
+ word_chunk.append(ONES[n1][1])
152
+ else:
153
+ word_chunk.append(ONES[n1][0])
154
+ if i > 1 and word_chunk:
155
+ word_chunk.append(' ')
156
+ if i > 0:
157
+ word_chunk.append(self.pluralize(x, THOUSANDS[i]))
158
+ words.append(''.join(word_chunk))
159
+
160
+ return ' '.join(words[:-1]) + ''.join(words[-1:])
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_SL.py ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+ # Copyright (c) 2015, Blaz Bregar. All Rights Reserved.
5
+
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2.1 of the License, or (at your option) any later version.
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ # You should have received a copy of the GNU Lesser General Public
15
+ # License along with this library; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17
+ # MA 02110-1301 USA
18
+
19
+ from __future__ import unicode_literals
20
+
21
+ from .lang_EU import Num2Word_EU
22
+
23
+
24
+ class Num2Word_SL(Num2Word_EU):
25
+ GIGA_SUFFIX = "ilijard"
26
+ MEGA_SUFFIX = "ilijon"
27
+
28
+ def setup(self):
29
+ super(Num2Word_SL, self).setup()
30
+
31
+ self.negword = "minus "
32
+ self.pointword = "celih"
33
+ self.errmsg_nonnum = "Only numbers may be converted to words."
34
+ self.errmsg_toobig = (
35
+ "Number is too large to convert to words (abs(%s) > %s)."
36
+ )
37
+ self.exclude_title = []
38
+
39
+ self.mid_numwords = [(1000, "tisoč"), (900, "devetsto"),
40
+ (800, "osemsto"), (700, "sedemsto"),
41
+ (600, "šeststo"), (500, "petsto"),
42
+ (400, "štiristo"), (300, "tristo"),
43
+ (200, "dvesto"), (100, "sto"),
44
+ (90, "devetdeset"), (80, "osemdeset"),
45
+ (70, "sedemdeset"), (60, "šestdeset"),
46
+ (50, "petdeset"), (40, "štirideset"),
47
+ (30, "trideset")]
48
+ self.low_numwords = ["dvajset", "devetnajst", "osemnajst",
49
+ "sedemnajst", "šestnajst", "petnajst",
50
+ "štirinajst", "trinajst", "dvanajst",
51
+ "enajst", "deset", "devet", "osem", "sedem",
52
+ "šest", "pet", "štiri", "tri", "dve", "ena",
53
+ "nič"]
54
+ self.ords = {"ena": "prv",
55
+ "dve": "drug",
56
+ "tri": "tretj",
57
+ "štiri": "četrt",
58
+ "sedem": "sedm",
59
+ "osem": "osm",
60
+ "sto": "stot",
61
+ "tisoč": "tisoč",
62
+ "milijon": "milijont"
63
+ }
64
+ self.ordflag = False
65
+
66
+ def merge(self, curr, next):
67
+ ctext, cnum, ntext, nnum = curr + next
68
+
69
+ if ctext.endswith("dve") and self.ordflag and nnum <= 1000000:
70
+ ctext = ctext[:len(ctext)-1] + "a"
71
+
72
+ if ctext == "dve" and not self.ordflag and nnum < 1000000000:
73
+ ctext = "dva"
74
+
75
+ if (ctext.endswith("tri") or ctext.endswith("štiri")) and\
76
+ nnum == 1000000 and not self.ordflag:
77
+ if ctext.endswith("štiri"):
78
+ ctext = ctext[:-1]
79
+ ctext = ctext + "je"
80
+
81
+ if cnum >= 20 and cnum < 100 and nnum == 2:
82
+ ntext = "dva"
83
+
84
+ if ctext.endswith("ena") and nnum >= 1000:
85
+ ctext = ctext[0:-1]
86
+
87
+ if cnum == 1:
88
+ if nnum < 10**6 or self.ordflag:
89
+ return next
90
+ ctext = ""
91
+
92
+ if nnum > cnum:
93
+ if nnum >= 10**6:
94
+ if self.ordflag:
95
+ ntext += "t"
96
+
97
+ elif cnum == 2:
98
+ if ntext.endswith("d"):
99
+ ntext += "i"
100
+ else:
101
+ ntext += "a"
102
+
103
+ elif 2 < cnum < 5:
104
+ if ntext.endswith("d"):
105
+ ntext += "e"
106
+ elif not ntext.endswith("d"):
107
+ ntext += "i"
108
+
109
+ elif ctext.endswith("en"):
110
+ if ntext.endswith("d") or ntext.endswith("n"):
111
+ ntext += ""
112
+
113
+ elif ctext.endswith("dve") and ntext.endswith("n"):
114
+ ctext = ctext[:-1] + "a"
115
+ ntext += "a"
116
+
117
+ elif ctext.endswith("je") and ntext.endswith("n"):
118
+ ntext += "i"
119
+
120
+ else:
121
+ if ntext.endswith("d"):
122
+ ntext += "a"
123
+ elif ntext.endswith("n"):
124
+ ntext += ""
125
+ elif ntext.endswith("d"):
126
+ ntext += "e"
127
+ else:
128
+ ntext += "ov"
129
+
130
+ if nnum >= 10**2 and self.ordflag is False and ctext:
131
+ ctext += " "
132
+
133
+ val = cnum * nnum
134
+ else:
135
+ if nnum < 10 < cnum < 100:
136
+ ntext, ctext = ctext, ntext + "in"
137
+ elif cnum >= 10**2 and self.ordflag is False:
138
+ ctext += " "
139
+ val = cnum + nnum
140
+
141
+ word = ctext + ntext
142
+ return (word, val)
143
+
144
+ def to_ordinal(self, value):
145
+ self.verify_ordinal(value)
146
+ self.ordflag = True
147
+ outword = self.to_cardinal(value)
148
+ self.ordflag = False
149
+ for key in self.ords:
150
+ if outword.endswith(key):
151
+ outword = outword[:len(outword) - len(key)] + self.ords[key]
152
+ break
153
+ return outword + "i"
154
+
155
+ # Is this correct??
156
+ def to_ordinal_num(self, value):
157
+ self.verify_ordinal(value)
158
+ return str(value) + "."
159
+
160
+ def to_currency(self, val, longval=True, old=False):
161
+ if old:
162
+ return self.to_splitnum(val, hightxt="evro/a/v",
163
+ lowtxt="stotin/a/i/ov",
164
+ jointxt="in", longval=longval)
165
+ return super(Num2Word_SL, self).to_currency(val, jointxt="in",
166
+ longval=longval)
167
+
168
+ def to_year(self, val, longval=True):
169
+ if not (val//100) % 10:
170
+ return self.to_cardinal(val)
171
+ return self.to_splitnum(val, hightxt="hundert", longval=longval)
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_SR.py ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import unicode_literals
19
+
20
+ from .base import Num2Word_Base
21
+ from .currency import parse_currency_parts, prefix_currency
22
+ from .utils import get_digits, splitbyx
23
+
24
+ ZERO = ('nula',)
25
+
26
+ ONES = {
27
+ 1: ('jedan', 'jedna'),
28
+ 2: ('dva', 'dve'),
29
+ 3: ('tri', 'tri'),
30
+ 4: ('četiri', 'četiri'),
31
+ 5: ('pet', 'pet'),
32
+ 6: ('šest', 'šest'),
33
+ 7: ('sedam', 'sedam'),
34
+ 8: ('osam', 'osam'),
35
+ 9: ('devet', 'devet'),
36
+ }
37
+
38
+ TENS = {
39
+ 0: ('deset',),
40
+ 1: ('jedanaest',),
41
+ 2: ('dvanaest',),
42
+ 3: ('trinaest',),
43
+ 4: ('četrnaest',),
44
+ 5: ('petnaest',),
45
+ 6: ('šesnaest',),
46
+ 7: ('sedamnaest',),
47
+ 8: ('osamnaest',),
48
+ 9: ('devetnaest',),
49
+ }
50
+
51
+ TWENTIES = {
52
+ 2: ('dvadeset',),
53
+ 3: ('trideset',),
54
+ 4: ('četrdeset',),
55
+ 5: ('pedeset',),
56
+ 6: ('šezdeset',),
57
+ 7: ('sedamdeset',),
58
+ 8: ('osamdeset',),
59
+ 9: ('devedeset',),
60
+ }
61
+
62
+ HUNDREDS = {
63
+ 1: ('sto',),
64
+ 2: ('dvesta',),
65
+ 3: ('trista',),
66
+ 4: ('četristo',),
67
+ 5: ('petsto',),
68
+ 6: ('šesto',),
69
+ 7: ('sedamsto',),
70
+ 8: ('osamsto',),
71
+ 9: ('devetsto',),
72
+ }
73
+
74
+ SCALE = {
75
+ 0: ('', '', '', False),
76
+ 1: ('hiljada', 'hiljade', 'hiljada', True), # 10^3
77
+ 2: ('milion', 'miliona', 'miliona', False), # 10^6
78
+ 3: ('bilion', 'biliona', 'biliona', False), # 10^9
79
+ 4: ('trilion', 'triliona', 'triliona', False), # 10^12
80
+ 5: ('kvadrilion', 'kvadriliona', 'kvadriliona', False), # 10^15
81
+ 6: ('kvintilion', 'kvintiliona', 'kvintiliona', False), # 10^18
82
+ 7: ('sekstilion', 'sekstiliona', 'sekstiliona', False), # 10^21
83
+ 8: ('septilion', 'septiliona', 'septiliona', False), # 10^24
84
+ 9: ('oktilion', 'oktiliona', 'oktiliona', False), # 10^27
85
+ 10: ('nonilion', 'noniliona', 'noniliona', False), # 10^30
86
+ }
87
+
88
+
89
+ class Num2Word_SR(Num2Word_Base):
90
+ CURRENCY_FORMS = {
91
+ 'RUB': (
92
+ ('rublja', 'rublje', 'rublji', True),
93
+ ('kopejka', 'kopejke', 'kopejki', True)
94
+ ),
95
+ 'EUR': (
96
+ ('evro', 'evra', 'evra', False),
97
+ ('cent', 'centa', 'centi', False)
98
+ ),
99
+ 'RSD': (
100
+ ('dinar', 'dinara', 'dinara', False),
101
+ ('para', 'pare', 'para', True)
102
+ ),
103
+ }
104
+
105
+ def setup(self):
106
+ self.negword = "minus"
107
+ self.pointword = "zapeta"
108
+
109
+ def to_cardinal(self, number, feminine=False):
110
+ n = str(number).replace(',', '.')
111
+ if '.' in n:
112
+ left, right = n.split('.')
113
+ leading_zero_count = len(right) - len(right.lstrip('0'))
114
+ decimal_part = ((ZERO[0] + ' ') * leading_zero_count +
115
+ self._int2word(int(right), feminine))
116
+ return u'%s %s %s' % (
117
+ self._int2word(int(left), feminine),
118
+ self.pointword,
119
+ decimal_part
120
+ )
121
+ else:
122
+ return self._int2word(int(n), feminine)
123
+
124
+ def pluralize(self, number, forms):
125
+ if number % 100 < 10 or number % 100 > 20:
126
+ if number % 10 == 1:
127
+ form = 0
128
+ elif 1 < number % 10 < 5:
129
+ form = 1
130
+ else:
131
+ form = 2
132
+ else:
133
+ form = 2
134
+ return forms[form]
135
+
136
+ def to_ordinal(self, number):
137
+ raise NotImplementedError()
138
+
139
+ def _cents_verbose(self, number, currency):
140
+ return self._int2word(
141
+ number,
142
+ self.CURRENCY_FORMS[currency][1][-1]
143
+ )
144
+
145
+ def _int2word(self, number, feminine=False):
146
+ if number < 0:
147
+ return ' '.join([self.negword, self._int2word(abs(number))])
148
+
149
+ if number == 0:
150
+ return ZERO[0]
151
+
152
+ words = []
153
+ chunks = list(splitbyx(str(number), 3))
154
+ chunk_len = len(chunks)
155
+ for chunk in chunks:
156
+ chunk_len -= 1
157
+ digit_right, digit_mid, digit_left = get_digits(chunk)
158
+
159
+ if digit_left > 0:
160
+ words.append(HUNDREDS[digit_left][0])
161
+
162
+ if digit_mid > 1:
163
+ words.append(TWENTIES[digit_mid][0])
164
+
165
+ if digit_mid == 1:
166
+ words.append(TENS[digit_right][0])
167
+ elif digit_right > 0:
168
+ is_feminine = feminine or SCALE[chunk_len][-1]
169
+ gender_idx = int(is_feminine)
170
+ words.append(
171
+ ONES[digit_right][gender_idx]
172
+ )
173
+
174
+ if chunk_len > 0 and chunk != 0:
175
+ words.append(self.pluralize(chunk, SCALE[chunk_len]))
176
+
177
+ return ' '.join(words)
178
+
179
+ def to_currency(self, val, currency='EUR', cents=True, separator=',',
180
+ adjective=False):
181
+ """
182
+ Args:
183
+ val: Numeric value
184
+ currency (str): Currency code
185
+ cents (bool): Verbose cents
186
+ separator (str): Cent separator
187
+ adjective (bool): Prefix currency name with adjective
188
+ Returns:
189
+ str: Formatted string
190
+
191
+ """
192
+ left, right, is_negative = parse_currency_parts(val)
193
+
194
+ try:
195
+ cr1, cr2 = self.CURRENCY_FORMS[currency]
196
+
197
+ except KeyError:
198
+ raise NotImplementedError(
199
+ 'Currency code "%s" not implemented for "%s"' %
200
+ (currency, self.__class__.__name__))
201
+
202
+ if adjective and currency in self.CURRENCY_ADJECTIVES:
203
+ cr1 = prefix_currency(
204
+ self.CURRENCY_ADJECTIVES[currency],
205
+ cr1
206
+ )
207
+
208
+ minus_str = "%s " % self.negword if is_negative else ""
209
+ cents_str = self._cents_verbose(right, currency) \
210
+ if cents else self._cents_terse(right, currency)
211
+
212
+ return u'%s%s %s%s %s %s' % (
213
+ minus_str,
214
+ self.to_cardinal(left, feminine=cr1[-1]),
215
+ self.pluralize(left, cr1),
216
+ separator,
217
+ cents_str,
218
+ self.pluralize(right, cr2)
219
+ )
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_SV.py ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import division, print_function, unicode_literals
19
+
20
+ from . import lang_EU
21
+
22
+
23
+ class Num2Word_SV(lang_EU.Num2Word_EU):
24
+ GIGA_SUFFIX = "iljarder"
25
+ MEGA_SUFFIX = "iljoner"
26
+
27
+ def set_high_numwords(self, high):
28
+ cap = 3 + 6 * len(high)
29
+
30
+ for word, n in zip(high, range(cap, 3, -6)):
31
+ if self.GIGA_SUFFIX:
32
+ self.cards[10 ** n] = word + self.GIGA_SUFFIX
33
+
34
+ if self.MEGA_SUFFIX:
35
+ self.cards[10 ** (n - 3)] = word + self.MEGA_SUFFIX
36
+
37
+ def setup(self):
38
+ super(Num2Word_SV, self).setup()
39
+
40
+ self.negword = "minus "
41
+ self.pointword = "komma"
42
+ self.exclude_title = ["och", "komma", "minus"]
43
+
44
+ self.mid_numwords = [(1000, "tusen"), (100, "hundra"),
45
+ (90, "nittio"), (80, "åttio"), (70, "sjuttio"),
46
+ (60, "sextio"), (50, "femtio"), (40, "förtio"),
47
+ (30, "trettio")]
48
+ self.low_numwords = ["tjugo", "nitton", "arton", "sjutton",
49
+ "sexton", "femton", "fjorton", "tretton",
50
+ "tolv", "elva", "tio", "nio", "åtta",
51
+ "sju", "sex", "fem", "fyra", "tre", "två",
52
+ "ett", "noll"]
53
+ self.ords = {"noll": "nollte",
54
+ "ett": "första",
55
+ "två": "andra",
56
+ "tre": "tredje",
57
+ "fyra": "fjärde",
58
+ "fem": "femte",
59
+ "sex": "sjätte",
60
+ "sju": "sjunde",
61
+ "åtta": "åttonde",
62
+ "nio": "nionde",
63
+ "tio": "tionde",
64
+ "elva": "elfte",
65
+ "tolv": "tolfte",
66
+ "tjugo": "tjugonde"}
67
+
68
+ def merge(self, lpair, rpair):
69
+ ltext, lnum = lpair
70
+ rtext, rnum = rpair
71
+ if lnum == 1 and rnum < 100:
72
+ return (rtext, rnum)
73
+ elif 100 > lnum > rnum:
74
+ return ("%s%s" % (ltext, rtext), lnum + rnum)
75
+ elif lnum >= 100 > rnum:
76
+ return ("%s%s" % (ltext, rtext), lnum + rnum)
77
+ elif rnum >= 1000000 and lnum == 1:
78
+ return ("%s %s" % ('en', rtext[:-2]), lnum + rnum)
79
+ elif rnum >= 1000000 and lnum > 1:
80
+ return ("%s %s" % (ltext, rtext), lnum + rnum)
81
+ elif rnum > lnum:
82
+ return ("%s%s" % (ltext, rtext), lnum * rnum)
83
+ return ("%s %s" % (ltext, rtext), lnum + rnum)
84
+
85
+ def to_ordinal(self, value):
86
+ self.verify_ordinal(value)
87
+ outwords = self.to_cardinal(value).split(" ")
88
+ lastword = outwords[-1]
89
+ ending_length = 0
90
+ try:
91
+ lastword_ending = self.ords[lastword[-4:]]
92
+ ending_length = 4
93
+ except KeyError:
94
+ try:
95
+ lastword_ending = self.ords[lastword[-3:]]
96
+ ending_length = 3
97
+ except KeyError:
98
+ lastword_ending = "de"
99
+ if lastword_ending == 'de':
100
+ lastword_first_part = self.title(lastword)[:]
101
+ else:
102
+ lastword_first_part = self.title(lastword)[:-ending_length]
103
+ lastword_correct = lastword_first_part + lastword_ending
104
+ outwords[-1] = lastword_correct
105
+ return " ".join(outwords)
106
+
107
+ def to_ordinal_num(self, value):
108
+ raise NotImplementedError(
109
+ "'ordinal_num' is not implemented for swedish language")
110
+
111
+ def to_year(self, val, longval=True):
112
+ raise NotImplementedError(
113
+ "'year' is not implemented for swedish language")
114
+
115
+ def to_currency(self, val, longval=True):
116
+ raise NotImplementedError(
117
+ "'currency' is not implemented for swedish language")
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_TE.py ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+
3
+ from __future__ import unicode_literals
4
+
5
+ from .lang_EU import Num2Word_EU
6
+
7
+
8
+ class Num2Word_TE(Num2Word_EU):
9
+ def set_high_numwords(self, high):
10
+ for n, word in self.high_numwords:
11
+ self.cards[10**n] = word
12
+
13
+ def setup(self):
14
+ self.low_numwords = [
15
+ "తొంభై తొమ్మిది",
16
+ "తొంభై ఎనిమిది",
17
+ "తొంభై ఏడు",
18
+ "తొంభై ఆరు",
19
+ "తొంభై అయిదు",
20
+ "తొంభై నాలుగు",
21
+ "తొంభై మూడు",
22
+ "తొంభై రెండు",
23
+ "తొంభై ఒకటి",
24
+ "తొంభై",
25
+ "ఎనభై తొమ్మిది",
26
+ "ఎనభై ఎనిమిది",
27
+ "ఎనభై ఏడు",
28
+ "ఎనభై ఆరు",
29
+ "ఎనభై అయిదు",
30
+ "ఎనభై నాలుగు",
31
+ "ఎనభై మూడు",
32
+ "ఎనభై రెండు",
33
+ "ఎనభై ఒకటి",
34
+ "ఎనభై",
35
+ "డెబ్బై తొమ్మిది",
36
+ "డెబ్బై ఎనిమిది",
37
+ "డెబ్బై ఏడు",
38
+ "డెబ్బై ఆరు",
39
+ "డెబ్బై అయిదు",
40
+ "డెబ్బై నాలుగు",
41
+ "డెబ్బై మూడు",
42
+ "డెబ్బై రెండు",
43
+ "డెబ్బై ఒకటి",
44
+ "డెబ్బై",
45
+ "అరవై తొమ్మిది",
46
+ "అరవై ఎనిమిది",
47
+ "అరవై ఏడు",
48
+ "అరవై ఆరు",
49
+ "అరవై అయిదు",
50
+ "అరవై నాలుగు",
51
+ "అరవై మూడు",
52
+ "అరవై రెండు",
53
+ "అరవై ఒకటి",
54
+ "అరవై",
55
+ "యాభై తొమ్మిది",
56
+ "యాభై ఎనిమిది",
57
+ "యాభై ఏడు",
58
+ "యాభై ఆరు",
59
+ "యాభై అయిదు",
60
+ "యాభై నాలుగు",
61
+ "యాభై మూడు",
62
+ "యాభై రెండు",
63
+ "యాభై ఒకటి",
64
+ "యాభై ",
65
+ "నలభై తొమ్మిది",
66
+ "నలభై ఎనిమిది",
67
+ "నలభై ఏడు",
68
+ "నలభై ఆరు",
69
+ "నలభై అయిదు",
70
+ "నలభై నాలుగు",
71
+ "నలభై మూడు",
72
+ "నలభై రెండు",
73
+ "నలభై ఒకటి",
74
+ "నలభై",
75
+ "ముప్పై తొమ్మిది",
76
+ "ముప్పై ఎనిమిది",
77
+ "ముప్పై ఏడు",
78
+ "ముప్పై ఆరు",
79
+ "ముప్పై ఐదు",
80
+ "ముప్పై నాలుగు",
81
+ "ముప్పై మూడు",
82
+ "ముప్పై రెండు",
83
+ "ముప్పై ఒకటి",
84
+ "ముప్పై",
85
+ "ఇరవై తొమ్మిది",
86
+ "ఇరవై ఎనిమిది",
87
+ "ఇరవై ఏడు",
88
+ "ఇరవై ఆరు",
89
+ "ఇరవై అయిదు",
90
+ "ఇరవై నాలుగు",
91
+ "ఇరవై మూడు",
92
+ "ఇరవై రెండు",
93
+ "ఇరవై ఒకటి",
94
+ "ఇరవై",
95
+ "పందొమ్మిది",
96
+ "పధ్ధెనిమిది",
97
+ "పదిహేడు",
98
+ "పదహారు",
99
+ "పదునయిదు",
100
+ "పధ్నాలుగు",
101
+ "పదమూడు",
102
+ "పన్నెండు",
103
+ "పదకొండు",
104
+ "పది",
105
+ "తొమ్మిది",
106
+ "ఎనిమిది",
107
+ "ఏడు",
108
+ "ఆరు",
109
+ "అయిదు",
110
+ "నాలుగు",
111
+ "మూడు",
112
+ "రెండు",
113
+ "ఒకటి",
114
+ "సున్న",
115
+ ]
116
+
117
+ self.mid_numwords = [(100, "వంద")]
118
+
119
+ self.high_numwords = [(7, "కోట్ల"), (5, "లక్ష"), (3, "వేయి")]
120
+
121
+ self.pointword = "బిందువు "
122
+
123
+ self.modifiers = [
124
+ " ్ ",
125
+ "ా ",
126
+ " ి ",
127
+ " ీ ",
128
+ " ు ",
129
+ " ూ ",
130
+ " ృ ",
131
+ " ౄ ",
132
+ " ె ",
133
+ " ే ",
134
+ " ై ",
135
+ " ొ",
136
+ " ో ",
137
+ " ౌ ",
138
+ " ఁ ",
139
+ " ం ",
140
+ " ః ",
141
+ ]
142
+
143
+ def merge(self, lpair, rpair):
144
+ ltext, lnum = lpair
145
+ rtext, rnum = rpair
146
+ if lnum == 1 and rnum < 100:
147
+ return (rtext, rnum)
148
+ elif 100 > lnum > rnum:
149
+ return ("%s-%s" % (ltext, rtext), lnum + rnum)
150
+ elif lnum >= 100 > rnum:
151
+ if ltext[-1] in self.modifiers:
152
+ return ("%s %s" % (ltext[:-1], rtext), lnum + rnum)
153
+ else:
154
+ return ("%s %s" % (ltext+"ల", rtext), lnum + rnum)
155
+ elif rnum > lnum:
156
+ return ("%s %s" % (ltext, rtext), lnum * rnum)
157
+ return ("%s %s" % (ltext, rtext), lnum + rnum)
158
+
159
+ def to_ordinal_num(self, value):
160
+ self.verify_ordinal(value)
161
+ return "%s%s" % (value, self.to_ordinal(value)[-1:])
162
+
163
+ def to_ordinal(self, value):
164
+ self.verify_ordinal(value)
165
+ outwords = self.to_cardinal(value)
166
+ if outwords[-1] in self.modifiers:
167
+ outwords = outwords[:-1]
168
+ ordinal_num = outwords + "వ"
169
+ return ordinal_num
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_TET.py ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-Num2Word_TET
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+
19
+ from num2words.currency import parse_currency_parts
20
+
21
+ from .lang_EU import Num2Word_EU
22
+
23
+ DOLLAR = ('dolar', 'dolar')
24
+ CENTS = ('sentavu', 'sentavu')
25
+
26
+
27
+ class Num2Word_TET(Num2Word_EU):
28
+
29
+ CURRENCY_FORMS = {
30
+ 'AUD': (DOLLAR, CENTS),
31
+ 'CAD': (DOLLAR, CENTS),
32
+ 'EUR': (('euro', 'euros'), CENTS),
33
+ 'GBP': (('pound sterling', 'pound sterling'), ('pence', 'pence')),
34
+ 'USD': (DOLLAR, CENTS),
35
+ }
36
+
37
+ GIGA_SUFFIX = None
38
+ MEGA_SUFFIX = "iliaun"
39
+
40
+ def setup(self):
41
+ super().setup()
42
+ lows = ["kuatr", "tr", "b", "m"]
43
+ self.high_numwords = self.gen_high_numwords([], [], lows)
44
+ self.negword = "menus "
45
+ self.pointword = "vírgula"
46
+ self.exclude_title = ["resin", "vírgula", "menus"]
47
+ self.count = 0
48
+
49
+ self.mid_numwords = [
50
+ (1000, "rihun"), (100, "atus"), (90, "sianulu"),
51
+ (80, "ualunulu"), (70, "hitunulu"), (60, "neenulu"),
52
+ (50, "limanulu"), (40, "haatnulu"), (30, "tolunulu"),
53
+ (20, "ruanulu")
54
+ ]
55
+ self.low_numwords = [
56
+ "sanulu",
57
+ "sia", "ualu", "hitu", "neen", "lima", "haat", "tolu", "rua",
58
+ "ida", "mamuk"
59
+ ]
60
+ self.hundreds = {
61
+ 1: "atus",
62
+ 2: "atus rua",
63
+ 3: "atus tolu",
64
+ 4: "atus haat",
65
+ 5: "atus lima",
66
+ 6: "atus neen",
67
+ 7: "atus hitu",
68
+ 8: "atus ualu",
69
+ 9: "atus sia",
70
+ }
71
+
72
+ def merge(self, curr, next):
73
+ ctext, cnum, ntext, nnum = curr + next
74
+
75
+ if cnum == 1 and nnum < 100:
76
+ return next
77
+
78
+ if nnum < cnum:
79
+ if nnum < 10:
80
+ value_str = str(cnum + nnum)
81
+ if int(value_str) > 100:
82
+ zero_list = value_str[1:-1]
83
+ all_zero = all(element == '0' for element in zero_list)
84
+ if all_zero:
85
+ if self.count >= 1:
86
+ self.count += 0
87
+ return (
88
+ "ho %s %s" % (ctext, ntext),
89
+ cnum + nnum
90
+ )
91
+ self.count += 1
92
+ return ("%s %s" % (ctext, ntext), cnum + nnum)
93
+
94
+ return ("%s resin %s" % (ctext, ntext), cnum + nnum)
95
+ else:
96
+ return ("%s %s" % (ctext, ntext), cnum + nnum)
97
+
98
+ return (ntext + " " + ctext, cnum * nnum)
99
+
100
+ def ho_result(self, result, value):
101
+ index = result.find('ho')
102
+ count_ho = result.count('ho')
103
+
104
+ if index != -1 and count_ho >= 1:
105
+ index_rihun = result.find('rihun')
106
+ value_str = len(str(value))
107
+ if index_rihun != -1 and value_str > 7:
108
+ result = result.replace("rihun ho", "ho rihun")
109
+ lows = ["kuatr", "tr", "b", "m"]
110
+ MEGA_SUFFIX = "iliaun"
111
+ for low in lows:
112
+ result = result.replace(
113
+ low + MEGA_SUFFIX + " ho", "ho " + low + MEGA_SUFFIX)
114
+ remove_first_ho = result.startswith('ho')
115
+ if remove_first_ho:
116
+ result = result[3:]
117
+ return result
118
+
119
+ def remove_ho(self, result, value):
120
+ value_str = str(value)
121
+ result = self.ho_result(result, value)
122
+ end_value = value_str[:-4]
123
+ end_true = end_value.endswith('0')
124
+ if end_true is False:
125
+ if value > 100:
126
+ if value_str[-1] != '0' and value_str[-2] == '0':
127
+ result = result.replace("ho", "")
128
+ result = result.replace(" ", " ")
129
+
130
+ return result
131
+
132
+ def to_cardinal(self, value):
133
+ result = super().to_cardinal(value)
134
+
135
+ results = self.remove_ho(result, value)
136
+ return results
137
+
138
+ def to_ordinal(self, value):
139
+ self.verify_ordinal(value)
140
+ out = ""
141
+ val = self.splitnum(value)
142
+ outs = val
143
+ while len(val) != 1:
144
+ outs = []
145
+ left, right = val[:2]
146
+ if isinstance(left, tuple) and isinstance(right, tuple):
147
+ outs.append(self.merge(left, right))
148
+ if val[2:]:
149
+ outs.append(val[2:])
150
+ else:
151
+ for elem in val:
152
+ if isinstance(elem, list):
153
+ if len(elem) == 1:
154
+ outs.append(elem[0])
155
+ else:
156
+ outs.append(self.clean(elem))
157
+ else:
158
+ outs.append(elem)
159
+ val = outs
160
+
161
+ words, num = outs[0]
162
+
163
+ words = self.remove_ho(words, value)
164
+
165
+ if num in [90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 5, 3, 2]:
166
+ words = 'da'+words+'k'
167
+ if num in [6, 4]:
168
+ words = 'da'+words
169
+ if num == 1:
170
+ words = 'dahuluk'
171
+ if num in [900, 800, 700, 500, 300, 200, 100]:
172
+ words = 'dah'+words+'k'
173
+ if num in [600, 400]:
174
+ words = 'dah'+words
175
+
176
+ words_split = words.split()
177
+ if len(words_split) >= 3 and num < 100:
178
+ first_word = 'da'+words_split[0]
179
+ second_word = " ".join(words_split[1:])
180
+ if 'haat' in second_word or 'neen' in second_word:
181
+ words = first_word+" "+second_word
182
+ else:
183
+ words = first_word+" "+second_word+'k'
184
+
185
+ word_first = 'dah'+words_split[0]
186
+ if word_first == 'dahatus' and len(words_split) >= 3:
187
+ word_second = " ".join(words_split[1:])
188
+ if 'haat' in word_second or 'neen' in word_second:
189
+ words = word_first+" "+word_second
190
+ else:
191
+ words = word_first+" "+word_second+'k'
192
+
193
+ if len(str(num)) > 3:
194
+ if 'haat' in words_split[-1:] or 'neen' in words_split[-1:]:
195
+ words = 'da'+words
196
+ else:
197
+ words = 'da'+words+'k'
198
+
199
+ result = self.title(out + words)
200
+
201
+ return result
202
+
203
+ def to_ordinal_num(self, value):
204
+ self.verify_ordinal(value)
205
+ return "%sº" % (value)
206
+
207
+ def to_year(self, val, longval=True):
208
+ if val < 0:
209
+ return self.to_cardinal(abs(val)) + ' antes Kristu'
210
+ return self.to_cardinal(val)
211
+
212
+ def to_currency(self, val, currency='USD', cents=True):
213
+ """
214
+ Args:
215
+ val: Numeric value
216
+ currency (str): Currency code
217
+ cents (bool): Verbose cents
218
+ adjective (bool): Prefix currency name with adjective
219
+ Returns:
220
+ str: Formatted string
221
+
222
+ """
223
+ left, right, is_negative = parse_currency_parts(val)
224
+
225
+ try:
226
+ cr1, cr2 = self.CURRENCY_FORMS[currency]
227
+
228
+ except KeyError:
229
+ raise NotImplementedError(
230
+ 'Currency code "%s" not implemented for "%s"' %
231
+ (currency, self.__class__.__name__))
232
+
233
+ minus_str = "%s " % self.negword.strip() if is_negative else ""
234
+ money_str = self._money_verbose(left, currency)
235
+ cents_str = self._cents_verbose(right, currency) \
236
+ if cents else self._cents_terse(right, currency)
237
+
238
+ if right == 0:
239
+ return u'%s%s %s' % (
240
+ minus_str,
241
+ self.pluralize(left, cr1),
242
+ money_str
243
+ )
244
+ else:
245
+ return u'%s%s %s %s %s' % (
246
+ minus_str,
247
+ self.pluralize(left, cr1),
248
+ money_str,
249
+ self.pluralize(right, cr2),
250
+ cents_str
251
+ )
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_TG.py ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import division, print_function, unicode_literals
19
+
20
+ from . import lang_EU
21
+
22
+ GENERIC_DOLLARS = ("доллар", "доллар")
23
+ GENERIC_CENTS = ("сент", "сент")
24
+
25
+
26
+ class Num2Word_TG(lang_EU.Num2Word_EU):
27
+ CURRENCY_FORMS = {
28
+ # repalced by EUR
29
+ "EUR": (("евро", "евро"), GENERIC_CENTS),
30
+ # replaced by EUR
31
+ "USD": (GENERIC_DOLLARS, GENERIC_CENTS),
32
+ "RUB": (("рубл", "рубл"), ("копейк", "копейк")),
33
+ "TJS": (("сомонӣ", "сомонӣ"), ("дирам", "дирам")),
34
+ }
35
+
36
+ GIGA_SUFFIX = "иллиард"
37
+ MEGA_SUFFIX = "иллион"
38
+
39
+ def set_high_numwords(self, high):
40
+ cap = 3 * (len(high) + 1)
41
+
42
+ for word, n in zip(high, range(cap, 5, -3)):
43
+ if n == 9:
44
+ self.cards[10 ** n] = word + self.GIGA_SUFFIX
45
+
46
+ else:
47
+ self.cards[10 ** n] = word + self.MEGA_SUFFIX
48
+
49
+ def setup(self):
50
+ super(Num2Word_TG, self).setup()
51
+
52
+ lows = ["квинт", "квадр", "тр", "м", "м"]
53
+ self.high_numwords = self.gen_high_numwords([], [], lows)
54
+ self.negword = "минус "
55
+ self.pointword = "нуқта"
56
+ self.exclude_title = ["ва", "минус", "нуқта"]
57
+
58
+ self.mid_numwords = [
59
+ (1000, "ҳазор"),
60
+ (100, "сад"),
61
+ (90, "навад"),
62
+ (80, "ҳаштод"),
63
+ (70, "ҳафтод"),
64
+ (60, "шаст"),
65
+ (50, "панҷоҳ"),
66
+ (40, "чил"),
67
+ (30, "си"),
68
+ ]
69
+ self.low_numwords = [
70
+ "бист",
71
+ "нуздаҳ",
72
+ "ҳаждаҳ",
73
+ "ҳабдаҳ",
74
+ "шонздаҳ",
75
+ "понздаҳ",
76
+ "чордаҳ",
77
+ "сенздаҳ",
78
+ "дувоздаҳ",
79
+ "ёздаҳ",
80
+ "даҳ",
81
+ "нӯҳ",
82
+ "ҳашт",
83
+ "ҳафт",
84
+ "шаш",
85
+ "панҷ",
86
+ "чор",
87
+ "се",
88
+ "ду",
89
+ "як",
90
+ "сифр",
91
+ ]
92
+
93
+ def to_cardinal(self, value):
94
+ try:
95
+ assert int(value) == value
96
+ except (ValueError, TypeError, AssertionError):
97
+ return self.to_cardinal_float(value)
98
+
99
+ out = ""
100
+ if value < 0:
101
+ value = abs(value)
102
+ out = self.negword
103
+
104
+ if value >= self.MAXVAL:
105
+ raise OverflowError(self.errmsg_toobig % (value, self.MAXVAL))
106
+
107
+ if value == 100:
108
+ return self.title(out + "сад")
109
+ else:
110
+ val = self.splitnum(value)
111
+ words, num = self.clean(val)
112
+ return self.title(out + words)
113
+
114
+ def merge(self, lpair, rpair):
115
+ ltext, lnum = lpair
116
+ rtext, rnum = rpair
117
+ if lnum == 1 and rnum < 100:
118
+ return (rtext, rnum)
119
+ elif 100 > lnum > rnum:
120
+ if ltext == "си":
121
+ return ("%sю %s" % (ltext, rtext), lnum + rnum)
122
+ elif ltext == "панҷоҳ":
123
+ return ("панҷову %s" % (rtext), lnum + rnum)
124
+ else:
125
+ return ("%sу %s" % (ltext, rtext), lnum + rnum)
126
+ elif lnum >= 100 > rnum:
127
+ return ("%sу %s" % (ltext, rtext), lnum + rnum)
128
+ elif rnum > lnum:
129
+ if ltext == "яксад" and rtext not in self.low_numwords:
130
+ return ("сад %s" % (rtext), lnum * rnum)
131
+ if rtext == "сад":
132
+ return ("%s%s" % (ltext, rtext), lnum * rnum)
133
+ else:
134
+ return ("%s %s" % (ltext, rtext), lnum * rnum)
135
+ return ("%sу %s" % (ltext, rtext), lnum + rnum)
136
+
137
+ def to_ordinal(self, value):
138
+ self.verify_ordinal(value)
139
+ cardinal = self.to_cardinal(value)
140
+ outwords = cardinal.split(" ")
141
+ lastword = outwords[-1]
142
+ if lastword in ["ду", "се", "си"]:
143
+ return "%sюм" % (cardinal)
144
+ else:
145
+ return "%sум" % (cardinal)
146
+
147
+ def to_ordinal_num(self, value):
148
+ self.verify_ordinal(value)
149
+ return "%s%s" % (value, self.to_ordinal(value)[-2:])
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_TH.py ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import unicode_literals
19
+
20
+ from num2words.base import Num2Word_Base
21
+ from num2words.currency import parse_currency_parts
22
+ from num2words.utils import splitbyx
23
+
24
+
25
+ class Num2Word_TH(Num2Word_Base):
26
+
27
+ def setup(self):
28
+ self.negword = 'ติดลบ'
29
+ self.pointword = 'จุด'
30
+
31
+ self.CURRENCY_FORMS = {
32
+ 'THB': (('บาท', 'บาท'), ('สตางค์', 'สตางค์')),
33
+ 'USD': (('ดอลลาร์', 'ดอลลาร์'), ('เซนต์', 'เซนต์')),
34
+ 'EUR': (('ยูโร', 'ยูโร'), ('เซนต์', 'เซนต์')),
35
+ }
36
+
37
+ self.high_numwords = []
38
+
39
+ self.mid_numwords = ['', 'สิบ', 'ร้อย', 'พัน', 'หมื่น', 'แสน', 'ล้าน']
40
+
41
+ self.low_numwords = [
42
+ 'ศูนย์', 'หนึ่ง', 'สอง', 'สาม', 'สี่',
43
+ 'ห้า', 'หก', 'เจ็ด', 'แปด', 'เก้า'
44
+ ]
45
+
46
+ def set_high_numwords(self, high_numwords):
47
+ pass
48
+
49
+ def set_mid_numwords(self, mid_numwords):
50
+ pass
51
+
52
+ def splitnum(self, six_num):
53
+ length = len(six_num) > 1
54
+ word_num = ''
55
+
56
+ for index, num in enumerate(map(int, six_num)):
57
+ if num:
58
+ if index:
59
+ word_num = self.mid_numwords[index] + word_num
60
+
61
+ if length and num == 1 and index == 0:
62
+ word_num += 'เอ็ด'
63
+ elif index == 1 and num == 2:
64
+ word_num = 'ยี่' + word_num
65
+ elif index != 1 or num != 1:
66
+ word_num = self.low_numwords[num] + word_num
67
+
68
+ elif num == 0 and index == 0 and length == 0:
69
+ word_num = self.low_numwords[0]
70
+
71
+ return word_num
72
+
73
+ def split_six(self, num_txt):
74
+ result = splitbyx(num_txt, 6, format_int=False)
75
+ result = list(result)[::-1]
76
+ number_list = []
77
+ for i in result:
78
+ number_list.append(i[::-1])
79
+ return number_list
80
+
81
+ def add_text_million(self, word_num):
82
+ result = ''
83
+
84
+ for index, t in enumerate(reversed(word_num)):
85
+ if index == 0:
86
+ result = t
87
+ else:
88
+ result = result + 'ล้าน' + t
89
+
90
+ return result
91
+
92
+ def round_2_decimal(self, number):
93
+ integer, cents, negative = parse_currency_parts(
94
+ number, is_int_with_cents=False
95
+ )
96
+ integer = '{}'.format(integer)
97
+ cents = '{}'.format(cents)
98
+
99
+ if len(cents) < 2:
100
+ add_zero = 2 - len(cents)
101
+ cents = ('0' * add_zero) + cents
102
+
103
+ text_num = integer + '.' + cents
104
+
105
+ return text_num, negative
106
+
107
+ def left_num_to_text(self, number):
108
+
109
+ left_num_list = self.split_six(number)
110
+
111
+ left_text_list = []
112
+ for i in left_num_list:
113
+ left_text_list.append(self.splitnum(i))
114
+
115
+ left_text = self.add_text_million(left_text_list)
116
+ return left_text
117
+
118
+ def to_cardinal(self, number):
119
+ negative = number < 0
120
+
121
+ pre, post = self.float2tuple(number)
122
+ precision = self.precision
123
+ pre = '{}'.format(pre)
124
+ post = '{}'.format(post)
125
+
126
+ if negative:
127
+ pre = pre.lstrip('-')
128
+
129
+ if len(post) < precision:
130
+ add_zero = precision - len(post)
131
+ post = ('0' * add_zero) + post
132
+
133
+ result = self.left_num_to_text(pre)
134
+
135
+ right_text = ''
136
+ if not post == '0':
137
+ for i in map(int, post):
138
+ right_text = right_text + self.low_numwords[i]
139
+ result = result + 'จุด' + right_text
140
+
141
+ if negative:
142
+ result = 'ติดลบ' + result
143
+
144
+ return result
145
+
146
+ def to_ordinal(self, number):
147
+ return self.to_cardinal(number)
148
+
149
+ def to_currency(self, number, currency='THB'):
150
+
151
+ number, negative = self.round_2_decimal(number)
152
+
153
+ split_num = number.split('.')
154
+
155
+ left_num = split_num[0]
156
+ left_text = self.left_num_to_text(left_num)
157
+
158
+ right_num = split_num[1]
159
+ right_text = self.splitnum(right_num[::-1].rstrip('0'))
160
+
161
+ try:
162
+ cr1, cr2 = self.CURRENCY_FORMS[currency]
163
+
164
+ except KeyError:
165
+ raise NotImplementedError(
166
+ 'Currency code "%s" not implemented for "%s"' %
167
+ (currency, self.__class__.__name__))
168
+
169
+ if right_num == '00':
170
+ if currency == 'THB':
171
+ result = left_text + cr1[0] + 'ถ้วน'
172
+ else:
173
+ result = left_text + cr1[0]
174
+ else:
175
+ if left_num == '0':
176
+ result = right_text + cr2[0]
177
+ else:
178
+ result = left_text + cr1[0] + right_text + cr2[0]
179
+
180
+ if negative:
181
+ result = self.negword + result
182
+
183
+ return result
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_TR.py ADDED
@@ -0,0 +1,856 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+ # Copyright (c) 2017, Tufan Kaynak, Framras. All Rights Reserved.
5
+
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2.1 of the License, or (at your option) any later version.
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ # You should have received a copy of the GNU Lesser General Public
15
+ # License along with this library; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17
+ # MA 02110-1301 USA
18
+
19
+ from __future__ import unicode_literals
20
+
21
+ from .base import Num2Word_Base
22
+
23
+
24
+ class Num2Word_TR(Num2Word_Base):
25
+ def __init__(self):
26
+ self.precision = 2
27
+ self.negword = u"eksi"
28
+ self.pointword = u"virgül"
29
+ self.CURRENCY_UNIT = u"lira"
30
+ self.CURRENCY_SUBUNIT = u"kuruş"
31
+ self.errmsg_nonnum = u"Sadece sayılar yazıya çevrilebilir."
32
+ self.errmsg_floatord = u"Tam sayı olmayan {} sıralamada kullanılamaz."
33
+ self.errmsg_negord = u"Pozitif olmayan {} sıralamada kullanılamaz."
34
+ self.errmsg_toobig = u"abs({}) sayı yazıya çevirmek için çok büyük. " \
35
+ u"Yazıya çevrilebilecek en büyük rakam {}."
36
+ self.exclude_title = []
37
+ self.DECIMAL_SIGN = ","
38
+ self.ORDINAL_SIGN = "."
39
+ self.ZERO = u"sıfır"
40
+ self.CARDINAL_ONES = {
41
+ "1": u"bir",
42
+ "2": u"iki",
43
+ "3": u"üç",
44
+ "4": u"dört",
45
+ "5": u"beş",
46
+ "6": u"altı",
47
+ "7": u"yedi",
48
+ "8": u"sekiz",
49
+ "9": u"dokuz"
50
+ }
51
+ self.ORDINAL_ONES = {
52
+ "1": u"birinci",
53
+ "2": u"ikinci",
54
+ "3": u"üçüncü",
55
+ "4": u"dördüncü",
56
+ "5": u"beşinci",
57
+ "6": u"altıncı",
58
+ "7": u"yedinci",
59
+ "8": u"sekizinci",
60
+ "9": u"dokuzuncu"
61
+ }
62
+ self.CARDINAL_TENS = {
63
+ "1": u"on",
64
+ "2": u"yirmi",
65
+ "3": u"otuz",
66
+ "4": u"kırk",
67
+ "5": u"elli",
68
+ "6": u"altmış",
69
+ "7": u"yetmiş",
70
+ "8": u"seksen",
71
+ "9": u"doksan"
72
+ }
73
+ self.ORDINAL_TENS = {
74
+ "1": u"onuncu",
75
+ "2": u"yirminci",
76
+ "3": u"otuzuncu",
77
+ "4": u"kırkıncı",
78
+ "5": u"ellinci",
79
+ "6": u"altmışıncı",
80
+ "7": u"yetmişinci",
81
+ "8": u"sekseninci",
82
+ "9": u"doksanıncı"
83
+ }
84
+ self.HUNDREDS = {
85
+ "2": u"iki",
86
+ "3": u"üç",
87
+ "4": u"dört",
88
+ "5": u"beş",
89
+ "6": u"altı",
90
+ "7": u"yedi",
91
+ "8": u"sekiz",
92
+ "9": u"dokuz"
93
+ }
94
+ self.CARDINAL_HUNDRED = (u"yüz",)
95
+ self.ORDINAL_HUNDRED = (u"yüzüncü",)
96
+ self.CARDINAL_TRIPLETS = {
97
+ 1: u"bin",
98
+ 2: u"milyon",
99
+ 3: u"milyar",
100
+ 4: u"trilyon",
101
+ 5: u"katrilyon",
102
+ 6: u"kentilyon"
103
+ }
104
+ self.ORDINAL_TRIPLETS = {
105
+ 1: u"bininci",
106
+ 2: u"milyonuncu",
107
+ 3: u"milyarıncı",
108
+ 4: u"trilyonuncu",
109
+ 5: u"katrilyonuncu",
110
+ 6: u"kentilyon"
111
+ }
112
+ self.MAXVAL = (10 ** ((len(self.CARDINAL_TRIPLETS) + 1) * 3)) - 1
113
+
114
+ self.integers_to_read = []
115
+ self.total_triplets_to_read = 0
116
+ self.total_digits_outside_triplets = 0
117
+ self.order_of_last_zero_digit = 0
118
+
119
+ def to_cardinal(self, value):
120
+ wrd = ""
121
+ is_cardinal = self.verify_cardinal(value)
122
+ if not is_cardinal:
123
+ return wrd
124
+
125
+ if not int(value) == value:
126
+ return self.to_cardinal_float(value)
127
+
128
+ if str(value).startswith("-"):
129
+ pre_word, value = self.negword, float(str(value)[1:])
130
+ else:
131
+ pre_word, value = "", float(value)
132
+
133
+ self.to_splitnum(value)
134
+
135
+ if self.order_of_last_zero_digit >= len(self.integers_to_read[0]):
136
+ # number like 00 and all 0s and even more, raise error
137
+ return "%s%s" % (pre_word, wrd)
138
+
139
+ if self.total_triplets_to_read == 1:
140
+ if self.total_digits_outside_triplets == 2:
141
+ if self.order_of_last_zero_digit == 1:
142
+ # number like x0, read cardinal x0 and return
143
+ wrd += self.CARDINAL_TENS.get(
144
+ self.integers_to_read[0][0], ""
145
+ )
146
+ return "%s%s" % (pre_word, wrd)
147
+ if self.order_of_last_zero_digit == 0:
148
+ # number like xy, read cardinal xy and return
149
+ wrd += self.CARDINAL_TENS.get(
150
+ self.integers_to_read[0][0], ""
151
+ )
152
+ wrd += self.CARDINAL_ONES.get(
153
+ self.integers_to_read[0][1], ""
154
+ )
155
+ return "%s%s" % (pre_word, wrd)
156
+
157
+ if self.total_digits_outside_triplets == 1:
158
+ if self.order_of_last_zero_digit == 0:
159
+ # number like x, read cardinal x and return
160
+ wrd += self.CARDINAL_ONES.get(
161
+ self.integers_to_read[0][0], ""
162
+ )
163
+ if self.integers_to_read[0][0] == "0":
164
+ return self.ZERO
165
+ return "%s%s" % (pre_word, wrd)
166
+
167
+ if self.total_digits_outside_triplets == 0:
168
+ if self.order_of_last_zero_digit == 2:
169
+ # number like x00, read cardinal x00 and return
170
+ wrd += self.HUNDREDS.get(
171
+ self.integers_to_read[0][0], ""
172
+ )
173
+ wrd += self.CARDINAL_HUNDRED[0]
174
+ return "%s%s" % (pre_word, wrd)
175
+ if self.order_of_last_zero_digit == 1:
176
+ # number like xy0, read cardinal xy0 and return
177
+ wrd += self.HUNDREDS.get(
178
+ self.integers_to_read[0][0], ""
179
+ )
180
+ wrd += self.CARDINAL_HUNDRED[0]
181
+ wrd += self.CARDINAL_TENS.get(
182
+ self.integers_to_read[0][1], ""
183
+ )
184
+ return "%s%s" % (pre_word, wrd)
185
+ if self.order_of_last_zero_digit == 0:
186
+ # number like xyz, read cardinal xyz and return
187
+ wrd += self.HUNDREDS.get(
188
+ self.integers_to_read[0][0], ""
189
+ )
190
+ wrd += self.CARDINAL_HUNDRED[0]
191
+ wrd += self.CARDINAL_TENS.get(
192
+ self.integers_to_read[0][1], ""
193
+ )
194
+ wrd += self.CARDINAL_ONES.get(
195
+ self.integers_to_read[0][2], ""
196
+ )
197
+ return "%s%s" % (pre_word, wrd)
198
+
199
+ if self.total_triplets_to_read >= 2:
200
+ if self.total_digits_outside_triplets == 2:
201
+ if self.order_of_last_zero_digit == len(
202
+ self.integers_to_read[0]) - 1:
203
+ # number like x0 and all 0s, read cardinal x0 0..0
204
+ # and return
205
+ wrd += self.CARDINAL_TENS.get(
206
+ self.integers_to_read[0][0], ""
207
+ )
208
+ wrd += self.CARDINAL_TRIPLETS[
209
+ self.total_triplets_to_read - 1
210
+ ]
211
+ return "%s%s" % (pre_word, wrd)
212
+ if self.order_of_last_zero_digit == len(
213
+ self.integers_to_read[0]) - 2:
214
+ # number like xy and all 0s, read cardinal xy 0..0
215
+ # and return
216
+ wrd += self.CARDINAL_TENS.get(
217
+ self.integers_to_read[0][0], ""
218
+ )
219
+ wrd += self.CARDINAL_ONES.get(
220
+ self.integers_to_read[0][1], ""
221
+ )
222
+ wrd += self.CARDINAL_TRIPLETS[
223
+ self.total_triplets_to_read - 1
224
+ ]
225
+ return "%s%s" % (pre_word, wrd)
226
+ if self.order_of_last_zero_digit < len(
227
+ self.integers_to_read[0]) - 2:
228
+ # number like xy and others, read cardinal xy n..n
229
+ # and return
230
+ wrd += self.CARDINAL_TENS.get(
231
+ self.integers_to_read[0][0], ""
232
+ )
233
+ wrd += self.CARDINAL_ONES.get(
234
+ self.integers_to_read[0][1], ""
235
+ )
236
+ wrd += self.CARDINAL_TRIPLETS[
237
+ self.total_triplets_to_read - 1
238
+ ]
239
+
240
+ if self.total_digits_outside_triplets == 1:
241
+ if self.order_of_last_zero_digit == len(
242
+ self.integers_to_read[0]) - 1:
243
+ # number like x and all 0s, read cardinal x 0..0
244
+ # and return
245
+ if not (self.total_triplets_to_read == 2 and
246
+ self.integers_to_read[0][0] == "1"):
247
+ wrd += self.CARDINAL_ONES.get(
248
+ self.integers_to_read[0][0], ""
249
+ )
250
+ wrd += self.CARDINAL_TRIPLETS[
251
+ self.total_triplets_to_read - 1
252
+ ]
253
+ return "%s%s" % (pre_word, wrd)
254
+ if self.order_of_last_zero_digit < len(
255
+ self.integers_to_read[0]) - 1:
256
+ # number like x and others, read cardinal x n..n
257
+ # and return
258
+ if not (self.total_triplets_to_read == 2 and
259
+ self.integers_to_read[0][0] == "1"):
260
+ wrd += self.CARDINAL_ONES.get(
261
+ self.integers_to_read[0][0], ""
262
+ )
263
+ wrd += self.CARDINAL_TRIPLETS[
264
+ self.total_triplets_to_read - 1
265
+ ]
266
+
267
+ if self.total_digits_outside_triplets == 0:
268
+ if self.order_of_last_zero_digit == len(
269
+ self.integers_to_read[0]) - 1:
270
+ # number like x00 and all 0s, read cardinal x00 0..0
271
+ # and return
272
+ wrd += self.HUNDREDS.get(self.integers_to_read[0][0], "")
273
+ wrd += self.CARDINAL_HUNDRED[0]
274
+ wrd += self.CARDINAL_TRIPLETS[
275
+ self.total_triplets_to_read - 1
276
+ ]
277
+ return "%s%s" % (pre_word, wrd)
278
+ if self.order_of_last_zero_digit == len(
279
+ self.integers_to_read[0]) - 2:
280
+ # number like xy0 and all 0s, read cardinal xy0 0..0
281
+ # and return
282
+ wrd += self.HUNDREDS.get(
283
+ self.integers_to_read[0][0], ""
284
+ )
285
+ wrd += self.CARDINAL_HUNDRED[0]
286
+ wrd += self.CARDINAL_TENS.get(
287
+ self.integers_to_read[0][1], ""
288
+ )
289
+ wrd += self.CARDINAL_TRIPLETS[
290
+ self.total_triplets_to_read - 1
291
+ ]
292
+ return "%s%s" % (pre_word, wrd)
293
+ if self.order_of_last_zero_digit == len(
294
+ self.integers_to_read[0]) - 3:
295
+ # number like xyz and all 0s, read cardinal xyz 0..0
296
+ # and return
297
+ wrd += self.HUNDREDS.get(self.integers_to_read[0][0], "")
298
+ wrd += self.CARDINAL_HUNDRED[0]
299
+ wrd += self.CARDINAL_TENS.get(
300
+ self.integers_to_read[0][1], ""
301
+ )
302
+ wrd += self.CARDINAL_ONES.get(
303
+ self.integers_to_read[0][2], ""
304
+ )
305
+ wrd += self.CARDINAL_TRIPLETS[
306
+ self.total_triplets_to_read - 1
307
+ ]
308
+ return "%s%s" % (pre_word, wrd)
309
+ if self.order_of_last_zero_digit < len(
310
+ self.integers_to_read[0]) - 3:
311
+ # number like xyz and all others, read cardinal xyz n..n
312
+ wrd += self.HUNDREDS.get(self.integers_to_read[0][0], "")
313
+ wrd += self.CARDINAL_HUNDRED[0]
314
+ wrd += self.CARDINAL_TENS.get(
315
+ self.integers_to_read[0][1], ""
316
+ )
317
+ if not (self.total_triplets_to_read == 2 and
318
+ self.integers_to_read[0][2] == "1"):
319
+ wrd += self.CARDINAL_ONES.get(
320
+ self.integers_to_read[0][2], ""
321
+ )
322
+ wrd += self.CARDINAL_TRIPLETS[
323
+ self.total_triplets_to_read - 1
324
+ ]
325
+
326
+ for i in list(range(self.total_triplets_to_read - 1, 0, -1)):
327
+ reading_triplet_order = self.total_triplets_to_read - i
328
+ if self.total_digits_outside_triplets == 0:
329
+ last_read_digit_order = reading_triplet_order * 3
330
+ else:
331
+ last_read_digit_order = (reading_triplet_order - 1) * 3 +\
332
+ self.total_digits_outside_triplets
333
+
334
+ if not self.integers_to_read[0][
335
+ last_read_digit_order: last_read_digit_order + 3
336
+ ] == "000":
337
+ if not self.integers_to_read[0][
338
+ last_read_digit_order
339
+ ] == "0":
340
+ wrd += self.HUNDREDS.get(
341
+ self.integers_to_read[0][last_read_digit_order], ""
342
+ )
343
+ if self.order_of_last_zero_digit == len(
344
+ self.integers_to_read[0]) - (
345
+ last_read_digit_order) - 1:
346
+ if i == 1:
347
+ wrd += self.CARDINAL_HUNDRED[0]
348
+ return "%s%s" % (pre_word, wrd)
349
+ elif i > 1:
350
+ wrd += self.CARDINAL_HUNDRED[0]
351
+ wrd += self.CARDINAL_TRIPLETS[i - 1]
352
+ return "%s%s" % (pre_word, wrd)
353
+ else:
354
+ wrd += self.CARDINAL_HUNDRED[0]
355
+
356
+ if not self.integers_to_read[0][
357
+ last_read_digit_order + 1] == "0":
358
+ if self.order_of_last_zero_digit == len(
359
+ self.integers_to_read[0]) - (
360
+ last_read_digit_order) - 2:
361
+ if i == 1:
362
+ wrd += self.CARDINAL_TENS.get(
363
+ self.integers_to_read[0][
364
+ last_read_digit_order + 1], ""
365
+ )
366
+ return "%s%s" % (pre_word, wrd)
367
+ elif i > 1:
368
+ wrd += self.CARDINAL_TENS.get(
369
+ self.integers_to_read[0][
370
+ last_read_digit_order + 1], ""
371
+ )
372
+ wrd += self.CARDINAL_TRIPLETS[i - 1]
373
+ return "%s%s" % (pre_word, wrd)
374
+ else:
375
+ wrd += self.CARDINAL_TENS.get(
376
+ self.integers_to_read[0][
377
+ last_read_digit_order + 1], ""
378
+ )
379
+
380
+ if not self.integers_to_read[0][
381
+ last_read_digit_order + 2] == "0":
382
+ if self.order_of_last_zero_digit == len(
383
+ self.integers_to_read[0]) - (
384
+ last_read_digit_order) - 3:
385
+ if i == 1:
386
+ wrd += self.CARDINAL_ONES.get(
387
+ self.integers_to_read[0][
388
+ last_read_digit_order + 2], ""
389
+ )
390
+ return "%s%s" % (pre_word, wrd)
391
+ if i == 2:
392
+ if not self.integers_to_read[0][
393
+ last_read_digit_order:
394
+ last_read_digit_order + 2
395
+ ] == "00":
396
+ wrd += self.CARDINAL_ONES.get(
397
+ self.integers_to_read[0][
398
+ last_read_digit_order + 2], ""
399
+ )
400
+ elif not self.integers_to_read[0][
401
+ last_read_digit_order + 2] == "1":
402
+ wrd += self.CARDINAL_ONES.get(
403
+ self.integers_to_read[0][
404
+ last_read_digit_order + 2], ""
405
+ )
406
+ wrd += self.CARDINAL_TRIPLETS[i - 1]
407
+ return "%s%s" % (pre_word, wrd)
408
+ if i > 2:
409
+ wrd += self.CARDINAL_ONES.get(
410
+ self.integers_to_read[0][
411
+ last_read_digit_order + 2], ""
412
+ )
413
+ wrd += self.CARDINAL_TRIPLETS[i - 1]
414
+ return "%s%s" % (pre_word, wrd)
415
+ else:
416
+ if not self.integers_to_read[0][
417
+ last_read_digit_order:
418
+ last_read_digit_order + 2
419
+ ] == "00":
420
+ wrd += self.CARDINAL_ONES.get(
421
+ self.integers_to_read[0][
422
+ last_read_digit_order + 2], ""
423
+ )
424
+ else:
425
+ if i == 2:
426
+ if not self.integers_to_read[0][
427
+ last_read_digit_order:
428
+ last_read_digit_order + 2
429
+ ] == "00":
430
+ wrd += self.CARDINAL_ONES.get(
431
+ self.integers_to_read[0][
432
+ last_read_digit_order + 2], ""
433
+ )
434
+ elif not self.integers_to_read[0][
435
+ last_read_digit_order + 2
436
+ ] == "1":
437
+ wrd += self.CARDINAL_ONES.get(
438
+ self.integers_to_read[0][
439
+ last_read_digit_order + 2], ""
440
+ )
441
+
442
+ wrd += self.CARDINAL_TRIPLETS[i - 1]
443
+
444
+ return "%s%s" % (pre_word, wrd)
445
+
446
+ def to_cardinal_float(self, value):
447
+ self.to_splitnum(value)
448
+ wrd = ""
449
+ wrd += self.pointword
450
+ if len(self.integers_to_read[1]) >= 1:
451
+ wrd += self.CARDINAL_TENS.get(self.integers_to_read[1][0], "")
452
+
453
+ if len(self.integers_to_read[1]) == 2:
454
+ wrd += self.CARDINAL_ONES.get(self.integers_to_read[1][1], "")
455
+
456
+ if self.integers_to_read[0] == "0":
457
+ wrd = self.ZERO + wrd
458
+ else:
459
+ wrd = self.to_cardinal(int(self.integers_to_read[0])) + wrd
460
+ return wrd
461
+
462
+ def verify_cardinal(self, value):
463
+ iscardinal = True
464
+ try:
465
+ if not float(value) == value:
466
+ iscardinal = False
467
+ except (ValueError, TypeError):
468
+ raise TypeError(self.errmsg_nonnum)
469
+ if abs(value) >= self.MAXVAL:
470
+ raise OverflowError(self.errmsg_toobig.format(value, self.MAXVAL))
471
+ return iscardinal
472
+
473
+ def verify_ordinal(self, value):
474
+ isordinal = True
475
+ try:
476
+ if not int(value) == value:
477
+ isordinal = False
478
+ if not abs(value) == value:
479
+ raise TypeError(self.errmsg_negord.format(value))
480
+ except (ValueError, TypeError):
481
+ raise TypeError(self.errmsg_nonnum)
482
+ if abs(value) >= self.MAXVAL:
483
+ raise OverflowError(self.errmsg_toobig.format(value, self.MAXVAL))
484
+ return isordinal
485
+
486
+ def to_ordinal(self, value):
487
+ wrd = ""
488
+ isordinal = self.verify_ordinal(value)
489
+ if isordinal:
490
+ self.to_splitnum(value)
491
+
492
+ if self.order_of_last_zero_digit >= len(self.integers_to_read[0]):
493
+ # number like 00 and all 0s and even more, raise error
494
+ return wrd
495
+
496
+ if self.total_triplets_to_read == 1:
497
+ if self.total_digits_outside_triplets == 2:
498
+ if self.order_of_last_zero_digit == 1:
499
+ # number like x0, read ordinal x0 and return
500
+ wrd += self.ORDINAL_TENS.get(
501
+ self.integers_to_read[0][0], ""
502
+ )
503
+ return wrd
504
+ if self.order_of_last_zero_digit == 0:
505
+ # number like xy, read ordinal xy and return
506
+ wrd += self.CARDINAL_TENS.get(
507
+ self.integers_to_read[0][0], ""
508
+ )
509
+ wrd += self.ORDINAL_ONES.get(
510
+ self.integers_to_read[0][1], ""
511
+ )
512
+ return wrd
513
+
514
+ if self.total_digits_outside_triplets == 1:
515
+ if self.order_of_last_zero_digit == 0:
516
+ # number like x, read ordinal x and return
517
+ wrd += self.ORDINAL_ONES.get(
518
+ self.integers_to_read[0][0], ""
519
+ )
520
+ if self.integers_to_read[0][0] == "0":
521
+ return u"sıfırıncı"
522
+ return wrd
523
+
524
+ if self.total_digits_outside_triplets == 0:
525
+ if self.order_of_last_zero_digit == 2:
526
+ # number like x00, read ordinal x00 and return
527
+ wrd += self.HUNDREDS.get(
528
+ self.integers_to_read[0][0], ""
529
+ )
530
+ wrd += self.ORDINAL_HUNDRED[0]
531
+ return wrd
532
+ if self.order_of_last_zero_digit == 1:
533
+ # number like xy0, read ordinal xy0 and return
534
+ wrd += self.HUNDREDS.get(
535
+ self.integers_to_read[0][0], ""
536
+ )
537
+ wrd += self.CARDINAL_HUNDRED[0]
538
+ wrd += self.ORDINAL_TENS.get(
539
+ self.integers_to_read[0][1], ""
540
+ )
541
+ return wrd
542
+ if self.order_of_last_zero_digit == 0:
543
+ # number like xyz, read ordinal xyz and return
544
+ wrd += self.HUNDREDS.get(
545
+ self.integers_to_read[0][0], ""
546
+ )
547
+ wrd += self.CARDINAL_HUNDRED[0]
548
+ wrd += self.CARDINAL_TENS.get(
549
+ self.integers_to_read[0][1], ""
550
+ )
551
+ if not self.integers_to_read[0][2] == "0":
552
+ wrd += self.ORDINAL_ONES.get(
553
+ self.integers_to_read[0][2], ""
554
+ )
555
+ return wrd
556
+
557
+ if self.total_triplets_to_read >= 2:
558
+ if self.total_digits_outside_triplets == 2:
559
+ if self.order_of_last_zero_digit == len(
560
+ self.integers_to_read[0]) - 1:
561
+ # number like x0 and all 0s, read ordinal x0 0..0
562
+ # and return
563
+ wrd += self.CARDINAL_TENS.get(
564
+ self.integers_to_read[0][0], ""
565
+ )
566
+ wrd += self.ORDINAL_TRIPLETS[
567
+ self.total_triplets_to_read - 1
568
+ ]
569
+ return wrd
570
+ if self.order_of_last_zero_digit == len(
571
+ self.integers_to_read[0]) - 2:
572
+ # number like xy and all 0s, read ordinal xy 0..0
573
+ # and return
574
+ wrd += self.CARDINAL_TENS.get(
575
+ self.integers_to_read[0][0], ""
576
+ )
577
+ wrd += self.CARDINAL_ONES.get(
578
+ self.integers_to_read[0][1], ""
579
+ )
580
+ wrd += self.ORDINAL_TRIPLETS[
581
+ self.total_triplets_to_read - 1
582
+ ]
583
+ return wrd
584
+ if self.order_of_last_zero_digit < len(
585
+ self.integers_to_read[0]) - 2:
586
+ # number like xy and others, read cardinal xy n..n
587
+ # and return
588
+ wrd += self.CARDINAL_TENS.get(
589
+ self.integers_to_read[0][0], ""
590
+ )
591
+ wrd += self.CARDINAL_ONES.get(
592
+ self.integers_to_read[0][1], ""
593
+ )
594
+ wrd += self.CARDINAL_TRIPLETS[
595
+ self.total_triplets_to_read - 1
596
+ ]
597
+
598
+ if self.total_digits_outside_triplets == 1:
599
+ if self.order_of_last_zero_digit == len(
600
+ self.integers_to_read[0]) - 1:
601
+ # number like x and all 0s, read ordinal x 0..0
602
+ # and return
603
+ if not (self.total_triplets_to_read == 2 and
604
+ self.integers_to_read[0][0] == "1"):
605
+ wrd += self.CARDINAL_ONES.get(
606
+ self.integers_to_read[0][0], ""
607
+ )
608
+ wrd += self.ORDINAL_TRIPLETS[
609
+ self.total_triplets_to_read - 1
610
+ ]
611
+ return wrd
612
+ if self.order_of_last_zero_digit < len(
613
+ self.integers_to_read[0]) - 1:
614
+ # number like x and others, read cardinal x n..n
615
+ # and return
616
+ if not (self.total_triplets_to_read == 2 and
617
+ self.integers_to_read[0][0] == "1"):
618
+ wrd += self.CARDINAL_ONES.get(
619
+ self.integers_to_read[0][0], ""
620
+ )
621
+ wrd += self.CARDINAL_TRIPLETS[
622
+ self.total_triplets_to_read - 1
623
+ ]
624
+
625
+ if self.total_digits_outside_triplets == 0:
626
+ if self.order_of_last_zero_digit == len(
627
+ self.integers_to_read[0]) - 1:
628
+ # number like x00 and all 0s, read ordinal x00 0..0
629
+ # and return
630
+ wrd += self.HUNDREDS.get(
631
+ self.integers_to_read[0][0], ""
632
+ )
633
+ wrd += self.CARDINAL_HUNDRED[0]
634
+ wrd += self.ORDINAL_TRIPLETS[
635
+ self.total_triplets_to_read - 1
636
+ ]
637
+ return wrd
638
+ if self.order_of_last_zero_digit == len(
639
+ self.integers_to_read[0]) - 2:
640
+ # number like xy0 and all 0s, read ordinal xy0 0..0
641
+ # and return
642
+ wrd += self.HUNDREDS.get(
643
+ self.integers_to_read[0][0], ""
644
+ )
645
+ wrd += self.CARDINAL_HUNDRED[0]
646
+ wrd += self.CARDINAL_TENS.get(
647
+ self.integers_to_read[0][1], ""
648
+ )
649
+ wrd += self.ORDINAL_TRIPLETS[
650
+ self.total_triplets_to_read - 1
651
+ ]
652
+ return wrd
653
+ if self.order_of_last_zero_digit == len(
654
+ self.integers_to_read[0]) - 3:
655
+ # number like xyz and all 0s, read ordinal xyz 0..0
656
+ # and return
657
+ wrd += self.HUNDREDS.get(
658
+ self.integers_to_read[0][0], ""
659
+ )
660
+ wrd += self.CARDINAL_HUNDRED[0]
661
+ wrd += self.CARDINAL_TENS.get(
662
+ self.integers_to_read[0][1], ""
663
+ )
664
+ wrd += self.CARDINAL_ONES.get(
665
+ self.integers_to_read[0][2], ""
666
+ )
667
+ wrd += self.ORDINAL_TRIPLETS[
668
+ self.total_triplets_to_read - 1
669
+ ]
670
+ return wrd
671
+ if self.order_of_last_zero_digit < len(
672
+ self.integers_to_read[0]) - 3:
673
+ # number like xyz and all others, read cardinal
674
+ # xyz n..n
675
+ wrd += self.HUNDREDS.get(
676
+ self.integers_to_read[0][0], ""
677
+ )
678
+ wrd += self.CARDINAL_HUNDRED[0]
679
+ wrd += self.CARDINAL_TENS.get(
680
+ self.integers_to_read[0][1], ""
681
+ )
682
+ if not (self.total_triplets_to_read == 2 and
683
+ self.integers_to_read[0][2] == "1"):
684
+ wrd += self.CARDINAL_ONES.get(
685
+ self.integers_to_read[0][2], ""
686
+ )
687
+ wrd += self.CARDINAL_TRIPLETS[
688
+ self.total_triplets_to_read - 1
689
+ ]
690
+
691
+ for i in list(range(self.total_triplets_to_read - 1, 0, -1)):
692
+ reading_triplet_order = self.total_triplets_to_read - i
693
+ if self.total_digits_outside_triplets == 0:
694
+ last_read_digit_order = reading_triplet_order * 3
695
+ else:
696
+ last_read_digit_order = \
697
+ (reading_triplet_order - 1) * 3 + \
698
+ self.total_digits_outside_triplets
699
+
700
+ if not self.integers_to_read[0][
701
+ last_read_digit_order: last_read_digit_order + 3
702
+ ] == "000":
703
+ if not self.integers_to_read[0][
704
+ last_read_digit_order
705
+ ] == "0":
706
+ if not self.integers_to_read[0][
707
+ last_read_digit_order
708
+ ] == "1":
709
+ wrd += self.CARDINAL_ONES.get(
710
+ self.integers_to_read[0][
711
+ last_read_digit_order
712
+ ], ""
713
+ )
714
+ if self.order_of_last_zero_digit == len(
715
+ self.integers_to_read[0]) - (
716
+ last_read_digit_order) - 1:
717
+ if i == 1:
718
+ wrd += self.ORDINAL_HUNDRED[0]
719
+ return wrd
720
+ elif i > 1:
721
+ wrd += self.CARDINAL_HUNDRED[0]
722
+ wrd += self.ORDINAL_TRIPLETS[i - 1]
723
+ return wrd
724
+ else:
725
+ wrd += self.CARDINAL_HUNDRED[0]
726
+
727
+ if not self.integers_to_read[0][
728
+ last_read_digit_order + 1
729
+ ] == "0":
730
+ if self.order_of_last_zero_digit == len(
731
+ self.integers_to_read[0]) - (
732
+ last_read_digit_order) - 2:
733
+ if i == 1:
734
+ wrd += self.ORDINAL_TENS.get(
735
+ self.integers_to_read[0][
736
+ last_read_digit_order + 1], ""
737
+ )
738
+ return wrd
739
+ elif i > 1:
740
+ wrd += self.CARDINAL_TENS.get(
741
+ self.integers_to_read[0][
742
+ last_read_digit_order + 1], ""
743
+ )
744
+ wrd += self.ORDINAL_TRIPLETS[i - 1]
745
+ return wrd
746
+ else:
747
+ wrd += self.CARDINAL_TENS.get(
748
+ self.integers_to_read[0][
749
+ last_read_digit_order + 1], ""
750
+ )
751
+
752
+ if not self.integers_to_read[0][
753
+ last_read_digit_order + 2
754
+ ] == "0":
755
+ if self.order_of_last_zero_digit == len(
756
+ self.integers_to_read[0]) - (
757
+ last_read_digit_order) - 3:
758
+ if i == 1:
759
+ wrd += self.ORDINAL_ONES.get(
760
+ self.integers_to_read[0][
761
+ last_read_digit_order + 2], ""
762
+ )
763
+ return wrd
764
+ if i == 2:
765
+ if not self.integers_to_read[0][
766
+ last_read_digit_order:
767
+ last_read_digit_order + 2] == "00":
768
+ wrd += self.CARDINAL_ONES.get(
769
+ self.integers_to_read[0][
770
+ last_read_digit_order + 2], ""
771
+ )
772
+ elif not self.integers_to_read[0][
773
+ last_read_digit_order + 2
774
+ ] == "1":
775
+ wrd += self.CARDINAL_ONES.get(
776
+ self.integers_to_read[0][
777
+ last_read_digit_order + 2], ""
778
+ )
779
+ wrd += self.ORDINAL_TRIPLETS[i - 1]
780
+ return wrd
781
+ if i > 2:
782
+ wrd += self.CARDINAL_ONES.get(
783
+ self.integers_to_read[0][
784
+ last_read_digit_order + 2], ""
785
+ )
786
+ wrd += self.ORDINAL_TRIPLETS[i - 1]
787
+ return wrd
788
+ else:
789
+ if not self.integers_to_read[0][
790
+ last_read_digit_order:
791
+ last_read_digit_order + 2] == "00":
792
+ wrd += self.CARDINAL_ONES.get(
793
+ self.integers_to_read[0][
794
+ last_read_digit_order + 2], ""
795
+ )
796
+ else:
797
+ if not self.integers_to_read[0][
798
+ last_read_digit_order:
799
+ last_read_digit_order + 2] == "00":
800
+ wrd += self.CARDINAL_ONES.get(
801
+ self.integers_to_read[0][
802
+ last_read_digit_order + 2], ""
803
+ )
804
+ elif not self.integers_to_read[0][
805
+ last_read_digit_order + 2] == "1":
806
+ wrd += self.CARDINAL_ONES.get(
807
+ self.integers_to_read[0][
808
+ last_read_digit_order + 2], ""
809
+ )
810
+
811
+ wrd += self.CARDINAL_TRIPLETS[i - 1]
812
+
813
+ return wrd
814
+
815
+ def to_ordinal_num(self, value):
816
+ self.verify_ordinal(value)
817
+ return "%s%s" % (value, self.to_ordinal(value)[-4:])
818
+
819
+ def to_splitnum(self, val):
820
+ float_digits = str(int(val * 10 ** self.precision))
821
+ if not int(val) == 0:
822
+ self.integers_to_read = [
823
+ str(int(val)),
824
+ float_digits[len(float_digits) - self.precision:]
825
+ ]
826
+ else:
827
+ self.integers_to_read = [
828
+ "0",
829
+ "0" * (self.precision - len(float_digits)) +
830
+ float_digits[len(float_digits) - self.precision:]
831
+ ]
832
+ if len(self.integers_to_read[0]) % 3 > 0:
833
+ self.total_triplets_to_read = (len(self.integers_to_read[0]) // 3)\
834
+ + 1
835
+ elif len(self.integers_to_read[0]) % 3 == 0:
836
+ self.total_triplets_to_read = len(self.integers_to_read[0]) // 3
837
+ self.total_digits_outside_triplets = len(self.integers_to_read[0]) % 3
838
+
839
+ okunacak = list(self.integers_to_read[0][::-1])
840
+ self.order_of_last_zero_digit = 0
841
+ found = 0
842
+ for i in range(len(okunacak) - 1):
843
+ if int(okunacak[i]) == 0 and found == 0:
844
+ self.order_of_last_zero_digit = i + 1
845
+ else:
846
+ found = 1
847
+
848
+ def to_currency(self, value):
849
+ if int(value) == 0:
850
+ return u"bedelsiz"
851
+ valueparts = self.to_cardinal(value).split(self.pointword)
852
+ if len(valueparts) == 1:
853
+ return valueparts[0] + self.CURRENCY_UNIT
854
+ if len(valueparts) == 2:
855
+ return self.CURRENCY_UNIT.join(valueparts) + \
856
+ self.CURRENCY_SUBUNIT
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_UK.py ADDED
@@ -0,0 +1,1067 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import unicode_literals
19
+
20
+ from .base import Num2Word_Base
21
+ from .utils import get_digits, splitbyx
22
+
23
+ ZERO = ('нуль',)
24
+
25
+ ONES_FEMININE = {
26
+ 1: ('одна', "однієї", "одній", "одну", "однією", "одній"),
27
+ 2: ('дві', "двох", "двом", "дві", "двома", "двох"),
28
+ 3: ('три', "трьох", "трьом", "три", "трьома", "трьох"),
29
+ 4: ('чотири', "чотирьох", "чотирьом", "чотири", "чотирма", "чотирьох"),
30
+ 5: ('п\'ять', "п'яти", "п'яти", "п'ять", "п'ятьма", "п'яти"),
31
+ 6: ('шість', "шести", "шести", "шість", "шістьма", "шести"),
32
+ 7: ('сім', "семи", "семи", "сім", "сьома", "семи"),
33
+ 8: ('вісім', "восьми", "восьми", "вісім", "вісьма", "восьми"),
34
+ 9: ("дев'ять", "дев'яти", "дев'яти", "дев'ять", "дев'ятьма", "дев'яти"),
35
+ }
36
+
37
+ ONES = {
38
+ 1: ('один', 'одного', "одному", "один", "одним", "одному"),
39
+ 2: ('два', 'двох', "двом", "два", "двома", "двох"),
40
+ 3: ('три', 'трьох', "трьом", "три", "трьома", "трьох"),
41
+ 4: ('чотири', 'чотирьох', "чотирьом", "чотири", "чотирма", "чотирьох"),
42
+ 5: ('п\'ять', "п'яти", "п'яти", "п'ять", "п'ятьма", "п'яти"),
43
+ 6: ('шість', 'шести', "шести", "шість", "шістьма", "шести"),
44
+ 7: ('сім', 'семи', "семи", "сім", "сьома", "семи"),
45
+ 8: ('вісім', 'восьми', "восьми", "вісім", "вісьма", "восьми"),
46
+ 9: ("дев'ять", "дев'яти", "дев'яти", "дев'ять", "дев'ятьма", "дев'яти"),
47
+ }
48
+
49
+ ONES_ORDINALS = {
50
+ 1: ("перший", "одно"),
51
+ 2: ("другий", "двох"),
52
+ 3: ("третій", "трьох"),
53
+ 4: ("четвертий", "чотирьох"),
54
+ 5: ("п'ятий", "п'яти"),
55
+ 6: ("шостий", "шести"),
56
+ 7: ("сьомий", "семи"),
57
+ 8: ("восьмий", "восьми"),
58
+ 9: ("дев'ятий", "дев'яти"),
59
+ 10: ("десятий", "десяти"),
60
+ 11: ("одинадцятий", "одинадцяти"),
61
+ 12: ("дванадцятий", "дванадцяти"),
62
+ 13: ("тринадцятий", "тринадцяти"),
63
+ 14: ("чотирнадцятий", "чотирнадцяти"),
64
+ 15: ("п'ятнадцятий", "п'ятнадцяти"),
65
+ 16: ("шістнадцятий", "шістнадцяти"),
66
+ 17: ("сімнадцятий", "сімнадцяти"),
67
+ 18: ("вісімнадцятий", "вісімнадцяти"),
68
+ 19: ("дев'ятнадцятий", "дев'ятнадцяти"),
69
+ }
70
+ TENS = {
71
+ 0: ('десять',
72
+ 'десяти',
73
+ "десяти",
74
+ "десять",
75
+ "десятьма",
76
+ "десяти"),
77
+ 1: ('одинадцять',
78
+ 'одинадцяти',
79
+ "одинадцяти",
80
+ "одинадцять",
81
+ "одинадцятьма",
82
+ "одинадцяти"),
83
+ 2: ('дванадцять',
84
+ 'дванадцяти',
85
+ "дванадцяти",
86
+ "дванадцять",
87
+ "дванадцятьма",
88
+ "дванадцяти"),
89
+ 3: ('тринадцять',
90
+ 'тринадцяти',
91
+ "тринадцяти",
92
+ "тринадцять",
93
+ "тринадцятьма",
94
+ "тринадцяти"),
95
+ 4: ('чотирнадцять',
96
+ 'чотирнадцяти',
97
+ "чотирнадцяти",
98
+ "чотирнадцять",
99
+ "чотирнадцятьма",
100
+ "чотирнадцяти"),
101
+ 5: ("п'ятнадцять",
102
+ "п'ятнадцяти",
103
+ "п'ятнадцяти",
104
+ "п'ятнадцять",
105
+ "п'ятнадцятьма",
106
+ "п'ятнадцяти"),
107
+ 6: ('шістнадцять',
108
+ 'шістнадцяти',
109
+ "шістнадцяти",
110
+ "шістнадцять",
111
+ "шістнадцятьма",
112
+ "шістнадцяти"),
113
+ 7: ('сімнадцять',
114
+ 'сімнадцяти',
115
+ "сімнадцяти",
116
+ "сімнадцять",
117
+ "сімнадцятьма",
118
+ "сімнадцяти"),
119
+ 8: ('вісімнадцять',
120
+ 'вісімнадцяти',
121
+ "вісімнадцяти",
122
+ "вісімнадцять",
123
+ "вісімнадцятьма",
124
+ "вісімнадцяти"),
125
+ 9: ("дев'ятнадцять",
126
+ "дев'ятнадцяти",
127
+ "дев'ятнадцяти",
128
+ "дев'ятнадцять",
129
+ "дев'ятнадцятьма",
130
+ "дев'ятнадцяти"),
131
+ }
132
+
133
+ TWENTIES = {
134
+ 2: ('двадцять',
135
+ "двадцяти",
136
+ "двадцяти",
137
+ "двадцять",
138
+ "двадцятьма",
139
+ "двадцяти"),
140
+ 3: ('тридцять',
141
+ "тридцяти",
142
+ "тридцяти",
143
+ "тридцять",
144
+ "тридцятьма",
145
+ "тридцяти"),
146
+ 4: ('сорок',
147
+ "сорока",
148
+ "сорока",
149
+ "сорок",
150
+ "сорока",
151
+ "сорока"),
152
+ 5: ('п\'ятдесят',
153
+ "п'ятдесяти",
154
+ "п'ятдесяти",
155
+ "п'ятдесят",
156
+ "п'ятдесятьма",
157
+ "п'ятдесяти"),
158
+ 6: ('шістдесят',
159
+ "шістдесяти",
160
+ "шістдесяти",
161
+ "шістдесят",
162
+ "шістдесятьма",
163
+ "шістдесяти"),
164
+ 7: ('сімдесят',
165
+ "сімдесяти",
166
+ "сімдесяти",
167
+ "сімдесят",
168
+ "сімдесятьма",
169
+ "сімдесяти"),
170
+ 8: ('вісімдесят',
171
+ "вісімдесяти",
172
+ "вісімдесяти",
173
+ "вісімдесят",
174
+ "вісімдесятьма",
175
+ "вісімдесяти"),
176
+ 9: ('дев\'яносто',
177
+ "дев'яноста",
178
+ "дев'яноста",
179
+ "дев'яносто",
180
+ "дев'яностами",
181
+ "дев'яноста"),
182
+ }
183
+
184
+ TWENTIES_ORDINALS = {
185
+ 2: ("двадцятий", "двадцяти"),
186
+ 3: ("тридцятий", "тридцяти"),
187
+ 4: ("сороковий", "сорока"),
188
+ 5: ("п'ятдесятий", "п'ятдесяти"),
189
+ 6: ("шістдесятий", "шістдесяти"),
190
+ 7: ("сімдесятий", "сімдесяти"),
191
+ 8: ("вісімдесятий", "вісімдесяти"),
192
+ 9: ("дев'яностий", "дев'яности"),
193
+ }
194
+
195
+ HUNDREDS = {
196
+ 1: ('сто',
197
+ "ста",
198
+ "ста",
199
+ "сто",
200
+ "стами",
201
+ "стах"),
202
+ 2: ('двісті',
203
+ "двохста",
204
+ "двомстам",
205
+ "двісті",
206
+ "двомастами",
207
+ "двохстах"),
208
+ 3: ('триста',
209
+ "трьохста",
210
+ "трьомстам",
211
+ "триста",
212
+ "трьомастами",
213
+ "трьохстах"),
214
+ 4: ('чотириста',
215
+ "чотирьохста",
216
+ "чотирьомстам",
217
+ "чотириста",
218
+ "чотирмастами",
219
+ "чотирьохстах"),
220
+ 5: ('п\'ятсот',
221
+ "п'ятиста",
222
+ "п'ятистам",
223
+ "п'ятсот",
224
+ "п'ятьмастами",
225
+ "п'ятистах"),
226
+ 6: ('шістсот',
227
+ "шестиста",
228
+ "шестистам",
229
+ "шістсот",
230
+ "шістьмастами",
231
+ "шестистах"),
232
+ 7: ('сімсот',
233
+ "семиста",
234
+ "семистам",
235
+ "сімсот",
236
+ "сьомастами",
237
+ "семистах"),
238
+ 8: ('вісімсот',
239
+ "восьмиста",
240
+ "восьмистам",
241
+ "вісімсот",
242
+ "восьмастами",
243
+ "восьмистах"),
244
+ 9: ("дев'ятсот",
245
+ "дев'ятиста",
246
+ "дев'ятистам",
247
+ "дев'ятсот",
248
+ "дев'ятьмастами",
249
+ "дев'ятистах"),
250
+ }
251
+
252
+ HUNDREDS_ORDINALS = {
253
+ 1: ("сотий", "сто"),
254
+ 2: ("двохсотий", "двохсот"),
255
+ 3: ("трьохсотий", "трьохсот"),
256
+ 4: ("чотирьохсотий", "чотирьохсот"),
257
+ 5: ("п'ятисотий", "п'ятсот"),
258
+ 6: ("шестисотий", "шістсот"),
259
+ 7: ("семисотий", "сімсот"),
260
+ 8: ("восьмисотий", "вісімсот"),
261
+ 9: ("дев'ятисотий", "дев'ятсот"),
262
+ }
263
+
264
+ THOUSANDS = {
265
+ # 10^3
266
+ 1: (('тисяча', 'тисячі', 'тисяч'),
267
+ ('тисячи', 'тисяч', 'тисяч'),
268
+ ('тисячі', 'тисячам', 'тисячам'),
269
+ ('тисячу', 'тисячі', 'тисяч'),
270
+ ('тисячею', 'тисячами', 'тисячами'),
271
+ ('тисячі', 'тисячах', 'тисячах'),),
272
+ # 10^6
273
+ 2: (('мільйон', 'мільйони', 'мільйонів'),
274
+ ('мільйона', 'мільйонів', 'мільйонів'),
275
+ ('мільйону', 'мільйонам', 'мільйонам'),
276
+ ('мільйон', 'мільйони', 'мільйонів'),
277
+ ('мільйоном', 'мільйонами', 'мільйонів'),
278
+ ('мільйоні', 'мільйонах', 'мільйонах'),),
279
+ # 10^9
280
+ 3: (('мільярд', 'мільярди', 'мільярдів'),
281
+ ('мільярда', 'мільярдів', 'мільярдів'),
282
+ ('мільярду', 'мільярдам', 'мільярдам'),
283
+ ('мільярд', 'мільярди', 'мільярдів'),
284
+ ('мільярдом', 'мільярдами', 'мільярдів'),
285
+ ('мільярді', 'мільярдах', 'мільярдах'),),
286
+ # 10^12
287
+ 4: (('трильйон', 'трильйони', 'трильйонів'),
288
+ ('трильйона', 'трильйонів', 'трильйонів'),
289
+ ('трильйону', 'трильйонам', 'трильйонам'),
290
+ ('трильйон', 'трильйони', 'трильйонів'),
291
+ ('трильйоном', 'трильйонами', 'трильйонів'),
292
+ ('трильйоні', 'трильйонах', 'трильйонах'),),
293
+ # 10^15
294
+ 5: (('квадрильйон', 'квадрильйони', 'квадрильйонів'),
295
+ ('квадрильйона', 'квадрильйонів', 'квадрильйонів'),
296
+ ('квадрильйону', 'квадрильйонам', 'квадрильйонам'),
297
+ ('квадрильйон', 'квадрильйони', 'квадрильйонів'),
298
+ ('квадрильйоном', 'квадрильйонами', 'квадрильйонів'),
299
+ ('квадрильйоні', 'квадрильйонах', 'квадрильйонах'),),
300
+ # 10^18
301
+ 6: (('квінтильйон', 'квінтильйони', 'квінтильйонів'),
302
+ ('квінтильйона', 'квінтильйонів', 'квінтильйонів'),
303
+ ('квінтильйону', 'квінтильйонам', 'квінтильйонам'),
304
+ ('квінтильйон', 'квінтильйони', 'квінтильйонів'),
305
+ ('квінтильйоном', 'квінтильйонами', 'квінтильйонів'),
306
+ ('квінтильйоні', 'квінтильйонах', 'квінтильйонах'),),
307
+ # 10^21
308
+ 7: (('секстильйон', 'секстильйони', 'секстильйонів'),
309
+ ('секстильйона', 'секстильйонів', 'секстильйонів'),
310
+ ('секстильйону', 'секстильйонам', 'секстильйонам'),
311
+ ('секстильйон', 'секстильйони', 'секстильйонів'),
312
+ ('секстильйоном', 'секстильйонами', 'секстильйонів'),
313
+ ('секстильйоні', 'секстильйонах', 'секстильйонах'),),
314
+ # 10^24
315
+ 8: (('септильйон', 'септильйони', 'септильйонів'),
316
+ ('септильйона', 'септильйонів', 'септильйонів'),
317
+ ('септильйону', 'септильйонам', 'септильйонам'),
318
+ ('септильйон', 'септильйони', 'септильйонів'),
319
+ ('септильйоном', 'септильйонами', 'септильйонів'),
320
+ ('септильйоні', 'септильйонах', 'септильйонах'),),
321
+ # 10^27
322
+ 9: (('октильйон', 'октильйони', 'октильйонів'),
323
+ ('октильйона', 'октильйонів', 'октильйонів'),
324
+ ('октильйону', 'октильйонам', 'октильйонам'),
325
+ ('октильйон', 'октильйони', 'октильйонів'),
326
+ ('октильйоном', 'октильйонами', 'октильйонів'),
327
+ ('октильйоні', 'октильйонах', 'октильйонах'),),
328
+ # 10^30
329
+ 10: (('нонільйон', 'нонільйони', 'нонільйонів'),
330
+ ('нонільйона', 'нонільйонів', 'нонільйонів'),
331
+ ('нонільйону', 'нонільйонам', 'нонільйонам'),
332
+ ('нонільйон', 'нонільйони', 'нонільйонів'),
333
+ ('нонільйоном', 'нонільйонами', 'нонільйонів'),
334
+ ('нонільйоні', 'нонільйонах', 'нонільйонах'),),
335
+ }
336
+
337
+ prefixes_ordinal = {
338
+ 1: "тисячний",
339
+ 2: "мільйонний",
340
+ 3: "мільярдний",
341
+ 4: "трильйонний",
342
+ 5: "квадрильйонний",
343
+ 6: "квінтильйонний",
344
+ 7: "секстильйонний",
345
+ 8: "септильйонний",
346
+ 9: "октильйонний",
347
+ 10: "нонільйонний",
348
+ }
349
+
350
+ FEMININE_MONEY = ('AOA', 'BAM', 'BDT', 'BWP', 'CZK', 'DKK',
351
+ 'ERN', 'HNL', 'HRK', 'IDR', 'INR', 'ISK',
352
+ 'JPY', 'KPW', 'KRW', 'LKR', 'MOP', 'MRU',
353
+ 'MUR', 'MVR', 'MWK', 'NGN', 'NIO', 'NOK',
354
+ 'NPR', 'PKR', 'SCR', 'SEK', 'STN', 'TRY',
355
+ 'WST', 'UAH', 'ZMW')
356
+ FEMININE_CENTS = ('ALL', 'BDT', 'BGN', 'BYN', 'GHS', 'HRK',
357
+ 'ILS', 'INR', 'NPR', 'OMR', 'OMR', 'PKR',
358
+ 'RSD', 'RUB', 'UAH')
359
+
360
+ GENERIC_DOLLARS = ('долар', 'долари', 'доларів')
361
+ GENERIC_CENTS = ('цент', 'центи', 'центів')
362
+
363
+
364
+ class Num2Word_UK(Num2Word_Base):
365
+ CURRENCY_FORMS = {
366
+ 'AED': (
367
+ ('дирхам', 'дирхами', 'дирхамів'),
368
+ ('філс', 'філси', 'філсів')
369
+ ),
370
+ 'AFN': (
371
+ ('афгані', 'афгані', 'афгані'),
372
+ ('пул', 'пули', 'пулів')
373
+ ),
374
+ 'ALL': (
375
+ ('лек', 'леки', 'леків'),
376
+ ('кіндарка', 'кіндарки', 'кіндарок')
377
+ ),
378
+ 'AMD': (
379
+ ('драм', 'драми', 'драмів'),
380
+ ('лум', 'лум', 'лум')
381
+ ),
382
+ 'ANG': (
383
+ ('гульден', 'гульдени', 'гульденів'),
384
+ GENERIC_CENTS
385
+ ),
386
+ 'AOA': (
387
+ ('кванза', 'кванзи', 'кванз'),
388
+ ('сентимо', 'сентимо', 'сентимо')
389
+ ),
390
+ 'ARS': (
391
+ ('песо', 'песо', 'песо'),
392
+ ('сентаво', 'сентаво', 'сентаво')
393
+ ),
394
+ 'AUD': (GENERIC_DOLLARS, GENERIC_CENTS),
395
+ 'AWG': (
396
+ ('флорин', 'флорини', 'флоринів'),
397
+ GENERIC_CENTS
398
+ ),
399
+ 'AZN': (
400
+ ('манат', 'манати', 'манатів'),
401
+ ('гяпік', 'гяпіки', 'гяпіків')
402
+ ),
403
+ 'BAM': (
404
+ ('марка', 'марки', 'марок'),
405
+ ('фенінг', 'фенінги', 'фенінгів')
406
+ ),
407
+ 'BBD': (GENERIC_DOLLARS, GENERIC_CENTS),
408
+ 'BDT': (
409
+ ('така', 'таки', 'так'),
410
+ ('пойша', 'пойші', 'пойш')
411
+ ),
412
+ 'BGN': (
413
+ ('лев', 'леви', 'левів'),
414
+ ('стотинка', 'стотинки', 'стотинок')
415
+ ),
416
+ 'BHD': (
417
+ ('динар', 'динари', 'динарів'),
418
+ ('філс', 'філси', 'філсів')
419
+ ),
420
+ 'BIF': (
421
+ ('франк', 'франки', 'франків'),
422
+ ('сантим', 'сантими', 'сантимів')
423
+ ),
424
+ 'BMD': (GENERIC_DOLLARS, GENERIC_CENTS),
425
+ 'BND': (GENERIC_DOLLARS, GENERIC_CENTS),
426
+ 'BOB': (
427
+ ('болівіано', 'болівіано', 'болівіано'),
428
+ ('сентаво', 'сентаво', 'сентаво')
429
+ ),
430
+ 'BRL': (
431
+ ('реал', 'реали', 'реалів'),
432
+ ('сентаво', 'сентаво', 'сентаво')
433
+ ),
434
+ 'BSD': (GENERIC_DOLLARS, GENERIC_CENTS),
435
+ 'BTN': (
436
+ ('нгултрум', 'нгултруми', 'нгултрумів'),
437
+ ('четрум', 'четруми', 'четрумів')
438
+ ),
439
+ 'BWP': (
440
+ ('пула', 'пули', 'пул'),
441
+ ('тхебе', 'тхебе', 'тхебе')
442
+ ),
443
+ 'BYN': (
444
+ ('рубель', 'рублі', 'рублів'),
445
+ ('копійка', 'копійки', 'копійок')
446
+ ),
447
+ 'BZD': (GENERIC_DOLLARS, GENERIC_CENTS),
448
+ 'CAD': (GENERIC_DOLLARS, GENERIC_CENTS),
449
+ 'CDF': (
450
+ ('франк', 'франки', 'франків'),
451
+ ('сантим', 'сантими', 'сантимів')
452
+ ),
453
+ 'CHF': (
454
+ ('франк', 'франки', 'франків'),
455
+ ('сантим', 'сантими', 'сантимів')
456
+ ),
457
+ 'CLP': (
458
+ ('песо', 'песо', 'песо'),
459
+ ('сентаво', 'сентаво', 'сентаво')
460
+ ),
461
+ 'CNY': (
462
+ ('юань', 'юані', 'юанів'),
463
+ ('финь', 'фині', 'финів')
464
+ ),
465
+ 'COP': (
466
+ ('песо', 'песо', 'песо'),
467
+ ('сентаво', 'сентаво', 'сентаво')
468
+ ),
469
+ 'CRC': (
470
+ ('колон', 'колони', 'колонів'),
471
+ ('сентімо', 'сентімо', 'сентімо')
472
+ ),
473
+ 'CUC': (
474
+ ('песо', 'песо', 'песо'),
475
+ ('сентаво', 'сентаво', 'сентаво')
476
+ ),
477
+ 'CUP': (
478
+ ('песо', 'песо', 'песо'),
479
+ ('сентаво', 'сентаво', 'сентаво')
480
+ ),
481
+ 'CVE': (
482
+ ('ескудо', 'ескудо', 'ескудо'),
483
+ ('сентаво', 'сентаво', 'сентаво')
484
+ ),
485
+ 'CZK': (
486
+ ('крона', 'крони', 'крон'),
487
+ ('гелер', 'гелери', 'гелерів')
488
+ ),
489
+ 'DJF': (
490
+ ('франк', 'франки', 'франків'),
491
+ ('сантим', 'сантими', 'сантимів')
492
+ ),
493
+ 'DKK': (
494
+ ('крона', 'крони', 'крон'),
495
+ ('ере', 'ере', 'ере')
496
+ ),
497
+ 'DOP': (
498
+ ('песо', 'песо', 'песо'),
499
+ ('сентаво', 'сентаво', 'сентаво')
500
+ ),
501
+ 'DZD': (
502
+ ('динар', 'динари', 'динарів'),
503
+ ('сантим', 'сантими', 'сантимів')
504
+ ),
505
+ 'EGP': (
506
+ ('фунт', 'фунти', 'фунтів'),
507
+ ('піастр', 'піастри', 'піастрів')
508
+ ),
509
+ 'ERN': (
510
+ ('накфа', 'накфи', 'накф'),
511
+ GENERIC_CENTS
512
+ ),
513
+ 'ETB': (
514
+ ('бир', 'бири', 'бирів'),
515
+ GENERIC_CENTS
516
+ ),
517
+ 'EUR': (
518
+ ('євро', 'євро', 'євро'),
519
+ GENERIC_CENTS
520
+ ),
521
+ 'FJD': (GENERIC_DOLLARS, GENERIC_CENTS),
522
+ 'FKP': (
523
+ ('фунт', 'фунти', 'фунтів'),
524
+ ('пенс', 'пенси', 'пенсів')
525
+ ),
526
+ 'GBP': (
527
+ ('фунт', 'фунти', 'фунтів'),
528
+ ('пенс', 'пенси', 'пенсів')
529
+ ),
530
+ 'GEL': (
531
+ ('ларі', 'ларі', 'ларі'),
532
+ ('тетрі', 'тетрі', 'тетрі')
533
+ ),
534
+ 'GHS': (
535
+ ('седі', 'седі', 'седі'),
536
+ ('песева', 'песеви', 'песев')
537
+ ),
538
+ 'GIP': (
539
+ ('фунт', 'фунти', 'фунтів'),
540
+ ('пенс', 'пенси', 'пенсів')
541
+ ),
542
+ 'GMD': (
543
+ ('даласі', 'даласі', 'даласі'),
544
+ ('бутут', 'бутути', 'бутутів')
545
+ ),
546
+ 'GNF': (
547
+ ('франк', 'франки', 'франків'),
548
+ ('сантим', 'сантими', 'сантимів')
549
+ ),
550
+ 'GTQ': (
551
+ ('кетсаль', 'кетсалі', 'кетсалів'),
552
+ ('сентаво', 'сентаво', 'сентаво')
553
+ ),
554
+ 'GYD': (GENERIC_DOLLARS, GENERIC_CENTS),
555
+ 'HKD': (GENERIC_DOLLARS, GENERIC_CENTS),
556
+ 'HNL': (
557
+ ('лемпіра', 'лемпіри', 'лемпір'),
558
+ ('сентаво', 'сентаво', 'сентаво')
559
+ ),
560
+ 'HRK': (
561
+ ('куна', 'куни', 'кун'),
562
+ ('ліпа', 'ліпи', 'ліп')
563
+ ),
564
+ 'HTG': (
565
+ ('гурд', 'гурди', 'гурдів'),
566
+ ('сантим', 'сантими', 'сантимів')
567
+ ),
568
+ 'HUF': (
569
+ ('форинт', 'форинти', 'форинтів'),
570
+ ('філлер', 'філлери', 'філлерів')
571
+ ),
572
+ 'IDR': (
573
+ ('рупія', 'рупії', 'рупій'),
574
+ GENERIC_CENTS
575
+ ),
576
+ 'ILS': (
577
+ ('шекель', 'шекелі', 'шекелів'),
578
+ ('агора', 'агори', 'агор')
579
+ ),
580
+ 'INR': (
581
+ ('рупія', 'рупії', 'рупій'),
582
+ ('пайса', 'пайси', 'пайс')
583
+ ),
584
+ 'IQD': (
585
+ ('динар', 'динари', 'динарів'),
586
+ ('філс', 'філси', 'філсів')
587
+ ),
588
+ 'IRR': (
589
+ ('ріал', 'ріали', 'ріалів'),
590
+ ('динар', 'динари', 'динарів')
591
+ ),
592
+ 'ISK': (
593
+ ('крона', 'крони', 'крон'),
594
+ ('ейре', 'ейре', 'ейре')
595
+ ),
596
+ 'JMD': (GENERIC_DOLLARS, GENERIC_CENTS),
597
+ 'JOD': (
598
+ ('динар', 'динари', 'динарів'),
599
+ ('філс', 'філси', 'філсів')
600
+ ),
601
+ 'JPY': (
602
+ ('єна', 'єни', 'єн'),
603
+ ('сен', 'сен', 'сен')
604
+ ),
605
+ 'KES': (
606
+ ('шилі��г', 'шилінги', 'шилінгів'),
607
+ GENERIC_CENTS
608
+ ),
609
+ 'KGS': (
610
+ ('сом', 'соми', 'сомів'),
611
+ ('тиїн', 'тиїни', 'тиїнів')
612
+ ),
613
+ 'KHR': (
614
+ ('рієль', 'рієлі', 'рієлів'),
615
+ ('су', 'су', 'су')
616
+ ),
617
+ 'KMF': (
618
+ ('франк', 'франки', 'франків'),
619
+ ('сантим', 'сантими', 'сантимів')
620
+ ),
621
+ 'KPW': (
622
+ ('вона', 'вони', 'вон'),
623
+ ('чон', 'чони', 'чонів')
624
+ ),
625
+ 'KRW': (
626
+ ('вона', 'вони', 'вон'),
627
+ ('джеон', 'джеони', 'джеонів')
628
+ ),
629
+ 'KWD': (
630
+ ('динар', 'динари', 'динарів'),
631
+ ('філс', 'філси', 'філсів')
632
+ ),
633
+ 'KYD': (GENERIC_DOLLARS, GENERIC_CENTS),
634
+ 'KZT': (
635
+ ('теньге', 'теньге', 'теньге'),
636
+ ('тиїн', 'тиїни', 'тиїнів')),
637
+ 'LAK': (
638
+ ('кіп', 'кіпи', 'кіпів'),
639
+ ('ат', 'ати', 'атів')
640
+ ),
641
+ 'LBP': (
642
+ ('фунт', 'фунти', 'фунтів'),
643
+ ('піастр', 'піастри', 'піастрів')
644
+ ),
645
+ 'LKR': (
646
+ ('рупія', 'рупії', 'рупій'),
647
+ GENERIC_CENTS
648
+ ),
649
+ 'LRD': (GENERIC_DOLLARS, GENERIC_CENTS),
650
+ 'LSL': (
651
+ ('лоті', 'малоті', 'малоті'),
652
+ ('сенте', 'лісенте', 'лісенте')
653
+ ),
654
+ 'LYD': (
655
+ ('динар', 'динари', 'динарів'),
656
+ ('дирхам', 'дирхами', 'дирхамів')
657
+ ),
658
+ 'MAD': (
659
+ ('дирхам', 'дирхами', 'дирхамів'),
660
+ ('сантим', 'сантими', 'сантимів')
661
+ ),
662
+ 'MDL': (
663
+ ('лей', 'леї', 'леї'),
664
+ ('бан', 'бані', 'бані')
665
+ ),
666
+ 'MGA': (
667
+ ('аріарі', 'аріарі', 'аріарі'),
668
+ ('іраймбіланья', 'іраймбіланья', 'іраймбіланья')
669
+ ),
670
+ 'MKD': (
671
+ ('денар', 'денари', 'денарів'),
672
+ ('дені', 'дені', 'дені')
673
+ ),
674
+ 'MMK': (
675
+ ('к\'ят', 'к\'ят', 'к\'ят'),
676
+ ('п\'я', 'п\'я', 'п\'я')
677
+ ),
678
+ 'MNT': (
679
+ ('тугрик', 'тугрики', 'тугриків'),
680
+ ('мунгу', 'мунгу', 'мунгу')
681
+ ),
682
+ 'MOP': (
683
+ ('патака', 'патакі', 'патак'),
684
+ ('аво', 'аво', 'аво')
685
+ ),
686
+ 'MRU': (
687
+ ('угія', 'угії', 'угій'),
688
+ ('хумс', 'хумс', 'хумс')
689
+ ),
690
+ 'MUR': (
691
+ ('рупія', 'рупії', 'рупій'),
692
+ GENERIC_CENTS
693
+ ),
694
+ 'MVR': (
695
+ ('руфія', 'руфії', 'руфій'),
696
+ ('ларі', 'ларі', 'ларі')
697
+ ),
698
+ 'MWK': (
699
+ ('квача', 'квачі', 'квач'),
700
+ ('тамбала', 'тамбала', 'тамбала')
701
+ ),
702
+ 'MXN': (
703
+ ('песо', 'песо', 'песо'),
704
+ ('сентаво', 'сентаво', 'сентаво')
705
+ ),
706
+ 'MYR': (
707
+ ('рингіт', 'рингіти', 'рингітів'),
708
+ GENERIC_CENTS
709
+ ),
710
+ 'MZN': (
711
+ ('метікал', 'метікали', 'метікалів'),
712
+ ('сентаво', 'сентаво', 'сентаво')
713
+ ),
714
+ 'NAD': (GENERIC_DOLLARS, GENERIC_CENTS),
715
+ 'NGN': (
716
+ ('найра', 'найри', 'найр'),
717
+ ('кобо', 'кобо', 'кобо')
718
+ ),
719
+ 'NIO': (
720
+ ('кордоба', 'кордоби', 'кордоб'),
721
+ ('сентаво', 'сентаво', 'сентаво')
722
+ ),
723
+ 'NOK': (
724
+ ('крона', 'крони', 'крон'),
725
+ ('ере', 'ере', 'ере')
726
+ ),
727
+ 'NPR': (
728
+ ('рупія', 'рупії', 'рупій'),
729
+ ('пайса', 'пайси', 'пайс')
730
+ ),
731
+ 'NZD': (GENERIC_DOLLARS, GENERIC_CENTS),
732
+ 'OMR': (
733
+ ('ріал', 'ріали', 'ріалів'),
734
+ ('байза', 'байзи', 'байз')
735
+ ),
736
+ 'PAB': (
737
+ ('бальбоа', 'бальбоа', 'бальбоа'),
738
+ ('сентесімо', 'сентесімо', 'сентесімо')
739
+ ),
740
+ 'PEN': (
741
+ ('соль', 'соль', 'соль'),
742
+ ('сентімо', 'сентімо', 'сентімо')
743
+ ),
744
+ 'PGK': (
745
+ ('кіна', 'кіна', 'кіна'),
746
+ ('тойя', 'тойя', 'тойя')
747
+ ),
748
+ 'PHP': (
749
+ ('песо', 'песо', 'песо'),
750
+ ('сентаво', 'сентаво', 'сентаво')
751
+ ),
752
+ 'PKR': (
753
+ ('рупія', 'рупії', 'рупій'),
754
+ ('пайса', 'пайси', 'пайс')
755
+ ),
756
+ 'PLN': (
757
+ ('злотий', 'злоті', 'злотих'),
758
+ ('грош', 'гроші', 'грошів')
759
+ ),
760
+ 'PYG': (
761
+ ('гуарані', 'гуарані', 'гуарані'),
762
+ ('сентімо', 'сентімо', 'сентімо')
763
+ ),
764
+ 'QAR': (
765
+ ('ріал', 'ріали', 'ріалів'),
766
+ ('дирхам', 'дирхами', 'дирхамів')
767
+ ),
768
+ 'RON': (
769
+ ('лей', 'леї', 'леї'),
770
+ ('бан', 'бані', 'бані')
771
+ ),
772
+ 'RSD': (
773
+ ('динар', 'динари', 'динарів'),
774
+ ('пара', 'пари', 'пар')
775
+ ),
776
+ 'RUB': (
777
+ ('рубль', 'рублі', 'рублів'),
778
+ ('копійка', 'копійки', 'копійок')
779
+ ),
780
+ 'RWF': (
781
+ ('франк', 'франки', 'франків'),
782
+ ('сантим', 'сантими', 'сантимів')
783
+ ),
784
+ 'SAR': (
785
+ ('ріал', 'ріали', 'ріалів'),
786
+ ('халал', 'халали', 'халалів')
787
+ ),
788
+ 'SBD': (GENERIC_DOLLARS, GENERIC_CENTS),
789
+ 'SCR': (
790
+ ('рупія', 'рупії', 'рупій'),
791
+ GENERIC_CENTS
792
+ ),
793
+ 'SDG': (
794
+ ('фунт', 'фунти', 'фунтів'),
795
+ ('піастр', 'піастри', 'піастрів')
796
+ ),
797
+ 'SEK': (
798
+ ('крона', 'крони', 'крон'),
799
+ ('ере', 'ере', 'ере')
800
+ ),
801
+ 'SGD': (GENERIC_DOLLARS, GENERIC_CENTS),
802
+ 'SHP': (
803
+ ('фунт', 'фунти', 'фунтів'),
804
+ ('пенс', 'пенси', 'пенсів')
805
+ ),
806
+ 'SLL': (
807
+ ('леоне', 'леоне', 'леоне'),
808
+ GENERIC_CENTS
809
+ ),
810
+ 'SOS': (
811
+ ('шилінг', 'шилінги', 'шилінгів'),
812
+ GENERIC_CENTS
813
+ ),
814
+ 'SRD': (GENERIC_DOLLARS, GENERIC_CENTS),
815
+ 'SSP': (
816
+ ('фунт', 'фунти', 'фунтів'),
817
+ ('піастр', 'піастри', 'піастрів')
818
+ ),
819
+ 'STN': (
820
+ ('добра', 'добри', 'добр'),
821
+ ('сентімо', 'сентімо', 'сентімо')
822
+ ),
823
+ 'SYP': (
824
+ ('фунт', 'фунти', 'фунтів'),
825
+ ('піастр', 'піастри', 'піастрів')
826
+ ),
827
+ 'SZL': (
828
+ ('ліланґені', 'ліланґені', 'ліланґені'),
829
+ GENERIC_CENTS
830
+ ),
831
+ 'THB': (
832
+ ('бат', 'бати', 'батів'),
833
+ ('сатанг', 'сатанги', 'сатангів')
834
+ ),
835
+ 'TJS': (
836
+ ('сомоні', 'сомоні', 'сомоні'),
837
+ ('дірам', 'дірами', 'дірамів')
838
+ ),
839
+ 'TMT': (
840
+ ('манат', 'манати', 'манатів'),
841
+ ('тенге', 'тенге', 'тенге')
842
+ ),
843
+ 'TND': (
844
+ ('динар', 'динари', 'динарів'),
845
+ ('міллім', 'мілліми', 'міллімів')
846
+ ),
847
+ 'TOP': (
848
+ ('паанга', 'паанга', 'паанга'),
849
+ ('сеніті', 'сеніті', 'сеніті')
850
+ ),
851
+ 'TRY': (
852
+ ('ліра', 'ліри', 'лір'),
853
+ ('куруш', 'куруші', 'курушів')
854
+ ),
855
+ 'TTD': (GENERIC_DOLLARS, GENERIC_CENTS),
856
+ 'TWD': (
857
+ ('новий долар', 'нові долари', 'нових доларів'),
858
+ GENERIC_CENTS
859
+ ),
860
+ 'TZS': (
861
+ ('шилінг', 'шилінги', 'шилінгів'),
862
+ GENERIC_CENTS
863
+ ),
864
+ 'UAH': (
865
+ ('гривня', 'гривні', 'гривень'),
866
+ ('копійка', 'копійки', 'копійок')
867
+ ),
868
+ 'UGX': (
869
+ ('шилінг', 'шилінги', 'шилінгів'),
870
+ GENERIC_CENTS
871
+ ),
872
+ 'USD': (GENERIC_DOLLARS, GENERIC_CENTS),
873
+ 'UYU': (
874
+ ('песо', 'песо', 'песо'),
875
+ ('сентесімо', 'сентесімо', 'сентесімо')
876
+ ),
877
+ 'UZS': (
878
+ ('сум', 'суми', 'сумів'),
879
+ ('тиїн', 'тиїни', 'тиїнів')
880
+ ),
881
+ 'VND': (
882
+ ('донг', 'донги', 'донгів'),
883
+ ('су', 'су', 'су')
884
+ ),
885
+ 'WST': (
886
+ ('тала', 'тал��', 'тал'),
887
+ ('сене', 'сене', 'сене')
888
+ ),
889
+ 'XCD': (GENERIC_DOLLARS, GENERIC_CENTS),
890
+ 'YER': (
891
+ ('ріал', 'ріали', 'ріалів'),
892
+ ('філс', 'філси', 'філсів')
893
+ ),
894
+ 'ZAR': (
895
+ ('ранд', 'ранди', 'рандів'),
896
+ GENERIC_CENTS
897
+ ),
898
+ 'ZMW': (
899
+ ('квача', 'квачі', 'квач'),
900
+ ('нгве', 'нгве', 'нгве')
901
+ ),
902
+ }
903
+
904
+ def setup(self):
905
+ self.negword = "мінус"
906
+ self.pointword = "кома"
907
+
908
+ def to_cardinal(self, number, **kwargs):
909
+ if 'case' in kwargs:
910
+ case = kwargs['case']
911
+ morphological_case = [
912
+ "nominative",
913
+ "genitive",
914
+ "dative",
915
+ "accusative",
916
+ "instrumental",
917
+ "locative"].index(case)
918
+ else:
919
+ morphological_case = 0
920
+
921
+ if 'gender' in kwargs:
922
+ gender = kwargs['gender'] == 'feminine'
923
+ else:
924
+ gender = False
925
+
926
+ n = str(number).replace(',', '.')
927
+ if '.' in n:
928
+ left, right = n.split('.')
929
+ leading_zero_count = len(right) - len(right.lstrip('0'))
930
+ right_side = self._int2word(int(right), gender, morphological_case)
931
+ decimal_part = ((ZERO[0] + ' ') * leading_zero_count +
932
+ right_side)
933
+ return u'%s %s %s' % (
934
+ self._int2word(int(left), gender, morphological_case),
935
+ self.pointword,
936
+ decimal_part
937
+ )
938
+ else:
939
+ return self._int2word(int(n), gender, morphological_case)
940
+
941
+ def pluralize(self, n, forms):
942
+ if n % 100 < 10 or n % 100 > 20:
943
+ if n % 10 == 1:
944
+ form = 0
945
+ elif 5 > n % 10 > 1:
946
+ form = 1
947
+ else:
948
+ form = 2
949
+ else:
950
+ form = 2
951
+
952
+ return forms[form]
953
+
954
+ def _int2word(self, n, feminine=False, morphological_case=0):
955
+ if n < 0:
956
+ n_value = self._int2word(abs(n), feminine, morphological_case)
957
+ return ' '.join([self.negword,
958
+ n_value])
959
+
960
+ if n == 0:
961
+ return ZERO[0]
962
+
963
+ words = []
964
+ chunks = list(splitbyx(str(n), 3))
965
+ i = len(chunks)
966
+ for x in chunks:
967
+ i -= 1
968
+
969
+ if x == 0:
970
+ continue
971
+
972
+ n1, n2, n3 = get_digits(x)
973
+
974
+ if n3 > 0:
975
+ words.append(HUNDREDS[n3][morphological_case])
976
+
977
+ if n2 > 1:
978
+ words.append(TWENTIES[n2][morphological_case])
979
+
980
+ if n2 == 1:
981
+ words.append(TENS[n1][morphological_case])
982
+ # elif n1 > 0 and not (i > 0 and x == 1):
983
+ elif n1 > 0:
984
+ ones = ONES_FEMININE if i == 1 or feminine and i == 0 else ONES
985
+ words.append(ones[n1][morphological_case])
986
+
987
+ if i > 0:
988
+ thousands_val = THOUSANDS[i][morphological_case]
989
+ words.append(self.pluralize(x, thousands_val))
990
+
991
+ return ' '.join(words)
992
+
993
+ def _money_verbose(self, number, currency):
994
+ return self._int2word(number, currency in FEMININE_MONEY)
995
+
996
+ def _cents_verbose(self, number, currency):
997
+ return self._int2word(number, currency in FEMININE_CENTS)
998
+
999
+ @staticmethod
1000
+ def last_fragment_to_ordinal(last, words, level):
1001
+ n1, n2, n3 = get_digits(last)
1002
+ last_two = n2*10+n1
1003
+ if last_two == 0:
1004
+ words.append(HUNDREDS_ORDINALS[n3][level])
1005
+ elif level == 1 and last == 1:
1006
+ return
1007
+ elif last_two < 20:
1008
+ if level == 0:
1009
+ if n3 > 0:
1010
+ words.append(HUNDREDS[n3][0])
1011
+ words.append(ONES_ORDINALS[last_two][0])
1012
+ else:
1013
+ last_fragment_string = ''
1014
+ if n3 > 0:
1015
+ last_fragment_string += HUNDREDS_ORDINALS[n3][1]
1016
+ last_fragment_string += ONES_ORDINALS[last_two][1]
1017
+ words.append(last_fragment_string)
1018
+ elif last_two % 10 == 0:
1019
+ if level == 0:
1020
+ if n3 > 0:
1021
+ words.append(HUNDREDS[n3][0])
1022
+ words.append(TWENTIES_ORDINALS[n2][0])
1023
+ else:
1024
+ last_fragment_string = ''
1025
+ if n3 > 0:
1026
+ last_fragment_string += HUNDREDS_ORDINALS[n3][1]
1027
+ last_fragment_string += TWENTIES_ORDINALS[n2][1]
1028
+ words.append(last_fragment_string)
1029
+ else:
1030
+ if level == 0:
1031
+ if n3 > 0:
1032
+ words.append(HUNDREDS[n3][0])
1033
+ words.append(TWENTIES[n2][0])
1034
+ words.append(ONES_ORDINALS[n1][0])
1035
+ else:
1036
+ last_fragment_string = ''
1037
+ if n3 > 0:
1038
+ last_fragment_string += HUNDREDS_ORDINALS[n3][1]
1039
+ last_fragment_string += TWENTIES_ORDINALS[n2][1]
1040
+ last_fragment_string += ONES_ORDINALS[n1][1]
1041
+ words.append(last_fragment_string)
1042
+
1043
+ def to_ordinal(self, number):
1044
+ self.verify_ordinal(number)
1045
+
1046
+ words = []
1047
+ fragments = list(splitbyx(str(number), 3))
1048
+ level = 0
1049
+ last = fragments[-1]
1050
+ while last == 0:
1051
+ level = level + 1
1052
+ fragments.pop()
1053
+ last = fragments[-1]
1054
+ if len(fragments) > 1:
1055
+ pre_part = self._int2word(number - (last * 1000 ** level))
1056
+ words.append(pre_part)
1057
+ Num2Word_UK.last_fragment_to_ordinal(
1058
+ last,
1059
+ words,
1060
+ 0 if level == 0 else 1
1061
+ )
1062
+ output = " ".join(words)
1063
+ if last == 1 and level > 0 and output != "":
1064
+ output = output + " "
1065
+ if level > 0:
1066
+ output = output + prefixes_ordinal[level]
1067
+ return output
TTS/Kokoro/.venv/Lib/site-packages/num2words/lang_VI.py ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import unicode_literals
19
+
20
+ to_19 = (u'không', u'một', u'hai', u'ba', u'bốn', u'năm', u'sáu',
21
+ u'bảy', u'tám', u'chín', u'mười', u'mười một', u'mười hai',
22
+ u'mười ba', u'mười bốn', u'mười lăm', u'mười sáu', u'mười bảy',
23
+ u'mười tám', u'mười chín')
24
+ tens = (u'hai mươi', u'ba mươi', u'bốn mươi', u'năm mươi',
25
+ u'sáu mươi', u'bảy mươi', u'tám mươi', u'chín mươi')
26
+ denom = ('',
27
+ u'nghìn', u'triệu', u'tỷ', u'nghìn tỷ', u'trăm nghìn tỷ',
28
+ 'Quintillion', 'Sextillion', 'Septillion', 'Octillion', 'Nonillion',
29
+ 'Decillion', 'Undecillion', 'Duodecillion', 'Tredecillion',
30
+ 'Quattuordecillion', 'Sexdecillion', 'Septendecillion',
31
+ 'Octodecillion', 'Novemdecillion', 'Vigintillion')
32
+
33
+
34
+ class Num2Word_VI(object):
35
+
36
+ def _convert_nn(self, val):
37
+ if val < 20:
38
+ return to_19[val]
39
+ for (dcap, dval) in ((k, 20 + (10 * v)) for (v, k) in enumerate(tens)):
40
+ if dval + 10 > val:
41
+ if val % 10:
42
+ a = u'lăm'
43
+ if to_19[val % 10] == u'một':
44
+ a = u'mốt'
45
+ else:
46
+ a = to_19[val % 10]
47
+ if to_19[val % 10] == u'năm':
48
+ a = u'lăm'
49
+ return dcap + ' ' + a
50
+ return dcap
51
+
52
+ def _convert_nnn(self, val):
53
+ word = ''
54
+ (mod, rem) = (val % 100, val // 100)
55
+ if rem > 0:
56
+ word = to_19[rem] + u' trăm'
57
+ if mod > 0:
58
+ word = word + ' '
59
+ if mod > 0 and mod < 10:
60
+ if mod == 5:
61
+ word = word != '' and word + u'lẻ năm' or word + u'năm'
62
+ else:
63
+ word = word != '' and word + u'lẻ ' \
64
+ + self._convert_nn(mod) or word + self._convert_nn(mod)
65
+ if mod >= 10:
66
+ word = word + self._convert_nn(mod)
67
+ return word
68
+
69
+ def vietnam_number(self, val):
70
+ if val < 100:
71
+ return self._convert_nn(val)
72
+ if val < 1000:
73
+ return self._convert_nnn(val)
74
+ for (didx, dval) in ((v - 1, 1000 ** v) for v in range(len(denom))):
75
+ if dval > val:
76
+ mod = 1000 ** didx
77
+ lval = val // mod
78
+ r = val - (lval * mod)
79
+
80
+ ret = self._convert_nnn(lval) + u' ' + denom[didx]
81
+ if 99 >= r > 0:
82
+ ret = self._convert_nnn(lval) + u' ' + denom[didx] + u' lẻ'
83
+ if r > 0:
84
+ ret = ret + ' ' + self.vietnam_number(r)
85
+ return ret
86
+
87
+ def number_to_text(self, number):
88
+ number = '%.2f' % number
89
+ the_list = str(number).split('.')
90
+ start_word = self.vietnam_number(int(the_list[0]))
91
+ final_result = start_word
92
+ if len(the_list) > 1 and int(the_list[1]) > 0:
93
+ end_word = self.vietnam_number(int(the_list[1]))
94
+ final_result = final_result + ' phẩy ' + end_word
95
+ return final_result
96
+
97
+ def to_cardinal(self, number):
98
+ return self.number_to_text(number)
99
+
100
+ def to_ordinal(self, number):
101
+ return self.to_cardinal(number)
TTS/Kokoro/.venv/Lib/site-packages/num2words/utils.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+
19
+ def splitbyx(n, x, format_int=True):
20
+ length = len(n)
21
+ if length > x:
22
+ start = length % x
23
+ if start > 0:
24
+ result = n[:start]
25
+ yield int(result) if format_int else result
26
+ for i in range(start, length, x):
27
+ result = n[i:i+x]
28
+ yield int(result) if format_int else result
29
+ else:
30
+ yield int(n) if format_int else n
31
+
32
+
33
+ def get_digits(n):
34
+ a = [int(x) for x in reversed(list(('%03d' % n)[-3:]))]
35
+ return a
TTS/Kokoro/.venv/Lib/site-packages/numpy-2.4.2.dist-info/DELVEWHEEL ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ Version: 1.11.2
2
+ Arguments: ['C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-s5wc8nbf\\cp312-win_amd64\\build\\venv\\Scripts\\delvewheel', 'repair', '--add-path', 'D:/a/numpy-release/numpy-release/.openblas/lib', '-w', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-s5wc8nbf\\cp312-win_amd64\\repaired_wheel', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-s5wc8nbf\\cp312-win_amd64\\built_wheel\\numpy-2.4.2-cp312-cp312-win_amd64.whl']
TTS/Kokoro/.venv/Lib/site-packages/numpy-2.4.2.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
TTS/Kokoro/.venv/Lib/site-packages/numpy-2.4.2.dist-info/METADATA ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.4
2
+ Name: numpy
3
+ Version: 2.4.2
4
+ Summary: Fundamental package for array computing in Python
5
+ Author: Travis E. Oliphant et al.
6
+ Maintainer-Email: NumPy Developers <numpy-discussion@python.org>
7
+ License-Expression: BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0
8
+ License-File: LICENSE.txt
9
+ License-File: numpy/_core/include/numpy/libdivide/LICENSE.txt
10
+ License-File: numpy/_core/src/common/pythoncapi-compat/COPYING
11
+ License-File: numpy/_core/src/highway/LICENSE
12
+ License-File: numpy/_core/src/multiarray/dragon4_LICENSE.txt
13
+ License-File: numpy/_core/src/npysort/x86-simd-sort/LICENSE.md
14
+ License-File: numpy/_core/src/umath/svml/LICENSE
15
+ License-File: numpy/fft/pocketfft/LICENSE.md
16
+ License-File: numpy/linalg/lapack_lite/LICENSE.txt
17
+ License-File: numpy/ma/LICENSE
18
+ License-File: numpy/random/LICENSE.md
19
+ License-File: numpy/random/src/distributions/LICENSE.md
20
+ License-File: numpy/random/src/mt19937/LICENSE.md
21
+ License-File: numpy/random/src/pcg64/LICENSE.md
22
+ License-File: numpy/random/src/philox/LICENSE.md
23
+ License-File: numpy/random/src/sfc64/LICENSE.md
24
+ License-File: numpy/random/src/splitmix64/LICENSE.md
25
+ Classifier: Development Status :: 5 - Production/Stable
26
+ Classifier: Intended Audience :: Science/Research
27
+ Classifier: Intended Audience :: Developers
28
+ Classifier: Programming Language :: C
29
+ Classifier: Programming Language :: Python
30
+ Classifier: Programming Language :: Python :: 3
31
+ Classifier: Programming Language :: Python :: 3.11
32
+ Classifier: Programming Language :: Python :: 3.12
33
+ Classifier: Programming Language :: Python :: 3.13
34
+ Classifier: Programming Language :: Python :: 3.14
35
+ Classifier: Programming Language :: Python :: 3 :: Only
36
+ Classifier: Programming Language :: Python :: Implementation :: CPython
37
+ Classifier: Topic :: Software Development
38
+ Classifier: Topic :: Scientific/Engineering
39
+ Classifier: Typing :: Typed
40
+ Classifier: Operating System :: Microsoft :: Windows
41
+ Classifier: Operating System :: POSIX
42
+ Classifier: Operating System :: Unix
43
+ Classifier: Operating System :: MacOS
44
+ Project-URL: homepage, https://numpy.org
45
+ Project-URL: documentation, https://numpy.org/doc/
46
+ Project-URL: source, https://github.com/numpy/numpy
47
+ Project-URL: download, https://pypi.org/project/numpy/#files
48
+ Project-URL: tracker, https://github.com/numpy/numpy/issues
49
+ Project-URL: release notes, https://numpy.org/doc/stable/release
50
+ Requires-Python: >=3.11
51
+ Description-Content-Type: text/markdown
52
+
53
+ <h1 align="center">
54
+ <img src="https://raw.githubusercontent.com/numpy/numpy/main/branding/logo/primary/numpylogo.svg" width="300">
55
+ </h1><br>
56
+
57
+
58
+ [![Powered by NumFOCUS](https://img.shields.io/badge/powered%20by-NumFOCUS-orange.svg?style=flat&colorA=E1523D&colorB=007D8A)](
59
+ https://numfocus.org)
60
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/numpy.svg?label=PyPI%20downloads)](
61
+ https://pypi.org/project/numpy/)
62
+ [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/numpy.svg?label=Conda%20downloads)](
63
+ https://anaconda.org/conda-forge/numpy)
64
+ [![Stack Overflow](https://img.shields.io/badge/stackoverflow-Ask%20questions-blue.svg)](
65
+ https://stackoverflow.com/questions/tagged/numpy)
66
+ [![Nature Paper](https://img.shields.io/badge/DOI-10.1038%2Fs41586--020--2649--2-blue)](
67
+ https://doi.org/10.1038/s41586-020-2649-2)
68
+ [![LFX Health Score](https://insights.linuxfoundation.org/api/badge/health-score?project=numpy)](https://insights.linuxfoundation.org/project/numpy)
69
+ [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/numpy/numpy/badge)](https://securityscorecards.dev/viewer/?uri=github.com/numpy/numpy)
70
+ [![Typing](https://img.shields.io/pypi/types/numpy)](https://pypi.org/project/numpy/)
71
+
72
+
73
+ NumPy is the fundamental package for scientific computing with Python.
74
+
75
+ - **Website:** https://numpy.org
76
+ - **Documentation:** https://numpy.org/doc
77
+ - **Mailing list:** https://mail.python.org/mailman/listinfo/numpy-discussion
78
+ - **Source code:** https://github.com/numpy/numpy
79
+ - **Contributing:** https://numpy.org/devdocs/dev/index.html
80
+ - **Bug reports:** https://github.com/numpy/numpy/issues
81
+ - **Report a security vulnerability:** https://tidelift.com/docs/security
82
+
83
+ It provides:
84
+
85
+ - a powerful N-dimensional array object
86
+ - sophisticated (broadcasting) functions
87
+ - tools for integrating C/C++ and Fortran code
88
+ - useful linear algebra, Fourier transform, and random number capabilities
89
+
90
+ Testing:
91
+
92
+ NumPy requires `pytest` and `hypothesis`. Tests can then be run after installation with:
93
+
94
+ python -c "import numpy, sys; sys.exit(numpy.test() is False)"
95
+
96
+ Code of Conduct
97
+ ----------------------
98
+
99
+ NumPy is a community-driven open source project developed by a diverse group of
100
+ [contributors](https://numpy.org/teams/). The NumPy leadership has made a strong
101
+ commitment to creating an open, inclusive, and positive community. Please read the
102
+ [NumPy Code of Conduct](https://numpy.org/code-of-conduct/) for guidance on how to interact
103
+ with others in a way that makes our community thrive.
104
+
105
+ Call for Contributions
106
+ ----------------------
107
+
108
+ The NumPy project welcomes your expertise and enthusiasm!
109
+
110
+ Small improvements or fixes are always appreciated. If you are considering larger contributions
111
+ to the source code, please contact us through the [mailing
112
+ list](https://mail.python.org/mailman/listinfo/numpy-discussion) first.
113
+
114
+ Writing code isn’t the only way to contribute to NumPy. You can also:
115
+ - review pull requests
116
+ - help us stay on top of new and old issues
117
+ - develop tutorials, presentations, and other educational materials
118
+ - maintain and improve [our website](https://github.com/numpy/numpy.org)
119
+ - develop graphic design for our brand assets and promotional materials
120
+ - translate website content
121
+ - help with outreach and onboard new contributors
122
+ - write grant proposals and help with other fundraising efforts
123
+
124
+ For more information about the ways you can contribute to NumPy, visit [our website](https://numpy.org/contribute/).
125
+ If you’re unsure where to start or how your skills fit in, reach out! You can
126
+ ask on the mailing list or here, on GitHub, by opening a new issue or leaving a
127
+ comment on a relevant issue that is already open.
128
+
129
+ Our preferred channels of communication are all public, but if you’d like to
130
+ speak to us in private first, contact our community coordinators at
131
+ numpy-team@googlegroups.com or on Slack (write numpy-team@googlegroups.com for
132
+ an invitation).
133
+
134
+ We also have a biweekly community call, details of which are announced on the
135
+ mailing list. You are very welcome to join.
136
+
137
+ If you are new to contributing to open source, [this
138
+ guide](https://opensource.guide/how-to-contribute/) helps explain why, what,
139
+ and how to successfully get involved.
TTS/Kokoro/.venv/Lib/site-packages/numpy-2.4.2.dist-info/RECORD ADDED
The diff for this file is too large to render. See raw diff
 
TTS/Kokoro/.venv/Lib/site-packages/numpy-2.4.2.dist-info/REQUESTED ADDED
File without changes
TTS/Kokoro/.venv/Lib/site-packages/numpy-2.4.2.dist-info/WHEEL ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: meson
3
+ Root-Is-Purelib: false
4
+ Tag: cp312-cp312-win_amd64
TTS/Kokoro/.venv/Lib/site-packages/numpy-2.4.2.dist-info/entry_points.txt ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [pkg_config]
2
+ numpy = numpy._core.lib.pkgconfig
3
+
4
+ [array_api]
5
+ numpy = numpy
6
+
7
+ [pyinstaller40]
8
+ hook-dirs = numpy:_pyinstaller_hooks_dir
9
+
10
+ [console_scripts]
11
+ f2py = numpy.f2py.f2py2e:main
12
+ numpy-config = numpy._configtool:main
13
+
TTS/Kokoro/.venv/Lib/site-packages/numpy/__config__.py ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is generated by numpy's build process
2
+ # It contains system_info results at the time of building this package.
3
+ from enum import Enum
4
+ from numpy._core._multiarray_umath import (
5
+ __cpu_features__,
6
+ __cpu_baseline__,
7
+ __cpu_dispatch__,
8
+ )
9
+
10
+ __all__ = ["show_config"]
11
+ _built_with_meson = True
12
+
13
+
14
+ class DisplayModes(Enum):
15
+ stdout = "stdout"
16
+ dicts = "dicts"
17
+
18
+
19
+ def _cleanup(d):
20
+ """
21
+ Removes empty values in a `dict` recursively
22
+ This ensures we remove values that Meson could not provide to CONFIG
23
+ """
24
+ if isinstance(d, dict):
25
+ return {k: _cleanup(v) for k, v in d.items() if v and _cleanup(v)}
26
+ else:
27
+ return d
28
+
29
+
30
+ CONFIG = _cleanup(
31
+ {
32
+ "Compilers": {
33
+ "c": {
34
+ "name": "msvc",
35
+ "linker": r"link",
36
+ "version": "19.44.35222",
37
+ "commands": r"cl",
38
+ "args": r"",
39
+ "linker args": r"",
40
+ },
41
+ "cython": {
42
+ "name": "cython",
43
+ "linker": r"cython",
44
+ "version": "3.2.4",
45
+ "commands": r"cython",
46
+ "args": r"",
47
+ "linker args": r"",
48
+ },
49
+ "c++": {
50
+ "name": "msvc",
51
+ "linker": r"link",
52
+ "version": "19.44.35222",
53
+ "commands": r"cl",
54
+ "args": r"",
55
+ "linker args": r"",
56
+ },
57
+ },
58
+ "Machine Information": {
59
+ "host": {
60
+ "cpu": "x86_64",
61
+ "family": "x86_64",
62
+ "endian": "little",
63
+ "system": "windows",
64
+ },
65
+ "build": {
66
+ "cpu": "x86_64",
67
+ "family": "x86_64",
68
+ "endian": "little",
69
+ "system": "windows",
70
+ },
71
+ "cross-compiled": bool("False".lower().replace("false", "")),
72
+ },
73
+ "Build Dependencies": {
74
+ "blas": {
75
+ "name": "scipy-openblas",
76
+ "found": bool("True".lower().replace("false", "")),
77
+ "version": "0.3.31.dev",
78
+ "detection method": "pkgconfig",
79
+ "include directory": r"C:/Users/runneradmin/AppData/Local/Temp/cibw-run-s5wc8nbf/cp312-win_amd64/build/venv/Lib/site-packages/scipy_openblas64/include",
80
+ "lib directory": r"C:/Users/runneradmin/AppData/Local/Temp/cibw-run-s5wc8nbf/cp312-win_amd64/build/venv/Lib/site-packages/scipy_openblas64/lib",
81
+ "openblas configuration": r"OpenBLAS 0.3.31.dev USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell MAX_THREADS=24",
82
+ "pc file directory": r"D:/a/numpy-release/numpy-release/.openblas",
83
+ },
84
+ "lapack": {
85
+ "name": "scipy-openblas",
86
+ "found": bool("True".lower().replace("false", "")),
87
+ "version": "0.3.31.dev",
88
+ "detection method": "pkgconfig",
89
+ "include directory": r"C:/Users/runneradmin/AppData/Local/Temp/cibw-run-s5wc8nbf/cp312-win_amd64/build/venv/Lib/site-packages/scipy_openblas64/include",
90
+ "lib directory": r"C:/Users/runneradmin/AppData/Local/Temp/cibw-run-s5wc8nbf/cp312-win_amd64/build/venv/Lib/site-packages/scipy_openblas64/lib",
91
+ "openblas configuration": r"OpenBLAS 0.3.31.dev USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell MAX_THREADS=24",
92
+ "pc file directory": r"D:/a/numpy-release/numpy-release/.openblas",
93
+ },
94
+ },
95
+ "Python Information": {
96
+ "path": r"C:\Users\runneradmin\AppData\Local\Temp\build-env-9ypq4bkp\Scripts\python.exe",
97
+ "version": "3.12",
98
+ },
99
+ "SIMD Extensions": {
100
+ "baseline": __cpu_baseline__,
101
+ "found": [
102
+ feature for feature in __cpu_dispatch__ if __cpu_features__[feature]
103
+ ],
104
+ "not found": [
105
+ feature for feature in __cpu_dispatch__ if not __cpu_features__[feature]
106
+ ],
107
+ },
108
+ }
109
+ )
110
+
111
+
112
+ def _check_pyyaml():
113
+ import yaml
114
+
115
+ return yaml
116
+
117
+
118
+ def show(mode=DisplayModes.stdout.value):
119
+ """
120
+ Show libraries and system information on which NumPy was built
121
+ and is being used
122
+
123
+ Parameters
124
+ ----------
125
+ mode : {`'stdout'`, `'dicts'`}, optional.
126
+ Indicates how to display the config information.
127
+ `'stdout'` prints to console, `'dicts'` returns a dictionary
128
+ of the configuration.
129
+
130
+ Returns
131
+ -------
132
+ out : {`dict`, `None`}
133
+ If mode is `'dicts'`, a dict is returned, else None
134
+
135
+ See Also
136
+ --------
137
+ get_include : Returns the directory containing NumPy C
138
+ header files.
139
+
140
+ Notes
141
+ -----
142
+ 1. The `'stdout'` mode will give more readable
143
+ output if ``pyyaml`` is installed
144
+
145
+ """
146
+ if mode == DisplayModes.stdout.value:
147
+ try: # Non-standard library, check import
148
+ yaml = _check_pyyaml()
149
+
150
+ print(yaml.dump(CONFIG))
151
+ except ModuleNotFoundError:
152
+ import warnings
153
+ import json
154
+
155
+ warnings.warn("Install `pyyaml` for better output", stacklevel=1)
156
+ print(json.dumps(CONFIG, indent=2))
157
+ elif mode == DisplayModes.dicts.value:
158
+ return CONFIG
159
+ else:
160
+ raise AttributeError(
161
+ f"Invalid `mode`, use one of: {', '.join([e.value for e in DisplayModes])}"
162
+ )
163
+
164
+
165
+ def show_config(mode=DisplayModes.stdout.value):
166
+ return show(mode)
167
+
168
+
169
+ show_config.__doc__ = show.__doc__
170
+ show_config.__module__ = "numpy"
TTS/Kokoro/.venv/Lib/site-packages/numpy/__config__.pyi ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from enum import Enum
2
+ from types import ModuleType
3
+ from typing import (
4
+ Final,
5
+ Literal as L,
6
+ NotRequired,
7
+ TypedDict,
8
+ overload,
9
+ type_check_only,
10
+ )
11
+
12
+ _CompilerConfigDictValue = TypedDict(
13
+ "_CompilerConfigDictValue",
14
+ {
15
+ "name": str,
16
+ "linker": str,
17
+ "version": str,
18
+ "commands": str,
19
+ "args": str,
20
+ "linker args": str,
21
+ },
22
+ )
23
+ _CompilerConfigDict = TypedDict(
24
+ "_CompilerConfigDict",
25
+ {
26
+ "c": _CompilerConfigDictValue,
27
+ "cython": _CompilerConfigDictValue,
28
+ "c++": _CompilerConfigDictValue,
29
+ },
30
+ )
31
+ _MachineInformationDict = TypedDict(
32
+ "_MachineInformationDict",
33
+ {
34
+ "host": _MachineInformationDictValue,
35
+ "build": _MachineInformationDictValue,
36
+ "cross-compiled": NotRequired[L[True]],
37
+ },
38
+ )
39
+
40
+ @type_check_only
41
+ class _MachineInformationDictValue(TypedDict):
42
+ cpu: str
43
+ family: str
44
+ endian: L["little", "big"]
45
+ system: str
46
+
47
+ _BuildDependenciesDictValue = TypedDict(
48
+ "_BuildDependenciesDictValue",
49
+ {
50
+ "name": str,
51
+ "found": NotRequired[L[True]],
52
+ "version": str,
53
+ "include directory": str,
54
+ "lib directory": str,
55
+ "openblas configuration": str,
56
+ "pc file directory": str,
57
+ },
58
+ )
59
+
60
+ class _BuildDependenciesDict(TypedDict):
61
+ blas: _BuildDependenciesDictValue
62
+ lapack: _BuildDependenciesDictValue
63
+
64
+ class _PythonInformationDict(TypedDict):
65
+ path: str
66
+ version: str
67
+
68
+ _SIMDExtensionsDict = TypedDict(
69
+ "_SIMDExtensionsDict",
70
+ {
71
+ "baseline": list[str],
72
+ "found": list[str],
73
+ "not found": list[str],
74
+ },
75
+ )
76
+
77
+ _ConfigDict = TypedDict(
78
+ "_ConfigDict",
79
+ {
80
+ "Compilers": _CompilerConfigDict,
81
+ "Machine Information": _MachineInformationDict,
82
+ "Build Dependencies": _BuildDependenciesDict,
83
+ "Python Information": _PythonInformationDict,
84
+ "SIMD Extensions": _SIMDExtensionsDict,
85
+ },
86
+ )
87
+
88
+ ###
89
+
90
+ __all__ = ["show_config"]
91
+
92
+ CONFIG: Final[_ConfigDict] = ...
93
+
94
+ class DisplayModes(Enum):
95
+ stdout = "stdout"
96
+ dicts = "dicts"
97
+
98
+ def _check_pyyaml() -> ModuleType: ...
99
+
100
+ @overload
101
+ def show(mode: L["stdout"] = "stdout") -> None: ...
102
+ @overload
103
+ def show(mode: L["dicts"]) -> _ConfigDict: ...
104
+
105
+ @overload
106
+ def show_config(mode: L["stdout"] = "stdout") -> None: ...
107
+ @overload
108
+ def show_config(mode: L["dicts"]) -> _ConfigDict: ...
TTS/Kokoro/.venv/Lib/site-packages/numpy/__init__.cython-30.pxd ADDED
@@ -0,0 +1,1242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NumPy static imports for Cython >= 3.0
2
+ #
3
+ # If any of the PyArray_* functions are called, import_array must be
4
+ # called first. This is done automatically by Cython 3.0+ if a call
5
+ # is not detected inside of the module.
6
+ #
7
+ # Author: Dag Sverre Seljebotn
8
+ #
9
+
10
+ from cpython.ref cimport Py_INCREF
11
+ from cpython.object cimport PyObject, PyTypeObject, PyObject_TypeCheck
12
+ cimport libc.stdio as stdio
13
+
14
+
15
+ cdef extern from *:
16
+ # Leave a marker that the NumPy declarations came from NumPy itself and not from Cython.
17
+ # See https://github.com/cython/cython/issues/3573
18
+ """
19
+ /* Using NumPy API declarations from "numpy/__init__.cython-30.pxd" */
20
+ """
21
+
22
+
23
+ cdef extern from "numpy/arrayobject.h":
24
+ # It would be nice to use size_t and ssize_t, but ssize_t has special
25
+ # implicit conversion rules, so just use "long".
26
+ # Note: The actual type only matters for Cython promotion, so long
27
+ # is closer than int, but could lead to incorrect promotion.
28
+ # (Not to worrying, and always the status-quo.)
29
+ ctypedef signed long npy_intp
30
+ ctypedef unsigned long npy_uintp
31
+
32
+ ctypedef unsigned char npy_bool
33
+
34
+ ctypedef signed char npy_byte
35
+ ctypedef signed short npy_short
36
+ ctypedef signed int npy_int
37
+ ctypedef signed long npy_long
38
+ ctypedef signed long long npy_longlong
39
+
40
+ ctypedef unsigned char npy_ubyte
41
+ ctypedef unsigned short npy_ushort
42
+ ctypedef unsigned int npy_uint
43
+ ctypedef unsigned long npy_ulong
44
+ ctypedef unsigned long long npy_ulonglong
45
+
46
+ ctypedef float npy_float
47
+ ctypedef double npy_double
48
+ ctypedef long double npy_longdouble
49
+
50
+ ctypedef signed char npy_int8
51
+ ctypedef signed short npy_int16
52
+ ctypedef signed int npy_int32
53
+ ctypedef signed long long npy_int64
54
+
55
+ ctypedef unsigned char npy_uint8
56
+ ctypedef unsigned short npy_uint16
57
+ ctypedef unsigned int npy_uint32
58
+ ctypedef unsigned long long npy_uint64
59
+
60
+ ctypedef float npy_float32
61
+ ctypedef double npy_float64
62
+ ctypedef long double npy_float80
63
+ ctypedef long double npy_float96
64
+ ctypedef long double npy_float128
65
+
66
+ ctypedef struct npy_cfloat:
67
+ pass
68
+
69
+ ctypedef struct npy_cdouble:
70
+ pass
71
+
72
+ ctypedef struct npy_clongdouble:
73
+ pass
74
+
75
+ ctypedef struct npy_complex64:
76
+ pass
77
+
78
+ ctypedef struct npy_complex128:
79
+ pass
80
+
81
+ ctypedef struct npy_complex160:
82
+ pass
83
+
84
+ ctypedef struct npy_complex192:
85
+ pass
86
+
87
+ ctypedef struct npy_complex256:
88
+ pass
89
+
90
+ ctypedef struct PyArray_Dims:
91
+ npy_intp *ptr
92
+ int len
93
+
94
+
95
+ cdef enum NPY_TYPES:
96
+ NPY_BOOL
97
+ NPY_BYTE
98
+ NPY_UBYTE
99
+ NPY_SHORT
100
+ NPY_USHORT
101
+ NPY_INT
102
+ NPY_UINT
103
+ NPY_LONG
104
+ NPY_ULONG
105
+ NPY_LONGLONG
106
+ NPY_ULONGLONG
107
+ NPY_FLOAT
108
+ NPY_DOUBLE
109
+ NPY_LONGDOUBLE
110
+ NPY_CFLOAT
111
+ NPY_CDOUBLE
112
+ NPY_CLONGDOUBLE
113
+ NPY_OBJECT
114
+ NPY_STRING
115
+ NPY_UNICODE
116
+ NPY_VSTRING
117
+ NPY_VOID
118
+ NPY_DATETIME
119
+ NPY_TIMEDELTA
120
+ NPY_NTYPES_LEGACY
121
+ NPY_NOTYPE
122
+
123
+ NPY_INT8
124
+ NPY_INT16
125
+ NPY_INT32
126
+ NPY_INT64
127
+ NPY_UINT8
128
+ NPY_UINT16
129
+ NPY_UINT32
130
+ NPY_UINT64
131
+ NPY_FLOAT16
132
+ NPY_FLOAT32
133
+ NPY_FLOAT64
134
+ NPY_FLOAT80
135
+ NPY_FLOAT96
136
+ NPY_FLOAT128
137
+ NPY_COMPLEX64
138
+ NPY_COMPLEX128
139
+ NPY_COMPLEX160
140
+ NPY_COMPLEX192
141
+ NPY_COMPLEX256
142
+
143
+ NPY_INTP
144
+ NPY_UINTP
145
+ NPY_DEFAULT_INT # Not a compile time constant (normally)!
146
+
147
+ ctypedef enum NPY_ORDER:
148
+ NPY_ANYORDER
149
+ NPY_CORDER
150
+ NPY_FORTRANORDER
151
+ NPY_KEEPORDER
152
+
153
+ ctypedef enum NPY_CASTING:
154
+ NPY_NO_CASTING
155
+ NPY_EQUIV_CASTING
156
+ NPY_SAFE_CASTING
157
+ NPY_SAME_KIND_CASTING
158
+ NPY_UNSAFE_CASTING
159
+ NPY_SAME_VALUE_CASTING
160
+
161
+ ctypedef enum NPY_CLIPMODE:
162
+ NPY_CLIP
163
+ NPY_WRAP
164
+ NPY_RAISE
165
+
166
+ ctypedef enum NPY_SCALARKIND:
167
+ NPY_NOSCALAR,
168
+ NPY_BOOL_SCALAR,
169
+ NPY_INTPOS_SCALAR,
170
+ NPY_INTNEG_SCALAR,
171
+ NPY_FLOAT_SCALAR,
172
+ NPY_COMPLEX_SCALAR,
173
+ NPY_OBJECT_SCALAR
174
+
175
+ ctypedef enum NPY_SORTKIND:
176
+ NPY_QUICKSORT
177
+ NPY_HEAPSORT
178
+ NPY_MERGESORT
179
+
180
+ ctypedef enum NPY_SEARCHSIDE:
181
+ NPY_SEARCHLEFT
182
+ NPY_SEARCHRIGHT
183
+
184
+ enum:
185
+ NPY_ARRAY_C_CONTIGUOUS
186
+ NPY_ARRAY_F_CONTIGUOUS
187
+ NPY_ARRAY_OWNDATA
188
+ NPY_ARRAY_FORCECAST
189
+ NPY_ARRAY_ENSURECOPY
190
+ NPY_ARRAY_ENSUREARRAY
191
+ NPY_ARRAY_ELEMENTSTRIDES
192
+ NPY_ARRAY_ALIGNED
193
+ NPY_ARRAY_NOTSWAPPED
194
+ NPY_ARRAY_WRITEABLE
195
+ NPY_ARRAY_WRITEBACKIFCOPY
196
+
197
+ NPY_ARRAY_BEHAVED
198
+ NPY_ARRAY_BEHAVED_NS
199
+ NPY_ARRAY_CARRAY
200
+ NPY_ARRAY_CARRAY_RO
201
+ NPY_ARRAY_FARRAY
202
+ NPY_ARRAY_FARRAY_RO
203
+ NPY_ARRAY_DEFAULT
204
+
205
+ NPY_ARRAY_IN_ARRAY
206
+ NPY_ARRAY_OUT_ARRAY
207
+ NPY_ARRAY_INOUT_ARRAY
208
+ NPY_ARRAY_IN_FARRAY
209
+ NPY_ARRAY_OUT_FARRAY
210
+ NPY_ARRAY_INOUT_FARRAY
211
+
212
+ NPY_ARRAY_UPDATE_ALL
213
+
214
+ cdef enum:
215
+ NPY_MAXDIMS # 64 on NumPy 2.x and 32 on NumPy 1.x
216
+ NPY_RAVEL_AXIS # Used for functions like PyArray_Mean
217
+
218
+ ctypedef void (*PyArray_VectorUnaryFunc)(void *, void *, npy_intp, void *, void *)
219
+
220
+ ctypedef struct PyArray_ArrayDescr:
221
+ # shape is a tuple, but Cython doesn't support "tuple shape"
222
+ # inside a non-PyObject declaration, so we have to declare it
223
+ # as just a PyObject*.
224
+ PyObject* shape
225
+
226
+ ctypedef struct PyArray_Descr:
227
+ pass
228
+
229
+ ctypedef class numpy.dtype [object PyArray_Descr, check_size ignore]:
230
+ # Use PyDataType_* macros when possible, however there are no macros
231
+ # for accessing some of the fields, so some are defined.
232
+ cdef PyTypeObject* typeobj
233
+ cdef char kind
234
+ cdef char type
235
+ # Numpy sometimes mutates this without warning (e.g. it'll
236
+ # sometimes change "|" to "<" in shared dtype objects on
237
+ # little-endian machines). If this matters to you, use
238
+ # PyArray_IsNativeByteOrder(dtype.byteorder) instead of
239
+ # directly accessing this field.
240
+ cdef char byteorder
241
+ cdef int type_num
242
+
243
+ @property
244
+ cdef inline npy_intp itemsize(self) noexcept nogil:
245
+ return PyDataType_ELSIZE(self)
246
+
247
+ @property
248
+ cdef inline npy_intp alignment(self) noexcept nogil:
249
+ return PyDataType_ALIGNMENT(self)
250
+
251
+ # Use fields/names with care as they may be NULL. You must check
252
+ # for this using PyDataType_HASFIELDS.
253
+ @property
254
+ cdef inline object fields(self):
255
+ return <object>PyDataType_FIELDS(self)
256
+
257
+ @property
258
+ cdef inline tuple names(self):
259
+ return <tuple>PyDataType_NAMES(self)
260
+
261
+ # Use PyDataType_HASSUBARRAY to test whether this field is
262
+ # valid (the pointer can be NULL). Most users should access
263
+ # this field via the inline helper method PyDataType_SHAPE.
264
+ @property
265
+ cdef inline PyArray_ArrayDescr* subarray(self) noexcept nogil:
266
+ return PyDataType_SUBARRAY(self)
267
+
268
+ @property
269
+ cdef inline npy_uint64 flags(self) noexcept nogil:
270
+ """The data types flags."""
271
+ return PyDataType_FLAGS(self)
272
+
273
+
274
+ ctypedef class numpy.flatiter [object PyArrayIterObject, check_size ignore]:
275
+ # Use through macros
276
+ pass
277
+
278
+ ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]:
279
+
280
+ @property
281
+ cdef inline int numiter(self) noexcept nogil:
282
+ """The number of arrays that need to be broadcast to the same shape."""
283
+ return PyArray_MultiIter_NUMITER(self)
284
+
285
+ @property
286
+ cdef inline npy_intp size(self) noexcept nogil:
287
+ """The total broadcasted size."""
288
+ return PyArray_MultiIter_SIZE(self)
289
+
290
+ @property
291
+ cdef inline npy_intp index(self) noexcept nogil:
292
+ """The current (1-d) index into the broadcasted result."""
293
+ return PyArray_MultiIter_INDEX(self)
294
+
295
+ @property
296
+ cdef inline int nd(self) noexcept nogil:
297
+ """The number of dimensions in the broadcasted result."""
298
+ return PyArray_MultiIter_NDIM(self)
299
+
300
+ @property
301
+ cdef inline npy_intp* dimensions(self) noexcept nogil:
302
+ """The shape of the broadcasted result."""
303
+ return PyArray_MultiIter_DIMS(self)
304
+
305
+ @property
306
+ cdef inline void** iters(self) noexcept nogil:
307
+ """An array of iterator objects that holds the iterators for the arrays to be broadcast together.
308
+ On return, the iterators are adjusted for broadcasting."""
309
+ return PyArray_MultiIter_ITERS(self)
310
+
311
+
312
+ ctypedef struct PyArrayObject:
313
+ # For use in situations where ndarray can't replace PyArrayObject*,
314
+ # like PyArrayObject**.
315
+ pass
316
+
317
+ ctypedef class numpy.ndarray [object PyArrayObject, check_size ignore]:
318
+ cdef __cythonbufferdefaults__ = {"mode": "strided"}
319
+
320
+ # NOTE: no field declarations since direct access is deprecated since NumPy 1.7
321
+ # Instead, we use properties that map to the corresponding C-API functions.
322
+
323
+ @property
324
+ cdef inline PyObject* base(self) noexcept nogil:
325
+ """Returns a borrowed reference to the object owning the data/memory.
326
+ """
327
+ return PyArray_BASE(self)
328
+
329
+ @property
330
+ cdef inline dtype descr(self):
331
+ """Returns an owned reference to the dtype of the array.
332
+ """
333
+ return <dtype>PyArray_DESCR(self)
334
+
335
+ @property
336
+ cdef inline int ndim(self) noexcept nogil:
337
+ """Returns the number of dimensions in the array.
338
+ """
339
+ return PyArray_NDIM(self)
340
+
341
+ @property
342
+ cdef inline npy_intp *shape(self) noexcept nogil:
343
+ """Returns a pointer to the dimensions/shape of the array.
344
+ The number of elements matches the number of dimensions of the array (ndim).
345
+ Can return NULL for 0-dimensional arrays.
346
+ """
347
+ return PyArray_DIMS(self)
348
+
349
+ @property
350
+ cdef inline npy_intp *strides(self) noexcept nogil:
351
+ """Returns a pointer to the strides of the array.
352
+ The number of elements matches the number of dimensions of the array (ndim).
353
+ """
354
+ return PyArray_STRIDES(self)
355
+
356
+ @property
357
+ cdef inline npy_intp size(self) noexcept nogil:
358
+ """Returns the total size (in number of elements) of the array.
359
+ """
360
+ return PyArray_SIZE(self)
361
+
362
+ @property
363
+ cdef inline char* data(self) noexcept nogil:
364
+ """The pointer to the data buffer as a char*.
365
+ This is provided for legacy reasons to avoid direct struct field access.
366
+ For new code that needs this access, you probably want to cast the result
367
+ of `PyArray_DATA()` instead, which returns a 'void*'.
368
+ """
369
+ return PyArray_BYTES(self)
370
+
371
+
372
+ int _import_array() except -1
373
+ # A second definition so _import_array isn't marked as used when we use it here.
374
+ # Do not use - subject to change any time.
375
+ int __pyx_import_array "_import_array"() except -1
376
+
377
+ #
378
+ # Macros from ndarrayobject.h
379
+ #
380
+ bint PyArray_CHKFLAGS(ndarray m, int flags) nogil
381
+ bint PyArray_IS_C_CONTIGUOUS(ndarray arr) nogil
382
+ bint PyArray_IS_F_CONTIGUOUS(ndarray arr) nogil
383
+ bint PyArray_ISCONTIGUOUS(ndarray m) nogil
384
+ bint PyArray_ISWRITEABLE(ndarray m) nogil
385
+ bint PyArray_ISALIGNED(ndarray m) nogil
386
+
387
+ int PyArray_NDIM(ndarray) nogil
388
+ bint PyArray_ISONESEGMENT(ndarray) nogil
389
+ bint PyArray_ISFORTRAN(ndarray) nogil
390
+ int PyArray_FORTRANIF(ndarray) nogil
391
+
392
+ void* PyArray_DATA(ndarray) nogil
393
+ char* PyArray_BYTES(ndarray) nogil
394
+
395
+ npy_intp* PyArray_DIMS(ndarray) nogil
396
+ npy_intp* PyArray_STRIDES(ndarray) nogil
397
+ npy_intp PyArray_DIM(ndarray, size_t) nogil
398
+ npy_intp PyArray_STRIDE(ndarray, size_t) nogil
399
+
400
+ PyObject *PyArray_BASE(ndarray) nogil # returns borrowed reference!
401
+ PyArray_Descr *PyArray_DESCR(ndarray) nogil # returns borrowed reference to dtype!
402
+ PyArray_Descr *PyArray_DTYPE(ndarray) nogil # returns borrowed reference to dtype! NP 1.7+ alias for descr.
403
+ int PyArray_FLAGS(ndarray) nogil
404
+ void PyArray_CLEARFLAGS(ndarray, int flags) nogil # Added in NumPy 1.7
405
+ void PyArray_ENABLEFLAGS(ndarray, int flags) nogil # Added in NumPy 1.7
406
+ npy_intp PyArray_ITEMSIZE(ndarray) nogil
407
+ int PyArray_TYPE(ndarray arr) nogil
408
+
409
+ object PyArray_GETITEM(ndarray arr, void *itemptr)
410
+ int PyArray_SETITEM(ndarray arr, void *itemptr, object obj) except -1
411
+
412
+ bint PyTypeNum_ISBOOL(int) nogil
413
+ bint PyTypeNum_ISUNSIGNED(int) nogil
414
+ bint PyTypeNum_ISSIGNED(int) nogil
415
+ bint PyTypeNum_ISINTEGER(int) nogil
416
+ bint PyTypeNum_ISFLOAT(int) nogil
417
+ bint PyTypeNum_ISNUMBER(int) nogil
418
+ bint PyTypeNum_ISSTRING(int) nogil
419
+ bint PyTypeNum_ISCOMPLEX(int) nogil
420
+ bint PyTypeNum_ISFLEXIBLE(int) nogil
421
+ bint PyTypeNum_ISUSERDEF(int) nogil
422
+ bint PyTypeNum_ISEXTENDED(int) nogil
423
+ bint PyTypeNum_ISOBJECT(int) nogil
424
+
425
+ npy_intp PyDataType_ELSIZE(dtype) nogil
426
+ npy_intp PyDataType_ALIGNMENT(dtype) nogil
427
+ PyObject* PyDataType_METADATA(dtype) nogil
428
+ PyArray_ArrayDescr* PyDataType_SUBARRAY(dtype) nogil
429
+ PyObject* PyDataType_NAMES(dtype) nogil
430
+ PyObject* PyDataType_FIELDS(dtype) nogil
431
+
432
+ bint PyDataType_ISBOOL(dtype) nogil
433
+ bint PyDataType_ISUNSIGNED(dtype) nogil
434
+ bint PyDataType_ISSIGNED(dtype) nogil
435
+ bint PyDataType_ISINTEGER(dtype) nogil
436
+ bint PyDataType_ISFLOAT(dtype) nogil
437
+ bint PyDataType_ISNUMBER(dtype) nogil
438
+ bint PyDataType_ISSTRING(dtype) nogil
439
+ bint PyDataType_ISCOMPLEX(dtype) nogil
440
+ bint PyDataType_ISFLEXIBLE(dtype) nogil
441
+ bint PyDataType_ISUSERDEF(dtype) nogil
442
+ bint PyDataType_ISEXTENDED(dtype) nogil
443
+ bint PyDataType_ISOBJECT(dtype) nogil
444
+ bint PyDataType_HASFIELDS(dtype) nogil
445
+ bint PyDataType_HASSUBARRAY(dtype) nogil
446
+ npy_uint64 PyDataType_FLAGS(dtype) nogil
447
+
448
+ bint PyArray_ISBOOL(ndarray) nogil
449
+ bint PyArray_ISUNSIGNED(ndarray) nogil
450
+ bint PyArray_ISSIGNED(ndarray) nogil
451
+ bint PyArray_ISINTEGER(ndarray) nogil
452
+ bint PyArray_ISFLOAT(ndarray) nogil
453
+ bint PyArray_ISNUMBER(ndarray) nogil
454
+ bint PyArray_ISSTRING(ndarray) nogil
455
+ bint PyArray_ISCOMPLEX(ndarray) nogil
456
+ bint PyArray_ISFLEXIBLE(ndarray) nogil
457
+ bint PyArray_ISUSERDEF(ndarray) nogil
458
+ bint PyArray_ISEXTENDED(ndarray) nogil
459
+ bint PyArray_ISOBJECT(ndarray) nogil
460
+ bint PyArray_HASFIELDS(ndarray) nogil
461
+
462
+ bint PyArray_ISVARIABLE(ndarray) nogil
463
+
464
+ bint PyArray_SAFEALIGNEDCOPY(ndarray) nogil
465
+ bint PyArray_ISNBO(char) nogil # works on ndarray.byteorder
466
+ bint PyArray_IsNativeByteOrder(char) nogil # works on ndarray.byteorder
467
+ bint PyArray_ISNOTSWAPPED(ndarray) nogil
468
+ bint PyArray_ISBYTESWAPPED(ndarray) nogil
469
+
470
+ bint PyArray_FLAGSWAP(ndarray, int) nogil
471
+
472
+ bint PyArray_ISCARRAY(ndarray) nogil
473
+ bint PyArray_ISCARRAY_RO(ndarray) nogil
474
+ bint PyArray_ISFARRAY(ndarray) nogil
475
+ bint PyArray_ISFARRAY_RO(ndarray) nogil
476
+ bint PyArray_ISBEHAVED(ndarray) nogil
477
+ bint PyArray_ISBEHAVED_RO(ndarray) nogil
478
+
479
+
480
+ bint PyDataType_ISNOTSWAPPED(dtype) nogil
481
+ bint PyDataType_ISBYTESWAPPED(dtype) nogil
482
+
483
+ bint PyArray_DescrCheck(object)
484
+
485
+ bint PyArray_Check(object)
486
+ bint PyArray_CheckExact(object)
487
+
488
+ # Cannot be supported due to out arg:
489
+ # bint PyArray_HasArrayInterfaceType(object, dtype, object, object&)
490
+ # bint PyArray_HasArrayInterface(op, out)
491
+
492
+
493
+ bint PyArray_IsZeroDim(object)
494
+ # Cannot be supported due to ## ## in macro:
495
+ # bint PyArray_IsScalar(object, verbatim work)
496
+ bint PyArray_CheckScalar(object)
497
+ bint PyArray_IsPythonNumber(object)
498
+ bint PyArray_IsPythonScalar(object)
499
+ bint PyArray_IsAnyScalar(object)
500
+ bint PyArray_CheckAnyScalar(object)
501
+
502
+ ndarray PyArray_GETCONTIGUOUS(ndarray)
503
+ bint PyArray_SAMESHAPE(ndarray, ndarray) nogil
504
+ npy_intp PyArray_SIZE(ndarray) nogil
505
+ npy_intp PyArray_NBYTES(ndarray) nogil
506
+
507
+ object PyArray_FROM_O(object)
508
+ object PyArray_FROM_OF(object m, int flags)
509
+ object PyArray_FROM_OT(object m, int type)
510
+ object PyArray_FROM_OTF(object m, int type, int flags)
511
+ object PyArray_FROMANY(object m, int type, int min, int max, int flags)
512
+ object PyArray_ZEROS(int nd, npy_intp* dims, int type, int fortran)
513
+ object PyArray_EMPTY(int nd, npy_intp* dims, int type, int fortran)
514
+ void PyArray_FILLWBYTE(ndarray, int val)
515
+ object PyArray_ContiguousFromAny(op, int, int min_depth, int max_depth)
516
+ unsigned char PyArray_EquivArrTypes(ndarray a1, ndarray a2)
517
+ bint PyArray_EquivByteorders(int b1, int b2) nogil
518
+ object PyArray_SimpleNew(int nd, npy_intp* dims, int typenum)
519
+ object PyArray_SimpleNewFromData(int nd, npy_intp* dims, int typenum, void* data)
520
+ #object PyArray_SimpleNewFromDescr(int nd, npy_intp* dims, dtype descr)
521
+ object PyArray_ToScalar(void* data, ndarray arr)
522
+
523
+ void* PyArray_GETPTR1(ndarray m, npy_intp i) nogil
524
+ void* PyArray_GETPTR2(ndarray m, npy_intp i, npy_intp j) nogil
525
+ void* PyArray_GETPTR3(ndarray m, npy_intp i, npy_intp j, npy_intp k) nogil
526
+ void* PyArray_GETPTR4(ndarray m, npy_intp i, npy_intp j, npy_intp k, npy_intp l) nogil
527
+
528
+ # Cannot be supported due to out arg
529
+ # void PyArray_DESCR_REPLACE(descr)
530
+
531
+
532
+ object PyArray_Copy(ndarray)
533
+ object PyArray_FromObject(object op, int type, int min_depth, int max_depth)
534
+ object PyArray_ContiguousFromObject(object op, int type, int min_depth, int max_depth)
535
+ object PyArray_CopyFromObject(object op, int type, int min_depth, int max_depth)
536
+
537
+ object PyArray_Cast(ndarray mp, int type_num)
538
+ object PyArray_Take(ndarray ap, object items, int axis)
539
+ object PyArray_Put(ndarray ap, object items, object values)
540
+
541
+ void PyArray_ITER_RESET(flatiter it) nogil
542
+ void PyArray_ITER_NEXT(flatiter it) nogil
543
+ void PyArray_ITER_GOTO(flatiter it, npy_intp* destination) nogil
544
+ void PyArray_ITER_GOTO1D(flatiter it, npy_intp ind) nogil
545
+ void* PyArray_ITER_DATA(flatiter it) nogil
546
+ bint PyArray_ITER_NOTDONE(flatiter it) nogil
547
+
548
+ void PyArray_MultiIter_RESET(broadcast multi) nogil
549
+ void PyArray_MultiIter_NEXT(broadcast multi) nogil
550
+ void PyArray_MultiIter_GOTO(broadcast multi, npy_intp dest) nogil
551
+ void PyArray_MultiIter_GOTO1D(broadcast multi, npy_intp ind) nogil
552
+ void* PyArray_MultiIter_DATA(broadcast multi, npy_intp i) nogil
553
+ void PyArray_MultiIter_NEXTi(broadcast multi, npy_intp i) nogil
554
+ bint PyArray_MultiIter_NOTDONE(broadcast multi) nogil
555
+ npy_intp PyArray_MultiIter_SIZE(broadcast multi) nogil
556
+ int PyArray_MultiIter_NDIM(broadcast multi) nogil
557
+ npy_intp PyArray_MultiIter_INDEX(broadcast multi) nogil
558
+ int PyArray_MultiIter_NUMITER(broadcast multi) nogil
559
+ npy_intp* PyArray_MultiIter_DIMS(broadcast multi) nogil
560
+ void** PyArray_MultiIter_ITERS(broadcast multi) nogil
561
+
562
+ # Functions from __multiarray_api.h
563
+
564
+ # Functions taking dtype and returning object/ndarray are disabled
565
+ # for now as they steal dtype references. I'm conservative and disable
566
+ # more than is probably needed until it can be checked further.
567
+ int PyArray_INCREF (ndarray) except * # uses PyArray_Item_INCREF...
568
+ int PyArray_XDECREF (ndarray) except * # uses PyArray_Item_DECREF...
569
+ dtype PyArray_DescrFromType (int)
570
+ object PyArray_TypeObjectFromType (int)
571
+ char * PyArray_Zero (ndarray)
572
+ char * PyArray_One (ndarray)
573
+ #object PyArray_CastToType (ndarray, dtype, int)
574
+ int PyArray_CanCastSafely (int, int) # writes errors
575
+ npy_bool PyArray_CanCastTo (dtype, dtype) # writes errors
576
+ int PyArray_ObjectType (object, int) except 0
577
+ dtype PyArray_DescrFromObject (object, dtype)
578
+ #ndarray* PyArray_ConvertToCommonType (object, int *)
579
+ dtype PyArray_DescrFromScalar (object)
580
+ dtype PyArray_DescrFromTypeObject (object)
581
+ npy_intp PyArray_Size (object)
582
+ #object PyArray_Scalar (void *, dtype, object)
583
+ #object PyArray_FromScalar (object, dtype)
584
+ void PyArray_ScalarAsCtype (object, void *)
585
+ #int PyArray_CastScalarToCtype (object, void *, dtype)
586
+ #int PyArray_CastScalarDirect (object, dtype, void *, int)
587
+ #PyArray_VectorUnaryFunc * PyArray_GetCastFunc (dtype, int)
588
+ #object PyArray_FromAny (object, dtype, int, int, int, object)
589
+ object PyArray_EnsureArray (object)
590
+ object PyArray_EnsureAnyArray (object)
591
+ #object PyArray_FromFile (stdio.FILE *, dtype, npy_intp, char *)
592
+ #object PyArray_FromString (char *, npy_intp, dtype, npy_intp, char *)
593
+ #object PyArray_FromBuffer (object, dtype, npy_intp, npy_intp)
594
+ #object PyArray_FromIter (object, dtype, npy_intp)
595
+ object PyArray_Return (ndarray)
596
+ #object PyArray_GetField (ndarray, dtype, int)
597
+ #int PyArray_SetField (ndarray, dtype, int, object) except -1
598
+ object PyArray_Byteswap (ndarray, npy_bool)
599
+ object PyArray_Resize (ndarray, PyArray_Dims *, int, NPY_ORDER)
600
+ int PyArray_CopyInto (ndarray, ndarray) except -1
601
+ int PyArray_CopyAnyInto (ndarray, ndarray) except -1
602
+ int PyArray_CopyObject (ndarray, object) except -1
603
+ object PyArray_NewCopy (ndarray, NPY_ORDER)
604
+ object PyArray_ToList (ndarray)
605
+ object PyArray_ToString (ndarray, NPY_ORDER)
606
+ int PyArray_ToFile (ndarray, stdio.FILE *, char *, char *) except -1
607
+ int PyArray_Dump (object, object, int) except -1
608
+ object PyArray_Dumps (object, int)
609
+ int PyArray_ValidType (int) # Cannot error
610
+ void PyArray_UpdateFlags (ndarray, int)
611
+ object PyArray_New (type, int, npy_intp *, int, npy_intp *, void *, int, int, object)
612
+ #object PyArray_NewFromDescr (type, dtype, int, npy_intp *, npy_intp *, void *, int, object)
613
+ #dtype PyArray_DescrNew (dtype)
614
+ dtype PyArray_DescrNewFromType (int)
615
+ double PyArray_GetPriority (object, double) # clears errors as of 1.25
616
+ object PyArray_IterNew (object)
617
+ object PyArray_MultiIterNew (int, ...)
618
+
619
+ int PyArray_PyIntAsInt (object) except? -1
620
+ npy_intp PyArray_PyIntAsIntp (object)
621
+ int PyArray_Broadcast (broadcast) except -1
622
+ int PyArray_FillWithScalar (ndarray, object) except -1
623
+ npy_bool PyArray_CheckStrides (int, int, npy_intp, npy_intp, npy_intp *, npy_intp *)
624
+ dtype PyArray_DescrNewByteorder (dtype, char)
625
+ object PyArray_IterAllButAxis (object, int *)
626
+ #object PyArray_CheckFromAny (object, dtype, int, int, int, object)
627
+ #object PyArray_FromArray (ndarray, dtype, int)
628
+ object PyArray_FromInterface (object)
629
+ object PyArray_FromStructInterface (object)
630
+ #object PyArray_FromArrayAttr (object, dtype, object)
631
+ #NPY_SCALARKIND PyArray_ScalarKind (int, ndarray*)
632
+ int PyArray_CanCoerceScalar (int, int, NPY_SCALARKIND)
633
+ npy_bool PyArray_CanCastScalar (type, type)
634
+ int PyArray_RemoveSmallest (broadcast) except -1
635
+ int PyArray_ElementStrides (object)
636
+ void PyArray_Item_INCREF (char *, dtype) except *
637
+ void PyArray_Item_XDECREF (char *, dtype) except *
638
+ object PyArray_Transpose (ndarray, PyArray_Dims *)
639
+ object PyArray_TakeFrom (ndarray, object, int, ndarray, NPY_CLIPMODE)
640
+ object PyArray_PutTo (ndarray, object, object, NPY_CLIPMODE)
641
+ object PyArray_PutMask (ndarray, object, object)
642
+ object PyArray_Repeat (ndarray, object, int)
643
+ object PyArray_Choose (ndarray, object, ndarray, NPY_CLIPMODE)
644
+ int PyArray_Sort (ndarray, int, NPY_SORTKIND) except -1
645
+ object PyArray_ArgSort (ndarray, int, NPY_SORTKIND)
646
+ object PyArray_SearchSorted (ndarray, object, NPY_SEARCHSIDE, PyObject *)
647
+ object PyArray_ArgMax (ndarray, int, ndarray)
648
+ object PyArray_ArgMin (ndarray, int, ndarray)
649
+ object PyArray_Reshape (ndarray, object)
650
+ object PyArray_Newshape (ndarray, PyArray_Dims *, NPY_ORDER)
651
+ object PyArray_Squeeze (ndarray)
652
+ #object PyArray_View (ndarray, dtype, type)
653
+ object PyArray_SwapAxes (ndarray, int, int)
654
+ object PyArray_Max (ndarray, int, ndarray)
655
+ object PyArray_Min (ndarray, int, ndarray)
656
+ object PyArray_Ptp (ndarray, int, ndarray)
657
+ object PyArray_Mean (ndarray, int, int, ndarray)
658
+ object PyArray_Trace (ndarray, int, int, int, int, ndarray)
659
+ object PyArray_Diagonal (ndarray, int, int, int)
660
+ object PyArray_Clip (ndarray, object, object, ndarray)
661
+ object PyArray_Conjugate (ndarray, ndarray)
662
+ object PyArray_Nonzero (ndarray)
663
+ object PyArray_Std (ndarray, int, int, ndarray, int)
664
+ object PyArray_Sum (ndarray, int, int, ndarray)
665
+ object PyArray_CumSum (ndarray, int, int, ndarray)
666
+ object PyArray_Prod (ndarray, int, int, ndarray)
667
+ object PyArray_CumProd (ndarray, int, int, ndarray)
668
+ object PyArray_All (ndarray, int, ndarray)
669
+ object PyArray_Any (ndarray, int, ndarray)
670
+ object PyArray_Compress (ndarray, object, int, ndarray)
671
+ object PyArray_Flatten (ndarray, NPY_ORDER)
672
+ object PyArray_Ravel (ndarray, NPY_ORDER)
673
+ npy_intp PyArray_MultiplyList (npy_intp *, int)
674
+ int PyArray_MultiplyIntList (int *, int)
675
+ void * PyArray_GetPtr (ndarray, npy_intp*)
676
+ int PyArray_CompareLists (npy_intp *, npy_intp *, int)
677
+ #int PyArray_AsCArray (object*, void *, npy_intp *, int, dtype)
678
+ int PyArray_Free (object, void *)
679
+ #int PyArray_Converter (object, object*)
680
+ int PyArray_IntpFromSequence (object, npy_intp *, int) except -1
681
+ object PyArray_Concatenate (object, int)
682
+ object PyArray_InnerProduct (object, object)
683
+ object PyArray_MatrixProduct (object, object)
684
+ object PyArray_Correlate (object, object, int)
685
+ #int PyArray_DescrConverter (object, dtype*) except 0
686
+ #int PyArray_DescrConverter2 (object, dtype*) except 0
687
+ int PyArray_IntpConverter (object, PyArray_Dims *) except 0
688
+ #int PyArray_BufferConverter (object, chunk) except 0
689
+ int PyArray_AxisConverter (object, int *) except 0
690
+ int PyArray_BoolConverter (object, npy_bool *) except 0
691
+ int PyArray_ByteorderConverter (object, char *) except 0
692
+ int PyArray_OrderConverter (object, NPY_ORDER *) except 0
693
+ unsigned char PyArray_EquivTypes (dtype, dtype) # clears errors
694
+ #object PyArray_Zeros (int, npy_intp *, dtype, int)
695
+ #object PyArray_Empty (int, npy_intp *, dtype, int)
696
+ object PyArray_Where (object, object, object)
697
+ object PyArray_Arange (double, double, double, int)
698
+ #object PyArray_ArangeObj (object, object, object, dtype)
699
+ int PyArray_SortkindConverter (object, NPY_SORTKIND *) except 0
700
+ object PyArray_LexSort (object, int)
701
+ object PyArray_Round (ndarray, int, ndarray)
702
+ unsigned char PyArray_EquivTypenums (int, int)
703
+ int PyArray_RegisterDataType (dtype) except -1
704
+ int PyArray_RegisterCastFunc (dtype, int, PyArray_VectorUnaryFunc *) except -1
705
+ int PyArray_RegisterCanCast (dtype, int, NPY_SCALARKIND) except -1
706
+ #void PyArray_InitArrFuncs (PyArray_ArrFuncs *)
707
+ object PyArray_IntTupleFromIntp (int, npy_intp *)
708
+ int PyArray_ClipmodeConverter (object, NPY_CLIPMODE *) except 0
709
+ #int PyArray_OutputConverter (object, ndarray*) except 0
710
+ object PyArray_BroadcastToShape (object, npy_intp *, int)
711
+ #int PyArray_DescrAlignConverter (object, dtype*) except 0
712
+ #int PyArray_DescrAlignConverter2 (object, dtype*) except 0
713
+ int PyArray_SearchsideConverter (object, void *) except 0
714
+ object PyArray_CheckAxis (ndarray, int *, int)
715
+ npy_intp PyArray_OverflowMultiplyList (npy_intp *, int)
716
+ int PyArray_SetBaseObject(ndarray, base) except -1 # NOTE: steals a reference to base! Use "set_array_base()" instead.
717
+
718
+ # The memory handler functions require the NumPy 1.22 API
719
+ # and may require defining NPY_TARGET_VERSION
720
+ ctypedef struct PyDataMemAllocator:
721
+ void *ctx
722
+ void* (*malloc) (void *ctx, size_t size)
723
+ void* (*calloc) (void *ctx, size_t nelem, size_t elsize)
724
+ void* (*realloc) (void *ctx, void *ptr, size_t new_size)
725
+ void (*free) (void *ctx, void *ptr, size_t size)
726
+
727
+ ctypedef struct PyDataMem_Handler:
728
+ char* name
729
+ npy_uint8 version
730
+ PyDataMemAllocator allocator
731
+
732
+ object PyDataMem_SetHandler(object handler)
733
+ object PyDataMem_GetHandler()
734
+
735
+ # additional datetime related functions are defined below
736
+
737
+
738
+ # Typedefs that matches the runtime dtype objects in
739
+ # the numpy module.
740
+
741
+ # The ones that are commented out needs an IFDEF function
742
+ # in Cython to enable them only on the right systems.
743
+
744
+ ctypedef npy_int8 int8_t
745
+ ctypedef npy_int16 int16_t
746
+ ctypedef npy_int32 int32_t
747
+ ctypedef npy_int64 int64_t
748
+
749
+ ctypedef npy_uint8 uint8_t
750
+ ctypedef npy_uint16 uint16_t
751
+ ctypedef npy_uint32 uint32_t
752
+ ctypedef npy_uint64 uint64_t
753
+
754
+ ctypedef npy_float32 float32_t
755
+ ctypedef npy_float64 float64_t
756
+ #ctypedef npy_float80 float80_t
757
+ #ctypedef npy_float128 float128_t
758
+
759
+ ctypedef float complex complex64_t
760
+ ctypedef double complex complex128_t
761
+
762
+ ctypedef npy_longlong longlong_t
763
+ ctypedef npy_ulonglong ulonglong_t
764
+
765
+ ctypedef npy_intp intp_t
766
+ ctypedef npy_uintp uintp_t
767
+
768
+ ctypedef npy_double float_t
769
+ ctypedef npy_double double_t
770
+ ctypedef npy_longdouble longdouble_t
771
+
772
+ ctypedef float complex cfloat_t
773
+ ctypedef double complex cdouble_t
774
+ ctypedef double complex complex_t
775
+ ctypedef long double complex clongdouble_t
776
+
777
+ cdef inline object PyArray_MultiIterNew1(a):
778
+ return PyArray_MultiIterNew(1, <void*>a)
779
+
780
+ cdef inline object PyArray_MultiIterNew2(a, b):
781
+ return PyArray_MultiIterNew(2, <void*>a, <void*>b)
782
+
783
+ cdef inline object PyArray_MultiIterNew3(a, b, c):
784
+ return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
785
+
786
+ cdef inline object PyArray_MultiIterNew4(a, b, c, d):
787
+ return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
788
+
789
+ cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
790
+ return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
791
+
792
+ cdef inline tuple PyDataType_SHAPE(dtype d):
793
+ if PyDataType_HASSUBARRAY(d):
794
+ return <tuple>d.subarray.shape
795
+ else:
796
+ return ()
797
+
798
+
799
+ cdef extern from "numpy/ndarrayobject.h":
800
+ PyTypeObject PyTimedeltaArrType_Type
801
+ PyTypeObject PyDatetimeArrType_Type
802
+ ctypedef int64_t npy_timedelta
803
+ ctypedef int64_t npy_datetime
804
+
805
+ cdef extern from "numpy/ndarraytypes.h":
806
+ ctypedef struct PyArray_DatetimeMetaData:
807
+ NPY_DATETIMEUNIT base
808
+ int64_t num
809
+
810
+ ctypedef struct npy_datetimestruct:
811
+ int64_t year
812
+ int32_t month, day, hour, min, sec, us, ps, as
813
+
814
+ # Iterator API added in v1.6
815
+ #
816
+ # These don't match the definition in the C API because Cython can't wrap
817
+ # function pointers that return functions.
818
+ # https://github.com/cython/cython/issues/6720
819
+ ctypedef int (*NpyIter_IterNextFunc "NpyIter_IterNextFunc *")(NpyIter* it) noexcept nogil
820
+ ctypedef void (*NpyIter_GetMultiIndexFunc "NpyIter_GetMultiIndexFunc *")(NpyIter* it, npy_intp* outcoords) noexcept nogil
821
+
822
+
823
+ cdef extern from "numpy/arrayscalars.h":
824
+
825
+ # abstract types
826
+ ctypedef class numpy.generic [object PyObject]:
827
+ pass
828
+ ctypedef class numpy.number [object PyObject]:
829
+ pass
830
+ ctypedef class numpy.integer [object PyObject]:
831
+ pass
832
+ ctypedef class numpy.signedinteger [object PyObject]:
833
+ pass
834
+ ctypedef class numpy.unsignedinteger [object PyObject]:
835
+ pass
836
+ ctypedef class numpy.inexact [object PyObject]:
837
+ pass
838
+ ctypedef class numpy.floating [object PyObject]:
839
+ pass
840
+ ctypedef class numpy.complexfloating [object PyObject]:
841
+ pass
842
+ ctypedef class numpy.flexible [object PyObject]:
843
+ pass
844
+ ctypedef class numpy.character [object PyObject]:
845
+ pass
846
+
847
+ ctypedef struct PyDatetimeScalarObject:
848
+ # PyObject_HEAD
849
+ npy_datetime obval
850
+ PyArray_DatetimeMetaData obmeta
851
+
852
+ ctypedef struct PyTimedeltaScalarObject:
853
+ # PyObject_HEAD
854
+ npy_timedelta obval
855
+ PyArray_DatetimeMetaData obmeta
856
+
857
+ ctypedef enum NPY_DATETIMEUNIT:
858
+ NPY_FR_Y
859
+ NPY_FR_M
860
+ NPY_FR_W
861
+ NPY_FR_D
862
+ NPY_FR_B
863
+ NPY_FR_h
864
+ NPY_FR_m
865
+ NPY_FR_s
866
+ NPY_FR_ms
867
+ NPY_FR_us
868
+ NPY_FR_ns
869
+ NPY_FR_ps
870
+ NPY_FR_fs
871
+ NPY_FR_as
872
+ NPY_FR_GENERIC
873
+
874
+
875
+ cdef extern from "numpy/arrayobject.h":
876
+ # These are part of the C-API defined in `__multiarray_api.h`
877
+
878
+ # NumPy internal definitions in datetime_strings.c:
879
+ int get_datetime_iso_8601_strlen "NpyDatetime_GetDatetimeISO8601StrLen" (
880
+ int local, NPY_DATETIMEUNIT base)
881
+ int make_iso_8601_datetime "NpyDatetime_MakeISO8601Datetime" (
882
+ npy_datetimestruct *dts, char *outstr, npy_intp outlen,
883
+ int local, int utc, NPY_DATETIMEUNIT base, int tzoffset,
884
+ NPY_CASTING casting) except -1
885
+
886
+ # NumPy internal definition in datetime.c:
887
+ # May return 1 to indicate that object does not appear to be a datetime
888
+ # (returns 0 on success).
889
+ int convert_pydatetime_to_datetimestruct "NpyDatetime_ConvertPyDateTimeToDatetimeStruct" (
890
+ PyObject *obj, npy_datetimestruct *out,
891
+ NPY_DATETIMEUNIT *out_bestunit, int apply_tzinfo) except -1
892
+ int convert_datetime64_to_datetimestruct "NpyDatetime_ConvertDatetime64ToDatetimeStruct" (
893
+ PyArray_DatetimeMetaData *meta, npy_datetime dt,
894
+ npy_datetimestruct *out) except -1
895
+ int convert_datetimestruct_to_datetime64 "NpyDatetime_ConvertDatetimeStructToDatetime64"(
896
+ PyArray_DatetimeMetaData *meta, const npy_datetimestruct *dts,
897
+ npy_datetime *out) except -1
898
+
899
+
900
+ #
901
+ # ufunc API
902
+ #
903
+
904
+ cdef extern from "numpy/ufuncobject.h":
905
+
906
+ ctypedef void (*PyUFuncGenericFunction) (char **, npy_intp *, npy_intp *, void *)
907
+
908
+ ctypedef class numpy.ufunc [object PyUFuncObject, check_size ignore]:
909
+ cdef:
910
+ int nin, nout, nargs
911
+ int identity
912
+ PyUFuncGenericFunction *functions
913
+ void **data
914
+ int ntypes
915
+ int check_return
916
+ char *name
917
+ char *types
918
+ char *doc
919
+ void *ptr
920
+ PyObject *obj
921
+ PyObject *userloops
922
+
923
+ cdef enum:
924
+ PyUFunc_Zero
925
+ PyUFunc_One
926
+ PyUFunc_None
927
+ # deprecated
928
+ UFUNC_FPE_DIVIDEBYZERO
929
+ UFUNC_FPE_OVERFLOW
930
+ UFUNC_FPE_UNDERFLOW
931
+ UFUNC_FPE_INVALID
932
+ # use these instead
933
+ NPY_FPE_DIVIDEBYZERO
934
+ NPY_FPE_OVERFLOW
935
+ NPY_FPE_UNDERFLOW
936
+ NPY_FPE_INVALID
937
+
938
+
939
+ object PyUFunc_FromFuncAndData(PyUFuncGenericFunction *,
940
+ void **, char *, int, int, int, int, char *, char *, int)
941
+ int PyUFunc_RegisterLoopForType(ufunc, int,
942
+ PyUFuncGenericFunction, int *, void *) except -1
943
+ void PyUFunc_f_f_As_d_d \
944
+ (char **, npy_intp *, npy_intp *, void *)
945
+ void PyUFunc_d_d \
946
+ (char **, npy_intp *, npy_intp *, void *)
947
+ void PyUFunc_f_f \
948
+ (char **, npy_intp *, npy_intp *, void *)
949
+ void PyUFunc_g_g \
950
+ (char **, npy_intp *, npy_intp *, void *)
951
+ void PyUFunc_F_F_As_D_D \
952
+ (char **, npy_intp *, npy_intp *, void *)
953
+ void PyUFunc_F_F \
954
+ (char **, npy_intp *, npy_intp *, void *)
955
+ void PyUFunc_D_D \
956
+ (char **, npy_intp *, npy_intp *, void *)
957
+ void PyUFunc_G_G \
958
+ (char **, npy_intp *, npy_intp *, void *)
959
+ void PyUFunc_O_O \
960
+ (char **, npy_intp *, npy_intp *, void *)
961
+ void PyUFunc_ff_f_As_dd_d \
962
+ (char **, npy_intp *, npy_intp *, void *)
963
+ void PyUFunc_ff_f \
964
+ (char **, npy_intp *, npy_intp *, void *)
965
+ void PyUFunc_dd_d \
966
+ (char **, npy_intp *, npy_intp *, void *)
967
+ void PyUFunc_gg_g \
968
+ (char **, npy_intp *, npy_intp *, void *)
969
+ void PyUFunc_FF_F_As_DD_D \
970
+ (char **, npy_intp *, npy_intp *, void *)
971
+ void PyUFunc_DD_D \
972
+ (char **, npy_intp *, npy_intp *, void *)
973
+ void PyUFunc_FF_F \
974
+ (char **, npy_intp *, npy_intp *, void *)
975
+ void PyUFunc_GG_G \
976
+ (char **, npy_intp *, npy_intp *, void *)
977
+ void PyUFunc_OO_O \
978
+ (char **, npy_intp *, npy_intp *, void *)
979
+ void PyUFunc_O_O_method \
980
+ (char **, npy_intp *, npy_intp *, void *)
981
+ void PyUFunc_OO_O_method \
982
+ (char **, npy_intp *, npy_intp *, void *)
983
+ void PyUFunc_On_Om \
984
+ (char **, npy_intp *, npy_intp *, void *)
985
+ void PyUFunc_clearfperr()
986
+ int PyUFunc_getfperr()
987
+ int PyUFunc_ReplaceLoopBySignature \
988
+ (ufunc, PyUFuncGenericFunction, int *, PyUFuncGenericFunction *)
989
+ object PyUFunc_FromFuncAndDataAndSignature \
990
+ (PyUFuncGenericFunction *, void **, char *, int, int, int,
991
+ int, char *, char *, int, char *)
992
+
993
+ int _import_umath() except -1
994
+
995
+ cdef inline void set_array_base(ndarray arr, object base) except *:
996
+ Py_INCREF(base) # important to do this before stealing the reference below!
997
+ PyArray_SetBaseObject(arr, base)
998
+
999
+ cdef inline object get_array_base(ndarray arr):
1000
+ base = PyArray_BASE(arr)
1001
+ if base is NULL:
1002
+ return None
1003
+ return <object>base
1004
+
1005
+ # Versions of the import_* functions which are more suitable for
1006
+ # Cython code.
1007
+ cdef inline int import_array() except -1:
1008
+ try:
1009
+ __pyx_import_array()
1010
+ except Exception:
1011
+ raise ImportError("numpy._core.multiarray failed to import")
1012
+
1013
+ cdef inline int import_umath() except -1:
1014
+ try:
1015
+ _import_umath()
1016
+ except Exception:
1017
+ raise ImportError("numpy._core.umath failed to import")
1018
+
1019
+ cdef inline int import_ufunc() except -1:
1020
+ try:
1021
+ _import_umath()
1022
+ except Exception:
1023
+ raise ImportError("numpy._core.umath failed to import")
1024
+
1025
+
1026
+ cdef inline bint is_timedelta64_object(object obj) noexcept:
1027
+ """
1028
+ Cython equivalent of `isinstance(obj, np.timedelta64)`
1029
+
1030
+ Parameters
1031
+ ----------
1032
+ obj : object
1033
+
1034
+ Returns
1035
+ -------
1036
+ bool
1037
+ """
1038
+ return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type)
1039
+
1040
+
1041
+ cdef inline bint is_datetime64_object(object obj) noexcept:
1042
+ """
1043
+ Cython equivalent of `isinstance(obj, np.datetime64)`
1044
+
1045
+ Parameters
1046
+ ----------
1047
+ obj : object
1048
+
1049
+ Returns
1050
+ -------
1051
+ bool
1052
+ """
1053
+ return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type)
1054
+
1055
+
1056
+ cdef inline npy_datetime get_datetime64_value(object obj) noexcept nogil:
1057
+ """
1058
+ returns the int64 value underlying scalar numpy datetime64 object
1059
+
1060
+ Note that to interpret this as a datetime, the corresponding unit is
1061
+ also needed. That can be found using `get_datetime64_unit`.
1062
+ """
1063
+ return (<PyDatetimeScalarObject*>obj).obval
1064
+
1065
+
1066
+ cdef inline npy_timedelta get_timedelta64_value(object obj) noexcept nogil:
1067
+ """
1068
+ returns the int64 value underlying scalar numpy timedelta64 object
1069
+ """
1070
+ return (<PyTimedeltaScalarObject*>obj).obval
1071
+
1072
+
1073
+ cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) noexcept nogil:
1074
+ """
1075
+ returns the unit part of the dtype for a numpy datetime64 object.
1076
+ """
1077
+ return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base
1078
+
1079
+
1080
+ cdef extern from "numpy/arrayobject.h":
1081
+
1082
+ ctypedef struct NpyIter:
1083
+ pass
1084
+
1085
+ cdef enum:
1086
+ NPY_FAIL
1087
+ NPY_SUCCEED
1088
+
1089
+ cdef enum:
1090
+ # Track an index representing C order
1091
+ NPY_ITER_C_INDEX
1092
+ # Track an index representing Fortran order
1093
+ NPY_ITER_F_INDEX
1094
+ # Track a multi-index
1095
+ NPY_ITER_MULTI_INDEX
1096
+ # User code external to the iterator does the 1-dimensional innermost loop
1097
+ NPY_ITER_EXTERNAL_LOOP
1098
+ # Convert all the operands to a common data type
1099
+ NPY_ITER_COMMON_DTYPE
1100
+ # Operands may hold references, requiring API access during iteration
1101
+ NPY_ITER_REFS_OK
1102
+ # Zero-sized operands should be permitted, iteration checks IterSize for 0
1103
+ NPY_ITER_ZEROSIZE_OK
1104
+ # Permits reductions (size-0 stride with dimension size > 1)
1105
+ NPY_ITER_REDUCE_OK
1106
+ # Enables sub-range iteration
1107
+ NPY_ITER_RANGED
1108
+ # Enables buffering
1109
+ NPY_ITER_BUFFERED
1110
+ # When buffering is enabled, grows the inner loop if possible
1111
+ NPY_ITER_GROWINNER
1112
+ # Delay allocation of buffers until first Reset* call
1113
+ NPY_ITER_DELAY_BUFALLOC
1114
+ # When NPY_KEEPORDER is specified, disable reversing negative-stride axes
1115
+ NPY_ITER_DONT_NEGATE_STRIDES
1116
+ NPY_ITER_COPY_IF_OVERLAP
1117
+ # The operand will be read from and written to
1118
+ NPY_ITER_READWRITE
1119
+ # The operand will only be read from
1120
+ NPY_ITER_READONLY
1121
+ # The operand will only be written to
1122
+ NPY_ITER_WRITEONLY
1123
+ # The operand's data must be in native byte order
1124
+ NPY_ITER_NBO
1125
+ # The operand's data must be aligned
1126
+ NPY_ITER_ALIGNED
1127
+ # The operand's data must be contiguous (within the inner loop)
1128
+ NPY_ITER_CONTIG
1129
+ # The operand may be copied to satisfy requirements
1130
+ NPY_ITER_COPY
1131
+ # The operand may be copied with WRITEBACKIFCOPY to satisfy requirements
1132
+ NPY_ITER_UPDATEIFCOPY
1133
+ # Allocate the operand if it is NULL
1134
+ NPY_ITER_ALLOCATE
1135
+ # If an operand is allocated, don't use any subtype
1136
+ NPY_ITER_NO_SUBTYPE
1137
+ # This is a virtual array slot, operand is NULL but temporary data is there
1138
+ NPY_ITER_VIRTUAL
1139
+ # Require that the dimension match the iterator dimensions exactly
1140
+ NPY_ITER_NO_BROADCAST
1141
+ # A mask is being used on this array, affects buffer -> array copy
1142
+ NPY_ITER_WRITEMASKED
1143
+ # This array is the mask for all WRITEMASKED operands
1144
+ NPY_ITER_ARRAYMASK
1145
+ # Assume iterator order data access for COPY_IF_OVERLAP
1146
+ NPY_ITER_OVERLAP_ASSUME_ELEMENTWISE
1147
+
1148
+ # construction and destruction functions
1149
+ NpyIter* NpyIter_New(ndarray arr, npy_uint32 flags, NPY_ORDER order,
1150
+ NPY_CASTING casting, dtype datatype) except NULL
1151
+ NpyIter* NpyIter_MultiNew(npy_intp nop, PyArrayObject** op, npy_uint32 flags,
1152
+ NPY_ORDER order, NPY_CASTING casting, npy_uint32*
1153
+ op_flags, PyArray_Descr** op_dtypes) except NULL
1154
+ NpyIter* NpyIter_AdvancedNew(npy_intp nop, PyArrayObject** op,
1155
+ npy_uint32 flags, NPY_ORDER order,
1156
+ NPY_CASTING casting, npy_uint32* op_flags,
1157
+ PyArray_Descr** op_dtypes, int oa_ndim,
1158
+ int** op_axes, const npy_intp* itershape,
1159
+ npy_intp buffersize) except NULL
1160
+ NpyIter* NpyIter_Copy(NpyIter* it) except NULL
1161
+ int NpyIter_RemoveAxis(NpyIter* it, int axis) except NPY_FAIL
1162
+ int NpyIter_RemoveMultiIndex(NpyIter* it) except NPY_FAIL
1163
+ int NpyIter_EnableExternalLoop(NpyIter* it) except NPY_FAIL
1164
+ int NpyIter_Deallocate(NpyIter* it) except NPY_FAIL
1165
+ int NpyIter_Reset(NpyIter* it, char** errmsg) except NPY_FAIL
1166
+ int NpyIter_ResetToIterIndexRange(NpyIter* it, npy_intp istart,
1167
+ npy_intp iend, char** errmsg) except NPY_FAIL
1168
+ int NpyIter_ResetBasePointers(NpyIter* it, char** baseptrs, char** errmsg) except NPY_FAIL
1169
+ int NpyIter_GotoMultiIndex(NpyIter* it, const npy_intp* multi_index) except NPY_FAIL
1170
+ int NpyIter_GotoIndex(NpyIter* it, npy_intp index) except NPY_FAIL
1171
+ npy_intp NpyIter_GetIterSize(NpyIter* it) nogil
1172
+ npy_intp NpyIter_GetIterIndex(NpyIter* it) nogil
1173
+ void NpyIter_GetIterIndexRange(NpyIter* it, npy_intp* istart,
1174
+ npy_intp* iend) nogil
1175
+ int NpyIter_GotoIterIndex(NpyIter* it, npy_intp iterindex) except NPY_FAIL
1176
+ npy_bool NpyIter_HasDelayedBufAlloc(NpyIter* it) nogil
1177
+ npy_bool NpyIter_HasExternalLoop(NpyIter* it) nogil
1178
+ npy_bool NpyIter_HasMultiIndex(NpyIter* it) nogil
1179
+ npy_bool NpyIter_HasIndex(NpyIter* it) nogil
1180
+ npy_bool NpyIter_RequiresBuffering(NpyIter* it) nogil
1181
+ npy_bool NpyIter_IsBuffered(NpyIter* it) nogil
1182
+ npy_bool NpyIter_IsGrowInner(NpyIter* it) nogil
1183
+ npy_intp NpyIter_GetBufferSize(NpyIter* it) nogil
1184
+ int NpyIter_GetNDim(NpyIter* it) nogil
1185
+ int NpyIter_GetNOp(NpyIter* it) nogil
1186
+ npy_intp* NpyIter_GetAxisStrideArray(NpyIter* it, int axis) except NULL
1187
+ int NpyIter_GetShape(NpyIter* it, npy_intp* outshape) nogil
1188
+ PyArray_Descr** NpyIter_GetDescrArray(NpyIter* it)
1189
+ PyArrayObject** NpyIter_GetOperandArray(NpyIter* it)
1190
+ ndarray NpyIter_GetIterView(NpyIter* it, npy_intp i)
1191
+ void NpyIter_GetReadFlags(NpyIter* it, char* outreadflags)
1192
+ void NpyIter_GetWriteFlags(NpyIter* it, char* outwriteflags)
1193
+ int NpyIter_CreateCompatibleStrides(NpyIter* it, npy_intp itemsize,
1194
+ npy_intp* outstrides) except NPY_FAIL
1195
+ npy_bool NpyIter_IsFirstVisit(NpyIter* it, int iop) nogil
1196
+ # functions for iterating an NpyIter object
1197
+ #
1198
+ # These don't match the definition in the C API because Cython can't wrap
1199
+ # function pointers that return functions.
1200
+ NpyIter_IterNextFunc NpyIter_GetIterNext(NpyIter* it, char** errmsg) except NULL
1201
+ NpyIter_GetMultiIndexFunc NpyIter_GetGetMultiIndex(NpyIter* it,
1202
+ char** errmsg) except NULL
1203
+ char** NpyIter_GetDataPtrArray(NpyIter* it) nogil
1204
+ char** NpyIter_GetInitialDataPtrArray(NpyIter* it) nogil
1205
+ npy_intp* NpyIter_GetIndexPtr(NpyIter* it)
1206
+ npy_intp* NpyIter_GetInnerStrideArray(NpyIter* it) nogil
1207
+ npy_intp* NpyIter_GetInnerLoopSizePtr(NpyIter* it) nogil
1208
+ void NpyIter_GetInnerFixedStrideArray(NpyIter* it, npy_intp* outstrides) nogil
1209
+ npy_bool NpyIter_IterationNeedsAPI(NpyIter* it) nogil
1210
+ void NpyIter_DebugPrint(NpyIter* it)
1211
+
1212
+ # NpyString API
1213
+ cdef extern from "numpy/ndarraytypes.h":
1214
+ ctypedef struct npy_string_allocator:
1215
+ pass
1216
+
1217
+ ctypedef struct npy_packed_static_string:
1218
+ pass
1219
+
1220
+ ctypedef struct npy_static_string:
1221
+ size_t size
1222
+ const char *buf
1223
+
1224
+ ctypedef struct PyArray_StringDTypeObject:
1225
+ PyArray_Descr base
1226
+ PyObject *na_object
1227
+ char coerce
1228
+ char has_nan_na
1229
+ char has_string_na
1230
+ char array_owned
1231
+ npy_static_string default_string
1232
+ npy_static_string na_name
1233
+ npy_string_allocator *allocator
1234
+
1235
+ cdef extern from "numpy/arrayobject.h":
1236
+ npy_string_allocator *NpyString_acquire_allocator(const PyArray_StringDTypeObject *descr)
1237
+ void NpyString_acquire_allocators(size_t n_descriptors, PyArray_Descr *const descrs[], npy_string_allocator *allocators[])
1238
+ void NpyString_release_allocator(npy_string_allocator *allocator)
1239
+ void NpyString_release_allocators(size_t length, npy_string_allocator *allocators[])
1240
+ int NpyString_load(npy_string_allocator *allocator, const npy_packed_static_string *packed_string, npy_static_string *unpacked_string)
1241
+ int NpyString_pack_null(npy_string_allocator *allocator, npy_packed_static_string *packed_string)
1242
+ int NpyString_pack(npy_string_allocator *allocator, npy_packed_static_string *packed_string, const char *buf, size_t size)
TTS/Kokoro/.venv/Lib/site-packages/numpy/__init__.pxd ADDED
@@ -0,0 +1,1155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NumPy static imports for Cython < 3.0
2
+ #
3
+ # If any of the PyArray_* functions are called, import_array must be
4
+ # called first.
5
+ #
6
+ # Author: Dag Sverre Seljebotn
7
+ #
8
+
9
+ DEF _buffer_format_string_len = 255
10
+
11
+ cimport cpython.buffer as pybuf
12
+ from cpython.ref cimport Py_INCREF
13
+ from cpython.mem cimport PyObject_Malloc, PyObject_Free
14
+ from cpython.object cimport PyObject, PyTypeObject
15
+ from cpython.buffer cimport PyObject_GetBuffer
16
+ from cpython.type cimport type
17
+ cimport libc.stdio as stdio
18
+
19
+
20
+ cdef extern from *:
21
+ # Leave a marker that the NumPy declarations came from NumPy itself and not from Cython.
22
+ # See https://github.com/cython/cython/issues/3573
23
+ """
24
+ /* Using NumPy API declarations from "numpy/__init__.pxd" */
25
+ """
26
+
27
+
28
+ cdef extern from "Python.h":
29
+ ctypedef int Py_intptr_t
30
+ bint PyObject_TypeCheck(object obj, PyTypeObject* type)
31
+
32
+ cdef extern from "numpy/arrayobject.h":
33
+ # It would be nice to use size_t and ssize_t, but ssize_t has special
34
+ # implicit conversion rules, so just use "long".
35
+ # Note: The actual type only matters for Cython promotion, so long
36
+ # is closer than int, but could lead to incorrect promotion.
37
+ # (Not to worrying, and always the status-quo.)
38
+ ctypedef signed long npy_intp
39
+ ctypedef unsigned long npy_uintp
40
+
41
+ ctypedef unsigned char npy_bool
42
+
43
+ ctypedef signed char npy_byte
44
+ ctypedef signed short npy_short
45
+ ctypedef signed int npy_int
46
+ ctypedef signed long npy_long
47
+ ctypedef signed long long npy_longlong
48
+
49
+ ctypedef unsigned char npy_ubyte
50
+ ctypedef unsigned short npy_ushort
51
+ ctypedef unsigned int npy_uint
52
+ ctypedef unsigned long npy_ulong
53
+ ctypedef unsigned long long npy_ulonglong
54
+
55
+ ctypedef float npy_float
56
+ ctypedef double npy_double
57
+ ctypedef long double npy_longdouble
58
+
59
+ ctypedef signed char npy_int8
60
+ ctypedef signed short npy_int16
61
+ ctypedef signed int npy_int32
62
+ ctypedef signed long long npy_int64
63
+
64
+ ctypedef unsigned char npy_uint8
65
+ ctypedef unsigned short npy_uint16
66
+ ctypedef unsigned int npy_uint32
67
+ ctypedef unsigned long long npy_uint64
68
+
69
+ ctypedef float npy_float32
70
+ ctypedef double npy_float64
71
+ ctypedef long double npy_float80
72
+ ctypedef long double npy_float96
73
+ ctypedef long double npy_float128
74
+
75
+ ctypedef struct npy_cfloat:
76
+ pass
77
+
78
+ ctypedef struct npy_cdouble:
79
+ pass
80
+
81
+ ctypedef struct npy_clongdouble:
82
+ pass
83
+
84
+ ctypedef struct npy_complex64:
85
+ pass
86
+
87
+ ctypedef struct npy_complex128:
88
+ pass
89
+
90
+ ctypedef struct npy_complex160:
91
+ pass
92
+
93
+ ctypedef struct npy_complex192:
94
+ pass
95
+
96
+ ctypedef struct npy_complex256:
97
+ pass
98
+
99
+ ctypedef struct PyArray_Dims:
100
+ npy_intp *ptr
101
+ int len
102
+
103
+
104
+ cdef enum NPY_TYPES:
105
+ NPY_BOOL
106
+ NPY_BYTE
107
+ NPY_UBYTE
108
+ NPY_SHORT
109
+ NPY_USHORT
110
+ NPY_INT
111
+ NPY_UINT
112
+ NPY_LONG
113
+ NPY_ULONG
114
+ NPY_LONGLONG
115
+ NPY_ULONGLONG
116
+ NPY_FLOAT
117
+ NPY_DOUBLE
118
+ NPY_LONGDOUBLE
119
+ NPY_CFLOAT
120
+ NPY_CDOUBLE
121
+ NPY_CLONGDOUBLE
122
+ NPY_OBJECT
123
+ NPY_STRING
124
+ NPY_UNICODE
125
+ NPY_VSTRING
126
+ NPY_VOID
127
+ NPY_DATETIME
128
+ NPY_TIMEDELTA
129
+ NPY_NTYPES_LEGACY
130
+ NPY_NOTYPE
131
+
132
+ NPY_INT8
133
+ NPY_INT16
134
+ NPY_INT32
135
+ NPY_INT64
136
+ NPY_UINT8
137
+ NPY_UINT16
138
+ NPY_UINT32
139
+ NPY_UINT64
140
+ NPY_FLOAT16
141
+ NPY_FLOAT32
142
+ NPY_FLOAT64
143
+ NPY_FLOAT80
144
+ NPY_FLOAT96
145
+ NPY_FLOAT128
146
+ NPY_COMPLEX64
147
+ NPY_COMPLEX128
148
+ NPY_COMPLEX160
149
+ NPY_COMPLEX192
150
+ NPY_COMPLEX256
151
+
152
+ NPY_INTP
153
+ NPY_UINTP
154
+ NPY_DEFAULT_INT # Not a compile time constant (normally)!
155
+
156
+ ctypedef enum NPY_ORDER:
157
+ NPY_ANYORDER
158
+ NPY_CORDER
159
+ NPY_FORTRANORDER
160
+ NPY_KEEPORDER
161
+
162
+ ctypedef enum NPY_CASTING:
163
+ NPY_NO_CASTING
164
+ NPY_EQUIV_CASTING
165
+ NPY_SAFE_CASTING
166
+ NPY_SAME_KIND_CASTING
167
+ NPY_UNSAFE_CASTING
168
+ NPY_SAME_VALUE_CASTING
169
+
170
+ ctypedef enum NPY_CLIPMODE:
171
+ NPY_CLIP
172
+ NPY_WRAP
173
+ NPY_RAISE
174
+
175
+ ctypedef enum NPY_SCALARKIND:
176
+ NPY_NOSCALAR,
177
+ NPY_BOOL_SCALAR,
178
+ NPY_INTPOS_SCALAR,
179
+ NPY_INTNEG_SCALAR,
180
+ NPY_FLOAT_SCALAR,
181
+ NPY_COMPLEX_SCALAR,
182
+ NPY_OBJECT_SCALAR
183
+
184
+ ctypedef enum NPY_SORTKIND:
185
+ NPY_QUICKSORT
186
+ NPY_HEAPSORT
187
+ NPY_MERGESORT
188
+
189
+ ctypedef enum NPY_SEARCHSIDE:
190
+ NPY_SEARCHLEFT
191
+ NPY_SEARCHRIGHT
192
+
193
+ enum:
194
+ NPY_ARRAY_C_CONTIGUOUS
195
+ NPY_ARRAY_F_CONTIGUOUS
196
+ NPY_ARRAY_OWNDATA
197
+ NPY_ARRAY_FORCECAST
198
+ NPY_ARRAY_ENSURECOPY
199
+ NPY_ARRAY_ENSUREARRAY
200
+ NPY_ARRAY_ELEMENTSTRIDES
201
+ NPY_ARRAY_ALIGNED
202
+ NPY_ARRAY_NOTSWAPPED
203
+ NPY_ARRAY_WRITEABLE
204
+ NPY_ARRAY_WRITEBACKIFCOPY
205
+
206
+ NPY_ARRAY_BEHAVED
207
+ NPY_ARRAY_BEHAVED_NS
208
+ NPY_ARRAY_CARRAY
209
+ NPY_ARRAY_CARRAY_RO
210
+ NPY_ARRAY_FARRAY
211
+ NPY_ARRAY_FARRAY_RO
212
+ NPY_ARRAY_DEFAULT
213
+
214
+ NPY_ARRAY_IN_ARRAY
215
+ NPY_ARRAY_OUT_ARRAY
216
+ NPY_ARRAY_INOUT_ARRAY
217
+ NPY_ARRAY_IN_FARRAY
218
+ NPY_ARRAY_OUT_FARRAY
219
+ NPY_ARRAY_INOUT_FARRAY
220
+
221
+ NPY_ARRAY_UPDATE_ALL
222
+
223
+ cdef enum:
224
+ NPY_MAXDIMS # 64 on NumPy 2.x and 32 on NumPy 1.x
225
+ NPY_RAVEL_AXIS # Used for functions like PyArray_Mean
226
+
227
+ ctypedef void (*PyArray_VectorUnaryFunc)(void *, void *, npy_intp, void *, void *)
228
+
229
+ ctypedef struct PyArray_ArrayDescr:
230
+ # shape is a tuple, but Cython doesn't support "tuple shape"
231
+ # inside a non-PyObject declaration, so we have to declare it
232
+ # as just a PyObject*.
233
+ PyObject* shape
234
+
235
+ ctypedef struct PyArray_Descr:
236
+ pass
237
+
238
+ ctypedef class numpy.dtype [object PyArray_Descr, check_size ignore]:
239
+ # Use PyDataType_* macros when possible, however there are no macros
240
+ # for accessing some of the fields, so some are defined.
241
+ cdef PyTypeObject* typeobj
242
+ cdef char kind
243
+ cdef char type
244
+ # Numpy sometimes mutates this without warning (e.g. it'll
245
+ # sometimes change "|" to "<" in shared dtype objects on
246
+ # little-endian machines). If this matters to you, use
247
+ # PyArray_IsNativeByteOrder(dtype.byteorder) instead of
248
+ # directly accessing this field.
249
+ cdef char byteorder
250
+ # Flags are not directly accessible on Cython <3. Use PyDataType_FLAGS.
251
+ # cdef char flags
252
+ cdef int type_num
253
+ # itemsize/elsize, alignment, fields, names, and subarray must
254
+ # use the `PyDataType_*` accessor macros. With Cython 3 you can
255
+ # still use getter attributes `dtype.itemsize`
256
+
257
+ ctypedef class numpy.flatiter [object PyArrayIterObject, check_size ignore]:
258
+ # Use through macros
259
+ pass
260
+
261
+ ctypedef class numpy.broadcast [object PyArrayMultiIterObject, check_size ignore]:
262
+ cdef int numiter
263
+ cdef npy_intp size, index
264
+ cdef int nd
265
+ cdef npy_intp *dimensions
266
+ cdef void **iters
267
+
268
+ ctypedef struct PyArrayObject:
269
+ # For use in situations where ndarray can't replace PyArrayObject*,
270
+ # like PyArrayObject**.
271
+ pass
272
+
273
+ ctypedef class numpy.ndarray [object PyArrayObject, check_size ignore]:
274
+ cdef __cythonbufferdefaults__ = {"mode": "strided"}
275
+
276
+ cdef:
277
+ # Only taking a few of the most commonly used and stable fields.
278
+ # One should use PyArray_* macros instead to access the C fields.
279
+ char *data
280
+ int ndim "nd"
281
+ npy_intp *shape "dimensions"
282
+ npy_intp *strides
283
+ dtype descr # deprecated since NumPy 1.7 !
284
+ PyObject* base # NOT PUBLIC, DO NOT USE !
285
+
286
+
287
+ int _import_array() except -1
288
+ # A second definition so _import_array isn't marked as used when we use it here.
289
+ # Do not use - subject to change any time.
290
+ int __pyx_import_array "_import_array"() except -1
291
+
292
+ #
293
+ # Macros from ndarrayobject.h
294
+ #
295
+ bint PyArray_CHKFLAGS(ndarray m, int flags) nogil
296
+ bint PyArray_IS_C_CONTIGUOUS(ndarray arr) nogil
297
+ bint PyArray_IS_F_CONTIGUOUS(ndarray arr) nogil
298
+ bint PyArray_ISCONTIGUOUS(ndarray m) nogil
299
+ bint PyArray_ISWRITEABLE(ndarray m) nogil
300
+ bint PyArray_ISALIGNED(ndarray m) nogil
301
+
302
+ int PyArray_NDIM(ndarray) nogil
303
+ bint PyArray_ISONESEGMENT(ndarray) nogil
304
+ bint PyArray_ISFORTRAN(ndarray) nogil
305
+ int PyArray_FORTRANIF(ndarray) nogil
306
+
307
+ void* PyArray_DATA(ndarray) nogil
308
+ char* PyArray_BYTES(ndarray) nogil
309
+
310
+ npy_intp* PyArray_DIMS(ndarray) nogil
311
+ npy_intp* PyArray_STRIDES(ndarray) nogil
312
+ npy_intp PyArray_DIM(ndarray, size_t) nogil
313
+ npy_intp PyArray_STRIDE(ndarray, size_t) nogil
314
+
315
+ PyObject *PyArray_BASE(ndarray) nogil # returns borrowed reference!
316
+ PyArray_Descr *PyArray_DESCR(ndarray) nogil # returns borrowed reference to dtype!
317
+ PyArray_Descr *PyArray_DTYPE(ndarray) nogil # returns borrowed reference to dtype! NP 1.7+ alias for descr.
318
+ int PyArray_FLAGS(ndarray) nogil
319
+ void PyArray_CLEARFLAGS(ndarray, int flags) nogil # Added in NumPy 1.7
320
+ void PyArray_ENABLEFLAGS(ndarray, int flags) nogil # Added in NumPy 1.7
321
+ npy_intp PyArray_ITEMSIZE(ndarray) nogil
322
+ int PyArray_TYPE(ndarray arr) nogil
323
+
324
+ object PyArray_GETITEM(ndarray arr, void *itemptr)
325
+ int PyArray_SETITEM(ndarray arr, void *itemptr, object obj) except -1
326
+
327
+ bint PyTypeNum_ISBOOL(int) nogil
328
+ bint PyTypeNum_ISUNSIGNED(int) nogil
329
+ bint PyTypeNum_ISSIGNED(int) nogil
330
+ bint PyTypeNum_ISINTEGER(int) nogil
331
+ bint PyTypeNum_ISFLOAT(int) nogil
332
+ bint PyTypeNum_ISNUMBER(int) nogil
333
+ bint PyTypeNum_ISSTRING(int) nogil
334
+ bint PyTypeNum_ISCOMPLEX(int) nogil
335
+ bint PyTypeNum_ISFLEXIBLE(int) nogil
336
+ bint PyTypeNum_ISUSERDEF(int) nogil
337
+ bint PyTypeNum_ISEXTENDED(int) nogil
338
+ bint PyTypeNum_ISOBJECT(int) nogil
339
+
340
+ npy_intp PyDataType_ELSIZE(dtype) nogil
341
+ npy_intp PyDataType_ALIGNMENT(dtype) nogil
342
+ PyObject* PyDataType_METADATA(dtype) nogil
343
+ PyArray_ArrayDescr* PyDataType_SUBARRAY(dtype) nogil
344
+ PyObject* PyDataType_NAMES(dtype) nogil
345
+ PyObject* PyDataType_FIELDS(dtype) nogil
346
+
347
+ bint PyDataType_ISBOOL(dtype) nogil
348
+ bint PyDataType_ISUNSIGNED(dtype) nogil
349
+ bint PyDataType_ISSIGNED(dtype) nogil
350
+ bint PyDataType_ISINTEGER(dtype) nogil
351
+ bint PyDataType_ISFLOAT(dtype) nogil
352
+ bint PyDataType_ISNUMBER(dtype) nogil
353
+ bint PyDataType_ISSTRING(dtype) nogil
354
+ bint PyDataType_ISCOMPLEX(dtype) nogil
355
+ bint PyDataType_ISFLEXIBLE(dtype) nogil
356
+ bint PyDataType_ISUSERDEF(dtype) nogil
357
+ bint PyDataType_ISEXTENDED(dtype) nogil
358
+ bint PyDataType_ISOBJECT(dtype) nogil
359
+ bint PyDataType_HASFIELDS(dtype) nogil
360
+ bint PyDataType_HASSUBARRAY(dtype) nogil
361
+ npy_uint64 PyDataType_FLAGS(dtype) nogil
362
+
363
+ bint PyArray_ISBOOL(ndarray) nogil
364
+ bint PyArray_ISUNSIGNED(ndarray) nogil
365
+ bint PyArray_ISSIGNED(ndarray) nogil
366
+ bint PyArray_ISINTEGER(ndarray) nogil
367
+ bint PyArray_ISFLOAT(ndarray) nogil
368
+ bint PyArray_ISNUMBER(ndarray) nogil
369
+ bint PyArray_ISSTRING(ndarray) nogil
370
+ bint PyArray_ISCOMPLEX(ndarray) nogil
371
+ bint PyArray_ISFLEXIBLE(ndarray) nogil
372
+ bint PyArray_ISUSERDEF(ndarray) nogil
373
+ bint PyArray_ISEXTENDED(ndarray) nogil
374
+ bint PyArray_ISOBJECT(ndarray) nogil
375
+ bint PyArray_HASFIELDS(ndarray) nogil
376
+
377
+ bint PyArray_ISVARIABLE(ndarray) nogil
378
+
379
+ bint PyArray_SAFEALIGNEDCOPY(ndarray) nogil
380
+ bint PyArray_ISNBO(char) nogil # works on ndarray.byteorder
381
+ bint PyArray_IsNativeByteOrder(char) nogil # works on ndarray.byteorder
382
+ bint PyArray_ISNOTSWAPPED(ndarray) nogil
383
+ bint PyArray_ISBYTESWAPPED(ndarray) nogil
384
+
385
+ bint PyArray_FLAGSWAP(ndarray, int) nogil
386
+
387
+ bint PyArray_ISCARRAY(ndarray) nogil
388
+ bint PyArray_ISCARRAY_RO(ndarray) nogil
389
+ bint PyArray_ISFARRAY(ndarray) nogil
390
+ bint PyArray_ISFARRAY_RO(ndarray) nogil
391
+ bint PyArray_ISBEHAVED(ndarray) nogil
392
+ bint PyArray_ISBEHAVED_RO(ndarray) nogil
393
+
394
+
395
+ bint PyDataType_ISNOTSWAPPED(dtype) nogil
396
+ bint PyDataType_ISBYTESWAPPED(dtype) nogil
397
+
398
+ bint PyArray_DescrCheck(object)
399
+
400
+ bint PyArray_Check(object)
401
+ bint PyArray_CheckExact(object)
402
+
403
+ # Cannot be supported due to out arg:
404
+ # bint PyArray_HasArrayInterfaceType(object, dtype, object, object&)
405
+ # bint PyArray_HasArrayInterface(op, out)
406
+
407
+
408
+ bint PyArray_IsZeroDim(object)
409
+ # Cannot be supported due to ## ## in macro:
410
+ # bint PyArray_IsScalar(object, verbatim work)
411
+ bint PyArray_CheckScalar(object)
412
+ bint PyArray_IsPythonNumber(object)
413
+ bint PyArray_IsPythonScalar(object)
414
+ bint PyArray_IsAnyScalar(object)
415
+ bint PyArray_CheckAnyScalar(object)
416
+
417
+ ndarray PyArray_GETCONTIGUOUS(ndarray)
418
+ bint PyArray_SAMESHAPE(ndarray, ndarray) nogil
419
+ npy_intp PyArray_SIZE(ndarray) nogil
420
+ npy_intp PyArray_NBYTES(ndarray) nogil
421
+
422
+ object PyArray_FROM_O(object)
423
+ object PyArray_FROM_OF(object m, int flags)
424
+ object PyArray_FROM_OT(object m, int type)
425
+ object PyArray_FROM_OTF(object m, int type, int flags)
426
+ object PyArray_FROMANY(object m, int type, int min, int max, int flags)
427
+ object PyArray_ZEROS(int nd, npy_intp* dims, int type, int fortran)
428
+ object PyArray_EMPTY(int nd, npy_intp* dims, int type, int fortran)
429
+ void PyArray_FILLWBYTE(ndarray, int val)
430
+ object PyArray_ContiguousFromAny(op, int, int min_depth, int max_depth)
431
+ unsigned char PyArray_EquivArrTypes(ndarray a1, ndarray a2)
432
+ bint PyArray_EquivByteorders(int b1, int b2) nogil
433
+ object PyArray_SimpleNew(int nd, npy_intp* dims, int typenum)
434
+ object PyArray_SimpleNewFromData(int nd, npy_intp* dims, int typenum, void* data)
435
+ #object PyArray_SimpleNewFromDescr(int nd, npy_intp* dims, dtype descr)
436
+ object PyArray_ToScalar(void* data, ndarray arr)
437
+
438
+ void* PyArray_GETPTR1(ndarray m, npy_intp i) nogil
439
+ void* PyArray_GETPTR2(ndarray m, npy_intp i, npy_intp j) nogil
440
+ void* PyArray_GETPTR3(ndarray m, npy_intp i, npy_intp j, npy_intp k) nogil
441
+ void* PyArray_GETPTR4(ndarray m, npy_intp i, npy_intp j, npy_intp k, npy_intp l) nogil
442
+
443
+ # Cannot be supported due to out arg
444
+ # void PyArray_DESCR_REPLACE(descr)
445
+
446
+
447
+ object PyArray_Copy(ndarray)
448
+ object PyArray_FromObject(object op, int type, int min_depth, int max_depth)
449
+ object PyArray_ContiguousFromObject(object op, int type, int min_depth, int max_depth)
450
+ object PyArray_CopyFromObject(object op, int type, int min_depth, int max_depth)
451
+
452
+ object PyArray_Cast(ndarray mp, int type_num)
453
+ object PyArray_Take(ndarray ap, object items, int axis)
454
+ object PyArray_Put(ndarray ap, object items, object values)
455
+
456
+ void PyArray_ITER_RESET(flatiter it) nogil
457
+ void PyArray_ITER_NEXT(flatiter it) nogil
458
+ void PyArray_ITER_GOTO(flatiter it, npy_intp* destination) nogil
459
+ void PyArray_ITER_GOTO1D(flatiter it, npy_intp ind) nogil
460
+ void* PyArray_ITER_DATA(flatiter it) nogil
461
+ bint PyArray_ITER_NOTDONE(flatiter it) nogil
462
+
463
+ void PyArray_MultiIter_RESET(broadcast multi) nogil
464
+ void PyArray_MultiIter_NEXT(broadcast multi) nogil
465
+ void PyArray_MultiIter_GOTO(broadcast multi, npy_intp dest) nogil
466
+ void PyArray_MultiIter_GOTO1D(broadcast multi, npy_intp ind) nogil
467
+ void* PyArray_MultiIter_DATA(broadcast multi, npy_intp i) nogil
468
+ void PyArray_MultiIter_NEXTi(broadcast multi, npy_intp i) nogil
469
+ bint PyArray_MultiIter_NOTDONE(broadcast multi) nogil
470
+ npy_intp PyArray_MultiIter_SIZE(broadcast multi) nogil
471
+ int PyArray_MultiIter_NDIM(broadcast multi) nogil
472
+ npy_intp PyArray_MultiIter_INDEX(broadcast multi) nogil
473
+ int PyArray_MultiIter_NUMITER(broadcast multi) nogil
474
+ npy_intp* PyArray_MultiIter_DIMS(broadcast multi) nogil
475
+ void** PyArray_MultiIter_ITERS(broadcast multi) nogil
476
+
477
+ # Functions from __multiarray_api.h
478
+
479
+ # Functions taking dtype and returning object/ndarray are disabled
480
+ # for now as they steal dtype references. I'm conservative and disable
481
+ # more than is probably needed until it can be checked further.
482
+ int PyArray_INCREF (ndarray) except * # uses PyArray_Item_INCREF...
483
+ int PyArray_XDECREF (ndarray) except * # uses PyArray_Item_DECREF...
484
+ dtype PyArray_DescrFromType (int)
485
+ object PyArray_TypeObjectFromType (int)
486
+ char * PyArray_Zero (ndarray)
487
+ char * PyArray_One (ndarray)
488
+ #object PyArray_CastToType (ndarray, dtype, int)
489
+ int PyArray_CanCastSafely (int, int) # writes errors
490
+ npy_bool PyArray_CanCastTo (dtype, dtype) # writes errors
491
+ int PyArray_ObjectType (object, int) except 0
492
+ dtype PyArray_DescrFromObject (object, dtype)
493
+ #ndarray* PyArray_ConvertToCommonType (object, int *)
494
+ dtype PyArray_DescrFromScalar (object)
495
+ dtype PyArray_DescrFromTypeObject (object)
496
+ npy_intp PyArray_Size (object)
497
+ #object PyArray_Scalar (void *, dtype, object)
498
+ #object PyArray_FromScalar (object, dtype)
499
+ void PyArray_ScalarAsCtype (object, void *)
500
+ #int PyArray_CastScalarToCtype (object, void *, dtype)
501
+ #int PyArray_CastScalarDirect (object, dtype, void *, int)
502
+ #PyArray_VectorUnaryFunc * PyArray_GetCastFunc (dtype, int)
503
+ #object PyArray_FromAny (object, dtype, int, int, int, object)
504
+ object PyArray_EnsureArray (object)
505
+ object PyArray_EnsureAnyArray (object)
506
+ #object PyArray_FromFile (stdio.FILE *, dtype, npy_intp, char *)
507
+ #object PyArray_FromString (char *, npy_intp, dtype, npy_intp, char *)
508
+ #object PyArray_FromBuffer (object, dtype, npy_intp, npy_intp)
509
+ #object PyArray_FromIter (object, dtype, npy_intp)
510
+ object PyArray_Return (ndarray)
511
+ #object PyArray_GetField (ndarray, dtype, int)
512
+ #int PyArray_SetField (ndarray, dtype, int, object) except -1
513
+ object PyArray_Byteswap (ndarray, npy_bool)
514
+ object PyArray_Resize (ndarray, PyArray_Dims *, int, NPY_ORDER)
515
+ int PyArray_CopyInto (ndarray, ndarray) except -1
516
+ int PyArray_CopyAnyInto (ndarray, ndarray) except -1
517
+ int PyArray_CopyObject (ndarray, object) except -1
518
+ object PyArray_NewCopy (ndarray, NPY_ORDER)
519
+ object PyArray_ToList (ndarray)
520
+ object PyArray_ToString (ndarray, NPY_ORDER)
521
+ int PyArray_ToFile (ndarray, stdio.FILE *, char *, char *) except -1
522
+ int PyArray_Dump (object, object, int) except -1
523
+ object PyArray_Dumps (object, int)
524
+ int PyArray_ValidType (int) # Cannot error
525
+ void PyArray_UpdateFlags (ndarray, int)
526
+ object PyArray_New (type, int, npy_intp *, int, npy_intp *, void *, int, int, object)
527
+ #object PyArray_NewFromDescr (type, dtype, int, npy_intp *, npy_intp *, void *, int, object)
528
+ #dtype PyArray_DescrNew (dtype)
529
+ dtype PyArray_DescrNewFromType (int)
530
+ double PyArray_GetPriority (object, double) # clears errors as of 1.25
531
+ object PyArray_IterNew (object)
532
+ object PyArray_MultiIterNew (int, ...)
533
+
534
+ int PyArray_PyIntAsInt (object) except? -1
535
+ npy_intp PyArray_PyIntAsIntp (object)
536
+ int PyArray_Broadcast (broadcast) except -1
537
+ int PyArray_FillWithScalar (ndarray, object) except -1
538
+ npy_bool PyArray_CheckStrides (int, int, npy_intp, npy_intp, npy_intp *, npy_intp *)
539
+ dtype PyArray_DescrNewByteorder (dtype, char)
540
+ object PyArray_IterAllButAxis (object, int *)
541
+ #object PyArray_CheckFromAny (object, dtype, int, int, int, object)
542
+ #object PyArray_FromArray (ndarray, dtype, int)
543
+ object PyArray_FromInterface (object)
544
+ object PyArray_FromStructInterface (object)
545
+ #object PyArray_FromArrayAttr (object, dtype, object)
546
+ #NPY_SCALARKIND PyArray_ScalarKind (int, ndarray*)
547
+ int PyArray_CanCoerceScalar (int, int, NPY_SCALARKIND)
548
+ npy_bool PyArray_CanCastScalar (type, type)
549
+ int PyArray_RemoveSmallest (broadcast) except -1
550
+ int PyArray_ElementStrides (object)
551
+ void PyArray_Item_INCREF (char *, dtype) except *
552
+ void PyArray_Item_XDECREF (char *, dtype) except *
553
+ object PyArray_Transpose (ndarray, PyArray_Dims *)
554
+ object PyArray_TakeFrom (ndarray, object, int, ndarray, NPY_CLIPMODE)
555
+ object PyArray_PutTo (ndarray, object, object, NPY_CLIPMODE)
556
+ object PyArray_PutMask (ndarray, object, object)
557
+ object PyArray_Repeat (ndarray, object, int)
558
+ object PyArray_Choose (ndarray, object, ndarray, NPY_CLIPMODE)
559
+ int PyArray_Sort (ndarray, int, NPY_SORTKIND) except -1
560
+ object PyArray_ArgSort (ndarray, int, NPY_SORTKIND)
561
+ object PyArray_SearchSorted (ndarray, object, NPY_SEARCHSIDE, PyObject *)
562
+ object PyArray_ArgMax (ndarray, int, ndarray)
563
+ object PyArray_ArgMin (ndarray, int, ndarray)
564
+ object PyArray_Reshape (ndarray, object)
565
+ object PyArray_Newshape (ndarray, PyArray_Dims *, NPY_ORDER)
566
+ object PyArray_Squeeze (ndarray)
567
+ #object PyArray_View (ndarray, dtype, type)
568
+ object PyArray_SwapAxes (ndarray, int, int)
569
+ object PyArray_Max (ndarray, int, ndarray)
570
+ object PyArray_Min (ndarray, int, ndarray)
571
+ object PyArray_Ptp (ndarray, int, ndarray)
572
+ object PyArray_Mean (ndarray, int, int, ndarray)
573
+ object PyArray_Trace (ndarray, int, int, int, int, ndarray)
574
+ object PyArray_Diagonal (ndarray, int, int, int)
575
+ object PyArray_Clip (ndarray, object, object, ndarray)
576
+ object PyArray_Conjugate (ndarray, ndarray)
577
+ object PyArray_Nonzero (ndarray)
578
+ object PyArray_Std (ndarray, int, int, ndarray, int)
579
+ object PyArray_Sum (ndarray, int, int, ndarray)
580
+ object PyArray_CumSum (ndarray, int, int, ndarray)
581
+ object PyArray_Prod (ndarray, int, int, ndarray)
582
+ object PyArray_CumProd (ndarray, int, int, ndarray)
583
+ object PyArray_All (ndarray, int, ndarray)
584
+ object PyArray_Any (ndarray, int, ndarray)
585
+ object PyArray_Compress (ndarray, object, int, ndarray)
586
+ object PyArray_Flatten (ndarray, NPY_ORDER)
587
+ object PyArray_Ravel (ndarray, NPY_ORDER)
588
+ npy_intp PyArray_MultiplyList (npy_intp *, int)
589
+ int PyArray_MultiplyIntList (int *, int)
590
+ void * PyArray_GetPtr (ndarray, npy_intp*)
591
+ int PyArray_CompareLists (npy_intp *, npy_intp *, int)
592
+ #int PyArray_AsCArray (object*, void *, npy_intp *, int, dtype)
593
+ int PyArray_Free (object, void *)
594
+ #int PyArray_Converter (object, object*)
595
+ int PyArray_IntpFromSequence (object, npy_intp *, int) except -1
596
+ object PyArray_Concatenate (object, int)
597
+ object PyArray_InnerProduct (object, object)
598
+ object PyArray_MatrixProduct (object, object)
599
+ object PyArray_Correlate (object, object, int)
600
+ #int PyArray_DescrConverter (object, dtype*) except 0
601
+ #int PyArray_DescrConverter2 (object, dtype*) except 0
602
+ int PyArray_IntpConverter (object, PyArray_Dims *) except 0
603
+ #int PyArray_BufferConverter (object, chunk) except 0
604
+ int PyArray_AxisConverter (object, int *) except 0
605
+ int PyArray_BoolConverter (object, npy_bool *) except 0
606
+ int PyArray_ByteorderConverter (object, char *) except 0
607
+ int PyArray_OrderConverter (object, NPY_ORDER *) except 0
608
+ unsigned char PyArray_EquivTypes (dtype, dtype) # clears errors
609
+ #object PyArray_Zeros (int, npy_intp *, dtype, int)
610
+ #object PyArray_Empty (int, npy_intp *, dtype, int)
611
+ object PyArray_Where (object, object, object)
612
+ object PyArray_Arange (double, double, double, int)
613
+ #object PyArray_ArangeObj (object, object, object, dtype)
614
+ int PyArray_SortkindConverter (object, NPY_SORTKIND *) except 0
615
+ object PyArray_LexSort (object, int)
616
+ object PyArray_Round (ndarray, int, ndarray)
617
+ unsigned char PyArray_EquivTypenums (int, int)
618
+ int PyArray_RegisterDataType (dtype) except -1
619
+ int PyArray_RegisterCastFunc (dtype, int, PyArray_VectorUnaryFunc *) except -1
620
+ int PyArray_RegisterCanCast (dtype, int, NPY_SCALARKIND) except -1
621
+ #void PyArray_InitArrFuncs (PyArray_ArrFuncs *)
622
+ object PyArray_IntTupleFromIntp (int, npy_intp *)
623
+ int PyArray_ClipmodeConverter (object, NPY_CLIPMODE *) except 0
624
+ #int PyArray_OutputConverter (object, ndarray*) except 0
625
+ object PyArray_BroadcastToShape (object, npy_intp *, int)
626
+ #int PyArray_DescrAlignConverter (object, dtype*) except 0
627
+ #int PyArray_DescrAlignConverter2 (object, dtype*) except 0
628
+ int PyArray_SearchsideConverter (object, void *) except 0
629
+ object PyArray_CheckAxis (ndarray, int *, int)
630
+ npy_intp PyArray_OverflowMultiplyList (npy_intp *, int)
631
+ int PyArray_SetBaseObject(ndarray, base) except -1 # NOTE: steals a reference to base! Use "set_array_base()" instead.
632
+
633
+ # The memory handler functions require the NumPy 1.22 API
634
+ # and may require defining NPY_TARGET_VERSION
635
+ ctypedef struct PyDataMemAllocator:
636
+ void *ctx
637
+ void* (*malloc) (void *ctx, size_t size)
638
+ void* (*calloc) (void *ctx, size_t nelem, size_t elsize)
639
+ void* (*realloc) (void *ctx, void *ptr, size_t new_size)
640
+ void (*free) (void *ctx, void *ptr, size_t size)
641
+
642
+ ctypedef struct PyDataMem_Handler:
643
+ char* name
644
+ npy_uint8 version
645
+ PyDataMemAllocator allocator
646
+
647
+ object PyDataMem_SetHandler(object handler)
648
+ object PyDataMem_GetHandler()
649
+
650
+ # additional datetime related functions are defined below
651
+
652
+
653
+ # Typedefs that matches the runtime dtype objects in
654
+ # the numpy module.
655
+
656
+ # The ones that are commented out needs an IFDEF function
657
+ # in Cython to enable them only on the right systems.
658
+
659
+ ctypedef npy_int8 int8_t
660
+ ctypedef npy_int16 int16_t
661
+ ctypedef npy_int32 int32_t
662
+ ctypedef npy_int64 int64_t
663
+
664
+ ctypedef npy_uint8 uint8_t
665
+ ctypedef npy_uint16 uint16_t
666
+ ctypedef npy_uint32 uint32_t
667
+ ctypedef npy_uint64 uint64_t
668
+
669
+ ctypedef npy_float32 float32_t
670
+ ctypedef npy_float64 float64_t
671
+ #ctypedef npy_float80 float80_t
672
+ #ctypedef npy_float128 float128_t
673
+
674
+ ctypedef float complex complex64_t
675
+ ctypedef double complex complex128_t
676
+
677
+ ctypedef npy_longlong longlong_t
678
+ ctypedef npy_ulonglong ulonglong_t
679
+
680
+ ctypedef npy_intp intp_t
681
+ ctypedef npy_uintp uintp_t
682
+
683
+ ctypedef npy_double float_t
684
+ ctypedef npy_double double_t
685
+ ctypedef npy_longdouble longdouble_t
686
+
687
+ ctypedef float complex cfloat_t
688
+ ctypedef double complex cdouble_t
689
+ ctypedef double complex complex_t
690
+ ctypedef long double complex clongdouble_t
691
+
692
+ cdef inline object PyArray_MultiIterNew1(a):
693
+ return PyArray_MultiIterNew(1, <void*>a)
694
+
695
+ cdef inline object PyArray_MultiIterNew2(a, b):
696
+ return PyArray_MultiIterNew(2, <void*>a, <void*>b)
697
+
698
+ cdef inline object PyArray_MultiIterNew3(a, b, c):
699
+ return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
700
+
701
+ cdef inline object PyArray_MultiIterNew4(a, b, c, d):
702
+ return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
703
+
704
+ cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
705
+ return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
706
+
707
+ cdef inline tuple PyDataType_SHAPE(dtype d):
708
+ if PyDataType_HASSUBARRAY(d):
709
+ return <tuple>d.subarray.shape
710
+ else:
711
+ return ()
712
+
713
+
714
+ cdef extern from "numpy/ndarrayobject.h":
715
+ PyTypeObject PyTimedeltaArrType_Type
716
+ PyTypeObject PyDatetimeArrType_Type
717
+ ctypedef int64_t npy_timedelta
718
+ ctypedef int64_t npy_datetime
719
+
720
+ cdef extern from "numpy/ndarraytypes.h":
721
+ ctypedef struct PyArray_DatetimeMetaData:
722
+ NPY_DATETIMEUNIT base
723
+ int64_t num
724
+
725
+ ctypedef struct npy_datetimestruct:
726
+ int64_t year
727
+ int32_t month, day, hour, min, sec, us, ps, as
728
+
729
+ # Iterator API added in v1.6
730
+ #
731
+ # These don't match the definition in the C API because Cython can't wrap
732
+ # function pointers that return functions.
733
+ # https://github.com/cython/cython/issues/6720
734
+ ctypedef int (*NpyIter_IterNextFunc "NpyIter_IterNextFunc *")(NpyIter* it) noexcept nogil
735
+ ctypedef void (*NpyIter_GetMultiIndexFunc "NpyIter_GetMultiIndexFunc *")(NpyIter* it, npy_intp* outcoords) noexcept nogil
736
+
737
+ cdef extern from "numpy/arrayscalars.h":
738
+
739
+ # abstract types
740
+ ctypedef class numpy.generic [object PyObject]:
741
+ pass
742
+ ctypedef class numpy.number [object PyObject]:
743
+ pass
744
+ ctypedef class numpy.integer [object PyObject]:
745
+ pass
746
+ ctypedef class numpy.signedinteger [object PyObject]:
747
+ pass
748
+ ctypedef class numpy.unsignedinteger [object PyObject]:
749
+ pass
750
+ ctypedef class numpy.inexact [object PyObject]:
751
+ pass
752
+ ctypedef class numpy.floating [object PyObject]:
753
+ pass
754
+ ctypedef class numpy.complexfloating [object PyObject]:
755
+ pass
756
+ ctypedef class numpy.flexible [object PyObject]:
757
+ pass
758
+ ctypedef class numpy.character [object PyObject]:
759
+ pass
760
+
761
+ ctypedef struct PyDatetimeScalarObject:
762
+ # PyObject_HEAD
763
+ npy_datetime obval
764
+ PyArray_DatetimeMetaData obmeta
765
+
766
+ ctypedef struct PyTimedeltaScalarObject:
767
+ # PyObject_HEAD
768
+ npy_timedelta obval
769
+ PyArray_DatetimeMetaData obmeta
770
+
771
+ ctypedef enum NPY_DATETIMEUNIT:
772
+ NPY_FR_Y
773
+ NPY_FR_M
774
+ NPY_FR_W
775
+ NPY_FR_D
776
+ NPY_FR_B
777
+ NPY_FR_h
778
+ NPY_FR_m
779
+ NPY_FR_s
780
+ NPY_FR_ms
781
+ NPY_FR_us
782
+ NPY_FR_ns
783
+ NPY_FR_ps
784
+ NPY_FR_fs
785
+ NPY_FR_as
786
+ NPY_FR_GENERIC
787
+
788
+
789
+ cdef extern from "numpy/arrayobject.h":
790
+ # These are part of the C-API defined in `__multiarray_api.h`
791
+
792
+ # NumPy internal definitions in datetime_strings.c:
793
+ int get_datetime_iso_8601_strlen "NpyDatetime_GetDatetimeISO8601StrLen" (
794
+ int local, NPY_DATETIMEUNIT base)
795
+ int make_iso_8601_datetime "NpyDatetime_MakeISO8601Datetime" (
796
+ npy_datetimestruct *dts, char *outstr, npy_intp outlen,
797
+ int local, int utc, NPY_DATETIMEUNIT base, int tzoffset,
798
+ NPY_CASTING casting) except -1
799
+
800
+ # NumPy internal definition in datetime.c:
801
+ # May return 1 to indicate that object does not appear to be a datetime
802
+ # (returns 0 on success).
803
+ int convert_pydatetime_to_datetimestruct "NpyDatetime_ConvertPyDateTimeToDatetimeStruct" (
804
+ PyObject *obj, npy_datetimestruct *out,
805
+ NPY_DATETIMEUNIT *out_bestunit, int apply_tzinfo) except -1
806
+ int convert_datetime64_to_datetimestruct "NpyDatetime_ConvertDatetime64ToDatetimeStruct" (
807
+ PyArray_DatetimeMetaData *meta, npy_datetime dt,
808
+ npy_datetimestruct *out) except -1
809
+ int convert_datetimestruct_to_datetime64 "NpyDatetime_ConvertDatetimeStructToDatetime64"(
810
+ PyArray_DatetimeMetaData *meta, const npy_datetimestruct *dts,
811
+ npy_datetime *out) except -1
812
+
813
+
814
+ #
815
+ # ufunc API
816
+ #
817
+
818
+ cdef extern from "numpy/ufuncobject.h":
819
+
820
+ ctypedef void (*PyUFuncGenericFunction) (char **, npy_intp *, npy_intp *, void *)
821
+
822
+ ctypedef class numpy.ufunc [object PyUFuncObject, check_size ignore]:
823
+ cdef:
824
+ int nin, nout, nargs
825
+ int identity
826
+ PyUFuncGenericFunction *functions
827
+ void **data
828
+ int ntypes
829
+ int check_return
830
+ char *name
831
+ char *types
832
+ char *doc
833
+ void *ptr
834
+ PyObject *obj
835
+ PyObject *userloops
836
+
837
+ cdef enum:
838
+ PyUFunc_Zero
839
+ PyUFunc_One
840
+ PyUFunc_None
841
+ # deprecated
842
+ UFUNC_FPE_DIVIDEBYZERO
843
+ UFUNC_FPE_OVERFLOW
844
+ UFUNC_FPE_UNDERFLOW
845
+ UFUNC_FPE_INVALID
846
+ # use these instead
847
+ NPY_FPE_DIVIDEBYZERO
848
+ NPY_FPE_OVERFLOW
849
+ NPY_FPE_UNDERFLOW
850
+ NPY_FPE_INVALID
851
+
852
+ object PyUFunc_FromFuncAndData(PyUFuncGenericFunction *,
853
+ void **, char *, int, int, int, int, char *, char *, int)
854
+ int PyUFunc_RegisterLoopForType(ufunc, int,
855
+ PyUFuncGenericFunction, int *, void *) except -1
856
+ void PyUFunc_f_f_As_d_d \
857
+ (char **, npy_intp *, npy_intp *, void *)
858
+ void PyUFunc_d_d \
859
+ (char **, npy_intp *, npy_intp *, void *)
860
+ void PyUFunc_f_f \
861
+ (char **, npy_intp *, npy_intp *, void *)
862
+ void PyUFunc_g_g \
863
+ (char **, npy_intp *, npy_intp *, void *)
864
+ void PyUFunc_F_F_As_D_D \
865
+ (char **, npy_intp *, npy_intp *, void *)
866
+ void PyUFunc_F_F \
867
+ (char **, npy_intp *, npy_intp *, void *)
868
+ void PyUFunc_D_D \
869
+ (char **, npy_intp *, npy_intp *, void *)
870
+ void PyUFunc_G_G \
871
+ (char **, npy_intp *, npy_intp *, void *)
872
+ void PyUFunc_O_O \
873
+ (char **, npy_intp *, npy_intp *, void *)
874
+ void PyUFunc_ff_f_As_dd_d \
875
+ (char **, npy_intp *, npy_intp *, void *)
876
+ void PyUFunc_ff_f \
877
+ (char **, npy_intp *, npy_intp *, void *)
878
+ void PyUFunc_dd_d \
879
+ (char **, npy_intp *, npy_intp *, void *)
880
+ void PyUFunc_gg_g \
881
+ (char **, npy_intp *, npy_intp *, void *)
882
+ void PyUFunc_FF_F_As_DD_D \
883
+ (char **, npy_intp *, npy_intp *, void *)
884
+ void PyUFunc_DD_D \
885
+ (char **, npy_intp *, npy_intp *, void *)
886
+ void PyUFunc_FF_F \
887
+ (char **, npy_intp *, npy_intp *, void *)
888
+ void PyUFunc_GG_G \
889
+ (char **, npy_intp *, npy_intp *, void *)
890
+ void PyUFunc_OO_O \
891
+ (char **, npy_intp *, npy_intp *, void *)
892
+ void PyUFunc_O_O_method \
893
+ (char **, npy_intp *, npy_intp *, void *)
894
+ void PyUFunc_OO_O_method \
895
+ (char **, npy_intp *, npy_intp *, void *)
896
+ void PyUFunc_On_Om \
897
+ (char **, npy_intp *, npy_intp *, void *)
898
+ void PyUFunc_clearfperr()
899
+ int PyUFunc_getfperr()
900
+ int PyUFunc_ReplaceLoopBySignature \
901
+ (ufunc, PyUFuncGenericFunction, int *, PyUFuncGenericFunction *)
902
+ object PyUFunc_FromFuncAndDataAndSignature \
903
+ (PyUFuncGenericFunction *, void **, char *, int, int, int,
904
+ int, char *, char *, int, char *)
905
+
906
+ int _import_umath() except -1
907
+
908
+ cdef inline void set_array_base(ndarray arr, object base):
909
+ Py_INCREF(base) # important to do this before stealing the reference below!
910
+ PyArray_SetBaseObject(arr, base)
911
+
912
+ cdef inline object get_array_base(ndarray arr):
913
+ base = PyArray_BASE(arr)
914
+ if base is NULL:
915
+ return None
916
+ return <object>base
917
+
918
+ # Versions of the import_* functions which are more suitable for
919
+ # Cython code.
920
+ cdef inline int import_array() except -1:
921
+ try:
922
+ __pyx_import_array()
923
+ except Exception:
924
+ raise ImportError("numpy._core.multiarray failed to import")
925
+
926
+ cdef inline int import_umath() except -1:
927
+ try:
928
+ _import_umath()
929
+ except Exception:
930
+ raise ImportError("numpy._core.umath failed to import")
931
+
932
+ cdef inline int import_ufunc() except -1:
933
+ try:
934
+ _import_umath()
935
+ except Exception:
936
+ raise ImportError("numpy._core.umath failed to import")
937
+
938
+
939
+ cdef inline bint is_timedelta64_object(object obj):
940
+ """
941
+ Cython equivalent of `isinstance(obj, np.timedelta64)`
942
+
943
+ Parameters
944
+ ----------
945
+ obj : object
946
+
947
+ Returns
948
+ -------
949
+ bool
950
+ """
951
+ return PyObject_TypeCheck(obj, &PyTimedeltaArrType_Type)
952
+
953
+
954
+ cdef inline bint is_datetime64_object(object obj):
955
+ """
956
+ Cython equivalent of `isinstance(obj, np.datetime64)`
957
+
958
+ Parameters
959
+ ----------
960
+ obj : object
961
+
962
+ Returns
963
+ -------
964
+ bool
965
+ """
966
+ return PyObject_TypeCheck(obj, &PyDatetimeArrType_Type)
967
+
968
+
969
+ cdef inline npy_datetime get_datetime64_value(object obj) nogil:
970
+ """
971
+ returns the int64 value underlying scalar numpy datetime64 object
972
+
973
+ Note that to interpret this as a datetime, the corresponding unit is
974
+ also needed. That can be found using `get_datetime64_unit`.
975
+ """
976
+ return (<PyDatetimeScalarObject*>obj).obval
977
+
978
+
979
+ cdef inline npy_timedelta get_timedelta64_value(object obj) nogil:
980
+ """
981
+ returns the int64 value underlying scalar numpy timedelta64 object
982
+ """
983
+ return (<PyTimedeltaScalarObject*>obj).obval
984
+
985
+
986
+ cdef inline NPY_DATETIMEUNIT get_datetime64_unit(object obj) nogil:
987
+ """
988
+ returns the unit part of the dtype for a numpy datetime64 object.
989
+ """
990
+ return <NPY_DATETIMEUNIT>(<PyDatetimeScalarObject*>obj).obmeta.base
991
+
992
+
993
+ cdef extern from "numpy/arrayobject.h":
994
+
995
+ ctypedef struct NpyIter:
996
+ pass
997
+
998
+ cdef enum:
999
+ NPY_FAIL
1000
+ NPY_SUCCEED
1001
+
1002
+ cdef enum:
1003
+ # Track an index representing C order
1004
+ NPY_ITER_C_INDEX
1005
+ # Track an index representing Fortran order
1006
+ NPY_ITER_F_INDEX
1007
+ # Track a multi-index
1008
+ NPY_ITER_MULTI_INDEX
1009
+ # User code external to the iterator does the 1-dimensional innermost loop
1010
+ NPY_ITER_EXTERNAL_LOOP
1011
+ # Convert all the operands to a common data type
1012
+ NPY_ITER_COMMON_DTYPE
1013
+ # Operands may hold references, requiring API access during iteration
1014
+ NPY_ITER_REFS_OK
1015
+ # Zero-sized operands should be permitted, iteration checks IterSize for 0
1016
+ NPY_ITER_ZEROSIZE_OK
1017
+ # Permits reductions (size-0 stride with dimension size > 1)
1018
+ NPY_ITER_REDUCE_OK
1019
+ # Enables sub-range iteration
1020
+ NPY_ITER_RANGED
1021
+ # Enables buffering
1022
+ NPY_ITER_BUFFERED
1023
+ # When buffering is enabled, grows the inner loop if possible
1024
+ NPY_ITER_GROWINNER
1025
+ # Delay allocation of buffers until first Reset* call
1026
+ NPY_ITER_DELAY_BUFALLOC
1027
+ # When NPY_KEEPORDER is specified, disable reversing negative-stride axes
1028
+ NPY_ITER_DONT_NEGATE_STRIDES
1029
+ NPY_ITER_COPY_IF_OVERLAP
1030
+ # The operand will be read from and written to
1031
+ NPY_ITER_READWRITE
1032
+ # The operand will only be read from
1033
+ NPY_ITER_READONLY
1034
+ # The operand will only be written to
1035
+ NPY_ITER_WRITEONLY
1036
+ # The operand's data must be in native byte order
1037
+ NPY_ITER_NBO
1038
+ # The operand's data must be aligned
1039
+ NPY_ITER_ALIGNED
1040
+ # The operand's data must be contiguous (within the inner loop)
1041
+ NPY_ITER_CONTIG
1042
+ # The operand may be copied to satisfy requirements
1043
+ NPY_ITER_COPY
1044
+ # The operand may be copied with WRITEBACKIFCOPY to satisfy requirements
1045
+ NPY_ITER_UPDATEIFCOPY
1046
+ # Allocate the operand if it is NULL
1047
+ NPY_ITER_ALLOCATE
1048
+ # If an operand is allocated, don't use any subtype
1049
+ NPY_ITER_NO_SUBTYPE
1050
+ # This is a virtual array slot, operand is NULL but temporary data is there
1051
+ NPY_ITER_VIRTUAL
1052
+ # Require that the dimension match the iterator dimensions exactly
1053
+ NPY_ITER_NO_BROADCAST
1054
+ # A mask is being used on this array, affects buffer -> array copy
1055
+ NPY_ITER_WRITEMASKED
1056
+ # This array is the mask for all WRITEMASKED operands
1057
+ NPY_ITER_ARRAYMASK
1058
+ # Assume iterator order data access for COPY_IF_OVERLAP
1059
+ NPY_ITER_OVERLAP_ASSUME_ELEMENTWISE
1060
+
1061
+ # construction and destruction functions
1062
+ NpyIter* NpyIter_New(ndarray arr, npy_uint32 flags, NPY_ORDER order,
1063
+ NPY_CASTING casting, dtype datatype) except NULL
1064
+ NpyIter* NpyIter_MultiNew(npy_intp nop, PyArrayObject** op, npy_uint32 flags,
1065
+ NPY_ORDER order, NPY_CASTING casting, npy_uint32*
1066
+ op_flags, PyArray_Descr** op_dtypes) except NULL
1067
+ NpyIter* NpyIter_AdvancedNew(npy_intp nop, PyArrayObject** op,
1068
+ npy_uint32 flags, NPY_ORDER order,
1069
+ NPY_CASTING casting, npy_uint32* op_flags,
1070
+ PyArray_Descr** op_dtypes, int oa_ndim,
1071
+ int** op_axes, const npy_intp* itershape,
1072
+ npy_intp buffersize) except NULL
1073
+ NpyIter* NpyIter_Copy(NpyIter* it) except NULL
1074
+ int NpyIter_RemoveAxis(NpyIter* it, int axis) except NPY_FAIL
1075
+ int NpyIter_RemoveMultiIndex(NpyIter* it) except NPY_FAIL
1076
+ int NpyIter_EnableExternalLoop(NpyIter* it) except NPY_FAIL
1077
+ int NpyIter_Deallocate(NpyIter* it) except NPY_FAIL
1078
+ int NpyIter_Reset(NpyIter* it, char** errmsg) except NPY_FAIL
1079
+ int NpyIter_ResetToIterIndexRange(NpyIter* it, npy_intp istart,
1080
+ npy_intp iend, char** errmsg) except NPY_FAIL
1081
+ int NpyIter_ResetBasePointers(NpyIter* it, char** baseptrs, char** errmsg) except NPY_FAIL
1082
+ int NpyIter_GotoMultiIndex(NpyIter* it, const npy_intp* multi_index) except NPY_FAIL
1083
+ int NpyIter_GotoIndex(NpyIter* it, npy_intp index) except NPY_FAIL
1084
+ npy_intp NpyIter_GetIterSize(NpyIter* it) nogil
1085
+ npy_intp NpyIter_GetIterIndex(NpyIter* it) nogil
1086
+ void NpyIter_GetIterIndexRange(NpyIter* it, npy_intp* istart,
1087
+ npy_intp* iend) nogil
1088
+ int NpyIter_GotoIterIndex(NpyIter* it, npy_intp iterindex) except NPY_FAIL
1089
+ npy_bool NpyIter_HasDelayedBufAlloc(NpyIter* it) nogil
1090
+ npy_bool NpyIter_HasExternalLoop(NpyIter* it) nogil
1091
+ npy_bool NpyIter_HasMultiIndex(NpyIter* it) nogil
1092
+ npy_bool NpyIter_HasIndex(NpyIter* it) nogil
1093
+ npy_bool NpyIter_RequiresBuffering(NpyIter* it) nogil
1094
+ npy_bool NpyIter_IsBuffered(NpyIter* it) nogil
1095
+ npy_bool NpyIter_IsGrowInner(NpyIter* it) nogil
1096
+ npy_intp NpyIter_GetBufferSize(NpyIter* it) nogil
1097
+ int NpyIter_GetNDim(NpyIter* it) nogil
1098
+ int NpyIter_GetNOp(NpyIter* it) nogil
1099
+ npy_intp* NpyIter_GetAxisStrideArray(NpyIter* it, int axis) except NULL
1100
+ int NpyIter_GetShape(NpyIter* it, npy_intp* outshape) nogil
1101
+ PyArray_Descr** NpyIter_GetDescrArray(NpyIter* it)
1102
+ PyArrayObject** NpyIter_GetOperandArray(NpyIter* it)
1103
+ ndarray NpyIter_GetIterView(NpyIter* it, npy_intp i)
1104
+ void NpyIter_GetReadFlags(NpyIter* it, char* outreadflags)
1105
+ void NpyIter_GetWriteFlags(NpyIter* it, char* outwriteflags)
1106
+ int NpyIter_CreateCompatibleStrides(NpyIter* it, npy_intp itemsize,
1107
+ npy_intp* outstrides) except NPY_FAIL
1108
+ npy_bool NpyIter_IsFirstVisit(NpyIter* it, int iop) nogil
1109
+ # functions for iterating an NpyIter object
1110
+ #
1111
+ # These don't match the definition in the C API because Cython can't wrap
1112
+ # function pointers that return functions.
1113
+ NpyIter_IterNextFunc* NpyIter_GetIterNext(NpyIter* it, char** errmsg) except NULL
1114
+ NpyIter_GetMultiIndexFunc* NpyIter_GetGetMultiIndex(NpyIter* it,
1115
+ char** errmsg) except NULL
1116
+ char** NpyIter_GetDataPtrArray(NpyIter* it) nogil
1117
+ char** NpyIter_GetInitialDataPtrArray(NpyIter* it) nogil
1118
+ npy_intp* NpyIter_GetIndexPtr(NpyIter* it)
1119
+ npy_intp* NpyIter_GetInnerStrideArray(NpyIter* it) nogil
1120
+ npy_intp* NpyIter_GetInnerLoopSizePtr(NpyIter* it) nogil
1121
+ void NpyIter_GetInnerFixedStrideArray(NpyIter* it, npy_intp* outstrides) nogil
1122
+ npy_bool NpyIter_IterationNeedsAPI(NpyIter* it) nogil
1123
+ void NpyIter_DebugPrint(NpyIter* it)
1124
+
1125
+ # NpyString API
1126
+ cdef extern from "numpy/ndarraytypes.h":
1127
+ ctypedef struct npy_string_allocator:
1128
+ pass
1129
+
1130
+ ctypedef struct npy_packed_static_string:
1131
+ pass
1132
+
1133
+ ctypedef struct npy_static_string:
1134
+ size_t size
1135
+ const char *buf
1136
+
1137
+ ctypedef struct PyArray_StringDTypeObject:
1138
+ PyArray_Descr base
1139
+ PyObject *na_object
1140
+ char coerce
1141
+ char has_nan_na
1142
+ char has_string_na
1143
+ char array_owned
1144
+ npy_static_string default_string
1145
+ npy_static_string na_name
1146
+ npy_string_allocator *allocator
1147
+
1148
+ cdef extern from "numpy/arrayobject.h":
1149
+ npy_string_allocator *NpyString_acquire_allocator(const PyArray_StringDTypeObject *descr)
1150
+ void NpyString_acquire_allocators(size_t n_descriptors, PyArray_Descr *const descrs[], npy_string_allocator *allocators[])
1151
+ void NpyString_release_allocator(npy_string_allocator *allocator)
1152
+ void NpyString_release_allocators(size_t length, npy_string_allocator *allocators[])
1153
+ int NpyString_load(npy_string_allocator *allocator, const npy_packed_static_string *packed_string, npy_static_string *unpacked_string)
1154
+ int NpyString_pack_null(npy_string_allocator *allocator, npy_packed_static_string *packed_string)
1155
+ int NpyString_pack(npy_string_allocator *allocator, npy_packed_static_string *packed_string, const char *buf, size_t size)