brise | React Library for TailwindCSS , similar to styled-components | Frontend Framework library
kandi X-RAY | brise Summary
kandi X-RAY | brise Summary
A breeze of fresh air when using TailwindCSS. brise offers an API that is very similar to styled-components but leverages TailwindCSS (or any other global CSS classnames) instead.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of brise
brise Key Features
brise Examples and Code Snippets
Community Discussions
Trending Discussions on brise
QUESTION
I've noticed 2 cases in which Microsoft Translator Text should raise errors when using custom engines, but instead has an unexpected behavior.
Normal CaseI send a request with the method POST.
URL = https://api.cognitive.microsofttranslator.com/translate
parameters :
- api-version=3.0
- textType=plain
- category=my_engine_id
- from=de
- to=en
Headers={"Ocp-Apim-Subscription-Key": my_key,'Content-type': 'application/json'}
Body (JSON format) :
[{"Text": "Klicken Sie in jedem Bildschirm auf das Textbeispiel, das am besten lesbar ist."},
{"Text": "Verschiedene Themen aus den Bereichen Wortschatz, Satzbau, Kohärenz, Textwiedergabe,
Kommasetzung und Orthographie werden anhand von Textbeispielen und Übungen vorgestellt."},
{"Text": "„Auch wenn zwei Staaten in Deutschland existieren, sind sie doch füreinander nicht Ausland; ihre Beziehungen zueinander können nur von besonderer Art sein.“"},
{"Text": "Mit dieser Formel bricht der neue Kanzler ein jahrzehntelanges Tabu."},
{"Text": "Bislang wird der östliche Teil Deutschlands von den bundesdeutschen Politikern als SBZ, Zone oder „sogenannte DDR“ bezeichnet."}]
The response is as expected:
Case 1[{"translations":
[{"text": "On each screen, click on the text sample that is most readable.",
"to": "en"}]},
{"translations":
[{"text": "Various topics from the fields of vocabulary, typesetting, coherence, text reproduction, comma setting and orthography are presented using text examples and exercises.",
"to": "en"}]},
etc.
I change the parameter to=fr in the URL (instead of "en").
The response shows that the text has been translated into french, although the custom engine is only trained from DE>EN (therefore I think a generic engine was used instead, but there is no info in the HTTP response) !
[{"translations":[{"text":"Sur chaque écran, cliquez sur l’échantillon de texte le plus lisible.","to":"fr"}]},{"translations":[{"text":"Divers sujets des domaines du vocabulaire, du typage, de la cohérence, de la reproduction du texte, du décor de virgule et de l’orthographe sont présentés à l’aide d’exemples de textes et d’exercices.","to":"fr"}]},{"translations":[{"text":"\"Même si deux États existent en Allemagne, ils ne sont pas étrangers l’un à l’autre; Leurs relations les uns avec les autres ne peuvent être que d’un genre particulier.","to":"fr"}]},{"translations":[{"text":"Avec cette formule, le nouveau chancelier brise un tabou de dix ans.","to":"fr"}]},{"translations":[{"text":"Jusqu’à présent, la partie orientale de l’Allemagne est appelée par les politiciens fédéraux allemands SBZ, zone ou « soi-disant DDR ».","to":"fr"}]}]
Instead of this behaviour, I would have expected an error in the HTTP response :
400075 The language pair and category combination is not valid.
I change the parameter from=da in the URL (instead of "de").
The response shows that the translation is simply a copy of the source text, although it indicates that it was translated into "en" !
[{"translations":[{"text":"Klicken Sie in jedem Bildschirm auf das Textbeispiel, das am besten lesbar ist.","to":"en"}]},{"translations":[{"text":"Verschiedene Themen aus den Bereichen Wortschatz, Satzbau, Kohärenz, Textwiedergabe, Kommasetzung und Orthographie werden anhand von Textbeispielen und Übungen vorgestellt.","to":"en"}]},{"translations":[{"text":"\"Auch wenn zwei Staaten in Deutschland existieren, sind sie doch füreinander nicht Ausland; ihre Beziehungen zueinander können nur von besonderer Art sein.\"","to":"en"}]},{"translations":[{"text":"Mit dieser Formula bricht der neue Kanzler ein jahrzehntelanges Tabu.","to":"en"}]},{"translations":[{"text":"Bislang wird der östliche Teil Deutschlands von den bundesdeutschen Politikern als SBZ, Zone oder \"sogenannte DDR\" bezeichnet.","to":"en"}]}]
Same as for Case 1, instead of this behaviour, I would have expected an error in the HTTP response :
400075 The language pair and category combination is not valid.
Is it normal that I don't get an error for these 2 cases ? Has anybody else encountered this behavior before ?
Actually I would like to either use these error codes, or else check before sending the translation request that the language pair corresponds to the custom engine, do you know of some way to do it ?
...ANSWER
Answered 2020-Mar-26 at 17:22For case1, translation is done in two hops - de>en, en>fr. The custom engine is used for the first hop, and our general model is used for the second. If you want the translation to fail in this case instead, you can set the parameter allowFallback to false
allowFallback Optional parameter. Specifies that the service is allowed to fallback to a general system when a custom system does not exist. Possible values are: true (default) or false. docs
In the second case, the request contains German text but is labeled as Danish. There is nothing we can do here except return the input. If you want the api to detect the from language, omit it from the parameters and the api will run auto-detect on the text.
If the from parameter is not specified, automatic language detection is applied to determine the source language.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install brise
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page