How to translate and rewrite articles using OpenAI GPT while keeping HTML markup intact – CyberSEO Pro

Did you know that the CyberSEO Pro and RSS Retriever plugins for WordPress can translate imported articles into different languages and rewrite their content using OpenAI GPT models while preserving the original HTML markup? This includes headings, lists, tables, images and embedded media content.

CyberSEO Pro supports three third party services for automatic article translation: Google Translate, Yandex Translate and DeepL. These services can translate an imported article into almost any language while preserving its HTML structure. The catch? These services are not free and require a subscription to use the API.

However, if you already have an OpenAI API key that you use for creating and rewriting articles with CyberSEO Pro, why bother paying extra for other services? Your existing OpenAI API key is more than enough to use the power of GPT to translate your content into a variety of foreign languages.

This task will be solved by a properly composed OpenAI GPT article assignment in the AI article generation tab of your feed’s settings. All you need to preserve the HTML markup of the original article is the phrase “return the result in HTML format“, which should be added at the end of your prompt. Accordingly, your assignment to translate the imported article into German, should look like follows.

For simplified article assignment (CyberSEO Pro):

Translate the article below to German and return the result in HTML format:
%post_content%

For post template (CyberSEO Pro, RSS Retriever):

[openai_gpt prompt="Translate the article below into German and return the result in HTML format: %post_content%"]

And if you want to rewrite the article without translating it, use the following assignment.

For simplified article assignment (CyberSEO Pro):

Rewrite the article below in an informative style and return the result in HTML format:
%post_content%

For post template (CyberSEO Pro, RSS Retriever):

[openai_gpt prompt="Rewrite the article below in an informative style and return the result in HTML format: %post_content%"]

If you want to rewrite an article that was written in a language other than English, it is recommended that you write the entire assignment in the original language of the source.

For simplified article assignment (CyberSEO Pro):

Reescriba el siguiente artículo en un estilo informativo y devuelva el resultado en formato HTML:
%post_content%

For post template (CyberSEO Pro, RSS Retriever):

[openai_gpt prompt="Reescriba el siguiente artículo en un estilo informativo y devuelva el resultado en formato HTML: %post_content%"]

Keep in mind that GPT-3.5 models may not always do the job perfectly, especially when it comes to rewriting. On the other hand, the GPT-4 model excels at this task. Also be aware that OpenAI GPT will translate your entire HTML document, so the combined token count of the original text and the generated result should not exceed OpenAI’s text size limits, so set the value of the Max tokens field to half of the maximum allowed limit for your chosen GPT model.

Note that you cannot use the %post_content_notags% post template shortcode in this case. This shortcode removes all HTML tags from the original article and reduces its size in an attempt to fit within the token limit of the GPT model used. But in the case above, we want to keep the original HTML markup, so we need to use the more “weighty” %post_content% shortcode.

Introducing GPT-3.5 Turbo Instruct – precision AI for CyberSEO Pro

Source: https://www.cyberseo.net/blog/how-to-translate-and-rewrite-articles-using-openai-gpt-while-keeping-html-markup-intact/


Leave a Reply