Our Pig Latin converter comes in two versions: a web-based version using PyScript and a standalone Python script. Here's an overview of how each version processes the text:
1. The user enters a word or sentence into the input field.
2. Once the "Convert" button is clicked, PyScript reads the input.
3. The program checks if the input is valid.
4. If the word starts with a vowel, "way" is appended to the end.
5. If the word starts with a consonant, the consonant(s) are moved to the end, and "ay" is added.
6. The result is displayed on the page, and the user can download the physical Python script.
1. Start the program.
2. Prompt user for input choice: "Read from a file or input directly? (file/terminal)"
3. If file:
Read sentences from pig_latin_input_output.txt.
Process each sentence and write results back to the file.
Display completion message.
4. If terminal:
Loop until exit:
Prompt user: "Enter a word or sentence (or type 'exit' to quit):"
If exit: Display exit message and break loop.
If valid input: Convert to Pig Latin and display result.
If empty input: Display "Please enter a valid word or sentence."
5. If invalid choice: Display "Invalid choice. Please type 'file' or 'terminal'."
6. End.