You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 22, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: lib/personas/post_raw_translator.rb
+36-14Lines changed: 36 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,6 @@ def system_prompt
11
11
<<~PROMPT.strip
12
12
You are a highly skilled translator tasked with translating content from one language to another. Your goal is to provide accurate and contextually appropriate translations while preserving the original structure and formatting of the content. Follow these instructions carefully:
13
13
14
-
Translation Instructions:
15
14
1. Translate the content accurately while preserving any Markdown, HTML elements, or newlines.
16
15
2. Maintain the original document structure including headings, lists, tables, code blocks, etc.
17
16
3. Preserve all links, images, and other media references without translation.
@@ -31,18 +30,7 @@ def system_prompt
31
30
Output your translation in the following JSON format:
32
31
{"translation": "Your translated text here"}
33
32
34
-
Here are three examples of correct translations:
35
-
36
-
Original: {"content":"New Update for Minecraft Adds Underwater Temples", "target_locale":"Spanish"}
37
-
Correct translation: {"translation": "Nueva actualización para Minecraft añade templos submarinos"}
38
-
39
-
Original: {"content": "# Machine Learning 101\n\nMachine Learning (ML) is a subset of Artificial Intelligence (AI) that focuses on the development of algorithms and statistical models that enable computer systems to improve their performance on a specific task through experience.\n\n## Key Concepts\n\n1. **Supervised Learning**: The algorithm learns from labeled training data.\n2. **Unsupervised Learning**: The algorithm finds patterns in unlabeled data.\n3. **Reinforcement Learning**: The algorithm learns through interaction with an environment.\n\n```python\n# Simple example of a machine learning model\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.linear_model import LogisticRegression\n\n# Assuming X and y are your features and target variables\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n\nmodel = LogisticRegression()\nmodel.fit(X_train, y_train)\n\n# Evaluate the model\naccuracy = model.score(X_test, y_test)\nprint(f'Model accuracy: {accuracy}')\n```\n\nFor more information, visit [Machine Learning on Wikipedia](https://en.wikipedia.org/wiki/Machine_learning).", "target_locale":"French"}
40
-
Correct translation: {"translation": "# Machine Learning 101\n\nLe Machine Learning (ML) est un sous-ensemble de l'Intelligence Artificielle (IA) qui se concentre sur le développement d'algorithmes et de modèles statistiques permettant aux systèmes informatiques d'améliorer leurs performances sur une tâche spécifique grâce à l'expérience.\n\n## Concepts clés\n\n1. **Apprentissage supervisé** : L'algorithme apprend à partir de données d'entraînement étiquetées.\n2. **Apprentissage non supervisé** : L'algorithme trouve des motifs dans des données non étiquetées.\n3. **Apprentissage par renforcement** : L'algorithme apprend à travers l'interaction avec un environnement.\n\n```python\n# Exemple simple d'un modèle de machine learning\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.linear_model import LogisticRegression\n\n# En supposant que X et y sont vos variables de caractéristiques et cibles\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n\nmodel = LogisticRegression()\nmodel.fit(X_train, y_train)\n\n# Évaluer le modèle\naccuracy = model.score(X_test, y_test)\nprint(f'Model accuracy: {accuracy}')\n```\n\nPour plus d'informations, visitez [Machine Learning sur Wikipedia](https://en.wikipedia.org/wiki/Machine_learning)."}
41
-
42
-
Original: {"content": "**Heathrow fechado**: paralisação de voos deve continuar nos próximos dias, diz gestora do aeroporto de *Londres*", "target_locale": "English"}
43
-
Correct translation: {"translation": "**Heathrow closed**: flight disruption expected to continue in coming days, says *London* airport management"}
44
-
45
-
Remember, you are being consumed via an API. Only return the translated text in the specified JSON format. Do not include any additional information or explanations in your response.
33
+
You are being consumed via an API. Only return the translated text in the specified JSON format. Do not include any additional information or explanations.
46
34
PROMPT
47
35
end
48
36
@@ -53,6 +41,40 @@ def response_format
53
41
deftemperature
54
42
0.3
55
43
end
44
+
45
+
defexamples
46
+
[
47
+
[
48
+
{
49
+
content:
50
+
"**Heathrow fechado**: paralisação de voos deve continuar nos próximos dias, diz gestora do aeroporto de *Londres*",
51
+
target_locale: "en",
52
+
}.to_json,
53
+
{
54
+
translation:
55
+
"**Heathrow closed**: flight disruption expected to continue in coming days, says *London* airport management",
56
+
}.to_json,
57
+
],
58
+
[
59
+
{
60
+
content: "New Update for Minecraft Adds Underwater Temples",
61
+
target_locale: "es",
62
+
}.to_json,
63
+
{translation: "Nueva actualización para Minecraft añade templos submarinos"}.to_json,
64
+
],
65
+
[
66
+
{
67
+
content:
68
+
"# Machine Learning 101\n\nMachine Learning (ML) is a subset of Artificial Intelligence (AI) that focuses on the development of algorithms and statistical models that enable computer systems to improve their performance on a specific task through experience.\n\n## Key Concepts\n\n1. **Supervised Learning**: The algorithm learns from labeled training data.\n2. **Unsupervised Learning**: The algorithm finds patterns in unlabeled data.\n3. **Reinforcement Learning**: The algorithm learns through interaction with an environment.\n\n```python\n# Simple example of a machine learning model\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.linear_model import LogisticRegression\n\n# Assuming X and y are your features and target variables\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n\nmodel = LogisticRegression()\nmodel.fit(X_train, y_train)\n\n# Evaluate the model\naccuracy = model.score(X_test, y_test)\nprint(f'Model accuracy: {accuracy}')\n```\n\nFor more information, visit [Machine Learning on Wikipedia](https://en.wikipedia.org/wiki/Machine_learning).",
69
+
target_locale: "fr",
70
+
}.to_json,
71
+
{
72
+
translation:
73
+
"# Machine Learning 101\n\nLe Machine Learning (ML) est un sous-ensemble de l'Intelligence Artificielle (IA) qui se concentre sur le développement d'algorithmes et de modèles statistiques permettant aux systèmes informatiques d'améliorer leurs performances sur une tâche spécifique grâce à l'expérience.\n\n## Concepts clés\n\n1. **Apprentissage supervisé** : L'algorithme apprend à partir de données d'entraînement étiquetées.\n2. **Apprentissage non supervisé** : L'algorithme trouve des motifs dans des données non étiquetées.\n3. **Apprentissage par renforcement** : L'algorithme apprend à travers l'interaction avec un environnement.\n\n```python\n# Exemple simple d'un modèle de machine learning\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.linear_model import LogisticRegression\n\n# En supposant que X et y sont vos variables de caractéristiques et cibles\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n\nmodel = LogisticRegression()\nmodel.fit(X_train, y_train)\n\n# Évaluer le modèle\naccuracy = model.score(X_test, y_test)\nprint(f'Model accuracy: {accuracy}')\n```\n\nPour plus d'informations, visitez [Machine Learning sur Wikipedia](https://en.wikipedia.org/wiki/Machine_learning).",
Correct translation: {"translation": "Perguntas e Respostas"}
36
-
37
-
Remember to keep proper nouns like "Minecraft" and "Toyota" in their original form. Translate the text now and provide your answer in the specified JSON format.
26
+
Translate the text now and provide your answer in the specified JSON format.
Correct translation: {"translation": "Toyota annonce une technologie de batteries révolutionnaire"}
40
-
41
-
Original: {"content": "Heathrow fechado: paralisação de voos deve continuar nos próximos dias, diz gestora do aeroporto de Londres", "target_locale": "en"}
42
-
Correct translation: {"translation": "Heathrow closed: flight disruption expected to continue in coming days, says London airport management"}
43
-
44
33
Remember to keep proper nouns like "Minecraft" and "Toyota" in their original form. Translate the title now and provide your answer in the specified JSON format.
45
34
PROMPT
46
35
end
@@ -52,6 +41,36 @@ def response_format
52
41
deftemperature
53
42
0.3
54
43
end
44
+
45
+
defexamples
46
+
[
47
+
[
48
+
{
49
+
content: "New Update for Minecraft Adds Underwater Temples",
50
+
target_locale: "es",
51
+
}.to_json,
52
+
{translation: "Nueva actualización para Minecraft añade templos submarinos"}.to_json,
0 commit comments