Previously I asked a question at here, but it doesn't seems to be at the correct place.
So, I moved it here with more details of what I've done.
Here is the sample data image to be process.
Start with what am I going to do..
What I tried to do here is to automate value extraction.
By referring from Left part which I address as "Attribute", then to extract Right part which I address as "Value".
E.g. Name = Gan Chye Chung; Date of Birth = 10/01/1985; and so on
What I've tried :
- Using Python hard-coded way to extract the Value after managed to identify the Attribute.
So, at here I'm using Tesseract to read each string found, to match with the Attribute list that I want to extract. (E.g. Name) then to assume the right part after Name will be the value until the end of the line. This way works fine, until I realized the tedious part that need to tune the code every time there is a changes in the dataset (tilted image, new attributes, and so on).
- Using sklearn Linear Regression to predict coordinates.
Afterwards, my teammate give me some idea that probably Linear Regression model will work in such case. So I try it by feeding coordinates of Attributes as (X) to predict coordinates of Values as (y). Well, I managed to get TopLeft coordinate of Value pretty accurate, since I'm feeding the same layout of samples with only different value in it for my first batch. Then here I faced another problem, which it seems impossible to predict the width of Value. Since the width of Value is inconsistent, current name probably will be just 14 charactes (including space). But person names can be more or less than that 14 characters which hard to set a standard at it.
- This also sklearn Linear Regression to predict the width or length.
But I add one more field called data_type to differentiate the types which later used for Value's width prediction. Over here, I set the types like this
E.g. Name is a T_varchar_100, dob is T_datetime, age is T_smallint.
Which then, I replace those into number to be able to fit into Linear Regression. Well, it doesn't seems to be a correct way, but I think it will work at the first place. I test to run it, turns out it failed as well to predict the width of the Value.
So, I wonder is there any other better way (or model) to do such prediction on Attribute - Value extraction?
It doesn't have to be a perfect answer.
Any help will be appreciated, link or reading or reference that I can refer to will be great as well. Just to brainstorm any idea that might works.
P.S. I'm not from statistic background, just try to take a tiny step into it. Cheers.