Я просто лемматизировал вектор символов. Проблема в том, что лемматизация создает пробел между словами, объединенными тире (например, краткосрочный становится краткосрочный). Мой вектор символов полон этих слов, поэтому я хотел бы найти способ убрать это искажение.
Позвольте мне привести пример:
text <- c("Stackoverflow is a great website where you can find great and very skilled people who are so kind to solve your coding problems. In the short-term is a very good thing because you can speed up your research, in the long-term is better if you learn how to code on your own. Let me add more non-sense to make my point. The growth-friendly composition of public finance is a good thing.")
ch_vector <- lemmatize_strings(text)
Как я уже сказал, результат таков:
"Stackoverflow be a great website where you can find great and very skill people who be so kind to solve your code problem. In the **short - term** be a very good thing because you can speed up your research, in the **long - term** be good if you learn how to code on your own. Let me add much **non - sense** to make my point. The **growth - friendly** composition of public finance be a good thing."
Вместо этого я хочу этого:
"Stackoverflow be a great website where you can find great and very skill people who be so kind to solve your code problem. In the **short-term** be a very good thing because you can speed up your research, in the **long-term** be good if you learn how to code on your own. Let me add much **non-sense** to make my point. The **growth-friendly** composition of public finance be a good thing."
До сих пор я делал это таким образом для каждого интересующего слова:
ch <- sub(pattern = "growth - friendly", replacement = "growth-friendly", x = ch_vector, fixed = TRUE)
Но это честно трудоемко, неэффективно и не всегда нормально работает (зависит от заглавных букв и т.д.)
Можете ли вы предложить лучший способ сделать это?
Большое спасибо