问题描述

当我们有很多文献时,如果想从众多文献中搜索一个特定的字符串,我们难道要逐个PDF打开找吗,那么多文献,而且全是PDF,逐个打开,Ctrl + F搜索也不现实,肿么办,难不成为自己的文献库构建个索引吗,在本机构建文本语料库索引工作量不小,我们能不能找个轻量级的办法呢,当然可以,收到Linux中常用的搜索命令grep的启发,那么我们能直接用grep命令搜PDF文件吗,当然不能,grep命令是搜文本文件的(各类code源代码,plain text等),那我们把PDF文献全部转换为TXT,然后再用grep行不行,行,但是能不能把这个转换步骤也省了,必须能,怎么一分钟实现,看下文。

以下方法仅适用于linux系统,windows系统请自行找替代方案。

解决方法

安装pdfgrep即可,点我进入官网,不建议按照官网提供的源码自行编译安装(很可能会出现一些依赖错误,解决起来比较麻烦),直接使用命令行从ubuntu仓库中安装即可:
sudo apt-get update -y
sudo apt-get install -y pdfgrep

使用方法

用法与grep高度一致,更多example,也可参考官网文档如下:点我查看文档,支持递归搜索哦。

例如在论文文件夹搜索关键词cosine,命令如下
pdfgrep -n -i 'cosine' *.pdf
结果片段如下:

