Artikash / Textractor

Extracts text from video games and visual novels. Highly extensible.
GNU General Public License v3.0
2k stars 201 forks source link

ChatGPT extension support #1004

Open RPing opened 1 year ago

RPing commented 1 year ago

ChatGPT API released: https://openai.com/blog/introducing-chatgpt-and-whisper-apis The translation request payload would be like

translate the following sentence in Chinese: "..."
ripdog commented 1 year ago

This would be fantastic. ChatGPT translation output is surprisingly awesome - both accurate and natural English output. It is also much less likely to freak out when given unusual input Japanese like DeepL, and doesn't randomly cut off outputs (except very long ones) like Google Translate.

medovy commented 1 year ago

Aren't deepl and other translators themselves neural networks, like chatgpt?

ripdog commented 1 year ago

Aren't deepl and other translators themselves neural networks, like chatgpt?

Yes, though they're much simpler and single-purpose, whereas GPTs are designed to be general text generators. They can do a wide variety of things and have a much greater 'understanding' of text than previous neural networks. This particularily manifests with ChatGPT translations in that they are almost always sane english - it virtually never generates gibberish unless the input is particularily awful.


So, I've actually made this. I'm an absolute beginner to C++ and it's, uh, 'ecosystem', so it was tough. Building it in particular was a nightmare, and I'm not super confident that I could repeat the endeavour. But hey, following the example of the existing API translators, I've got something which works. Yay!

I've only given it the most basic testing, but it seems to work so far. The worst issue seems to be that the model will sometimes preface the translation with "Output: " or "Translation: ", hardly a dealbreaker.

You'll need an API key to use it, click the link in the extension settings to get that. The API does cost money, but not very much. You'll get $18 in free usage, which will probably last you longer than you expect.

ChatGPT.zip

The source is here: https://github.com/ripdog/Textractor/commit/9b7e386ded09b2b4acb02e969b5e36e5380736ae

I'll consider doing a PR if Artikash ever comes back, but I'd imagine he could slap this together in 5 minutes.

ripdog commented 1 year ago

What would be nice is if it was possible to allow the user to add to the prompt, which could allow the user to direct the style of translation, or to give a translation dictionary to allow names to be consistently correctly translated - something that even ChatGPT struggles with.

Of course, japanese names are often hard for even native speakers to read from text, but they at least have the benefit of remembering the reading after learning it once.

firsteyev commented 1 year ago

could you add a switch key, for example, the F5 key, to switch if the GPT translate is on? I can read simple Japanese, so I don't need GPT to translate every sentence, so I want to use a hotkey to determine whether translate it.

ripdog commented 1 year ago

could you add a switch key, for example, the F5 key, to switch if the GPT translate is on? I can read simple Japanese, so I don't need GPT to translate every sentence, so I want to use a hotkey to determine whether translate it.

