Can i know how to identify words ending with "ing", say "playing","praying","remembering" etc. I want to remove such words using removeWords function. -- View this message in context: http://r.789695.n4.nabble.com/Identifying-words-ending-with-anything-say-ing-tp4631834.html Sent from the R help mailing list archive at Nabble.com.
Identifying words ending with anything, say "ing"
4 messages · Chuck, aksay1210
#sample words
words <- c("fixing","Dog","Carting","kite","running","playing")
#find words ending in 'ing'
result <- regexpr("^[a-zA-Z]+ing$",words)
result
[1] 1 -1 1 -1 1 1
attr(,"match.length")
[1] 6 -1 7 -1 7 7
attr(,"useBytes")
[1] TRUE
# you can use result to take out the offending words:
new.words <- words[-which(result>0)]
new.words
[1] "Dog" "kite"
Hope that helps.
aksay1210 wrote
Can i know how to identify words ending with "ing", say "playing","praying","remembering" etc. I want to remove such words using removeWords function.
-- View this message in context: http://r.789695.n4.nabble.com/Identifying-words-ending-with-anything-say-ing-tp4631834p4631835.html Sent from the R help mailing list archive at Nabble.com.
Thanx a lot Charlie BUT What if I have many sentences (not individual words), where I would want to remove such words ? -- View this message in context: http://r.789695.n4.nabble.com/Identifying-words-ending-with-anything-say-ing-tp4631834p4631836.html Sent from the R help mailing list archive at Nabble.com.
My query comes from the background that I want to process my text and want to remove all the proper nouns.. So, by tagPOS i can tag them as /NNP and then can remove those words from the whole text. So, if someone tell me How I can do that, that would be very helpful..!! Thanks -- View this message in context: http://r.789695.n4.nabble.com/Identifying-words-ending-with-anything-say-ing-tp4631834p4631837.html Sent from the R help mailing list archive at Nabble.com.