So we are tasked to create a code where the result of the Easyocr into a table (specifically food menus). The brick wall starts right after obtaining the result from easyocr since it I tried sorting the result but it sorts per character and number instead of words and price. I know that creating a list manually will solve it but it beats the purpose of automating the code of applying discount on a ocr.
We read the text:
result2 = reader.readtext(IMAGE_PATH, detail=0, slope_ths= 0.2)
result2 contains the following:
['SIZZLING SPECIALS',
'Spareribs',
'195.00',
'Pork Katsudon',
'175.00',
'Sizzling Sisig',
'180.00',
'Sisig Pulutan',
'160.00',
'Pork',
'Barbeque',
'160.00',
'Pork Teriyaki',
'160.00',
'Peruvian Chicken',
'160.,00',
'Stuffed Squid',
'345.00',
'Boneless Bangus',
'150.00',
"Tokwa't Baboy",
'150.00',
'Sizzling Lomi',
'110.00']
I wanted to have a result where in the food name and the price are in separate columns. As well as to apply discount to the price.
Column 1 | Column 2 |
---|---|
Spareribs | 195.00-20% |
Pork Katsudon | 175.00-20% |
... | ... |
... | ... |
... | ... |
Sizzling lomi | 115.00-20% |
You would need to do some data cleaning, but try the following: