Skip to main content
Syamim
Silver ⭐️
August 19, 2024
Question

WORD REPLACEMENT USING DICTIONARY FILE IN NIFI

Hello everyone.

So I've been finding on How to Perform Word Replacement in a csv file by using a Dictionary File as the Guide.

I've yet unable to succeed in doing this. I was hoping to get it done with just a single dataflow and just by using processors (without script) but I don't know what processors to use. I've tried a few but nothing seems to work. Hopefully I can get help.

The input csv file i have is named try.csv which contains the words that need to be processed (word replacement takes place).

While the dictionary file is named syno_street.csv which have a couple of rows and 3 columns:
column1: original word (need to be searched in input csv)
column2: original word (need to be searched in input csv)
column3: replacement word (the output after processing)

syno_street.csv:

Syamim_0-1724049506813.png

try.csv: (input csv for testing)

Syamim_1-1724049660674.png

Thank you in advance.

2 replies

VidyaSargur
Community Manager
Community Manager
August 20, 2024

@Syamim, Welcome to our community! To help you get the best possible answer, I have tagged our NiFi experts @SAMSAL @MattWho @mburgess  who may be able to assist you further.

Please feel free to provide any additional information or details about your query, and we hope that you will find a satisfactory solution to your question.

Translate
Regards, Vidya Sargur, Community Manager Was your question answered? Make sure to mark the answer as the accepted solution. If you find a reply useful, say thanks by clicking on the thumbs up button.
Syamim
SyamimAuthor
Silver ⭐️
August 20, 2024

Hello,

For the try.csv input, I've successfully configured it. However, what I didn't succeed is when I change the content of the input file to have strings at the front and the back of the words that need to be replaced.

So my try.csv currently looks like this: (testing input file)

Syamim_1-1724143949072.png

and the output is like this:

Syamim_2-1724144019378.png

How do i fix this?

This is my nifi setup currently:

Syamim_3-1724144118236.png

Thank you!

 

Translate