Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Implement spelled out for Māori #54

Open
wants to merge 155 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
f6322e0
Updated README.md to use SpelledOut.jl
jakewilliami Oct 23, 2020
887c5e2
Merge branch 'master' of https://github.com/jakewilliami/SpelledOut.j…
jakewilliami Oct 23, 2020
fae56f2
Updated .travis.yml
jakewilliami Oct 27, 2020
5ed572a
Updated .travis.yml
jakewilliami Oct 28, 2020
84a4fc0
Updated .travis.yml
jakewilliami Oct 28, 2020
4a1bd52
Merge pull request #5 from jakewilliami/dev
jakewilliami Oct 28, 2020
090466b
Bug fixes
jakewilliami Oct 28, 2020
351b196
Merge pull request #6 from jakewilliami/dev
jakewilliami Oct 28, 2020
30cfb81
Updated .travis.yml
jakewilliami Oct 28, 2020
6b78340
Merge pull request #7 from jakewilliami/dev
jakewilliami Oct 28, 2020
70e0f42
Updated version number
jakewilliami Oct 28, 2020
8a40775
Merge pull request #8 from jakewilliami/dev
jakewilliami Oct 28, 2020
cde7d4b
Updated version number
jakewilliami Oct 28, 2020
03d92d7
Updated version number
jakewilliami Oct 28, 2020
c8e6707
Updated version number
jakewilliami Oct 28, 2020
fe9bcb1
Merge pull request #9 from jakewilliami/dev
jakewilliami Oct 28, 2020
d1ac283
Added OS BSD to .travis.yml
jakewilliami Oct 28, 2020
c911b7d
Merge pull request #10 from jakewilliami/dev
jakewilliami Oct 28, 2020
60fe0c7
Updated version number
jakewilliami Oct 28, 2020
266da7a
Merge pull request #11 from jakewilliami/dev
jakewilliami Oct 28, 2020
7d3f70e
Updated version number
jakewilliami Oct 28, 2020
820e794
Bug fix (closes #12)
jakewilliami Nov 1, 2020
7c6e079
Merge pull request #13 from jakewilliami/dev
jakewilliami Nov 1, 2020
a225a6c
Implemented floating point spelled out (closes #14)
jakewilliami Nov 1, 2020
6954eee
Merge pull request #16 from jakewilliami/dev
jakewilliami Nov 1, 2020
ef65528
Began work on complex numbers (addresses #15)
jakewilliami Nov 1, 2020
9ff2ef2
Merge pull request #17 from jakewilliami/dev
jakewilliami Nov 1, 2020
5b7bb0d
Removed 1.0 from travis testing, as DecFP requires 1.3 or greater
jakewilliami Nov 1, 2020
b6acc4c
Merge pull request #18 from jakewilliami/dev
jakewilliami Nov 1, 2020
33c15f6
CompatHelper: add new compat entry for "DecFP" at version "1.1"
github-actions[bot] Nov 28, 2020
1a8a90b
Removed testing 1.0 for LTR 1.6 out soon
jakewilliami Dec 30, 2020
ff60415
Merge pull request #21 from jakewilliami/compathelper/new_version/202…
jakewilliami Dec 30, 2020
71894d4
Refactored for setup for multiple language support
jakewilliami Jan 12, 2021
88cf416
Merge pull request #23 from jakewilliami/universal
jakewilliami Jan 12, 2021
3aa9d5a
Migrated to GitHub Actions
jakewilliami Jan 12, 2021
f389b1d
Added docstrings
jakewilliami Jan 12, 2021
eb7280d
Docs setup
jakewilliami Jan 12, 2021
acfd411
Added docs tag
jakewilliami Jan 12, 2021
9768685
Fixed typo in docs
jakewilliami Jan 12, 2021
135ce3f
Rectified bug with language kwarg
jakewilliami Jan 12, 2021
d204234
Refactored docs
jakewilliami Jan 12, 2021
3ae0c25
Added description in docs home page
jakewilliami Jan 12, 2021
68428f6
Updated version number
jakewilliami Jan 12, 2021
4ac38e2
Some ground work for russian spelled-out
jakewilliami Jan 12, 2021
ee690d2
Merge branch 'universal' of https://github.com/jakewilliami/SpelledOu…
jakewilliami Jan 12, 2021
dd947c3
Fixed error message (addresses #25)
jakewilliami Jan 13, 2021
6b6ae59
Fixed error message (addresses #25)
jakewilliami Jan 13, 2021
a5ed4a0
Merge pull request #26 from jakewilliami/universal
jakewilliami Jan 13, 2021
0f56491
Updated version number
jakewilliami Jan 13, 2021
cdac284
Merge branch 'master' of https://github.com/jakewilliami/SpelledOut.jl
jakewilliami Jan 13, 2021
0dc9781
Made error message slightly more correct
jakewilliami Jan 13, 2021
54f0ab1
add .vscode to .gitignore
rmsrosa Jan 13, 2021
a1e7d43
add test project
rmsrosa Jan 13, 2021
c009fa5
Merge pull request #27 from rmsrosa/pkg_tests
jakewilliami Jan 13, 2021
74b60ed
Removed kwarg from exported function and replaced with language var…
jakewilliami Jan 14, 2021
57c36fe
Removed un-needed variants (good suggestion by @rmsrosa)
jakewilliami Jan 14, 2021
b380e28
Merge pull request #28 from jakewilliami/universal
jakewilliami Jan 14, 2021
61c105a
Default language to system locale (suggestion by @rmsrosa)
jakewilliami Jan 14, 2021
f6e9a43
Merge pull request #29 from jakewilliami/universal
jakewilliami Jan 14, 2021
78e3f05
Allowed english SpelledOut to parse big numbers in scientific notation
jakewilliami Jan 18, 2021
e8f7ccb
Merge pull request #33 from jakewilliami/universal
jakewilliami Jan 18, 2021
24209e0
Added formatting dependency to docs-specific dependencies
jakewilliami Jan 18, 2021
307f023
Merge pull request #34 from jakewilliami/universal
jakewilliami Jan 18, 2021
d13b6cd
CompatHelper: add new compat entry for "Formatting" at version "0.4"
github-actions[bot] Jan 19, 2021
6ad4f40
add spanish
longemen3000 Jan 21, 2021
945f82d
Merge pull request #35 from jakewilliami/compathelper/new_version/202…
jakewilliami Jan 24, 2021
46c6c26
Delete _git2_a23528
jakewilliami Jan 24, 2021
04d0569
Merge pull request #36 from longemen3000/master
jakewilliami Jan 24, 2021
774bb76
Updated version number
jakewilliami Jan 24, 2021
e2205cc
Update supported_languages.md
jakewilliami Jan 24, 2021
8b59553
Update Project.toml
jakewilliami Jan 25, 2021
1b99bff
Fixed large floats being parsed scientifically
jakewilliami Jan 27, 2021
9a3f139
Code cleanup after issue fix
jakewilliami Jan 27, 2021
45e8d5e
Merge pull request #44 from jakewilliami/bigfloats
jakewilliami Jan 27, 2021
30f05d8
Added fallback to error for bad input type (closes #41)
jakewilliami Jan 27, 2021
aaa7741
Merge pull request #45 from jakewilliami/fallback
jakewilliami Jan 27, 2021
62a0ee1
Removed 32-bit linux support (DecFP was making tests fail; closes #46)
jakewilliami Jan 27, 2021
cdba05f
Added parsing for rational numbers (closes #39)
jakewilliami Jan 27, 2021
d061b7c
Merge pull request #47 from jakewilliami/rational
jakewilliami Jan 27, 2021
ddccd6b
Added method handling irrational numbers (closes #38, but open questi…
jakewilliami Jan 27, 2021
ea19c65
Merge pull request #49 from jakewilliami/irrational
jakewilliami Jan 27, 2021
282cbd3
Updated version number
jakewilliami Jan 27, 2021
e81c4b2
Added caveat about 32-bit systems
jakewilliami Jan 27, 2021
38ae94c
slight performance considerations while obtaining default language
jakewilliami Aug 21, 2021
2fbebed
correct syntax for british spell out in docs
rick2047 Oct 15, 2021
1847b02
Merge pull request #51 from rick2047/docstring
jakewilliami Oct 15, 2021
88c1e75
added pt_BR
Gabrielforest May 30, 2022
06f115e
"deleting useless file"
Gabrielforest May 30, 2022
3fafa7d
.gitignore
Gabrielforest May 30, 2022
2e6f397
removed files from Rstudio IDE
Gabrielforest Jun 1, 2022
aaf5f54
Initial commit on optimisation branch
jakewilliami Jun 2, 2022
67bac52
Added variants subsection to support future addition of Portugal Pt
jakewilliami Jun 2, 2022
8259e01
Refactor pt_BR code structure to contain all Portuguese variants with…
jakewilliami Jun 2, 2022
60ac237
Removed unused functions
jakewilliami Jun 2, 2022
91544a8
Changed dict to keyword argument for consistency in interface
jakewilliami Jun 2, 2022
5ceb84f
pt_BR tests
Gabrielforest Jun 2, 2022
7cb2f49
fixing a bug and implementing pt-PT separately
Gabrielforest Jun 2, 2022
1ea43b4
implementing pt-PT and pt-BR together
Gabrielforest Jun 6, 2022
effd44c
Included pt on the supported language file
Gabrielforest Jun 6, 2022
200978e
fixing print error
Gabrielforest Jun 21, 2022
fe7aee7
WIP: Implement spelled out for Māori
jakewilliami Jun 21, 2022
5fd574c
WIP: Implement spelled out for Māori
jakewilliami Jun 21, 2022
18c1f29
Update package version number
jakewilliami Jun 21, 2022
2e117fe
Merge pull request #52 from Gabrielforest/master
jakewilliami Jun 21, 2022
ed12c23
Added quick start section and elaborate on contributing section withi…
jakewilliami Jun 26, 2022
7f2cc2a
Added quick start section and elaborate on contributing section withi…
jakewilliami Jun 26, 2022
d91f8d7
Removed non-function test line
jakewilliami Jun 26, 2022
4fe41d5
Added benchmark testing script
jakewilliami Jun 26, 2022
cd6f81e
Prefer buffers over strings
jakewilliami Jun 26, 2022
9f33c80
Use IOBuffer in small convert
jakewilliami Jun 26, 2022
da97cce
Work mostly with IOBuffers
jakewilliami Jun 26, 2022
06e7d77
Remove unused kwargs to lesser functions
jakewilliami Jun 26, 2022
d0c2ee7
Only work with bigints after we check if number is small
jakewilliami Jun 26, 2022
0a30c3b
Favour `print(io, ...)` over `write(io, ...)`
jakewilliami Jun 27, 2022
e313d20
Reduced liberal use of big integers
jakewilliami Jun 27, 2022
c3c5aa2
Better string manipulation and use buf for niche convert funcs
jakewilliami Jun 27, 2022
06835df
Update contributing section to include supported number types
jakewilliami Jun 27, 2022
21041ae
Update contributing section to include supported number types
jakewilliami Jun 27, 2022
a01a6fa
Remove original copy backup
jakewilliami Jun 27, 2022
8251a3c
Removed no-longer-needed benchmarking file
jakewilliami Jun 27, 2022
508e847
Merge pull request #53 from jakewilliami/optimisation
jakewilliami Jun 27, 2022
4ad05f4
Fixed ISO country code link in README
jakewilliami Jul 25, 2022
a7e63b8
Fixed ISO country code link in README
jakewilliami Jul 25, 2022
e40d696
Remove accidental, temp emacs file
jakewilliami Sep 19, 2022
3474a6d
Remove accidental, temp emacs file
jakewilliami Sep 19, 2022
7c392ab
Align tests cases by result
jakewilliami Sep 19, 2022
bd7ad2d
Align tests cases by result
jakewilliami Sep 19, 2022
1132d0e
Add nicer error messages for bounds checking internal mi functions
jakewilliami Sep 19, 2022
d7886be
Add nicer error messages for bounds checking internal mi functions
jakewilliami Sep 19, 2022
6efc313
Merge branch 'master' into maori
jakewilliami Sep 19, 2022
ed0e569
Merge branch 'master' into maori
jakewilliami Sep 19, 2022
b157f7c
Implement spelled_out for numbers up to 999 for Māori
jakewilliami Sep 19, 2022
e233741
Implement spelled_out for numbers up to 999 for Māori
jakewilliami Sep 19, 2022
e4516d2
Account for edge case at 1000 saying kotahi
jakewilliami Sep 19, 2022
dc2d79a
Account for edge case at 1000 saying kotahi
jakewilliami Sep 19, 2022
7b913dc
Further correction of 1xxx edge case for kotahi
jakewilliami Sep 19, 2022
496ae97
Further correction of 1xxx edge case for kotahi
jakewilliami Sep 19, 2022
f34bbc2
Fix initial word by accounting for order of magnitude in mi
jakewilliami Sep 19, 2022
7b8e491
Fix initial word by accounting for order of magnitude in mi
jakewilliami Sep 19, 2022
adb801f
Changed bounds in comment
jakewilliami Sep 22, 2022
58a00b5
Changed bounds in comment
jakewilliami Sep 22, 2022
12b0497
Added tests for Julia 1.0 and 1.6
jakewilliami Sep 22, 2022
fc9f07f
Added tests for Julia 1.0 and 1.6
jakewilliami Sep 22, 2022
1762128
More progress on spelling out postive integers in Te Reo (Māori)
jakewilliami Mar 29, 2023
32db7e1
Merge remote-tracking branch 'refs/remotes/origin/maori' into maori
jakewilliami Mar 29, 2023
f9b9bed
Add author and timeline information to top of main lang files
jakewilliami Apr 5, 2023
db572b3
WIP: Add notes on Māori
jakewilliami Oct 21, 2023
4c321a3
Merge remote-tracking branch 'origin/master' into maori
jakewilliami Sep 8, 2024
5dc66d4
Broaden explanation of the SpelledOut function
jakewilliami Sep 8, 2024
be6f8da
Add further TODO notes for Māori
jakewilliami Sep 8, 2024
b882f1a
Remove Travis CI config
jakewilliami Sep 8, 2024
960f2b1
Update copyright date in LICENSE
jakewilliami Sep 8, 2024
a1479c5
Standardise project spacing
jakewilliami Sep 8, 2024
2f08287
Update dates spend in Māori SpelledOut
jakewilliami Sep 8, 2024
01ce4fa
Add GitHub handles to author attribution
jakewilliami Sep 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ jobs:
fail-fast: false
matrix:
version:
- "1.5" # current
- "nightly" # Latest Release
- "1.0" # Old version
- "1.6" # Recent LTS version
- "nightly" # Latest release
os:
- ubuntu-latest
- macOS-latest
Expand Down
34 changes: 0 additions & 34 deletions .old_travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Jake W. Ireland <[email protected]> and contributors
Copyright (c) 2020–2024 Jake W. Ireland <[email protected]> and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,32 @@


## Description
This is a minimal package for a pure Julia implementation of converting numbers in their Arabic form to numbers in their Anglo-Saxan form. The process of **spelling out** a number has also been referred to as **set full out**, to write out in **long hand**, and &mdash; as a great mind once suggested &mdash; to **transnumerate**.
This is a minimal package for a pure Julia implementation of converting numbers in their Arabic form to numbers in their natural language form. The process of **spelling out** a number has also been referred to as **set full out**, and to write out in **long hand**. Some people to whom I look up have suggested calling this **verbal depresentation**, to **digitate**, and&mdash;one of my favourites&mdash;to **transnumerate**.

## Quick Start
```julia
julia> using SpelledOut

julia> spelled_out(1234);

julia> spelled_out(1234, lang = :en);

julia> spelled_out(1234, lang = :en_UK);
```

See [here](https://jakewilliami.github.io/SpelledOut.jl/dev/supported_languages/#Supported-Languages) for a list of supported languages.

## Contributing
Each new language will require a language code to use it. This code is determined by [ISO-639-1](https://www.loc.gov/standards/iso639-2/php/langcodes-keyword.php).<sup>[[1]](https://www.wikiwand.com/en/ISO_639-1)</sup>

When contributing, you should add a file and a directory: `src/<iso-639-1-lang-code>.jl`, and `src/<iso-639-1-lang-code>/`. Within the latter, this is where you should store any language-specific dictionaries.

When implementing the main function for your language (typically called `spelled_out_<iso-639-1-lang-code>`), consider implementing methods on this function for the following types:
- `Integer`
- `Rational`
- `Float64`
- `Complex`

You can also add a fallback method and throw an error, but this should be caught by a `MethodError` anyway. Now you can add to the main [`SpelledOut.jl`](src/SpelledOut.jl) function, in which you can add a branch for your language (following the trend).

Finally, ensure you update the documentation for [Supported Languages](https://jakewilliami.github.io/SpelledOut.jl/dev/supported_languages/#Supported-Languages).
15 changes: 7 additions & 8 deletions src/SpelledOut.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export spelled_out, Spelled_out, Spelled_Out, SPELLED_OUT
include("en.jl")
include("es.jl")
include("pt.jl")
include("mi.jl")

"""
```julia
Expand Down Expand Up @@ -53,16 +54,14 @@ function spelled_out(
dict::Symbol = :modern
)

if lang ∈ (:en, :en_US)
return spelled_out_en(number, british = false, dict = dict)
elseif lang ∈ (:en_UK, :en_GB, :en_NZ, :en_AU)
return spelled_out_en(number, british = true, dict = dict)
if lang ∈ (:en, :en_US, :en_UK, :en_GB, :en_NZ, :en_AU)
return spelled_out_en(number, british = lang ∈ (:en_UK, :en_GB, :en_NZ, :en_AU), dict = dict)
elseif lang ∈ (:es,)
return spelled_out_es(number; dict = dict)
elseif lang ∈ (:pt_BR,)
return spelled_out_pt(number; portugal = false, dict = dict)
elseif lang ∈ (:pt,)
return spelled_out_pt(number; portugal = true, dict = dict)
elseif lang ∈ (:pt, :pt_BR)
return spelled_out_pt(number; portugal = lang == :pt, dict = dict)
elseif lang ∈ (:mi,)
return spelled_out_mi(number)
end

throw(error("We do not support $lang yet. Please make an issue and someone might be able to help you, or feel free to contribute."))
Expand Down
76 changes: 39 additions & 37 deletions src/en.jl
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
# Jake Ireland (@jakewilliami; October–November, 2020)

# dictionaries
include(joinpath(@__DIR__, "en", "standard_dictionary_numbers_extended.jl"))
include(joinpath(@__DIR__, "en", "large_standard_dictionary_numbers_extended.jl"))
include(joinpath(@__DIR__, "en", "ordinal_dictionaries.jl"))

# utils
include(joinpath(@__DIR__, "en", "utils.jl"))

# convert a value < 100 to English.
function _small_convert_en!(io::IOBuffer, number::Integer)
if number < 20
print(io, _small_numbers[number + 1])
return io
end

m = mod(number, 10)

for (v, d̂) in enumerate(_tens)
d = 20 + 10 * (v - 1)

if d + 10 > number
if m ≠ 0
n = _small_numbers[m + 1]
Expand All @@ -28,7 +30,7 @@ function _small_convert_en!(io::IOBuffer, number::Integer)
return io
end
end

return io
end

Expand All @@ -44,7 +46,7 @@ end
function _large_convert_en!(io::IOBuffer, number::Integer; british::Bool = false)
divisor = div(number, 100)
modulus = mod(number, 100)

if divisor > 0
print(io, _small_numbers[divisor + 1], " hundred")
if modulus > 0
Expand All @@ -57,11 +59,11 @@ function _large_convert_en!(io::IOBuffer, number::Integer; british::Bool = false
print(io, "and ")
end
end

if modulus > 0
_small_convert_en!(io, modulus)
end

return io
end

Expand All @@ -82,47 +84,47 @@ function _spelled_out_en!(io::IOBuffer, number_norm::Integer; british::Bool = fa
else
error("Unrecognized dict value: $dict")
end

if number_norm < 0
print(io, "negative ")
end

if number_norm > limit - 1
error("""SpelledOut.jl does not support numbers larger than $(limit_str * " - 1"). Sorry about that!""")
end


if number_norm < 100
_small_convert_en!(io, number_norm)
return io
end

if number_norm < 1000
_large_convert_en!(io, number_norm, british = british)
return io
end

number = abs(number_norm)

for v in 0:length(scale_numbers)
d_idx = v
d_number = round(big(1000)^v)

if d_number > number
modulus = big(1000)^(d_idx - 1)
l, r = divrem(number, modulus)

_large_convert_en!(io, l, british = british)
print(io, " ", scale_numbers[d_idx - 1])
print(io, " ", scale_numbers[d_idx - 1])
if r > 0
print(io, ", ")
_spelled_out_en!(io, r, british = british, dict = dict)
end

return io
end
end

error("Unreachable")
end

Expand All @@ -137,9 +139,9 @@ function spell_ordinal_en(number::Integer; british::Bool = false, dict::Symbol =
word_buf = IOBuffer()
_spelled_out_en!(word_buf, number, british = british, dict = dict)
s = String(take!(word_buf))
lastword = lastsplit(isspace, s)
redolast = lastsplit('-', lastword)

lastword = lastsplit(isspace, s)
redolast = lastsplit('-', lastword)

if redolast != lastword
_lastsplit = '-'
Expand All @@ -148,21 +150,21 @@ function spell_ordinal_en(number::Integer; british::Bool = false, dict::Symbol =
_lastsplit = ' '
word = lastword
end

firstpart = firstlastsplit(_lastsplit, s)

if firstpart != word
print(word_buf, firstpart, _lastsplit)
end

if haskey(irregular, word)
print(word_buf, irregular[word])
elseif word[end] == 'y'
print(word_buf, word[1:end-1], ysuffix)
else
print(word_buf, word, suffix)
end

return String(take!(word_buf))
end

Expand All @@ -174,11 +176,11 @@ function decimal_convert_en(number::AbstractString; british::Bool = false, dict:
word_buf = IOBuffer()
_spelled_out_en!(word_buf, parse(BigInt, whole), british = british, dict = dict)
print(word_buf, " point")

for i in decimal
print(word_buf, ' ', _small_number_dictionary[i])
end

return String(take!(word_buf))
end

Expand All @@ -193,7 +195,7 @@ function spelled_out_en(number::AbstractFloat; british::Bool = false, dict::Symb
# E.g., 1e10 should be parsed as an integer (as should 1.0e10)
number = parse(BigInt, str_number)
end

if isa(number, AbstractString)
# if the number is a string then it is a decimal, which is formatted precisely
# for correct precision with decimal places
Expand All @@ -204,7 +206,7 @@ function spelled_out_en(number::AbstractFloat; british::Bool = false, dict::Symb
else
throw(error("Cannot parse type $(typeof(number)). Please make an issue."))
end

# should never get here
return nothing
end
Expand All @@ -215,15 +217,15 @@ function spelled_out_en(number::Complex; british::Bool = false, dict::Symbol = :
end

function spelled_out_en(number::Rational; british::Bool = false, dict::Symbol = :modern)
_num, _den = number.num, number.den
_num, _den = number.num, number.den

# return the number itself if the denomimator is one
isone(_den) && return spelled_out_en(_num, british = british, dict = dict)
word = spelled_out_en(_num, british = british, dict = dict) * " " * spell_ordinal_en(_den, british = british, dict = dict)
isone(_den) && return spelled_out_en(_num, british = british, dict = dict)

word = spelled_out_en(_num, british = british, dict = dict) * " " * spell_ordinal_en(_den, british = british, dict = dict)

# account for pluralisation
return isone(_num) ? word : word * "s"
return isone(_num) ? word : word * "s"
end

function spelled_out_en(number::AbstractIrrational; british::Bool = false, dict::Symbol = :modern)
Expand Down
2 changes: 1 addition & 1 deletion src/en/large_standard_dictionary_numbers_extended.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ const _large_scale_traditional_european = String[
"sesquinquagintillion", "sexagintilliard", "unsexagintillion", "quinsexagintilliard",
"septuagintilliard", "quinseptuagintilliard", "octogintilliard", "quinoctogintilliard",
"nonagintilliard", "quinnonagintilliard", "centilliard", "quinquagintacentilliard",
"ducentilliard", "quinquagintaducentilliard", "trecentilliard", "quinquagintatrecentilliard",
"ducentilliard", "quinquagintaducentilliard", "trecentilliard", "quinquagintatrecentilliard",
"quadringentilliard", "quinquagintaquadringentilliard", "quingentilliard"
]
12 changes: 6 additions & 6 deletions src/en/standard_dictionary_numbers_extended.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
const _small_numbers = String[
"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten",
"eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"]

const _small_number_dictionary = Dict{Char, String}(
'0' => "zero", '1' => "one", '2' => "two", '3' => "three", '4' => "four", '5' => "five", '6' => "six",
'7' => "seven", '8' => "eight", '9' => "nine")

const _tens = String[
"twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]

# The scale_numbers are US, Canada and modern British (short scale)
const _scale_modern = String[
"thousand", "million", "billion", "trillion", "quadrillion",
Expand All @@ -21,7 +21,7 @@ const _scale_modern = String[
"quintrigintillion", "sestrigintillion", "septentrigintillion", "octotrigintillion", "noventrigintillion",
"quadragintillion"
]

const _scale_traditional_british = String[
"thousand", "million", "thousand million", "billion", "thousand billion",
"trillion", "thousand trillion", "quadrillion", "thousand quadrillion", "quintillion",
Expand All @@ -32,7 +32,7 @@ const _scale_traditional_british = String[
"octodecillion", "thousand octodecillion","novendecillion", "thousand novendecillion", "vigintillion",
"thousand vigintillion"
]

const _scale_traditional_european = String[
"thousand", "million", "milliard", "billion", "billiard",
"trillion", "trilliard", "quadrillion", "quadrilliard", "quintillion",
Expand All @@ -44,6 +44,6 @@ const _scale_traditional_european = String[
"octodecillion", "octodecilliard", "novendecillion", "novendecilliard", "vigintillion",
"vigintilliard"
]

const limit = BigInt(big(10)^120)
const limit_str = "10^120"
Loading
Loading