-
Notifications
You must be signed in to change notification settings - Fork 475
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
add support for Japanese (JA) #171
add support for Japanese (JA) #171
Conversation
Hi @siikamiika Thanks a lot again! |
hey, @erozqba ! I speak a bit of Japanese. @siikamiika ping me once the WIP is over ! |
Seems like the code is having some issues with Python 2. Probably Unicode related. The tests should be fine for Python 3 now, but I haven't updated README yet. |
@erozqba @ventilooo Everything looks fine to me now. This sure was an interesting language to implement. 😅 I'm also just learning Japanese so I did this as an exercise. I did some research on the preferred readings of some number words in Japanese, but there could be errors somewhere. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot, @siikamiika for this contribution!
@ventilooo thanks in advance for your code review.
num2words/lang_JA.py
Outdated
(724, ("神亀", "じんき")), | ||
(729, ("天平", "てんぴょう")), | ||
# (749, ("天平感宝", "てんぴょうかんぽう")), | ||
(749, ("天平勝宝", "てんぴょうしょうほう")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why there are some commented lines as this one in this list?
It's because there have been multiple emperors/empresses during the same
year and one has to be chosen since num2words doesn't distinguish between
months and days. The last one is the one who has reigned until the next
emperor/empress. I actually had them the wrong way around first (used the
first one) but fixed them in a commit
…On Thu, Jun 14, 2018, 19:01 Ernesto Rodriguez Ortiz < ***@***.***> wrote:
***@***.**** commented on this pull request.
Thanks a lot, siikamiika for this contribution!
------------------------------
In num2words/lang_JA.py
<#171 (comment)>
:
> +
+# Source: https://www.sljfaq.org/afaq/era-list.html
+# if there are multiple eras for the same year, use the last one
+ERA_START = [
+ (645, ("大化", "たいか")),
+ (650, ("白雉", "はくち")),
+ (686, ("朱鳥", "しゅちょう")),
+ (701, ("大宝", "たいほう")),
+ (704, ("慶雲", "けいうん")),
+ (708, ("和銅", "わどう")),
+ (715, ("霊亀", "れいき")),
+ (717, ("養老", "ようろう")),
+ (724, ("神亀", "じんき")),
+ (729, ("天平", "てんぴょう")),
+ # (749, ("天平感宝", "てんぴょうかんぽう")),
+ (749, ("天平勝宝", "てんぴょうしょうほう")),
Why there are some commented lines as this one in this list?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#171 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFV8s1gsB792hxY4yW9hFsp7rXB6j45_ks5t8oi8gaJpZM4UeNjH>
.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@siikamiika Instead of putting some emperor/empress in comment, could you solve this with a method ?
Like with ⬇️
self.assertEqual(n2j(0, prefer=["〇"]), "〇")
In order to easily give the choice to the user.
Also I don't know how useful this could be, but having the option to choose the the output format between
If I want to write an app for kid, they don't necessarily know all the kanji associated with numbers.
Or if I want to write an app for foreigner, to learn Japanese. Having an romaji output would help.
Sounds like a good idea, I'll try to do that.
Hiragana output is currently supported with the Romaji is a bit complicated, though. First, there are multiple ways to romanize Japanese text, as seen from your link. An optional dependency to something like python-romkan could be added, but even then there would be the problem of separating the number words with spaces only for romanized Japanese but not with kana. Anyway, I agree that there could be some use for that feature. I guess I could look into implementing romaji at some point. |
I just realized that the era thing wasn't as simple as having some ruler for less than a year. The Some reading: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's perfect !
Once again @siikamiika , thanks for your contribution !
If you want to discuss further on future improvement for the Japanese support.
Just open an issue with the RFC tag 😉 🤞
Changes proposed in this pull request:
Status
How to verify this change
Additional notes