Skip to content

Instantly share code, notes, and snippets.

@shubham769
Created April 29, 2020 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shubham769/5348823a652d95335839b8404714c724 to your computer and use it in GitHub Desktop.
Save shubham769/5348823a652d95335839b8404714c724 to your computer and use it in GitHub Desktop.
def mapping_replacer(x, dic):
for word in dic.keys():
if " " + word + " " in x:
x = x.replace(" " + word + " ", " " + dic[word] + " ")
return x
text = "we aren't able to come ,cause of heavy rain"
mapping_replacer(text, contraction)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment