文件内容提取:Apache Tika 2.9.2

ops/2024/10/10 23:57:40/

提取各种文件的文本内容,offic image zip 等等…

Apache Tika 2.9.2 、 jdk8

基础 pom.xml

<!-- https://mvnrepository.com/artifact/org.apache.tika/tika-core -->
<dependency><groupId>org.apache.tika</groupId><artifactId>tika-core</artifactId><version>2.9.2</version>
</dependency>
<dependency><groupId>org.apache.tika</groupId><artifactId>tika-parsers-standard-package</artifactId><version>2.9.2</version>
</dependency>

还需要用到的 pom.xml

<dependency><groupId>org.apache.logging.log4j</groupId><artifactId>log4j-core</artifactId>
</dependency>
<dependency><groupId>commons-io</groupId><artifactId>commons-io</artifactId><version>2.17.0</version>
</dependency>
<dependency><groupId>org.apache.commons</groupId><artifactId>commons-compress</artifactId><version>1.26.2</version>
</dependency>
  • 注意版本号,不然会出问题

java demo

@Test
public void test() throws Exception {InputStream inputStream = Files.newInputStream(Paths.get("text.zip"));BodyContentHandler contentHandler = new BodyContentHandler(-1);Metadata metadata = new Metadata();ParseContext parseContext = new ParseContext();new AutoDetectParser().parse(inputStream, contentHandler, metadata, parseContext);// 提取出来的内容System.out.println(contentHandler);System.out.println("-------------------------------------------");// 元数据信息String[] names = metadata.names();for (String name : names) {System.out.println(name + ":" + metadata.get(name));}
}

http://www.ppmy.cn/ops/123370.html

相关文章

Matlab线条设置

1. 绘制基本线条 使用 plot 函数绘制线条是最常见的方法。 x 0:0.1:10; % x 值 y sin(x); % y 值% 绘制基本线条 figure; plot(x, y); title(Sine Wave); xlabel(x); ylabel(sin(x));2. 设置线条属性 在 plot 函数中&#xff0c;你可以通过额外的参数设置线条的属性。…

CMU 10423 Generative AI:lec17(优化Attention机制的方法)

1 概述 这个文档主要介绍了如何通过优化Attention机制来加速Transformer的计算。以下是主要内容的概述&#xff1a; 1. 回顾&#xff1a;MoE与知识的稀疏性 在前面的课程中&#xff0c;讲解了如何使用Mixture of Experts (MoE) 来加速MLP层的计算。MoE的核心理念是知识的稀疏…

毕业设计_基于SpringBoot+vue的社区博客系统【源码+SQL+教程+可运行】41002

毕业设计_基于SpringBootvue的社区博客系统【源码SQL教程可运行】41002 下载地址&#xff1a;https://download.csdn.net/download/qq_24428851/89834978 技术栈&#xff1a; graduation_admin 后台管理页面 (vue)graduation_web 前台页面 (vue)graduation_server 后台api (…

药物识别与分类系统源码分享

药物识别与分类检测系统源码分享 [一条龙教学YOLOV8标注好的数据集一键训练_70全套改进创新点发刊_Web前端展示] 1.研究背景与意义 项目参考AAAI Association for the Advancement of Artificial Intelligence 项目来源AACV Association for the Advancement of Computer V…

一文了解:LLM Dropout

咱们来聊聊&#xff0c;啥样的预测模型才算是好模型&#xff1f;简单来说&#xff0c;就是那种在处理它从没见过的数据时&#xff0c;也能表现得特别棒的模型。老派的泛化理论告诉我们&#xff0c;要想让模型在训练集和测试集上都表现差不多&#xff0c;就得让模型简单点。这个…

微信小程序 实现下拉刷新功能

实现小程序中的下拉刷新功能 下拉刷新是小程序中一种非常常见的用户交互方式&#xff0c;通过下拉页面&#xff0c;用户可以自动刷新页面以获取最新的内容。这种功能不仅提高了用户体验&#xff0c;还能确保用户总是看到最新的信息。本文将介绍如何在微信小程序中实现下拉刷新…

JSON 全知全解:深入探索 JSON 的奥秘

目录 一、JSON 基础认知&#xff08;一&#xff09;JSON 的定义与历史&#xff08;二&#xff09;JSON 的语法规则&#xff08;三&#xff09;JSON 与 JS 对象的关系 二、JSON 在不同语言中的用法&#xff08;一&#xff09;JavaScript 中的 JSON 操作&#xff08;二&#xff0…

古典舞在线交流:SpringBoot平台实现与优化

第一章 绪论 1.1研究背景 在当今的社会&#xff0c;可以说是信息技术的发展时代&#xff0c;在社会的方方面面无不涉及到各种信息的处理。信息是人们对客观世界的具体描述&#xff0c;是人们进行交流与联系的重要途径。人类社会就处在一个对信息进行有效合理的加工中。它将促进…