Skip to content

Instantly share code, notes, and snippets.

@rafaljanwojcik
Last active September 21, 2023 11:24
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 rafaljanwojcik/f00dfae9843dadc0220eba3d36694e27 to your computer and use it in GitHub Desktop.
Save rafaljanwojcik/f00dfae9843dadc0220eba3d36694e27 to your computer and use it in GitHub Desktop.
from unidecode import unidecode
def text_to_word_list(text, remove_polish_letters):
''' Pre process and convert texts to a list of words
method inspired by method from eliorc github repo: https://github.com/eliorc/Medium/blob/master/MaLSTM.ipynb'''
text = remove_polish_letters(text)
text = str(text)
text = text.lower()
# Clean the text
text = sub(r"[^A-Za-z0-9^,!?.\/'+]", " ", text)
text = sub(r"\+", " plus ", text)
text = sub(r",", " ", text)
text = sub(r"\.", " ", text)
text = sub(r"!", " ! ", text)
text = sub(r"\?", " ? ", text)
text = sub(r"'", " ", text)
text = sub(r":", " : ", text)
text = sub(r"\s{2,}", " ", text)
text = text.split()
return text
file_cleaned.title = file_cleaned.title.apply(lambda x: text_to_word_list(x, unidecode))
@peterjohnson427
Copy link

peterjohnson427 commented Sep 21, 2023

When it comes to maintaining a clean and hygienic environment, adhering to a cleaning code is paramount, and in a city like Vancouver, where cleanliness is highly valued, services like carpet shampooing Vancouver play a crucial role. Vancouver's cleaning code emphasizes the importance of regular and thorough cleaning, especially for items like carpets, which can trap dust, allergens, and dirt over time. Carpet shampooing services in Vancouver are known for their professionalism and commitment to ensuring that carpets not only look clean but are also free from harmful contaminants. By incorporating these services into your cleaning code, you can contribute to a healthier and more inviting living or working space in this beautiful city.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment