Document extraction template induction
A method for document extraction includes receiving, from a user device associated with a user, an annotated document that includes one or more fields. Each respective field of the one or more fields of the annotated document is labeled by a respective annotation. The method includes clustering, using a template matching algorithm, the annotated document into a cluster and inducing, using the annotated document, a document template for the cluster. The method includes receiving, from the user device, an unannotated document including the one or more fields. The method includes clustering, using the template matching algorithm, the unannotated document into the cluster and, in response to clustering the unannotated document into the cluster, extracting, using the document template, the one or more fields.
1 . A computer-implemented method executed by data processing hardware that causes the data processing hardware to perform operations comprising:
receiving, from a user device associated with a user, an annotated document, the annotated document comprising one or more fields, each respective field of the one or more fields of the annotated document labeled by a respective annotation;
determining, using a template matching algorithm that evaluates non-value text and structural layout features of documents, that the annotated document fails to satisfy a similarity threshold with each cluster in a set of clusters;
based on determining that the annotated document fails to satisfy the similarity threshold, clustering, using the template matching algorithm, the annotated document into a new cluster of the set of clusters;
inducing, using the annotated document assigned to the new cluster, a document template for the new cluster, the document template defining expected spatial locations of the one or more fields relative to non-value text and structural layout features of the annotated document;
receiving, from the user device, an unannotated document comprising the one or more fields;
clustering, using the template matching algorithm, the unannotated document into the new cluster; and
in response to clustering the unannotated document into the new cluster, extracting, using the document template, the one or more fields by applying the defined expected spatial locations of the one or more fields from the document template to the unannotated document to identify and retrieve content from corresponding regions.
2 . The method of claim 1 , wherein inducing the document template for the new cluster comprises training an extraction model using the annotated document.
3 . The method of claim 2 , wherein the operations further comprise combining the extraction model for the new cluster with another extraction model from a different cluster.
4 . The method of claim 1 , wherein the operations further comprise:
receiving, from the user device, a second annotated document, the second annotated document comprising one or more different fields, each respective different field of the one or more different fields of the second annotated document labeled by a respective annotation; and
clustering, using the template matching algorithm, the second annotated document into a second cluster of the set of clusters; and
inducing, from the second annotated document, a second document template for the second cluster.
5 . The method of claim 1 , wherein obtaining the annotated document comprises requesting, from the user device, the annotated document.
6 . The method of claim 1 , wherein the template matching algorithm comprises an unsupervised algorithm.
7 . The method of claim 1 , wherein each respective annotation comprises a tag and a bounding box.
8 . The method of claim 1 , wherein the annotated document comprises a form.
9 . The method of claim 1 , wherein the operations further comprise:
receiving, from the user device, a set of unannotated documents, each respective unannotated document of the set of unannotated documents comprising one or more respective fields; and
for each respective unannotated document in the set of unannotated documents:
clustering, using the template matching algorithm, the respective unannotated document into a respective cluster, the respective cluster associated with a respective document template; and
extracting, using the respective document template, the one or more respective fields.
10 . The method of claim 1 , wherein the template matching algorithm comprises a bag-of-words algorithm.
11 . A system comprising:
data processing hardware; and
memory hardware in communication with the data processing hardware, the memory hardware storing instructions that when executed on the data processing hardware cause the data processing hardware to perform operations comprising:
receiving, from a user device associated with a user, an annotated document, the annotated document comprising one or more fields, each respective field of the one or more fields of the annotated document labeled by a respective annotation;
determining, using a template matching algorithm that evaluates non-value text and structural layout features of documents, that the annotated document fails to satisfy a similarity threshold with each cluster in a set of clusters;
based on determining that the annotated document fails to satisfy the similarity threshold, clustering, using the template matching algorithm, the annotated document into a new cluster of the set of clusters;
inducing, using the annotated document assigned to the new cluster, a document template for the new cluster, the document template defining expected spatial locations of the one or more fields relative to non-value text and structural layout features of the annotated document;
receiving, from the user device, an unannotated document comprising the one or more fields;
clustering, using the template matching algorithm, the unannotated document into the new cluster; and
in response to clustering the unannotated document into the new cluster, extracting, using the document template, the one or more fields by applying the defined expected spatial locations of the one or more fields from the document template to the unannotated document to identify and retrieve content from corresponding regions.
12 . The system of claim 11 , wherein inducing the document template for the new cluster comprises training an extraction model using the annotated document.
13 . The system of claim 12 , wherein the operations further comprise combining the extraction model for the new cluster with another extraction model from a different cluster.
14 . The system of claim 11 , wherein the operations further comprise:
receiving, from the user device, a second annotated document, the second annotated document comprising one or more different fields, each respective different field of the one or more different fields of the second annotated document labeled by a respective annotation; and
clustering, using the template matching algorithm, the second annotated document into a second cluster of the set of clusters; and
inducing, from the second annotated document, a second document template for the second cluster.
15 . The system of claim 11 , wherein obtaining the annotated document comprises requesting, from the user device, the annotated document.
16 . The system of claim 11 , wherein the template matching algorithm comprises an unsupervised algorithm.
17 . The system of claim 11 , wherein each respective annotation comprises a tag and a bounding box.
18 . The system of claim 11 , wherein the annotated document comprises a form.
19 . The system of claim 11 , wherein the operations further comprise:
receiving, from the user device, a set of unannotated documents, each respective unannotated document of the set of unannotated documents comprising one or more respective fields; and
for each respective unannotated document in the set of unannotated documents:
clustering, using the template matching algorithm, the respective unannotated document into a respective cluster, the respective cluster associated with a respective document template; and
extracting, using the respective document template, the one or more respective fields.
20 . The system of claim 11 , wherein the template matching algorithm comprises a bag-of-words algorithm.