format_transformations.py 437 B

123456789101112131415161718192021
  1. # This file is written to do type transformations. A transformation symbolizes a mapping.
  2. def asciify(s):
  3. replaces = [
  4. ('ö', 'oe'),
  5. ('ä', 'ae'),
  6. ('ü', 'ue'),
  7. # (' ', ''),
  8. # ('/', ''),
  9. # ('(', ''),
  10. # (')', ''),
  11. ('ß', 'ss'),
  12. ]
  13. for rep in replaces:
  14. s = s.replace(*rep)
  15. return s
  16. def json_to_dict(data):
  17. import json
  18. return json.loads(data)