gpt4 book ai didi

apache-tika - Apache Tika 不提取 RTF 文件的第一行,它只提取第一行的最后三个字符。

转载 作者:行者123 更新时间:2023-12-01 13:28:31 38 4
gpt4 key购买 nike

我在评论中添加了RTF文件。在文本编辑器中复制以下文本并另存为RTF格式。

This is a view of RFT file when you will open in any RTF viewer.

BodyContentHandler handler = new BodyContentHandler();
Metadata metadata = new Metadata();
FileInputStream inputstream = new FileInputStream(new File("level1Missing.rtf"));
ParseContext pcontext = new ParseContext();
RTFParser rt = new RTFParser();
rt.parse(inputstream, handler, metadata, pcontext);
//getting the content of the document
System.out.println("Contents of the PDF :\n\n" + handler.toString());

Output of the above code is.

最佳答案

在我看来,Apache Tika 没有问题。关键性在rtf文件中;在{\line {\b Level1} :\par}之前少了一个\par

你可以试试这个另一个简单的文件:

{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\par
This is some {\b bold} text.\par
}

如果在 This is some {\b bold} text.\par 之前删除 \par,tika 将提取第一行的最后一个字符。

关于apache-tika - Apache Tika 不提取 RTF 文件的第一行,它只提取第一行的最后三个字符。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47218379/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com