That really sounds like a function that should be added to the base of Textractor, or maybe a seperate plugin. I'm afraid that I'm both a complete beginner to C++ (and it's a tough language to learn) and uninterested in taking over Textractor development, so I'm afraid not.

I'd advise opening a new issue to request that feature, as it's off-topic here.

akippnn commented 1 year ago

Would be nice to see Textractor getting active again.

In any case, I was thinking more along the lines of extracting multiple lines. GPT does a lot better when you give it more context for it to generate text accurately. Just asking it to translate something wouldn't give it justice.

Yes, it does use more tokens for more input, so anyone should be able to finetune the prompts and the request body.

And then finally, saving the text. Partial message deltas would also be nice.

I'll do what I can when I'm free.

ripdog commented 1 year ago

That would be great. I had the same ideas around providing chatgpt a rolling buffer of previous messages, however that idea is incompatible with the abstractions which Textractor provides for Google, Bing, DeepL API translators, etc. The abstraction is really nice and provided things like that control panel for free, rate limiting, only translating the active hook, etc. So to provide a history to chatgpt, you'd have to modify that, and that was simply beyond my C++ skills.

Being able to customize the prompt would also be super useful. A good use for that would be providing a list of name translations, allowing chatgpt to know how to translate unusual names. Perhaps the extension could provide specific UI for this by surfacing a list of text input pairs, and save the name->translation list per-game.

Even better would be the ability to retry individual lines when chatgpt provides silly output or decides to dump the romaji above the translation for some reason. Sadly this would require a rewritten output pane, one which provided a widget-per-translation. This could also allow fun things like multiple translation APIs working side-by-side... I'm just dreaming now.

I'm looking forward to a more advanced extension - chatgpt can already provide some freakishly good translations, and will swiftly become a god-tier MTL solution with these improvements.

On Sat, Apr 8, 2023 at 6:52 PM Aki @.***> wrote:

Would be nice to see Textractor getting active again.

In any case, I was thinking more along the lines of extracting multiple lines. GPT does a lot better when you give it more context for it to generate text accurately. Just asking it to translate something wouldn't give it justice.

Yes, it does use more tokens for more input, so anyone should be able to finetune the prompts and the request body.

And then finally, saving the text. Partial message deltas would also be nice.

I'll do what I can when I'm free.

— Reply to this email directly, view it on GitHub https://github.com/Artikash/Textractor/issues/1004#issuecomment-1500808859, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABKWYBDG7ANGRFJVOTRQVTXAEDLDANCNFSM6AAAAAAVOPXYKY . You are receiving this because you commented.Message ID: @.***>

Zolaf commented 8 months ago

Aren't deepl and other translators themselves neural networks, like chatgpt?

Yes, though they're much simpler and single-purpose, whereas GPTs are designed to be general text generators. They can do a wide variety of things and have a much greater 'understanding' of text than previous neural networks. This particularily manifests with ChatGPT translations in that they are almost always sane english - it virtually never generates gibberish unless the input is particularily awful.

So, I've actually made this. I'm an absolute beginner to C++ and it's, uh, 'ecosystem', so it was tough. Building it in particular was a nightmare, and I'm not super confident that I could repeat the endeavour. But hey, following the example of the existing API translators, I've got something which works. Yay!

I've only given it the most basic testing, but it seems to work so far. The worst issue seems to be that the model will sometimes preface the translation with "Output: " or "Translation: ", hardly a dealbreaker.

You'll need an API key to use it, click the link in the extension settings to get that. The API does cost money, but not very much. You'll get $18 in free usage, which will probably last you longer than you expect.

ChatGPT.zip

The source is here: ripdog@9b7e386

I'll consider doing a PR if Artikash ever comes back, but I'd imagine he could slap this together in 5 minutes.

Hey, thanks for making this! But in your zip file, you put in the deepL extension instead of chatgpt for x86. Do you have the chatgpt extension for x86? Thanks!

ripdog commented 8 months ago

Aren't deepl and other translators themselves neural networks, like chatgpt?

Yes, though they're much simpler and single-purpose, whereas GPTs are designed to be general text generators. They can do a wide variety of things and have a much greater 'understanding' of text than previous neural networks. This particularily manifests with ChatGPT translations in that they are almost always sane english - it virtually never generates gibberish unless the input is particularily awful. So, I've actually made this. I'm an absolute beginner to C++ and it's, uh, 'ecosystem', so it was tough. Building it in particular was a nightmare, and I'm not super confident that I could repeat the endeavour. But hey, following the example of the existing API translators, I've got something which works. Yay! I've only given it the most basic testing, but it seems to work so far. The worst issue seems to be that the model will sometimes preface the translation with "Output: " or "Translation: ", hardly a dealbreaker. You'll need an API key to use it, click the link in the extension settings to get that. The API does cost money, but not very much. You'll get $18 in free usage, which will probably last you longer than you expect. ChatGPT.zip The source is here: ripdog@9b7e386 I'll consider doing a PR if Artikash ever comes back, but I'd imagine he could slap this together in 5 minutes.

Hey, thanks for making this! But in your zip file, you put in the deepL extension instead of chatgpt for x86. Do you have the chatgpt extension for x86? Thanks!

Give this one a go: ChatGPT Translate.zip

I seem to see an x64 version in the initial zip, does it not work?

Zolaf commented 8 months ago

Hey, thanks for making this! But in your zip file, you put in the deepL extension instead of chatgpt for x86. Do you have the chatgpt extension for x86? Thanks!

Give this one a go: ChatGPT Translate.zip

I seem to see an x64 version in the initial zip, does it not work?

Thanks for the reply. The x64 version of your extension gives me an error saying it's an invalid extension when I try to use it with the x86 version of Textractor. The file you posted just now opens up a DeepL extension interface, despite being named ChatGPT Translate. I even tried using my ChatGPT API with it anyway, but it only works with a DeepL API, so it appears to actually be the DeepL extension. Does it work for you with the x86 Textractor?

I would really like to get it working, as most stuff I play are x86 instead of x64.

ripdog commented 8 months ago

Oh dear, sorry to hear about that. I only ever use the x86 version, as japanese games are almost never compiled in 64 bit mode (as there is no point for VNs). I've already torn down the build environment (visual studio loves taking up tens of gigabytes on the system drive, and I don't use it) so I can't easily rebuild it.

