Method and system for analyzing texts
View Patent ↗The invention provides a computer-implemented method and system for analyzing texts. The method comprises the steps of identifying one or more sentences of a first text in a first language; identifying one or more sentences of a second text in a second language; translating the identified one or more sentences of the first text from the first language into the second language; processing the sentences of the first text in the second language and the sentences of the second text in the second language into a first representation of the sentences of the first text, and a second representation of the sentences of the second text; and comparing the first representation of sentences of the first text with the second representation of sentences of the second text to identify one or more sentences of similarity between the first text and the second text.
1 . A computer-implemented method for aligning different language texts, comprising the steps of:
employing an identifying module of a computer device or system to select one or more sentences of a first text in a first language;
employing said identifying module to select one or more sentences of a second text in a second language;
employing a translation module of the computer device or system to translate the selected one or more sentences of the first text from the first language into the second language using a translation application programming interface (API);
employing a processing module of the computer device or system to process the sentences of the first text in the second language into a first representation of the sentences of the first text in the second language and to process the sentences of the second text in the second language into a second representation of the sentences of the second text in the second language; and
employing a comparison module of the computer device or system to compare the first representation of sentences of the first text in the second language with the second representation of sentences of the second text in the second language to determine similarity between the first text and the second text to thereby identify and align one or more corresponding sentences from the first text in the first language with one or more sentences of the second text in the second language to enable alignment of the first text in the first language with the second text in the second language.
2 . The computer-implemented method according to claim 1 , wherein the processing step comprises employing the processing module of the computer device or system to convert the sentences of the first text in the second language and the sentences of the second text in the second language into corresponding first and second vectors.
3 . The computer-implemented method according to claim 2 , wherein the processing step further comprises employing the processing module of the computer device or system to generate a representation comprising the first representation based on the first vectors and to generate another representation comprising the second representation based on the second vectors.
4 . The computer-implemented method according to claim 3 , wherein the processing step comprises processing based on a computer algorithm comprising a word-embedding algorithm.
5 . The computer-implemented method according to claim 3 , wherein the comparing step comprises employing the comparison module of the computer device or system to calculate distances between the first representation and the second representation to identify and align one or more sentences of the first text in the first language with one or more sentences of the second text in the second language.
6 . The computer-implemented method according to claim 2 , wherein the comparing step comprises employing the comparison module of the computer device or system to calculate a cosine distance between the first and second vectors.
7 . The computer-implemented method according to claim 1 , further comprising a step of employing the processing module of the computer device or system to tokenize the sentences of the first text in the second language and the sentences of the second text in the second language prior to the processing step for forming the first and second representations.
8 . The computer-implemented method according to claim 7 , further comprising a step of employing the processing module of the computer device or system to normalize the tokenized sentences of the first text and the second text.
9 . The computer-implemented method according to claim 8 , further comprising a step of employing the processing module of the computer device or system to analyze the normalized, tokenized sentences of the first text and the second text by filtering out one or more stop words.
10 . A computer system comprising a memory for storing data and a processor for executing computer readable instructions, wherein the processor is configured by the computer readable instructions when being executed to implement the method of:
employing an identifying module of a computer system to select one or more sentences of a first text in a first language;
employing said identifying module to select one or more sentences of a second text in a second language;
employing a translation module of the computer system to translate the selected one or more sentences of the first text from the first language into the second language using a translation application programming interface (API);
employing a processing module of the computer system to process the sentences of the first text in the second language into a first representation of the sentences of the first text in the second language and to process the sentences of the second text in the second language into a second representation of the sentences of the second text in the second language; and
employing a comparison module of the computer system to compare the first representation of sentences of the first text in the second language with the second representation of sentences of the second text in the second language to determine similarity between the first text and the second text to thereby identify and align one or more corresponding sentences from the first text in the first language with one or more sentences of the second text in the second language to enable alignment of the first text in the first language with the second text in the second language.
11 . A computer-implemented system for aligning different language texts, comprising:
an identifying module for selecting one or more sentences of a first text in a first language; and for selecting one or more sentences of a second text in a second language;
a translating module for translating the selected one or more sentences of the first text from the first language into the second language using a translation application programming interface (API);
a processing module for processing the sentences of the first text in the second language into a first representation of the sentences of the first text in the second language and to process the sentences of the second text in the second language into a second representation of the sentences of the second text in the second language; and
a comparison module for comparing the first representation of sentences of the first text in the second language with the second representation of sentences of the second text in the second language to determine similarity between the first text and the second text to thereby identify and align one or more corresponding sentences from the first text in the first language with one or more sentences of the second text in the second language to enable alignment of the first text in the first language with the second text in the second language.