v <- c("electricity's", "it's", "what's")
clean <- gsub(pattern = "'s$", # àm sạch ok
replacement = "",
x = v)
clean[1] "electricity" "it" "what"
Duc Nguyen
January 29, 2026
Thực tế là ta sẽ loại bỏ dấu 's.
v <- c("electricity's", "it's", "what's")
clean <- gsub(pattern = "'s$", # àm sạch ok
replacement = "",
x = v)
clean[1] "electricity" "it" "what"
v <- c("electricity's", "it's", "what's")
clean <- gsub(pattern = "'s\\b",
replacement = "",
x = v)
clean[1] "electricity" "it" "what"
text <- c("electricity's impact on people's life's",
"it's is a good idea",
"what's",
"electricity's")
clean_text <- gsub(pattern = "'s\\b", # cú pháp này mạnh hơn
replacement = "",
x = text)
clean_text[1] "electricity impact on people life" "it is a good idea"
[3] "what" "electricity"
chuyển về cùng upper hoặc lower case
clean thô: dùng grep, gsub, which để fix từ
clean ký tự unicode
clean dấu quote
rã token
clean stop word (có thể add thêm word cần loại)
clean synonym
gộp theo topic
xử lý miss spelling