I want to make a prompt generator for text-based AI.
each prompt should be a random wikipedia article in any topics.
each prompt should consist of 2 medium length sentences with have intricate details on it.
first two sentences should be in english followed by its translation into random world language.
the prompts generated counting will be decided by the user. should provide a parameter option "number_of_prompt=( )" for the user input.
should provide also the language of translation parameter option, marked by "translate_to=( )" for the user input.
if the user not provide the language translation parameter, generate random translation by the AI.
make 5 variations of distinctive, each with different structure simpke syntax-like pseudocode system.
ok, lets try generate the prompt generator in really simple pseudocode syntax-like format system, easy readable task for the text-based AI. and simulate the output also for each prompt generator. thanks
Assistant
Got it! Below are 5 distinctive pseudocode-style prompt generator structures with simple syntax and comments for clarity. Each version follows your requirements and simulates output with sample prompts.
Version 1: Sequential procedural style
code
FUNCTION generate_prompts(number_of_prompt, translate_to = None):
FOR i FROM 1 TO number_of_prompt:
article = GET random Wikipedia article
sentences = EXTRACT 2 detailed sentences from article in English
IF translate_to IS None:
language = PICK random world language
ELSE:
language = translate_to
translation = TRANSLATE sentences INTO language
PRINT "Prompt #" + i
PRINT sentences (English)
PRINT translation (language)
PRINT "Language: " + language
END FUNCTION
Prompt #1
English: The Galápagos Islands, located in the Pacific Ocean, are a volcanic archipelago known for their unique biodiversity and immense scientific importance.
The islands' isolated environment contributed to the evolution of distinctive species studied by Charles Darwin during his voyage on the HMS Beagle.
Spanish: Las Islas Galápagos, ubicadas en el Océano Pacífico, son un archipiélago volcánico conocido por su biodiversidad única e inmensa importancia científica.
El ambiente aislado de las islas contribuyó a la evolución de especies distintivas estudiadas por Charles Darwin durante su viaje en el HMS Beagle.
Language: Spanish
Version 2: Functional with parameters and randomized language
code
FUNCTION generate_prompts(number_of_prompt, translate_to = None):
DEFINE languages_list = [list of world languages]
FOR index FROM 1 TO number_of_prompt:
article = GET random Wikipedia article
english_text = EXTRACT 2 medium detailed sentences from article
IF translate_to IS NOT None:
chosen_language = translate_to
ELSE:
chosen_language = RANDOM_CHOICE(languages_list)
translated_text = TRANSLATE(english_text, chosen_language)
OUTPUT {
"Prompt_Number": index,
"English": english_text,
"Translation": translated_text,
"Language": chosen_language
}
END FUNCTION
Prompt_Number: 1
English: Mount Everest, the Earth's highest mountain above sea level, is part of the Himalaya range in Asia and attracts many climbers each year.
The mountain's summit marks the border between Nepal and China, and its extreme altitude poses significant challenges to mountaineers.
Translation: Mont Everest, la plus haute montagne au-dessus du niveau de la mer, fait partie de la chaîne de l'Himalaya en Asie et attire de nombreux grimpeurs chaque année.
Le sommet de la montagne marque la frontière entre le Népal et la Chine, et son altitude extrême pose des défis importants aux alpinistes.
Language: French
Version 3: Object-oriented pseudocode style
code
CLASS PromptGenerator:
PROPERTY number_of_prompt
PROPERTY translate_to
PROPERTY languages_list = [list of world languages]
METHOD __init__(num, lang=None):
number_of_prompt = num
translate_to = lang
METHOD generate():
FOR i IN RANGE(1, number_of_prompt+1):
article = GET_RANDOM_WIKI_ARTICLE()
sentences = EXTRACT_DETAILED_SENTENCES(article, 2)
IF translate_to IS None:
lang = RANDOM_CHOICE(languages_list)
ELSE:
lang = translate_to
translation = TRANSLATE(sentences, lang)
PRINT("Prompt " + i)
PRINT(sentences)
PRINT(translation)
PRINT("Language: " + lang)
END CLASS
# Usage:
prompt_gen = PromptGenerator(1, "German")
prompt_gen.generate()
Simulated output
code
Prompt 1
English: Nikola Tesla was a Serbian-American inventor known for his development of alternating current electrical systems and pioneering work in electromagnetism.
He held numerous patents and contributed to wireless communication and electrical power transmission technologies widely used today.
German: Nikola Tesla war ein serbisch-amerikanischer Erfinder, bekannt für die Entwicklung von Wechselstromsystemen und seine bahnbrechende Arbeit auf dem Gebiet des Elektromagnetismus.
Er hielt zahlreiche Patente und leistete Beiträge zur drahtlosen Kommunikation und zur Stromübertragung, die heute weit verbreitet sind.
Language: German
Version 4: Concise inline logic
code
FUNCTION generate_prompts(number_of_prompt, translate_to=None):
languages = [list of languages]
FOR i IN 1 TO number_of_prompt:
article = GET_RANDOM_ARTICLE()
eng_sentences = EXTRACT_TWO_DETAILED_SENTENCES(article)
lang = translate_to IF translate_to IS NOT None ELSE RANDOM_SELECT(languages)
translation = TRANSLATE(eng_sentences, lang)
PRINT("Prompt #" + i)
PRINT(eng_sentences)
PRINT(translation)
PRINT("Language: " + lang)
END FUNCTION
Prompt #1
English: The Amazon rainforest is the largest tropical rainforest in the world, spanning multiple South American countries and possessing unparalleled biodiversity.
It plays a crucial role in regulating the global climate and sustaining indigenous communities for thousands of years.
Japanese: アマゾン熱帯雨林は世界最大の熱帯雨林であり、南米の複数の国にまたがり、比類のない生物多様性を持っています。
それは地球規模の気候を調節し、何千年もの間先住民のコミュニティを支えてきました。
Language: Japanese
Prompt #2
English: The Great Barrier Reef off the coast of Australia is the world's largest coral reef system, hosting thousands of marine species within its vibrant ecosystem.
Coral bleaching events caused by climate change threaten its delicate balance and have sparked global conservation efforts.
Japanese: オーストラリア沖のグレートバリアリーフは世界最大のサンゴ礁システムであり、その生き生きとした生態系には何千もの海洋生物種が生息しています。
気候変動によるサンゴの白化現象はその繊細なバランスを脅かし、世界的な保全活動を促しています。
Language: Japanese
Version 5: With error handling and default values
code
FUNCTION generate_prompts(number_of_prompt=1, translate_to=None):
languages = [all supported languages]
IF number_of_prompt <= 0:
RETURN "Error: number_of_prompt must be a positive integer."
FOR count FROM 1 TO number_of_prompt:
article = FETCH_RANDOM_WIKI_ARTICLE()
IF article IS None:
CONTINUE
english_text = EXTRACT_TWO_SENTENCES(article)
language = translate_to IF translate_to IS NOT None ELSE RANDOM_CHOICE(languages)
TRY:
translated_text = TRANSLATE_TEXT(english_text, language)
EXCEPT TranslationError:
translated_text = "Translation not available."
DISPLAY "Prompt " + count
DISPLAY "English: " + english_text
DISPLAY language + ": " + translated_text
DISPLAY "Language: " + language
END FUNCTION
Simulated output (number_of_prompt=1, no translate_to specified)
code
Prompt 1
English: Marie Curie was a physicist and chemist who conducted pioneering research on radioactivity, becoming the first woman to win a Nobel Prize.
Her discoveries led to significant advancements in medical treatments and our understanding of atomic physics.
Afrikaans: Marie Curie was 'n fisikus en chemikus wat baanbrekersnavorsing oor radioaktiwiteit gedoen het, en die eerste vrou geword het wat 'n Nobelprys gewen het.
Haar ontdekkings het gelei tot beduidende vooruitgang in mediese behandelings en ons begrip van atomfisie.
Language: Afrikaans
If you'd like, I can help you convert one of these pseudocode versions into a full working code in Python or another language. Just let me know!