script.py 716 B

12345678910111213141516171819202122232425262728293031
  1. from googletrans import Translator
  2. translator = Translator()
  3. params = {
  4. "language string": "ja",
  5. }
  6. def input_modifier(string):
  7. """
  8. This function is applied to your text inputs before
  9. they are fed into the model.
  10. """
  11. return translator.translate(string, src=params['language string'], dest='en').text
  12. def output_modifier(string):
  13. """
  14. This function is applied to the model outputs.
  15. """
  16. return translator.translate(string, src="en", dest=params['language string']).text
  17. def bot_prefix_modifier(string):
  18. """
  19. This function is only applied in chat mode. It modifies
  20. the prefix text for the Bot and can be used to bias its
  21. behavior.
  22. """
  23. return string