(base) ergou@dell:~/Desktop/paper_reading/papers$ pdfgrep -n -i 'cosine' *.pdf
paper0.pdf:22:in VSM or BoW, are compared using similarity measure like Cosine similarity (Vu et al.
paper1.pdf:1:space. Given their vector embeddings, we then use cosine
paper1.pdf:3:first tokenizes the input text and then calculates vectors for                     to average them as the cosine similarity function depends
paper1.pdf:3:or tf-idf, these vectors are contextualized; they consider                   choice of summing or averaging would not influence the cosine
paper1.pdf:3:and problem report as a potential match. Another positive                      the euclidian similarity, and cosine similarity [9], [43]. The
paper1.pdf:4:dimensions. In contrast, the cosine similarity measures the
paper1.pdf:4:Previous research [1][3], [9], showed that cosine similarity                                          05/2012              09/2018
paper1.pdf:5:analyze DeepMatcher's cosine similarity values to understand
paper1.pdf:5:consuming over 80% battery. Had to uninstall to even                       cosine similarity, it added one additional suggestion per step
paper1.pdf:6:as many relevant bug reports in the issue tracker as                                 Cosine Similarity Analysis. We analyzed the cosine sim­
paper1.pdf:6:as many relevant bug reports in the issue tracker as                                 Cosine Similarity Analysis. We analyzed the cosine sim­
paper1.pdf:6:suggested bug reports to three, the MAP score                                    irrelevant bug report suggestions. Figure 4 shows the cosine
paper1.pdf:6:of problem reports for which DeepMatcher                                            We found that VLC has the lowest cosine similarity score
paper1.pdf:6:the MAP and the hit ratio scores for each                                    (26 matches). The lower cosine similarity indicates a higher
paper1.pdf:7:by the developers. our previously reported plot of the cosine                     report 546 days after the corresponding problem report for
paper1.pdf:7:the highest cosine similarity score and highest noun overlap                          It is essential for app developers to address users'
paper1.pdf:11:sensitive embeddings on which we applied cosine similarity to                     [15] M. Honnibal, I. Montani, S. Van Landeghem, and A.
paper2.pdf:3:encoding implies computing 												

从多个PDF中快速搜索字符串相关推荐

  1. mysql数据库搜索字符_在MySQL数据库中快速搜索字符串?

    使用FULLTEXT搜索来快速搜索字符串.让我们首先创建一个表-mysql> create table DemoTable1554 -> ( -> Title text ->  ...

  2. ieda中快捷搜索_IntelliJ IDEA IDE设置系列教程(十):在工具窗口中快速搜索

    IntelliJ IDEA是Java语言开发的集成环境,IntelliJ在业界被公认为优秀的Java开发工具之一,尤其在智能代码助手.代码自动提示.重构.J2EE支持.Ant.JUnit.CVS整合. ...

  3. android设备局域网中快速搜索之cling方式

    cling方式就像pc端windows局域网工作组刷新显示一样,原来用过扫描ip地址的方式,可以使用就是有点慢,还有一种自己加入组广播,通过发送组广播的方式. android设备局域网中快速搜索之cl ...

  4. 图片提取利器,从PDF中快速提取图片并存储到本地

    PDF是日常生活中经常使用的文件格式,里面可能包含着重要的文字信息和图片资源.然而当需要提取PDF中的图片时,往往需要使用复杂的工具.图片提取利器能够帮助你从PDF中快速提取图片并存储到本地. # c ...

  5. 怎么快速搜索服务器里的文件,Windows中快速搜索指定文件夹

    Windows自带的记事本因方便小巧常被大家使用,但记事本的"状态栏"和"自动换行"却是对冤家,当你通过菜单栏开启"自动换行"... Win ...

  6. matlab寻找向量最小值,matlab – 在排序向量中快速搜索大于x的最小值

    由于输入已经排序,自定义二进制搜索应该有效(您可能需要对边缘情况进行一些更新,即请求的值小于数组的所有元素): function [result, res2] = binarySearchExampl ...

  7. php对pdf关键字定位,如何在PDF文件中快速查找关键字

    有时候我们在阅读和编辑PDF文章时需要对PDF文件里的重要关键词进行查找,但如果PDF文章内容过长,怎么才能快速查找出想要查找的关键字? 想要在PDF文件中快速查找出关键字,那么利用迅捷PDF编辑器进 ...

  8. 如何在 PDF 中搜索并准确找到您要查找的文本内容

    您是否需要在冗长的 PDF 文档中快速查找单词或短语? 没有什么比打开一个只有文本墙的大型 PDF 文档更令人沮丧的了.或者必须在很长的文本中找到特定的单词或短语.或者很长的 PDF. 它不方便.耗时 ...

  9. VBA快速合并字符串方法

    在前几天分享的文章[快速对比数据]中,使用了如下代码,有小朋友问为什么要再第20行代码中使用Trim函数呢?是否可以在构建字符串时直接处理呢?本文将就讲一下VBA中快速连接字符串的几种方法. 我们使用 ...

最新文章

  1. 命令行带参数启动--命令行相关问题 代码规范
  2. 全球及中国食品行业发展潜力与投资机会评估报告2022版
  3. sqlite数据库的基本增删改查操作
  4. 西北民族大学c语言程序设计复试科目,2016年西北民族大学中国民族信息技术研究院962C语言程序设计复试笔试仿真模拟题...
  5. resolv文件自动配置
  6. selenium java api_selenium_java常用API操作
  7. 帝豪gl车机系统降级_鲜试车丨10万元级国民轿车再升级,试驾2020款吉利帝豪GL...
  8. MAC 下的SVN客户端 Versions、SmartSVN、Cornerstone
  9. android studio 添加 ignored files 忽略文件
  10. easywechat微信开发系列(2):公众号网页支付
  11. 计算机工程学院运动会加油稿50字,运动会加油稿50字
  12. RTL8372-CG/RTL8373-CG
  13. OB数据库大赛初赛总结
  14. 栈内存和堆内存的区别(一个笔试题的一部分)
  15. 塞雷三分钟漫画中国史2
  16. MIME类型是什么?包含哪些类型?
  17. 如果哥白尼也玩“虚拟化”和“超融合”
  18. crc-16 ccitt标准在哪里可以看到详细的
  19. 【深度学习】超越ConvNeXt!Transformer 风格的卷积网络视觉基线模型Conv2Former
  20. 核心圈好图书推荐(二)

热门文章

  1. bzero memset置零的性能比较
  2. 了解 C++ 之 typename
  3. Unloaded branch node detected. “loadOptions“ prop is required to load its children
  4. 简易的js获取星期几的两种方法
  5. srm32f4按键蜂鸣器_STM32F407通过按键控制LED和蜂鸣器
  6. 寻路 pathfinder 狂乱画
  7. ARM汇编之MOV指令
  8. 关于解决 inittramfs unpacking failed:Decoding failed 报错
  9. crsctl命令详解
  10. 一键就能发布项目-DevOps_v1.0.1