Je suis en train de transformer un texte en cours de lecture à partir d'un fichier pdf.Suppression de caractères et combinaison de chaînes
En particulier, j'ai un vecteur de caractère qui contient des tirets ("-") qui préforment la syllabification, ou la séparation des mots en nouvelles lignes, mais seulement quand il se produit pour les nombres. Par exemple:
text text text 123-
456 text text..
Ce que je veux faire est de supprimer les tous les traits d'union et de coller ces mots toghether.
text text text 123456
text text..
Mon départ tentative:
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>
A partir de là, j'ai essayé:
test <- gsub("-", "", test)
Mais ce nombre retourne séparés. Par exemple
- 123 2. 456
Pas un mot - 123456.
Toutes les idées?
Essayez 'paste (test, collapse =" ")' pour obtenir '" 123456 "'. – LAP