If you clone my fork and follow the compilation instructions, you can build your own copy.

Zolaf commented 8 months ago

Thanks! No time to learn like the present

Rickaton commented 8 months ago

Oh dear, sorry to hear about that. I only ever use the x86 version, as japanese games are almost never compiled in 64 bit mode (as there is no point for VNs). I've already torn down the build environment (visual studio loves taking up tens of gigabytes on the system drive, and I don't use it) so I can't easily rebuild it.

If you clone my fork and follow the compilation instructions, you can build your own copy.

I was hoping to finally be able to use the chatgpt api with textractor x86 but sadly it only works with the x64 version. And textractor x64 doesnt work with most japanese VNs. I hope we will also get a workable x86 version soon.

ripdog commented 8 months ago

Oh dear, sorry to hear about that. I only ever use the x86 version, as japanese games are almost never compiled in 64 bit mode (as there is no point for VNs). I've already torn down the build environment (visual studio loves taking up tens of gigabytes on the system drive, and I don't use it) so I can't easily rebuild it. If you clone my fork and follow the compilation instructions, you can build your own copy.

I was hoping to finally be able to use the chatgpt api with textractor x86 but sadly it only works with the x64 version. And textractor x64 doesnt work with most japanese VNs. I hope we will also get a workable x86 version soon.

The x86 version is the one which works.

Rickaton commented 8 months ago

Oh dear, sorry to hear about that. I only ever use the x86 version, as japanese games are almost never compiled in 64 bit mode (as there is no point for VNs). I've already torn down the build environment (visual studio loves taking up tens of gigabytes on the system drive, and I don't use it) so I can't easily rebuild it. If you clone my fork and follow the compilation instructions, you can build your own copy.

I was hoping to finally be able to use the chatgpt api with textractor x86 but sadly it only works with the x64 version. And textractor x64 doesnt work with most japanese VNs. I hope we will also get a workable x86 version soon.

The x86 version is the one which works.

But when I download the zip and put the ChatGPT Translate.x dll in the x86 folder and try to add the extension it says that its an invalid extension. I tried it with the x64 version and there the extension works. So the ChatGPT Translate.x dll from your zip only works with textractor x64 for me.

ripdog commented 8 months ago

Oh dear, sorry to hear about that. I only ever use the x86 version, as japanese games are almost never compiled in 64 bit mode (as there is no point for VNs). I've already torn down the build environment (visual studio loves taking up tens of gigabytes on the system drive, and I don't use it) so I can't easily rebuild it. If you clone my fork and follow the compilation instructions, you can build your own copy.

I was hoping to finally be able to use the chatgpt api with textractor x86 but sadly it only works with the x64 version. And textractor x64 doesnt work with most japanese VNs. I hope we will also get a workable x86 version soon.

The x86 version is the one which works.

But when I download the zip and put the ChatGPT Translate.x dll in the x86 folder and try to add the extension it says that its an invalid extension. I tried it with the x64 version and there the extension works. So the ChatGPT Translate.x dll from your zip only works with textractor x64 for me.

??? Are you using the original one? From the 'x86' folder? Look up the thread a little.

Zolaf commented 8 months ago

Hey Ripdog, just wanted to confirm what Rickaton is saying. That's what I was trying to say earlier. I think I got the files mixed up a bit earlier. The x86 version of your extension never worked for me with the x86 Textractor either. Only the x64 version of your extension works with the x64 version of Textractor.

