2
$\begingroup$

believe me if I say that I have read basically all the threads in this website regarding this subject. A lot of them have a similar title, but the problem is somehow different.

Small context: just started studying TensorFlow, and I am new to the machine learning world, too...so sorry for any stupid thing I will write in this post. I am studying the foundation of this subject, of course, but I would like to know if at the end I will be able to solve a specific scenario, and to obtain a good direction to follow.

Scenario: I have a lot of documents (paper documents converted to PDFs/images) that have the same structure...a template with few user-filled content. Let's give an example (variables in bold):

Police Department of New York [...] The driver John Doe, born on 2019-04-03, owner of a some_car_model_here
with the driver license XY123ZZ" etc...

So basically I need to extract the entities name, the birthdate, the car model, the driver license and so on. Additionally, there can be different names and different dates on the document, so the context is important. Example: I only need the name that comes after the words "The driver".

What I am doing now:

  1. Extract the content of the document (in blocks) with Google Vision
  2. Checking the first sentences of the document to understand which set of regex to apply (in this case, I should apply the "Police Department" of "New York" set of regexes)
  3. Apply the regexes order to extract entities from this document

What I want to do: I was hoping to have a smartest way that increases the chance to correctly extract what I need, if I periodically add tons of documents to a hypothetical training set. This is why I was thinking about "machine learning", and this is why I have identified TensorFlow as a possible library for it.

I have already seen that NLTK could be an option, but at the end (correct me if I am wrong) I should write my own rules, probably regex again, to extract some custom content. I have read also about NER, but hardly thinking how it can help.

So basically what I am asking is: can I perform this task with Tensorflow (or a "machine learning"-related library)? Is there a specific subject/branch to look for? Do you have any other suggestion (if I am on the wrong track)?

Thanks, Lorenzo

$\endgroup$
  • 1
    $\begingroup$ Hi @Lorenzo S interesting! In the end it is a NER problem, and NER hasn't been solved. So the question is: How well do you need it to preform? Also note that some of your features can be expected to be regular (such as dates and license numbers), but names aren't. $\endgroup$ – S van Balen Aug 8 '19 at 15:16
  • $\begingroup$ thanks for your reply! After studying the subject more deeply, I can now see how this can be a NER problem, in the sense that I can focus on the shape of the word / words structure in order to create custom entities. But I was thinking to another approach, based on the fact that all the documents have the same structure, and the same paragraphs. So I was hoping to "easily" extract what wasn't on the template. Don't know if I my point it's clear, hopefully it is :) $\endgroup$ – Lorenzo S Aug 9 '19 at 13:53
  • $\begingroup$ I will add an example to better explain why I thought about the template-first approach. In the document there are different NAMES (the guy who took the fine, the policeman name who did the fine), different CITIES (where the guy is born, where the guy lives, the place related to the fine), different DATES (when the guy was born, when the guy took the fine, when the notification was sent, etc..). So the context was somehow important: a name that has around a certain sentence should have a different entity...hopefully this can give some additional context! :) $\endgroup$ – Lorenzo S Aug 9 '19 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.