Start a new topic

Query DeepL API via Python

Now it's possible to get DeepL's translation directly in CafeTran's target editor, without any screen flickering etc.


Note that the used API is temporarily!


See: https://forum.keyboardmaestro.com/t/translate-via-deepl/7910/2


Thank you very much, Tom!!!


And watch: https://youtu.be/S_AV4K0O2k0


Here is a screenshot of the above mentioned macro, adjusted to paste a warning in the Stickies note positionned above CT. It serves as a warning that the DeepL suggestion pasted in the Stickies note contains something that is in the blacklist.

image




1 person likes this
Great idea, nice implementation: dix points!
This is EF starring great! You just pointed the way to implement match repair to DeepL. That is: MT repair. Just add a find and replace command and you can let the macro replace incorrect words eg zeehonden with afdichtingen. You’ll need a two dimensional array for this. Let me ask JMichaelTX for a hint how to do this.
@You’ll need a two dimensional array for this
Good idea.
I even thought about implementing some tridimensional macro for that, but it didn't work, I have a super flat monitor. :D

1 person likes this
Hans, I think we don't even need a complex macro for this.
Just using a series of list "search and replace" things would do the trick (as you probably knew), and if we eventually want to edit some of them, the search function is available.
Here is an example. DeepL often gives me "rabougrissement" for stunting, and I change it for "retard de croissance" in the clipboard.
Even if my list of "search and replace" becomes very long, I can still edit them quite quickly with the search function:

image


The frame that contains the searched word is highlighted in KBM, so I can modify or remove it quickly.
I know that using a TAB delimited file would be great and more elegant, but even without it, it seems quite manageable if you don't have thousands of substitutions (I don't)...

1 person likes this

Nice solution, Alain, and simple indeed.


Nevertheless, I want to learn how to access such a two-dimensional array. So I hope that I can learn that tomorrow (today I have to go to the museum, expo about the eighties: https://museumkwartier.nl/event/de-jaren-80-noord-brabants-museum/?gclid=Cj0KCQjwgb3OBRDNARIsAOyZbxAb3jnAM9MYyr2e6UPmSkqd_8c9e1cFiWJJenKkcPRL2DrnA78_OcAaAqe0EALw_wcB).


I just realised that this technique can also be used for masking sensitive info before sending a segment to all-knowing DeepL.


I'd be interested to learn the speed, e.g. with 100 lines of replacements, or with 1000 (names of companies I work for, their street names and towns, postal codes etc.).

I just wonder if JMichaelTX will also smell a two-dimensional wet fart.


H.

Dear colleague, Mr. Hans van den Broek,


I'd be much obliged if you could refrain from further posting to this thread.


If you have nothing positive to contribute and just want to take me down or ventilate your dirty language here, please hush.


You're an adult person, so please behave as one!


Best,


HL

I see that JMichaelTX solved the problem one more time on the KBM forum. :-)
This gives us a very powerfull macro! Works perfectly here :-) 

1 person likes this

Hi Alain, could you please repost here the macro that you have tested? I seem to have downloaded a previous version, in my the regular expression part is missing :(. 



 Hi Hans,

Here it is... the only version I downloaded (this morning, Japan time).

Since a couple of days, DeepL started adding the translation of the German word 'nahe' to every sentence. It turned out that the culprit was a trailing whitespace. So I added two commands:


image


Please note that ALT+Up isn’t the default KBS for adjusting the end punk.
Login to post a comment