The file you posted in the second zip appears to be the x64 extension again, but we both actually want the x86 extension. The x64 works fine. The original zip file you posted has a DeepL extension in the x86 folder. And the second zip file you posted appears to be the x64 ChatGPT extension.

If you still have the x86 Chatgpt extension version we would both love that. If not, I'll have to learn how to compile that stuff like you said.

Thanks!

ripdog commented 8 months ago

Sorry about that, give this one a try. I use it myself on x86. ChatGPT Translate.zip

Zolaf commented 8 months ago

Awesome, it works! Thanks a bunch! I'm looking forward to GPT quality translations

Rickaton commented 8 months ago

Yeah it works great. Thanks from me too!

kaminodominator commented 5 months ago

Hey, I'm new to Chat GPT. I'm not sure how this extension works, will it use GPT 3.5, GPT 4, GPT 4 Turbo, or just whatever you choose in your GPT account? Also, it seems that you pay tokens both for output and input.

That would be great. I had the same ideas around providing chatgpt a rolling buffer of previous messages, however that idea is incompatible with the abstractions which Textractor provides for Google, Bing, DeepL API translators, etc. The abstraction is really nice and provided things like that control panel for free, rate limiting, only translating the active hook, etc. So to provide a history to chatgpt, you'd have to modify that, and that was simply beyond my C++ skills. Being able to customize the prompt would also be super useful. A good use for that would be providing a list of name translations, allowing chatgpt to know how to translate unusual names. Perhaps the extension could provide specific UI for this by surfacing a list of text input pairs, and save the name->translation list per-game. Even better would be the ability to retry individual lines when chatgpt provides silly output or decides to dump the romaji above the translation for some reason. Sadly this would require a rewritten output pane, one which provided a widget-per-translation. This could also allow fun things like multiple translation APIs working side-by-side... I'm just dreaming now. I'm looking forward to a more advanced extension - chatgpt can already provide some freakishly good translations, and will swiftly become a god-tier MTL solution with these improvements.

Some people already use GPT to translate entire games and it seems to only cost around 100-200$ per game. Dazedanon on f95 mostly uses this superpower for NTR hentai games, lol. The end result is more readable than any other MTL by far (when he uses GPT 4, 3.5 isn't nearly as good), close to the level of an actual fan translation if there's no serious mistake with the input and prompt (like making sure that all sexes correspond to the right names). It's shocking that it's still so niche and that many Japanese developers still use basic Google Translate or something for their games, which results in trash tier "translations". Even for actual professional translators, this tool should make everything a many times faster.

ripdog commented 5 months ago

The extension uses hard-coded GPT3.5, sadly. I'm braindead with C++ so I'm kinda out of my depth with making it at all configurable. If someone who is at least competent with C++ could add configurability for the prompt and model, that would make the extension 100x better. :)

On Sat, Jan 20, 2024 at 12:54 AM kaminodominator @.***> wrote:

Hey, I'm new to Chat GPT. I'm not sure how this extension works, will it use GPT 3.5, GPT 4, GPT 4 Turbo, or just whatever you choose in your GPT account? Also, it seems that you pay tokens both for output and input.

That would be great. I had the same ideas around providing chatgpt a rolling buffer of previous messages, however that idea is incompatible with the abstractions which Textractor provides for Google, Bing, DeepL API translators, etc. The abstraction is really nice and provided things like that control panel for free, rate limiting, only translating the active hook, etc. So to provide a history to chatgpt, you'd have to modify that, and that was simply beyond my C++ skills. Being able to customize the prompt would also be super useful. A good use for that would be providing a list of name translations, allowing chatgpt to know how to translate unusual names. Perhaps the extension could provide specific UI for this by surfacing a list of text input pairs, and save the name->translation list per-game. Even better would be the ability to retry individual lines when chatgpt provides silly output or decides to dump the romaji above the translation for some reason. Sadly this would require a rewritten output pane, one which provided a widget-per-translation. This could also allow fun things like multiple translation APIs working side-by-side... I'm just dreaming now. I'm looking forward to a more advanced extension - chatgpt can already provide some freakishly good translations, and will swiftly become a god-tier MTL solution with these improvements.

