System and method for transforming unstructured text into structured form
A system and method for transforming unstructured text into structured form is disclosed. The system and method include converting an input word sequence (e.g., sentence) into tagged output which can be then easily be converted into a structured format. The system may include a bidirectional recurrent neural network that can generate multiple labels of individual words or phrases. In some embodiments, a customized learning loss equation involving set similarity is used to generate the multiple labels.
1. A method of transforming unstructured text into structured form, comprising:
obtaining a word sequence, including at least a first word and a second word;
obtaining a first word embedding and a first part-of-speech (“POS”) tag embedding both corresponding to the first word;
obtaining a second word embedding and a second POS tag embedding both corresponding to the second word;
concatenating the first word embedding with the first POS word embedding into a first input and the second word embedding with the second POS word embedding into a second input;
using self-attention to process the first input and the second input through a bidirectional recurrent neural network (“RNN”) to generate a first output corresponding to the first input and a second output corresponding to the second input, wherein the first output includes at least two labels corresponding to the first word;
using a loss to perform back-propagation to adjust weights of the bidirectional RNN, wherein the loss is based on both the vector of true labels and the vector of independent probabilities of predicted labels; and
wherein the loss is HL diff , and wherein
HL diff =average( y t *(1− y p )+(1− y t )* y p ),
where y t is the vector of true labels and y p is the vector of independent probabilities of predicted labels.
2. The method of claim 1 , wherein the first output includes three labels corresponding to the first word.
3. The method of claim 1 , wherein the probability that the first word fits with a label is independent of the probability that the first word fits with another label.
4. The method of claim 1 , wherein the bidirectional RNN includes one of a long short-term memory (“LSTM”) and a gated recurrent unit (“GRU”) that controls how information is passed down from layer to layer of the bidirectional RNN.
5. The method of claim 1 , further comprising saving a key pair including the first word and the first output in a database.
6. The method of claim 1 , further comprising saving a key pair including the second word and the second output in a database.
7. The method of claim 1 , wherein at an output layer of the bidirectional RNN, a Sigmoid function is used to normalize each of the label prediction scores between 0 and 1.
8. A non-transitory computer-readable medium storing software comprising instructions executable by one or more computers which, upon such execution, cause the one or more computers to transform unstructured text into structured form by:
obtaining a word sequence, including at least a first word and a second word;
obtaining a first word embedding and a first part-of-speech (“POS”) tag embedding both corresponding to the first word;
obtaining a second word embedding and a second POS tag embedding both corresponding to the second word;
concatenating the first word embedding with the first POS word embedding into a first input and the second word embedding with the second POS word embedding into a second input;
using self-attention to process the first input and the second input through a bidirectional recurrent neural network (“RNN”) to generate a first output corresponding to the first input and a second output corresponding to the second input, wherein the first output includes at least two labels corresponding to the first word;
using a loss to perform back-propagation to adjust weights of the bidirectional RNN, wherein the loss is based on both the vector of true labels and the vector of independent probabilities of predicted labels; and
wherein the loss is HL diff , and wherein
HL diff =average( y t *(1− y p )+(1− y t )* y p ),
where y t is the vector of true labels and y p is the vector of independent probabilities of predicted labels.
9. The non-transitory computer-readable medium storing software of claim 8 , wherein the first output includes three labels corresponding to the first word.
10. The non-transitory computer-readable medium storing software of claim 8 , wherein the probability that the first word fits with a label is independent of the probability that the first word fits with another label.
11. The non-transitory computer-readable medium storing software of claim 8 , wherein the bidirectional RNN includes one of a long short-term memory (“LSTM”) and a gated recurrent unit (“GRU”) that controls how information is passed down from layer to layer of the bidirectional RNN.
12. The non-transitory computer-readable medium storing software of claim 8 , wherein the instructions, upon execution, further cause the one or more computers to transform unstructured text into structured form by:
saving a key pair including the first word and the first output in a database.
13. The non-transitory computer-readable medium storing software of claim 8 , wherein the instructions, upon execution, further cause the one or more computers to transform unstructured text into structured form by:
saving a key pair including the second word and the second output in a database.
14. The non-transitory computer-readable medium storing software of claim 8 , wherein at an output layer of the bidirectional RNN, a Sigmoid function is used to normalize each of the label prediction scores between 0 and 1.
15. A system for transforming unstructured text into structured form, comprising:
one or more computers and one or more storage devices storing instructions that are operable, when executed by the one or more computers, to cause the one or more computers to:
obtain a word sequence, including at least a first word and a second word;
obtain a first word embedding and a first part-of-speech (“POS”) tag embedding both corresponding to the first word;
obtain a second word embedding and a second POS tag embedding both corresponding to the second word;
concatenate the first word embedding with the first POS word embedding into a first input and the second word embedding with the second POS word embedding into a second input;
use self-attention to process the first input and the second input through a bidirectional recurrent neural network (“RNN”) to generate a first output corresponding to the first input and a second output corresponding to the second input, wherein the first output includes at least two labels corresponding to the first word;
using a loss to perform back-propagation to adjust weights of the bidirectional RNN, wherein the loss is based on both the vector of true labels and the vector of independent probabilities of predicted labels; and
wherein the loss is HL diff , and wherein
HL diff =average( y t *(1− y p )+(1− y t )* y p ),
where y t is the vector of true labels and y p is the vector of independent probabilities of predicted labels.
16. The system of claim 15 , wherein the first output includes three labels corresponding to the first word.
17. The system of claim 15 , wherein the probability that the first word fits with a label is independent of the probability that the first word fits with another label.
18. The system of claim 15 , wherein the bidirectional RNN includes one of a long short-term memory (“LSTM”) and a gated recurrent unit (“GRU”) that controls how information is passed down from layer to layer of the bidirectional RNN.
19. The system of claim 15 , wherein the stored instructions are further operable, when executed by the one or more computers, to cause the one or more computers to:
save a key pair including the first word and the first output in a database.
20. The system of claim 15 , wherein the stored instructions are further operable, when executed by the one or more computers, to cause the one or more computers to:
save a key pair including the second word and the second output in a database.