Comments (5)
I finaly figured out.
As programming is just an hobby.. I don't have the reflex to look at the GitHub code, but I just figured out I could give it a shoot and most of the information is actually right in there.
For those who wonder:
def translate_text_with_glossary( self, text: Union[str, Iterable[str]], glossary: GlossaryInfo, target_lang: Union[str, Language, None] = None, **kwargs, ) -> Union[TextResult, List[TextResult]]:
We basicaly need to provide the full glossary object, not just the Id and if you are already calling without glossary, you can just call the basic function "translate_text". translate_text_with_glossary is actually calling translate_text.
from deepl-python.
Hello,
Sorry I was too quick. The "translate_text_with_glossary" function is still givin an error, but if you provide the glossary_id with the basic function "translate_text" it will work.
from deepl-python.
Hi Samuel,
I'm glad you figured out a solution. I'll add some additional explanation:
GlossaryInfo
objects are returned by thecreate_glossary
,get_glossary
, andlist_glossaries
functions. They contain the glossary ID string, and some details, for example the source and target language codes of the glossary.- For
translate_text_with_glossary()
, theglossary
parameter is required, and must be aGlossaryInfo
object. - For
translate_text()
, theglossary
parameter is optional, and may be either a string (the glossary ID) or aGlossaryInfo
object (from which the glossary ID is taken). - While
translate_text
is general purpose,translate_text_with_glossary
is intended as a wrapper/helper function.
The error you had is expected if you call translate_text_with_glossary
with glossary
set to a string. I'm sorry for the confusion, we can add a check to translate_text_with_glossary
to catch this case in future.
Is your problem now resolved, or do you get another error?
from deepl-python.
Hello Daniel,
It did work using translate_text
directly.
But after I looked at the code of translate_text_with_glossary
, I tried to pass GlossaryInfo
object and it still failed.
Best regards,
Samuel
from deepl-python.
Hi Samuel,
Okay, there shouldn't be an error when passing a GlossaryInfo
to translate_text_with_glossary
. Can you share your code and/or the error you get? Is it the same error as in your opening comment?
Regards,
Daniel
from deepl-python.
Related Issues (20)
- [Bug] DeepL Write adds sentences describing chosen style
- DeepL documentation states ZH is supported as target for translate_docs but on execution it errors HOT 2
- translate_document_from_filepath fails to recognise XML files HOT 1
- Error: Bad request, message: Document is empty HOT 4
- [Feature Request] Make auto-retry toggleable HOT 3
- can't use my auth key, and can't sign up to the API plan for free trial HOT 4
- preserve_formatting missing in translate_document() function HOT 5
- translator.create_glossary() forces to remove regional variant HOT 3
- Translation with glossary and target "EN-GB" looses some words HOT 2
- Encoding problem when translating to french. HOT 2
- New feature : customize timeout duration HOT 2
- Glossaries HOT 1
- deepl.Formality.MORE results in untranslated text HOT 1
- Mismatch in the placement of ignore tags and lack of translation HOT 1
- The deepl.Formality is ignored
- Abnormal strings in translation results: ãã£ã£ãç§ã¡ã¡åã HOT 5
- `translate_document()` should `seek(0, 0)` the output file after being done
- Disambiguate homonyms in glossaries / provide alternative translations? HOT 3
- When translating long English fields into Chinese, the last paragraph was lost
- Glossary flexible search
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deepl-python.