Search using multiple vector spaces
An electronic apparatus is disclosed. The electronic apparatus includes a memory configured to store a plurality of searchable texts and a plurality of neural network models, and a processor. The processor is configured to identify a first entity among words included in an input text by inputting the input text into a first neural network model, acquire at least one text among the searchable texts which is positioned adjacent to the identified first entity on a first vector space by inputting the identified first entity into a second neural network model, identify at least one text among the acquired texts which is positioned adjacent to the input text on a second vector space, and output a search result based on the identified text.
1 . An electronic apparatus for performing a search, the electronic apparatus comprising:
memory configured to store a plurality of searchable texts and a plurality of neural network models, the plurality of neural network models including a first neural network model and a second neural network model; and
at least one processor configured to:
identify a first entity among words included in input text by inputting the input text into the first neural network model;
position the identified first entity on a first vector space by inputting the identified first entity into the second neural network model;
convert the input text into an input vector and position the input vector on a second vector space that is different from the first vector space by inputting the input text into a third neural network model, wherein the third neural network model is configured to be trained to position the input text on the second vector space by converting the input text to the input vector;
acquire at least one text, among the plurality of searchable texts, which is positioned adjacent to the identified first entity on the first vector space, wherein a number of the acquired at least one text is less than a number of the plurality of searchable texts;
convert the acquired at least one text into at least one text vector and position the at least one text vector on the second vector space by inputting the at least one acquired text into the third neural network model;
compare, on the second vector space, the at least one text vector and the input vector;
identify at least one text, among the at least one acquired text, which is positioned adjacent to the input text on the second vector space, by acquiring at least one identifying vector positioned adjacent to the input vector, the identified at least one text corresponding to the acquired at least one identifying vector; and
output a search result based on the identified at least one text,
wherein the first neural network model is configured,
when a first training text belonging to a question category is configured to have a mapping relation with a third training text belonging to an answer category, and when a second training text belonging to the question category is configured to have a mapping relation with a fourth training text belonging to the answer category, to apply weights by comparing the first training text and the second training text to thereby identify a first word included in the first training text and a second word included in the second training text having different meanings, and
based on the third training text and the fourth training text being identified as having different meanings, applying a larger weight to the first word relative to weights applied to other words included in the first training text, and apply a larger weight to the second word relative to weights applied to other words included in the second training text.
2 . The electronic apparatus of claim 1 ,
wherein each of the plurality of searchable texts corresponds to a respective second entity of a plurality of second entities, each of the plurality of second entities being positioned on the first vector space, and
wherein the at least one processor is configured to acquire the at least one text among the plurality of searchable texts by:
identifying at least one second entity which is positioned adjacent to the first entity on the first vector space; and
acquiring each searchable text corresponding to the identified at least one second entity.
3 . The electronic apparatus of claim 2 ,
wherein the at least one processor is configured to identify the at least one second entity positioned adjacent to the first entity by comparing, on the first vector space, a position of the first entity with at least one position respectively corresponding to at least one of the plurality of second entities.
4 . The electronic apparatus of claim 1 ,
wherein the at least one processor is configured to identify the acquired at least one text positioned adjacent to the input text by comparing, on the second vector space, a position of the input text with at least one position respectively corresponding to at least one of the plurality of searchable texts.
5 . The electronic apparatus of claim 1 ,
wherein the first neural network model is configured to apply a different weight to each word included in a training text, at least one word having a largest weight, relative to weights of other words included in the training text, being thereby labeled as an entity corresponding to the training text.
6 . The electronic apparatus of claim 1 ,
wherein the input text and each of the plurality of searchable texts are each configured to be text in a form of a sentence included in at least one of a question category or an answer category, and
wherein each text included in the question category among the plurality of searchable texts is configured to have a mapping relation with a corresponding text included in the answer category among the plurality of searchable texts.
7 . The electronic apparatus of claim 6 ,
wherein the at least one processor is configured, when the input text is included in the question category, to acquire the at least one text by acquiring at least one searchable text included in the question category and positioned adjacent to the identified first entity on the first vector space, and
wherein the at least one processor is configured, when the input text is included in the question category, to output the search result based on at least one searchable text included in the answer category and having a mapping relation with the identified at least one text.
8 . A method of controlling an electronic apparatus for performing a search, the electronic apparatus including a plurality of texts, the method comprising:
identifying a first entity among words included in input text by inputting the input text into a first neural network model;
positioning the identified first entity on a first vector space by inputting the identified first entity into a second neural network model;
converting the input text into an input vector and position the input vector on a second vector space that is different from the first vector space by inputting the input text into a third neural network model, wherein the third neural network model is configured to be trained to position the input text on the second vector space by converting the input text to the input vector;
acquiring at least one text, among a plurality of searchable texts, which is positioned adjacent to the identified first entity on the first vector space, wherein a number of the acquired at least one text is less than a number of the plurality of searchable texts;
converting the acquired at least one text into at least one text vector and positioning the at least one text vector on the second vector space by inputting the at least one acquired text into the third neural network model;
comparing, on the second vector space, the at least one text vector and the input vector;
identifying at least one text, among the at least one acquired text, which is positioned adjacent to the input text on the second vector space, by acquiring at least one identifying vector positioned adjacent to the input vector, the identified at least one text corresponding to the acquired at least one identifying vector; and
outputting a search result based on the identified at least one text,
wherein the first neural network model is configured, when a first training text belonging to a question category is configured to have a mapping relation with a third training text belonging to an answer category, and when a second training text belonging to the question category is configured to have a mapping relation with a fourth training text belonging to the answer category, to apply weights by comparing the first training text and the second training text belonging to a question category and identify a first word included in a first training text and a second word included in a second training text having different meanings, and
based on the third training text and the fourth training text being identified as having different meanings, applying a larger weight to the first word relative to weights applied to other words included in the first training text, and apply a larger weight to the second word relative to weights applied to other words included in the second training text.
9 . The method of claim 8 ,
wherein each of the plurality of searchable texts corresponds to a respective second entity of a plurality of second entities, each of the plurality of second entities being positioned on the first vector space, and
wherein the acquiring of the at least one text among the plurality of searchable texts includes:
identifying at least one second entity which is positioned adjacent to the first entity on the first vector space; and
acquiring each searchable text corresponding to the identified at least one second entity.
10 . The method of claim 9 ,
wherein the identifying of the at least one second entity positioned adjacent to the first entity includes comparing, on the first vector space, a position of the first entity with at least one position respectively corresponding to at least one of the plurality of second entities.
11 . The method of claim 8 ,
wherein the identifying of the acquired at least one text positioned adjacent to the input text includes comparing, on the second vector space, a position of the input text with at least one position corresponding to each of the plurality of searchable texts.
12 . The method of claim 8 ,
wherein the first neural network model is configured to apply a different weight to each word included in training text, at least one word having a largest weight, relative to weights of other words included in the training text, being thereby labeled as an entity corresponding to the training text.
13 . The method of claim 8 ,
wherein the input text and each of the plurality of searchable texts are each configured to be text in a form of a sentence included in at least one of a question category or an answer category, and
wherein each text included in the question category among the plurality of searchable texts is configured to have a mapping relation with a corresponding text included in the answer category among the plurality of searchable texts.
14 . The method of claim 13 ,
wherein the acquiring further comprises, when the input text is included in the question category, acquiring the at least one text by acquiring at least one searchable text included in the question category and positioned adjacent to the identified first entity on the first vector space, and
wherein the outputting further comprises, when the input text is included in the question category, outputting the search result based on at least one searchable text included in the answer category and having a mapping relation with the identified at least one text.