Some people already use GPT to translate entire games and it seems to only cost around 100-200$ per game. Dazedanon on f95 mostly uses this superpower for NTR hentai games, lol. The end result is more readable than any other MTL by far (when he uses GPT 4, 3.5 isn't nearly as good), close to the level of an actual fan translation if there's no serious mistake with the input and prompt (like making sure that all sexes correspond to the right names). It's shocking that it's still so niche and that many Japanese developers still use basic Google Translate or something for their games, which results in trash tier "translations". Even for actual professional translators, this tool should make everything a many times faster.

— Reply to this email directly, view it on GitHub https://github.com/Artikash/Textractor/issues/1004#issuecomment-1900276683, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABKWYFCRY4UII2YAML33PTYPJNFVAVCNFSM6AAAAAAVOPXYK2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBQGI3TMNRYGM . You are receiving this because you commented.Message ID: @.***>

kaminodominator commented 5 months ago

The extension uses hard-coded GPT3.5, sadly. I'm braindead with C++ so I'm kinda out of my depth with making it at all configurable. If someone who is at least competent with C++ could add configurability for the prompt and model, that would make the extension 100x better. :)

If it isn't possible to make it configurable, wouldn't it be easy to just copy the same extension but with hard-coded GPT 4, or 4 Turbo? Just like there are separate extensions for Deepl, Translate, etc. I don't know how hard it would be for you to do, but if it's just copy-pasting everything and changing a few lines, then why not? Gpt3.5. is much cheaper, but there're probably people who'd rather pay more for a better TL.

Also, I'll see if it's possible to find some random C++ guru from India on Fiverr and make him do all the hard work for 10$. xD

ripdog commented 5 months ago

It's trivial, but I'm not setting up that MS build environment again 🙃 pain.

On Sat, Jan 20, 2024 at 1:10 AM kaminodominator @.***> wrote:

The extension uses hard-coded GPT3.5, sadly. I'm braindead with C++ so I'm kinda out of my depth with making it at all configurable. If someone who is at least competent with C++ could add configurability for the prompt and model, that would make the extension 100x better. :)

If it isn't possible to make it configurable, wouldn't it be easy to just copy the same extension but with hard-coded GPT 4, or 4 Turbo? Just like there are separate extensions for Deepl, Translate, etc. I don't know how hard it would be for you to do, but if it's just copy-pasting everything and changing a few lines, then why not? Gpt3.5. is much cheaper, but there're probably people who'd rather pay more for a better TL.

Also, I'll see if it's possible to find some random C++ guru from India on Fiverr and make him do all the hard work for 10$. xD

— Reply to this email directly, view it on GitHub https://github.com/Artikash/Textractor/issues/1004#issuecomment-1900303823, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABKWYEDQKOZAG3E24MZHLTYPJPD3AVCNFSM6AAAAAAVOPXYK2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBQGMYDGOBSGM . You are receiving this because you commented.Message ID: @.***>

kaminodominator commented 5 months ago

I guess we'll wait for someone very enthusiastic then, lol. Or until I bother to find that awesome person on Fiverr. Which should probably happen before I play MGQ Paradox Part 3 or some other big game.

voidpenguin-28 commented 4 months ago

For those looking for a more configurable GPT translation extension, I have created one.

Its config is fully configured via the Textractor.ini file (there is no GUI for this extension). Further info is available in the extension docs in the repo.

The extension is highly configurable, allowing you to control features such as:

  1. GPT model leveraged.
  2. Adjustable GPT prompts to fine-tune GPT's behavior.
  3. Leveraging past message history to provide additional context for translating lines.
  4. Filtering which text hooks/threads to run translations for.
  5. Configurable timeout & retry logic for API network requests.
  6. Logging GPT API requests for tracing/debugging purposes.

Can be downloaded here: https://github.com/voidpenguin-28/Textractor-ExtraExtensions/releases

Since the zip file contains an '.xdll' file, Chrome may end up complaining about a suspicious download. But it is a false positive. You can always compile the extension yourself from the source code if there's any worries there.

Full documentation and source code are here: https://github.com/voidpenguin-28/Textractor-ExtraExtensions/tree/main/Textractor.GptApiTranslate

