Menu

How we write “work-life balance” can come in many forms. It could be written “wlb,” “work life balance,” “work/life balance.” They are all the same. But the variability could pose some issue in Natural Language Processing. Changing them all back to the normal is the solution. But writing repetitive str_replace_all()  may not be the most efficient. For loop()  can help.

Let’s assume that Pros represent comments about his/her company from Glassdoor. The first step is to convert them to lowercase letters.

Next, we create an array storing the variations.

We then create a for loop()  to go over the list.