Fairslator

FREEMIUM
Por Michal Měchura | Actualizada לפני חודשיים | Translation
Popularidad

6.5 / 10

Latencia

1,021ms

Nivel de servicio

100%

Health Check

N/A

Volver a todos los tutoriales (3)

How to work with inline markup in the Fairslator API

The text people put through translators and other kinds of processors are often peppered with inline markup of various kinds, such as HTML tags, XML tags or Markdown formatting codes.

"My brother is <b>very</b> afraid of the dentist."

The Fairslator API makes it possible for you to tell it how to recognize such markup. If you do that, Fairslator will ignore the markup when analyzing the text, and will output the markup unchanged in the rewritten texts.

{
	"sourceText": "You are a {b}very{/b} good laywer.",
	"sourceLang": "en",
	"text": "Sie sind ein {b}sehr{/b} guter Anwalt.",
	"lang": "de",
	"secondPerson": "tf",
	"markupRegex": "{[^}]+}"
}

Output:

"Du bist eine {b}sehr{/b} gute Anwältin."

The field markupRegex is a regular expression which recognizes instances of the markup. Including it in your APi request can sometimes make a great difference. If your text has inline markup but you don’t tell Fairslator how to recognize it, it can become confused thinking those are actual words, misunderstand the text, and rewrite it badly.