If you run into any issues, I would recommended reporting them in the "Issues" for my extensions repo: https://github.com/voidpenguin-28/Textractor-ExtraExtensions/issues

WinterfuryZX commented 4 months ago

Testing this right now.

A couple if problems:

voidpenguin-28 commented 4 months ago

Thanks for testing this out.

Regarding point 1, would you be able to enable debug mode and provide some examples from the log (gpt-request-log.txt) of this scenario? This would help me narrow down the issue, since I have not faced this issue myself.

Regarding point 2, unfortunately there's probably not much I can do here, as this is likely more of a GPT issue. Some models of GPT are notorious for their inconsistency. From my experience, GPT-4 has generally been better at consistently following prompts than GPT-4-Turbo (but unfortunately it costs quite a bit more money). Beyond this, adjusting your wording of the prompt may potentially improve things.

WinterfuryZX commented 4 months ago

gpt-request-log.txt As you can see, the 2nd time I tried it worked correctly.

Zolaf commented 4 months ago

This looks incredibly thorough, Voidpenguin! Thanks for making it/sharing. I'm excited to try it out when I get the time!

WinterfuryZX commented 4 months ago

gpt-request-log.txt In this game sometimes the plugin translates and prompts all the lines, not only the last.

Ah, now I noticed that there are hidden line feeds (\n) not showing up on textractor, I'll try to filter them. (edit.)

voidpenguin-28 commented 4 months ago

Great, thanks for the useful data.

I see you are using the 3.5 model, which is why there is some loss of accuracy/consistency compared to the 4.0 models. Most of my testing during development was with the 4.0 models, which generally does a better job sticking to prompts.


I have made some minor updates to the extension (v1.0.1) which slightly improves formatting/parsing of translated lines (especially for split-up dialogue lines). https://github.com/voidpenguin-28/Textractor-ExtraExtensions/releases

However, it seems like GPT has a natural tendency to merge a split up dialogue line after being translated. I tried testing with some prompts to try to prevent that, but it would rarely listen unfortunately.

This means that in many cases GPT will return a full dialogue line, even if the current line is only part of a dialogue line.


As for trying to get GPT to more reliably map names and genders, try using more specific language in your prompt. In other words, try changing the "For context:" text to something like "Always map these JP names to the following romaji and genders:".

Or if your goal is just simply to ensure that names are translated correctly, here is another potential option. I created another Textractor extension called VndbCharNameMapper. https://github.com/voidpenguin-28/Textractor-ExtraExtensions/tree/main/Textractor.VndbCharNameMapper

This extension allows you to simply provide a vnid for a visual novel in vndb.org and the extension will automatically handle translating/mapping the characters' names from vndb's character database.

This extension can also be downloaded in the Releases of the same repo as the gpt extension: https://github.com/voidpenguin-28/Textractor-ExtraExtensions/releases

WinterfuryZX commented 4 months ago

Yes I'm using 3.5 because the API's cost is almost 10 times cheaper compared to 4.

WinterfuryZX commented 4 months ago

Or if your goal is just simply to ensure that names are translated correctly, here is another potential option. I created another Textractor extension called VndbCharNameMapper. https://github.com/voidpenguin-28/Textractor-ExtraExtensions/tree/main/Textractor.VndbCharNameMapper

This extension allows you to simply provide a vnid for a visual novel in vndb.org and the extension will automatically handle translating/mapping the characters' names from vndb's character database.

This extension can also be downloaded in the Releases of the same repo as the gpt extension: https://github.com/voidpenguin-28/Textractor-ExtraExtensions/releases

Very cool, I wonder if I can manually add country names into the generated .ini file.

voidpenguin-28 commented 4 months ago

Very cool, I wonder if I can manually add country names into the generated .ini file.

I believe that should work. Interesting idea.

WinterfuryZX commented 4 months ago

eldia works fine.

ripdog commented 4 months ago

Oh man, these extensions are awesome. Thanks so much for making them, voidpenguin. I can confirm they both work great. I pray that one day Artikash comes back to pull them into the main repo 😭

voidpenguin-28 commented 4 months ago

Thank you. I appreciate all the positive feedback.

