Replacing punctuation by space in text analytics

text_analytics

#1

How to replace a punctuation mark say " | " by a space in a corpus for text analytics.
ex : “maths|enlgish|science” --> "maths english science"
and similarly removing spaces to from a corpus
ex :“physical education” --> "physicaleducation"
pls help!!


#2

Hi @syed.danish

here it is:

gsub("\|", " ", c(“maths|enlgish|science”))

Have a good day
Alain


#3

output for your code is:
" m a t h s | e n l g i s h | s c i e n c e "


#4

Correct code should be : m1$skills=gsub("[|]"," ",m1$skills)
Thanks for your help!!


#5

Hi Syed

sorry one character was lost:
gsub("\|", " ", c(“maths|enlgish|science”))

Alain