I'm transforming a text that's being read from a pdf file.
In particular, I have a character vector which contains hyphens ("-") that preform syllabification, or separation of the words to new lines, but only when it occurs for numbers. For example:
text text text 123-
456 text text..
What I want to do is remove the all the hypens and paste those words toghether.
text text text 123456
text text..
My starting attempt:
library(pdftools)
library(tidytext)
library(readxl)
library(dplyr)
setwd("~/Automation - Official Guazzete")
path <- getwd()
pdf_file <- file.path(path, "stecajni_postapki.pdf")
test <- pdf_text(pdf_file)
dput(tail(test)[1])
"10 јули 2017 Бр. 86 - Стр. 1\r\n Стечајни постапки\r\n СТЕЧАЈНИ ПОСТАПКИ\r\n Основниот суд Скопје II – Скопје преку стечајниот\r\n судија Вероника Станојевска и привремениот стечаен\r\n управник Ѓорѓе Костов, објавува дека со Решение 2\r\n Ст. бр. 841/17 од 16.6.2017 година, се отвора стечајна\r\n постапка над должникот Друштво за производство, тр-\r\n говија КБ ТРЕЈД Ќиро ДООЕЛ Скопје, со трансакцис-\r\n ка сметка 300000000744414 при Комерцијална банка\r\n АД Скопје со ЕДБ 403099419454 Скопје, ЕМБС\r\n 4854217 и единствен даночен број 4030003477097 и\r\n приоритетна дејност на мало во неспецијализирани про-\r\n давници претежно со храна и пијалаци... <truncated>
From here, I tried:
test <- gsub("-", "", test)
But this returns seperate numbers. For example
- 123 2. 456
Not one word - 123456.
Any ideas?