我正在尝试通过搜索某些关键字来对pdf进行一些文本挖掘。
这是我的代码:
library(pdftools)
library(tidyverse)
library(pdfsearch)
UC_text <- pdf_text("https://wilmar-iframe.todayir.com/attachment/20190411162436345449392_en.pdf")
result <- keyword_search(UC_text,
keyword = c('SUBSTANTIAL SHAREHOLDERS'),
path = TRUE, surround_lines = 1)
但是,我收到文件名错误消息的时间过长。我如何解决这个问题?
根据pdfsearch的cran手册中的说明,您可以直接将PDF链接传递到keyword_search()
。这样,我看不到您提供的错误消息。我宁愿得到以下结果。
result <- keyword_search("https://wilmar-iframe.todayir.com/attachment/20190411162436345449392_en.pdf",
keyword = c('SUBSTANTIAL SHAREHOLDERS'),
path = TRUE, surround_lines = 1)
keyword page_num line_num line_text token_text
<chr> <int> <int> <list> <list>
1 SUBSTANTIAL SHAREHOLDERS 49 2010 <chr [3]> <list [3]>