Animenosekai / translate

A module grouping multiple translation APIs
GNU Affero General Public License v3.0
524 stars 60 forks source link

Next: 3.0 #78

Open Animenosekai opened 1 year ago

Animenosekai commented 1 year ago

version: 3.0 status: ALPHA

Next

Provides informations about the next coming version

Design Banner

This version provides general improvements over the whole project, bringing exciting new features.

New

Fixes

Updates

Everything is detailed in the README.md file

A comparison from the previous release can be found here v2.3...v3.0

A comparison from the current branch can be found here v3.0...main

[^1]: We might use Textual for an interactive TUI. We should also default to the interactive TUI when running translatepy without any action specified.

[^2]: An actual public website was planned but due to the end of Heroku's free service and a lack of resource for now, we are going to stick with the local website (I think?). However the idea is not abandonned and a way of ranking the different translators based on real results is expected in the future.

[^3]: For single word translations ?

[^4]: This provides a way of choosing the translators to use from the CLI (#53) But this also allows choosing the translator from the web server and thus the website.

[^5]: Refer to https://github.com/Animenosekai/translate/discussions/62

[^6]: Following #58

[^7]: Following https://github.com/Animenosekai/translate/issues/28#issuecomment-918746811

[^8]: Following #54

[^9]: Following #28

[^10]: The branch needs to be changed to fit the main branch (local website) and to have a CLI access

[^11]: Following #66

[^12]: Following #65

[^13]: Following https://github.com/Animenosekai/translate/issues/78#issuecomment-1443529618

Note
Ideas with a 🧃 mark in front still need some consideration and might not be in the final product.

🍡 Animenosekai

ZhymabekRoman commented 1 year ago

Wow, judging by the list, there's a lot of work to be done :smiley:

ZhymabekRoman commented 1 year ago

New Translate Services:

New languages:

Other changes:

Animenosekai commented 1 year ago

New Translate Services:

  • [ ] ABBYY Lingvo

New languages:

Other changes:

  • [ ] Mypy static type hint support

Added to the list !

Animenosekai commented 1 year ago

@ZhymabekRoman

Here is what is currently happening on the new-models branch !

Brand new models have been implemented !

They now all include the raw attribute (which is optional)

Screenshot 0005-03-02 at 18 32 07 Screenshot 0005-03-02 at 18 30 47

Most of them support rich string representation, which can be generated through the __pretty__ method on the Result model :

Screenshot 0005-03-02 at 18 33 35

By passing in the cli=True parameter, you can even get colors !

Screenshot 0005-03-02 at 18 33 52

The brand new BaseTranslator

New dictionary, example methods and alternative methods have been added !

It natively handles bulk translations, transliterations, ... on everything ! Through the use of typing.overload, the type checkers automatically know if the return value should be an iterable (if a bulk action) or if it should be a normal result model.

Moreover, the Result model actually implements __iter__ to avoid mistakes when looping over Translator.translate() even if a single translation is done.

The iterable returned by bulk actions is a custom LazyIterable which actually loads things if needed and stores them.

https://user-images.githubusercontent.com/40539549/222507458-37b2d2f4-75c8-4745-81f7-24fb363e065e.mp4

My bad the method is not transliteration but transliterate... (maybe could alias it ?)

Now I need to modify the actual translators implementations and re-implement Translate (aggregate translators) using BaseTranslator

Animenosekai commented 1 year ago

Updated all of the translators 🍡

Screenshot 0005-03-03 at 00 24 47
Animenosekai commented 1 year ago

And the Translate class is working !

Now, it inherits from BaseTranslator and its code is much simpler 🧃

Screenshot 0005-03-03 at 01 11 48
ZhymabekRoman commented 1 year ago

Wow! @Animenosekai, Great job ✨

ZhymabekRoman commented 1 year ago

TODO: add logger (like loguru)

ZhymabekRoman commented 1 year ago

TODO: Integrate fake-useragent

ZhymabekRoman commented 1 year ago

TODO: avoid def __init__(self, request: Request = Request()):. See more: https://youtu.be/Cj6O9FUjiAA

Flask warning:

[flake8] [W] Do not perform function calls in argument defaults. The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-ti
me function call. If this is intended, assign the function call to a module-level variable and use that variable as a default value.
Animenosekai commented 1 year ago

TODO: avoid def __init__(self, request: Request = Request()):. See more: https://youtu.be/Cj6O9FUjiAA

Flask warning:

[flake8] [W] Do not perform function calls in argument defaults. The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-ti
me function call. If this is intended, assign the function call to a module-level variable and use that variable as a default value.

This is fixed in the new-models branch

https://github.com/Animenosekai/translate/blob/c6cce0fcfabf14e4ce19a2b80af1f6d05337b3bd/translatepy/translate.py#L28

Animenosekai commented 1 year ago

TODO: add logger (like loguru)

The server is going to use nasse, which already has a custom logger which we could use.

See also: Nasse — Logging

ZhymabekRoman commented 1 year ago

TODO: add logger (like loguru)

The server is going to use nasse, which already has a custom logger which we could use.

See also: Nasse — Logging

Great job! :rocket:

ZhymabekRoman commented 1 year ago

TODO: Telegram bot :grinning:

Animenosekai commented 1 year ago

TODO: Telegram bot 😀

Hmmmm I'm not sure if this should be done by this repo or in another repo

Animenosekai commented 1 year ago

Btw @ZhymabekRoman if you look at 5817dd6 I reorganized the CLI a bit (needs a bit more work) and I created a TUI using Textual

Screenshot 0005-08-23 at 02 21 16 Screenshot 0005-08-23 at 02 21 34 Screenshot 0005-08-23 at 02 21 50 Screenshot 0005-08-23 at 02 22 11 Screenshot 0005-08-23 at 02 23 07
ZhymabekRoman commented 1 year ago

TODO: Telegram bot 😀

Hmmmm I'm not sure if this should be done by this repo or in another repo

Yeah, maybe in separated repo

ZhymabekRoman commented 1 year ago

Btw @ZhymabekRoman if you look at 5817dd6 I reorganized the CLI a bit (needs a bit more work) and I created a TUI using Textual

Wow! :hushed: Great job @Animenosekai ! I like this!

Animenosekai commented 1 year ago

Reimplemented HTML translation

Animenosekai commented 1 year ago

The website works again!

Screenshot 0005-08-26 at 19 45 05
Animenosekai commented 1 year ago

Added the Papago translator from Naver

Screenshot 0005-08-28 at 20 06 23
ZhymabekRoman commented 1 year ago
ZhymabekRoman commented 1 year ago
ZhymabekRoman commented 7 months ago