WinterfuryZX commented 4 months ago

Thank you. I appreciate all the positive feedback.

Can you add an option to enable the clipboard hook? It's already doable with a workaround (injecting textractor on a dummy executable and thread linking the clipboard hook thread with a random thread) but it's quite annoying to setup. It's useful to translate text extracted with other tools like Agent.

voidpenguin-28 commented 4 months ago

That's straightforward enough. All set, I've updated all extensions to add a 'SkipConsoleAndClipboard' config key, which adjusts which of those threads you would like to include/exclude.

SkipConsoleAndClipboard: Allows you to exclude the Console and/or Clipboard threads
    - Default value: '1' (skip Console and Clipboard threads)
    - Possible values:
        - 0: Do not skip Console nor Clipboard threads
        - 1: Skip both the Console and Clipboard threads
        - 2: Skip the Console thread (but not the Clipboard thread)
        - 3: Skip the Clipboard thread (but not the Console thread)
    - This setting applies regardless of the value of the *ActiveThreadOnly* config key.

It is v1.1.0 for all extensions: https://github.com/voidpenguin-28/Textractor-ExtraExtensions/releases

medovy commented 4 months ago

The internet is full of free sites with gpt3.5 level neural networks that translate well and fast, much better than google translator and the like.

Is there any way to connect such neural networks to textractor?

WinterfuryZX commented 3 months ago

That's straightforward enough. All set, I've updated all extensions to add a 'SkipConsoleAndClipboard' config key, which adjusts which of those threads you would like to include/exclude.

SkipConsoleAndClipboard: Allows you to exclude the Console and/or Clipboard threads
  - Default value: '1' (skip Console and Clipboard threads)
  - Possible values:
      - 0: Do not skip Console nor Clipboard threads
      - 1: Skip both the Console and Clipboard threads
      - 2: Skip the Console thread (but not the Clipboard thread)
      - 3: Skip the Clipboard thread (but not the Console thread)
  - This setting applies regardless of the value of the *ActiveThreadOnly* config key.

It is v1.1.0 for all extensions: https://github.com/voidpenguin-28/Textractor-ExtraExtensions/releases

I wonder if possible to catch this error and retry: It randomly appears while using 3.5.

[2024-03-08 01:14:52] [ERROR] {"model":"gpt-3.5-turbo","messages":[{"role":"system","content":"Translate novel script to natural fluent EN. Preserve numbering. Use all JP input lines as context (previous lines). However, only return the translation for the line that starts with '99:'. Words written in romaji followed by (F) are female characters, followed by (M) are male characters, followed by (C) are countries."},{"role":"user","content":"\n96: ダーン! ダーン!\n97: ‥‥ほら、さっさと走れよ。撃ってくるぞ。\n98: ちょっと、押さないでよ。何で私の後ろからついてくるのっ。\n99: お前の尻を見ながら走りたいんでね。"}]} { "error": { "message": "The server had an error processing your request. Sorry about that! You can retry your request, or contact us through our help center at help.openai.com if you keep seeing this error. (Please include the request ID req_22722c52ef8c24c8ebf5c7a5af9c7893 in your email.)", "type": "server_error", "param": null, "code": null } }

voidpenguin-28 commented 3 months ago

I wonder if possible to catch this error and retry: It randomly appears while using 3.5.

[2024-03-08 01:14:52] [ERROR] {"model":"gpt-3.5-turbo","messages":[{"role":"system","content":"Translate novel script to natural fluent EN. Preserve numbering. Use all JP input lines as context (previous lines). However, only return the translation for the line that starts with '99:'. Words written in romaji followed by (F) are female characters, followed by (M) are male characters, followed by (C) are countries."},{"role":"user","content":"\n96: ダーン! ダーン!\n97: ‥‥ほら、さっさと走れよ。撃ってくるぞ。\n98: ちょっと、押さないでよ。何で私の後ろからついてくるのっ。\n99: お前の尻を見ながら走りたいんでね。"}]} { "error": { "message": "The server had an error processing your request. Sorry about that! You can retry your request, or contact us through our help center at help.openai.com if you keep seeing this error. (Please include the request ID req_22722c52ef8c24c8ebf5c7a5af9c7893 in your email.)", "type": "server_error", "param": null, "code": null } }

