{"id":19517312,"url":"https://github.com/hapytex/ordinal","last_synced_at":"2025-02-26T00:12:10.593Z","repository":{"id":41049752,"uuid":"293388780","full_name":"hapytex/ordinal","owner":"hapytex","description":"Convert numbers into words.","archived":false,"fork":false,"pushed_at":"2024-01-28T12:19:51.000Z","size":16790,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-08T12:43:15.837Z","etag":null,"topics":["haskell","number","number-to-words"],"latest_commit_sha":null,"homepage":"https://hackage.haskell.org/package/ordinal","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hapytex.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":"https://www.buymeacoffee.com/hapytex"}},"created_at":"2020-09-07T00:57:53.000Z","updated_at":"2023-06-06T15:53:50.000Z","dependencies_parsed_at":"2024-01-28T13:30:01.393Z","dependency_job_id":"999405a8-c356-406c-a83a-6d618087b203","html_url":"https://github.com/hapytex/ordinal","commit_stats":{"total_commits":84,"total_committers":2,"mean_commits":42.0,"dds":0.4642857142857143,"last_synced_commit":"b7de43beb4c63047d0692a3048f9f3f6e438fd78"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hapytex%2Fordinal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hapytex%2Fordinal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hapytex%2Fordinal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hapytex%2Fordinal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hapytex","download_url":"https://codeload.github.com/hapytex/ordinal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240766613,"owners_count":19854119,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["haskell","number","number-to-words"],"created_at":"2024-11-11T00:01:48.910Z","updated_at":"2025-02-26T00:12:10.509Z","avatar_url":"https://github.com/hapytex.png","language":"Haskell","funding_links":["https://www.buymeacoffee.com/hapytex"],"categories":[],"sub_categories":[],"readme":"# ordinal\n\n[![Build Status of the package by GitHub actions](https://github.com/hapytex/ordinal/actions/workflows/build-ci.yml/badge.svg)](https://github.com/hapytex/ordinal/actions/workflows/build-ci.yml)\n[![Build Status of the package by Hackage](https://matrix.hackage.haskell.org/api/v2/packages/ordinal/badge)](https://matrix.hackage.haskell.org/#/package/ordinal)\n[![Hackage version badge](https://img.shields.io/hackage/v/ordinal.svg)](https://hackage.haskell.org/package/ordinal)\n\nA package to convert numbers to the words. It contains a datatype for\nalgorithmic conversion that can convert the number for *most* languages.\nIt converts numbers to its *cardinal* and *ordinal* format.\n\nThe package is based on Python's [**`num2words`** package \\[GitHub\\]](https://github.com/savoirfairelinux/num2words).\n\nThe following languages are currently supported (in *alphabetical* order):\n\n 1. Dutch (nl);\n 2. English (en);\n 3. French (fr); and\n 4. German (de).\n\n## Usage\n\nOne can import the `Text.Numerals` module, and use the `toCardinal`,\n`toOrdinal`, `toShortOrdinal`, `toTimeText` and `toTimeText'` functions with a\nnumber-to-word algorithm that is exported by the `Text.Numerals.Languages` module,\nfor example:\n\n```\nPrelude Text.Numerals Data.Text.IO\u003e Data.Text.IO.putStrLn (toCardinal english 42)\nforty-two\nPrelude Text.Numerals Data.Text.IO\u003e Data.Text.IO.putStrLn (toOrdinal french 42)\nquarante-deuxième\nPrelude Text.Numerals Data.Text.IO\u003e Data.Text.IO.putStrLn (toShortOrdinal german 42)\n42.\nPrelude Text.Numerals Data.Text.IO\u003e Data.Text.IO.putStrLn (toTimeText' dutch 18 42)\ntwaalf minuten na half zeven 's avonds\n```\n\nOne can also define a language algorithm themselves, for this one can look at\nthe source code of the language modules.\n\n## Executable\n\nThe package also includes an executable named `ordinal`. One can use `ordinal` with:\n\n```\nordinal [OPTIONS..] [numbers..]\n```\n\nwhere `OPTIONS` specifies the language and the format that should be used to convert the numbers, and the numbers can be specified as an integer, or with `hh:mm` notation.\n\nThe options are:\n\n - **`-l=en`**/**`-lang=en`**/**`--language=en`**: is used to specify the language as an ISO-639 code, or the full name of the language. By default English (`en`);\n - **`-c`**/**`--cardinal`** set the number mode to cardinal, which is the default mode;\n - **`-o`**/**`--ordinal`** set the number mode to ordinal;\n - **`-s`**/**`--short-ordinal`** set the number mode to short ordinal; and\n - **`-t`**/**`--time`** set the number mode to time.\n\n## Package structure\n\nThe modules are all located under `Text.Numerals` module. The `Text.Numerals`\nmodule exports the main modules.\n\nThe `Text.Numerals.Class` module defines classes, data types and synonyms that\nprovide an interface to convert numbers to words.\n\nThe `Text.Numerals.Algorithm` module contains algorithms to make converting\nnumbers to words more convienient. The module `Text.Numerals.Algorithm.Template`\ncontains functions for *template Haskell*, at the moment this only contains a\nfunction to make an `ordinize` function.\n\nThe `Text.Numerals.Prefix` module contains numerical prefixes, at the moment\nonly *Latin* prefixes. These are used for *short scale* and *long scale*\nalgorithms to specify millions, billions, etc. in languages.\n\nThe `Text.Numerals.Languages` module exports for each implemented language its\nalgorithm, this makes working with multiple languages more convienient. Under\nthis module there are dedicated modules per language that do not only export the\nalgorithm for that language, but also helper functions and constants.\n\n## `ordinal` is not *safe* Haskell\n\nThe package uses the `Data.Vector` module which is not safe, and therefore\n`ordinal` is not safe either.\n\n## Continuous Integration\n\nThe commits on GitHub are validated by [*Travis*](https://travis-ci.com/hapytex/ordinal).\nThe build will validate that the system is building, that the compiler does not\ngenerate any *errors* or *warnings*. It will also run the test-suite and will\nrun `hlint` on the source code to check for improvements. Finally it will run\n`grep` on the Haskell files in the `src/` directory to check for missing\nelements (`???`) and `TODO`s.\n\n## Contribute\n\nYou can contribute by making a pull request on the [*GitHub\nrepository*](https://github.com/hapytex/ordinal).\n\nYou can contact the package maintainer by sending a mail to\n[`hapytexeu+gh@gmail.com`](mailto:hapytexeu+gh@gmail.com).\n\n### Adding a new language\n\nThere is a `src/Text/Numerals/Languages/Language.hs.template` template file to\ninclude a new language. This includes a list of tasks to do in order to add the\nlanguage. The `test/` directory contains a `test/Text/Numerals/Languages/LanguageSpec.hs.template`\nfile to test the new language. In these templates, one needs to fill in the\n`???` parts. One can make use of the `new-language.sh` script to automatically\ncopy the templates and open the editor to add the language. In that case the name\nof the language is passed as first parameter.\n\nNormally the languages are tested for all numbers in the 0-200 range, and the\nfirst hundred Fibonacci numbers greater than 200, so:\n```\n[\n  233,377,610,987,1597,2584,4181,6765,10946,17711,28657,46368,75025,121393\n ,196418,317811,514229,832040,1346269,2178309,3524578,5702887,9227465,14930352\n ,24157817,39088169,63245986,102334155,165580141,267914296,433494437,701408733\n ,1134903170,1836311903,2971215073,4807526976,7778742049,12586269025,20365011074\n ,32951280099,53316291173,86267571272,139583862445,225851433717,365435296162\n ,591286729879,956722026041,1548008755920,2504730781961,4052739537881,6557470319842\n ,10610209857723,17167680177565,27777890035288,44945570212853,72723460248141\n ,117669030460994,190392490709135,308061521170129,498454011879264,806515533049393\n ,1304969544928657,2111485077978050,3416454622906707,5527939700884757,8944394323791464\n ,14472334024676221,23416728348467685,37889062373143906,61305790721611591,99194853094755497\n ,160500643816367088,259695496911122585,420196140727489673,679891637638612258\n ,1100087778366101931,1779979416004714189,2880067194370816120,4660046610375530309\n ,7540113804746346429,12200160415121876738,19740274219868223167,31940434634990099905\n ,51680708854858323072,83621143489848422977,135301852344706746049,218922995834555169026\n ,354224848179261915075,573147844013817084101,927372692193078999176,1500520536206896083277\n ,2427893228399975082453,3928413764606871165730,6356306993006846248183,10284720757613717413913\n ,16641027750620563662096,26925748508234281076009,43566776258854844738105\n ,70492524767089125814114,114059301025943970552219\n]\n```\n\nand powers of ten until *10\u003csup\u003e24\u003c/sup\u003e*.\n\n---\n\nThis package is dedicated to *Wouter Folens* (\\* 2019), in the hope that he will\nlearn about transforming numbers into words.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhapytex%2Fordinal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhapytex%2Fordinal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhapytex%2Fordinal/lists"}