Support Questions

Find answers, ask questions, and share your expertise

How to configure Extracting Text custom process in nifi

avatar
Expert Contributor

Hi,

I've followed the following document and added ExtractText processor supported by TIKA.

ExtractText NiFi Custom Processor Powered by Apache Tika

Could you please help me what properties i need to add for the configuration? I used Getfile to ingest the pdf file, but i am not sure how this custom process should be configured. Any help would be appreciated.

SJ

1 ACCEPTED SOLUTION

avatar
Guru

Hi @Sanaz Janbakhsh

I just did a quick test using GetFile to ingest a PDF, and used the custom processor as is without any configuration. I then used a PutFile to drop the output of the Extracted text to a dir. As expected, the output is the text lifted from the original PDF, in a text file format. No special configuration required. If you are looking to play with the metadata using Tika, you can look at the ExtractMediaMetadata processor which comes with modern versions of NiFi out of the box and uses Tika under the hood.

38478-screen-shot-2017-08-31-at-110825-am.png

View solution in original post

5 REPLIES 5

avatar
Guru

Hi @Sanaz Janbakhsh

I just did a quick test using GetFile to ingest a PDF, and used the custom processor as is without any configuration. I then used a PutFile to drop the output of the Extracted text to a dir. As expected, the output is the text lifted from the original PDF, in a text file format. No special configuration required. If you are looking to play with the metadata using Tika, you can look at the ExtractMediaMetadata processor which comes with modern versions of NiFi out of the box and uses Tika under the hood.

38478-screen-shot-2017-08-31-at-110825-am.png

avatar
Expert Contributor

Hi Sonu,

Thanks for the advice. Just a question, what if i want to extract specific text from pdf and not extract the whole pdf to text.Is it possible?

Thanks

avatar
Guru

Hi @Sanaz Janbakhsh

You could probably achieve that by combining processors. Use the Tika-based processor to extract everything from the pdf in txt form, and then use another processor (ExtractText with RegEx to find your content for example) to extract the specific text you want, and decide what to do with that content from there.

avatar
Expert Contributor

Thanks Sonu

avatar
Master Guru

My custom processor is pretty easy to customize.

https://github.com/tspannhw/nifi-extracttext-processor

You can tweak it to extract just somethings, Apache Tika is very powerful.