No problem, that's an easy fix. I have now integrated this into the extension's request retry logic.

It is v1.1.1 of the extension: https://github.com/voidpenguin-28/Textractor-ExtraExtensions/releases

WinterfuryZX commented 3 months ago

The internet is full of free sites with gpt3.5 level neural networks that translate well and fast, much better than google translator and the like.

Is there any way to connect such neural networks to textractor?

Gpt3.5 api is fairly cheap, use that, around 0.05 to 0.10 usd per hour. (4 is 10x more expensive, maybe more than 10x)

The price difference is absurd, I used 3.5 way more than 4(only did some testing in Italian): image

WinterfuryZX commented 3 months ago

anyway I'm testing this command to correct pinpoint genders of the characters without wasting tokens and and it seems to be working fine for now. "Words written in romaji followed by (F) are female characters, followed by (M) are male characters, followed by (C) are countries."

And the mapper ini edited this way: [v147-Single] ストールマン=Stoleman (M) 孔=Kou (M) 茜=Akane (F) 二階堂=Nikaidou (M) 松乃=Matsuno (F) 三郎=Saburou (M)

etc.

edit: I'm an idiot 2 identical regex filters are actually fine. image

You have to check the pluging correctly parse it as such: \n99: ぷ、Prin (F)‥‥でかしたっ!

kaminodominator commented 1 month ago

There's a new GPT 4o model that's cheaper, faster and better at the same time. Basically, it can be called GPT 4.5.

SVS002 commented 3 weeks ago

Great, thanks for the useful data.

I see you are using the 3.5 model, which is why there is some loss of accuracy/consistency compared to the 4.0 models. Most of my testing during development was with the 4.0 models, which generally does a better job sticking to prompts.

I have made some minor updates to the extension (v1.0.1) which slightly improves formatting/parsing of translated lines (especially for split-up dialogue lines). https://github.com/voidpenguin-28/Textractor-ExtraExtensions/releases

However, it seems like GPT has a natural tendency to merge a split up dialogue line after being translated. I tried testing with some prompts to try to prevent that, but it would rarely listen unfortunately.

This means that in many cases GPT will return a full dialogue line, even if the current line is only part of a dialogue line.

As for trying to get GPT to more reliably map names and genders, try using more specific language in your prompt. In other words, try changing the "For context:" text to something like "Always map these JP names to the following romaji and genders:".

Or if your goal is just simply to ensure that names are translated correctly, here is another potential option. I created another Textractor extension called VndbCharNameMapper. https://github.com/voidpenguin-28/Textractor-ExtraExtensions/tree/main/Textractor.VndbCharNameMapper

This extension allows you to simply provide a vnid for a visual novel in vndb.org and the extension will automatically handle translating/mapping the characters' names from vndb's character database.

This extension can also be downloaded in the Releases of the same repo as the gpt extension: https://github.com/voidpenguin-28/Textractor-ExtraExtensions/releases

i also have some request, why don't create a new file vndb cache name in path include game, if do that, text will avoid confusing a few same character name in some game.

voidpenguin-28 commented 3 weeks ago

i also have some request, why don't create a new file vndb cache name in path include game, if do that, text will avoid confusing a few same character name in some game.

Would you be able to elaborate/clarify this? I might not quite be understanding the request correctly.

Although there is a single cache file, the file maintains mappings for each vnid separately, so cached names will only be used for the vnids you specifically specify in the 'VnIds' config value. In other words, there shouldn't be any names from other visual novels mapping for the currently open visual novel.

SVS002 commented 3 weeks ago

i also have some request, why don't create a new file vndb cache name in path include game, if do that, text will avoid confusing a few same character name in some game.

Would you be able to elaborate/clarify this? I might not quite be understanding the request correctly.

Although there is a single cache file, the file maintains mappings for each vnid separately, so cached names will only be used for the vnids you specifically specify in the 'VnIds' config value. In other words, there shouldn't be any names from other visual novels mapping for the currently open visual novel.

So the extension will know game we are play is what id vndb we have in config value? I thought with so much visual novel,will the extension will mapping wrong name(becuase the kanji name of them is same) of another visual novel?