Fairslator

免费增值
通过 Michal Měchura | 已更新 4일 전 | Translation
人气

7 / 10

延迟

468ms

服务等级

100%

Health Check

N/A

返回全部教程 (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.