Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. __author__ = 'ninja'
  2.  
  3. import re
  4.  
  5.  
  6. def translate_akrinom(word):
  7. akronim_list ={"lol": "laugh out loud", "dw": "don't worry",
  8. "hf": "have fun", "gg": "good game",
  9. "brb": "be right back", "g2g": "got to go",
  10. "wtf": "what the fuck", "wp": "well played",
  11. "gl": "good luck", "imo": "in my opinion", "neka": "nesto"}
  12. new_word_list = ""
  13. if akronim_list.has_key(word.lower()):
  14. new_word_list += akronim_list[word.lower()]
  15. else:
  16. new_word_list += word
  17. return new_word_list
  18.  
  19. def check_string_for_akronim(string_for_checking):
  20. word_list = re.findall(r"[\w']+|[.,!?;:/\| ]", string_for_checking)
  21. new_word_list = [translate_akrinom(word)for word in word_list]
  22. print ''.join(new_word_list)
  23.  
  24. def main():
  25. check_string_for_akronim(raw_input("Unesi recenicu u kojoj zelis da promenis akronime."))
  26.  
  27. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement