Spanish ordinal number generator
Project description
intesim
intesim converts positive integers into their Spanish ordinal form using the ésimo/ésima notation.
from intesim import intesim
intesim(5, "M") # → "quinto"
intesim(5, "F") # → "quinta"
intesim(21, "M", True) # → "vigésimos primeros"
intesim(1000, "F") # → "milésima"
Installation
pip install intesim
Requires Python 3.10 or higher.
Usage
intesim(number: int, gender: Literal ["M", "F"], plural: bool=False, before_noun: bool=False)
Parameters
| Parameter | Type | Description |
|---|---|---|
number |
int |
A positive integer to convert. |
gender |
"M" or "F" |
"M" for masculine, "F" for feminine form. |
plural |
bool |
True for plural, False for singular. Defaults to False. |
before_noun |
bool |
True for apocopated forms of some numbers, False for general forms. Defaults to False. |
Returns
A str with the ordinal representation of number.
Examples
Gender
intesim(1, "M") # → "primero"
intesim(1, "F") # → "primera"
intesim(3, "M") # → "tercero"
intesim(3, "F") # → "tercera"
Plurality
intesim(2, "M", True) # → "segundos"
intesim(2, "F", True) # → "segundas"
Before Noun
(Only changes when masculine singular form)
intesim(1, "M", False, False) # → "primero"
intesim(3, "M", False, False) # → "tercero"
intesim(13, "M", False, False) # → "decimotercero"
intesim(1, "M", False, True) # → "primer"
intesim(3, "M", False, True) # → "tercer"
intesim(13, "M", False, True) # → "decimotercer"
Larger numbers
intesim(20, "F") # → "vigésima"
intesim(35, "M") # → "trigésimo quinto"
intesim(100, "F") # → "centésima"
intesim(451, "M") # → "cuadrigentésimo quincuagésimo primero"
intesim(1000, "F", True) # → "milésimas"
intesim(5000, "M") # → "cincomilésimo"
intesim(123_456_789, "F", True) # → "centésimas vigésimas terceras millonésimas cuadrigentésimas quincuagésimas sextas milésimas septingentésimas octogésimas novenas"
intesim(333_333_333, "M", False) # → "tricentésimo trigésimo tercer millonésimo tricentésimo trigésimo tercer milésimo tricentésimo trigésimo tercero"
This library currently covers ordinals from 1 to 999 999 999.
For integers beyond the current cover of this library, the function raises a ValueError.
Background
Spanish ordinals agree with the noun they modify in both gender (-o / -a) and number (-os / -as). The ésimo family of ordinals is the standard form for numbers above twelve and is used in formal, technical, and academic writing. For casual writing, the -avo/-ava form is more common.
For some approved examples of this kind of spanish ordinals, look at the "Ordinales" column here.
Apocopated versions of the ordinals are used only before masculine nouns. The RAE explains this more thoroughly here.
License
Apache 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file intesim-0.1.1.tar.gz.
File metadata
- Download URL: intesim-0.1.1.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1dd48d6f6013f83c41105d060d3007ef472c3d0304fe8bf3f075bbf1a18bf40
|
|
| MD5 |
1275fc1cbf48a3d24c726e0ca74e9af7
|
|
| BLAKE2b-256 |
bdc9daa3a8102e242b1facedc46cfe9902031ad7230a432ebf04b3179c261136
|
Provenance
The following attestation bundles were made for intesim-0.1.1.tar.gz:
Publisher:
workflow.yml on rimopa/intesim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
intesim-0.1.1.tar.gz -
Subject digest:
f1dd48d6f6013f83c41105d060d3007ef472c3d0304fe8bf3f075bbf1a18bf40 - Sigstore transparency entry: 1329133259
- Sigstore integration time:
-
Permalink:
rimopa/intesim@a3574a5b088644e8ed72cfde26d61273ec50d893 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/rimopa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@a3574a5b088644e8ed72cfde26d61273ec50d893 -
Trigger Event:
release
-
Statement type:
File details
Details for the file intesim-0.1.1-py3-none-any.whl.
File metadata
- Download URL: intesim-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ca4b4f074f0a8e03545d11e0a6d8140c4e23c87ff5870360d51101423a37d7a
|
|
| MD5 |
75da3114b3dff61abfe99b782f3787ce
|
|
| BLAKE2b-256 |
96d35b89d6006b02d80dc101365e603c62a3a04c6eb5c6cfcbdf45acd10ac1ff
|
Provenance
The following attestation bundles were made for intesim-0.1.1-py3-none-any.whl:
Publisher:
workflow.yml on rimopa/intesim
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
intesim-0.1.1-py3-none-any.whl -
Subject digest:
0ca4b4f074f0a8e03545d11e0a6d8140c4e23c87ff5870360d51101423a37d7a - Sigstore transparency entry: 1329133268
- Sigstore integration time:
-
Permalink:
rimopa/intesim@a3574a5b088644e8ed72cfde26d61273ec50d893 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/rimopa
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@a3574a5b088644e8ed72cfde26d61273ec50d893 -
Trigger Event:
release
-
Statement type: