Method and system for analyzing text
By identifying, translating and comparing sentence representations in different languages, and using cosine similarity to identify semantically similar sentences, the problem of poor multilingual text matching accuracy in the existing technology is solved, and efficient and accurate text analysis and pairing effects are achieved.
Patent Information
- Application Number
- CN202310330461.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-03-28
- Filing Date
- 2023-03-30
- Publication Date
- 2024-10-01
AI Technical Summary
Existing computer-based text analysis technology has poor accuracy when identifying parallel sentences in different languages, especially when the source document and the target document are composed of different sentence sequences. It is especially difficult to pair multi-lingual texts.
By identifying sentences in the first language, translating and generating representations, processing and comparing them with sentences in the second language, identifying semantically similar sentences using cosine similarity, and generating parallel sentence pairs.
It achieves accurate pairing of texts in different languages, improves the efficiency and accuracy of multilingual text analysis, can quickly process documents containing a large number of words or sentences, and is implemented in user-friendly computer equipment.
Smart Images

Figure CN118734836A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a computer implemented method and system for analyzing text and, in particular, but not exclusively, to a method and system for analyzing the similarity of a piece of text in two or more languages, especially for sentence pairing. Background Art
[0002] Various computer-based language processing tools have been developed. Among different language processing techniques, sentence pairing from text databases such as text corpora is gaining increasing attention. A text corpus can be a linguistic source such as a document or document database with a large and structured collection of texts stored and processed electronically. It can include texts in a single language or in multiple languages. Text corpora become an important resource for state-of-the-art language processing techniques such as natural language processing, computational linguistics, and machine translation.
[0003] Parallel text involves two or more texts placed side by side with translations, while a parallel corpus usually refers to translations of the same text into two or more languages. Parallel text alignment or text pairing therefore requires the identification of corresponding texts, such as sentences, clauses or phrases that make up the texts in different languages.
[0004] Traditional methods for performing parallel sentence pairing can apply known language processing techniques. For example, a translation-based bidirectional method has been proposed to extract parallel sentences from Wikipedia-aligned English and Persian documents (Extracting An English-Persian Parallel Corpus From Comparable Corpora; AkbarKarimi, Ebrahim Ansari, Bahram Sadeghi Bigham; arXiv preprint arXiv: 1711.00681 (2017)). Other methods may include word embedding-based techniques, such as disclosed in H2@BUCC18: Parallel Sentence Extraction from Comparable Corpora Using Multilingual SentenceEmbeddings; Houda Bouamor and Hassan Sajjad; Proceedings of the 11th Workshop on Building and Using Comparable Corpora (BUCC) (2018), which identifies parallel sentence pairs in a French-English corpus by adopting a hybrid approach of multilingual sentence-level embeddings, neural machine translation, and supervised classification. Deep learning-based techniques have also been applied to identify parallel sentences in comparable corpora (BUCC 2017 Shared Task: a First Attempt Toward a Deep Learning Framework for Identifying Parallel Sentences in Comparable Corpora (Grégoire & Langlais, BUCC 2017)). Another parallel text sentence aligner Champollion, also known as dictionary-based language processing technology (Champollion: A Robust Parallel Text Sentence Aligner. Xiaoyi Ma, Proceedings of the Fifth International Conference on Language Resources and Evaluation (LREC. 2006)), only supports alignment of English with Arabic, Chinese, and Hindi, and usually performs poorly when the source and target documents consist of different sentence sequences.
[0005] Purpose of the Invention
[0006] It is an object of the present invention to provide a computer-implemented method and system for analyzing text.
[0007] Another object of the present invention is to alleviate or eliminate to some extent one or more problems associated with known computer-based text analysis techniques, or at least provide a useful alternative.
[0008] The above objects are achieved by the combination of features of the independent claims; the dependent claims disclose further advantageous embodiments of the invention.
[0009] Those skilled in the art will derive other objects of the present invention from the following description. Therefore, the above object statements are not exhaustive, but are only used to illustrate many objects of the present invention. Summary of the invention
[0010] In a first main aspect, the present invention provides a computer-implemented method for analyzing text. 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 to 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 the sentences of the first text with the second representation of the sentences of the second text to identify one or more similar sentences between the first text and the second text.
[0011] In a second main aspect, the invention provides a 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 used to execute to implement the method of the first main aspect.
[0012] In a third main aspect, the present invention provides a computer-implemented system for analyzing text. The system includes: a recognition module for recognizing one or more sentences of a first text in a first language; and for recognizing one or more sentences of a second text in a second language; a translation module for translating the recognized one or more sentences of the first text from the first language into the second language; a processing module for 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 a comparison module for comparing the first representation of the sentences of the first text with the second representation of the sentences of the second text to identify one or more similar sentences between the first text and the second text.
[0013] This summary does not necessarily disclose all the features essential to defining the present invention; the present invention may be realized in sub-combinations of the disclosed features. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The above and other features of the present invention will be apparent from the following description of preferred embodiments provided by way of example only in conjunction with the accompanying drawings, which include:
[0015] Figure 1 is a schematic block diagram of a computer-implemented system for analyzing text according to the present invention;
[0016] Figure 2 It is shown based on Figure 1 A flowchart of the steps of implementing the computer-implemented method of the system;
[0017] Figure 3 showing the accuracy test results of the embodiments of the present invention and the prior art Champollion; and
[0018] Figure 4 The results of the intersection of an embodiment of the present invention and Champollion are shown. DETAILED DESCRIPTION
[0019] The following description is merely intended to illustrate preferred embodiments and is not intended to limit the combination of features necessary to implement the present invention.
[0020] References in this specification to "one embodiment" or "an embodiment" mean that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the invention. The appearance of the phrase "in one embodiment" in various places in this specification does not necessarily refer to the same embodiment, nor are independent or alternative embodiments mutually exclusive of other embodiments. In addition, various features are described that may be present in some embodiments but not in other embodiments. Similarly, various requirements are described that are required for some embodiments but not required for other embodiments.
[0021] It should be understood that the elements shown in the drawings can be implemented by various forms of hardware, software or a combination thereof. Preferably, these elements are implemented with a combination of hardware and software on one or more appropriately programmed general-purpose devices that may include a processor, a memory and an input / output interface.
[0022] This specification illustrates the principles of the present invention. It will therefore be appreciated that those skilled in the art will be able to devise various arrangements that, although not explicitly described or shown herein, embody the principles of the present invention and are included within its spirit and scope.
[0023] In addition, all statements citing the principles, aspects and embodiments of the present invention and their specific examples herein are intended to cover their structural and functional equivalents. In addition, such equivalents are intended to include currently known equivalents and equivalents developed in the future, that is, any element developed to perform the same function, regardless of structure.
[0024] Thus, for example, it will be appreciated by those skilled in the art that the block diagrams presented herein represent conceptual views of systems embodying the principles of the invention.
[0025] The functions of the various elements shown in the figures may be provided through the use of dedicated hardware as well as hardware capable of executing software in association with appropriate software. When provided by a processor, the functions may be provided by a single dedicated processor, a single shared processor, or multiple separate processors, some of which may be shared. In addition, the explicit use of the term "processor" should not be interpreted as referring exclusively to hardware capable of executing software, and may implicitly include, but is not limited to, digital signal processor ("DSP") hardware, read-only memory ("ROM") for storing software, random access memory ("RAM"), and non-volatile memory.
[0026] In the claims herein, any element expressed as a means for performing a particular function is intended to encompass any manner of performing that function, including, for example, a) a combination of circuit elements that perform that function; or b) any form of software (thus including firmware, microcode, etc.), combined with appropriate circuitry for executing that software to perform the function. The invention as defined by such claims resides in the fact that the functions provided by the various described means are combined together in the manner required by the claims. It is therefore considered that any means that can provide those functions are equivalent to the means shown herein.
[0027] The present invention relates to a system and method for analyzing text, more preferably, to a system and method for analyzing text similarity, such as by identifying similar sentences, clauses and / or phrases from texts in two or more languages. In one embodiment, the present invention can be applied to pairing or matching two or more sentences from a parallel text corpus, such as identifying corresponding sentences of a text or texts of the same content or different content of two or more paragraphs in different languages. Generally speaking, parallel texts may involve one or more texts placed side by side with their translations, and parallel text corpora may involve translations of the same paragraph of text in two or more languages. Therefore, parallel text alignment or text pairing requires identifying corresponding sentences from texts in different languages. In the context of the present invention, the term "sentence" should be given a broad meaning to cover a group or a group of words, which can be but not limited to a clause, a phrase or a group of clauses or phrases in the form of a paragraph, preferably, expressing statements, assertions, questions, commands, exclamations, etc. in the text. The text can be a work of any form, such as an article, prose, story, poem or any type of literary work. The term "similarity" may generally refer to semantic similarity, ie relating to meaning, and / or syntactic similarity, e.g. relating to grammar, sentence structure, parts of speech, etc.
[0028] Reference Figure 1 , showing a block diagram of a system for analyzing text according to an embodiment of the present invention. Figure 2 It is further shown that Figure 1 The specific method steps for analyzing text implemented by the system.
[0029] In one embodiment, the system of the present invention can be implemented in any known form of computer device 10, including a desktop computer, a laptop computer, a tablet computer, a smart phone, or any portable electronic smart device. The system and method of the present invention can also be implemented by a network server 110. Preferably, the computer device 10 can be connected to a network 100 (whether private or public, such as the Internet) via a communication module 60 to exchange information or data. The network 100 may include a communication network.
[0030] Specifically, the computer device 10 includes an input interface 20 for inputting text materials to be analyzed. For example, a user can type text through a computer input device, which can include, for example, a keyboard or a touch screen panel. The user can also open a pre-typed, scanned or saved text (e.g., in .txt, .doc, .pdf or .jpg format, etc.) that is prepared in advance and stored in a memory 40 of the computer device 10. The user can also download an electronic document of interest from the Internet 100 through the communication module 60, such as any one or more formats of .txt, .doc or .pdf or any other format for electronic processing.
[0031] The text will then be processed and analyzed by a processor 30. The processor 30 may include a plurality of functional blocks for performing various functions. For example, the processor 30 may include a plurality of modules, including a recognition module 32, a translation module 34, a processing module 36, and a comparison module 38, the functions of which are described below.
[0032] First, recognition module 32 can be configured to recognize or select one or more sentences of the first source text in the first source language, and recognize or select one or more sentences of the second target text in the second target language.Text can include the word block that forms one or more sentences, clauses, phrases or sentences, clauses or phrase groups in one or more paragraph forms.The first language can be any language that is different from the second target language.In one embodiment, the step of identifying text sentences can include based on, for example, identifying punctuation marks or stop words etc. from the text to cut off a corresponding section of text in the sentence structure.
[0033] In one embodiment, the analyzed text may include more than two texts, for example, the first source text includes texts in two or more different languages. In another embodiment, the second target text may require more than one language, for example, two or more different languages. If the content of the first and second texts is the same or different, the recognition of parallel sentences can also be applied.
[0034] The translation module 34 then translates the identified one or more sentences of the first source text from the first language into the second target language. The translation can be performed by any known computer-based language translation tool, such as a translation application programming interface (API), such as the Google translation API, the Amazon translation API, and / or other proprietary translation software or programs.
[0035] The processing module 36 processes the sentences of the first source text, which has now been translated into the second target language, into the first representation of the sentences of the first text, and also processes the sentences of the second text in the second language into the second representation of the sentences of the second text. Specifically, the processing by the processing module 36 may include converting the translated sentences of the first text in the second target language into a first vector, and converting the sentences of the second text in the second language into a second vector, wherein the first vector and the second vector may respectively include digital vectors. More preferably, the first and second vectors will then be further processed by the processing module 36 by generating a representation including a first representation based on the first vector and a second representation based on the second vector. In one embodiment, the representation may include a two-dimensional representation, although other forms of representations such as three-dimensional representations may also be included in the present invention. In a preferred embodiment, the processing step may include processing based on a computer algorithm such as a word embedding algorithm. However, it will be appreciated by those skilled in the art that the processing method is not limited by a specific computer model or algorithm, but may be applicable to any other encoding and / or mapping means for the purpose of language processing, as long as the change does not depart from the inventive concept of the present invention.
[0036] Preferably or optionally, before generating a representation based on a sentence of a first text translated into a second target language and a sentence of a second text in a second target language, the processing module 32 may first segment or divide the data or text of the translated sentence of the first text into a first token sequence, and segment or divide the data or text of the sentence of the second text in the second language into a second token sequence. Tokenization can be achieved by replacing data with a unique identification symbol or token by any known tokenization device. Preferably, the tokenization device roughly divides each text into words. A suitable such tokenization device is the Stanford Tokenizer. The tokenized data will then be normalized and subsequently filtered by deleting irrelevant word units (e.g., one or more stop words that have no useful meaning in the sentence). The filtered data will then be processed into a representation including a first representation of the sentence of the translated first text and a second representation of the sentence of the second text, as described above.
[0037] After generating corresponding representations for corresponding sentences of the first and second texts, the comparison module 38 then compares the first representation of the sentence of the first source text with the second representation of the sentence of the second target text to identify one or more similar sentences between the first text and the second text, and / or identify the sentence from the target text that is most similar to the sentence in the source text, and vice versa. In one embodiment, the comparison is performed by calculating the distance, for example, by determining the cosine distance based on the cosine similarity. The cosine distance between the two non-zero vectors of the first representation and the second representation of the generated two-dimensional representation can be determined, thereby identifying one or more sentences with the highest similarity to one or more sentences of the second target text from the translated first source text, and vice versa. The shorter the determined distance, the higher the similarity that can be inferred, and the longer the determined distance, the greater the difference between the two compared sentences. In a preferred embodiment, the sentence similarity between the first text and the second text refers to semantic similarity, that is, related to the meaning of the sentence, although other types of similarity, such as syntax related to grammar, sentence structure and part of speech, may also be applicable. The identified similar sentences between the first text and the second text can then be paired to form parallel sentence pairs.
[0038] Any suitable method for determining cosine differences may be used. One such suitable method for determining cosine differences includes "Common natural language processing technology] Text similarity (II): Cosine Similarity" published at https: / / ithelp.ithome.com.tw / articles / 10268777.
[0039] In one embodiment, the system of the present invention includes a memory 40 for storing data and a processor 30 for executing computer-readable instructions. When used to perform the steps of the above method, the processor 30 is configured by the computer-readable instructions.
[0040] The accuracy of the system of the present invention was further evaluated and verified by using the known dictionary-based language processing technique Champollion. Figure 2 As shown in FIG. 1 , the same source and target texts are processed by both Champollion and the present invention's systems to identify paired sentences with similar meanings. The resulting paired sentences from Champollion can then be cross-checked with the sentences identified by the present invention for intersection. The results produced by Champollion and the present invention are shown in FIG. Figure 3 As shown, the intersection result is further shown as Figure 4Specifically, two sets of data from each of the systems of the Champollion technique and the present invention, namely (i) by using the original first and second texts of parallel documents as paired inputs (see Figure 3 C and D in ), and (ii) by shuffling one or more sentences in the first and / or second text as paired input (see Figure 3 A and B) in are generated. Figure 3 The results reveal that both Champollion and the present invention's pairings are highly comparable, regardless of whether the text has been previously scrambled or not. Figure 4 It is further revealed that the intersection percentages of paired sentences from different sources in different fields between Champollion and the present invention are generally higher than 58%.
[0041] The advantage of the present invention is that it provides a novel system and method for effectively analyzing texts in different languages or performing text pairing. Specifically, the present invention provides a systematic and accurate method to identify sentence pairs from parallel documents, such as from a parallel text corpus. The system and method can be implemented in a fast, efficient and user-friendly computer device. Therefore, the present invention is suitable for improving existing language processing technologies, such as natural language processing, computational linguistics and / or machine translation technologies, etc. The present invention can also effectively analyze texts in a computationally efficient manner because it involves one or more steps that prevent or reduce unnecessary data processing. For example, a detailed analysis of a document or document containing hundreds or thousands of words or sentences can be efficiently processed in seconds. Multiple texts or documents can also be processed and analyzed simultaneously.
[0042] This description illustrates the principles of the invention. It will therefore be appreciated that those skilled in the art will be able to devise various arrangements which, although not explicitly described or shown herein, embody the principles of the invention and are included within its spirit and scope.
[0043] In addition, all stated principles, aspects and embodiments of the present invention and specific examples thereof herein are intended to include their structural and functional equivalents. In addition, such equivalents are intended to include currently known equivalents and equivalents developed in the future, i.e., any element that performs the same function, regardless of the structure.
[0044] Although the present invention has been shown and described in detail in the accompanying drawings and the foregoing description, the present invention should be considered to be illustrative rather than restrictive. It is understood that only exemplary embodiments are shown and described, and the scope of the present invention is not limited in any way. It is understood that any feature described herein can be used with any embodiment. The illustrative embodiments do not exclude each other, nor do they exclude other embodiments not listed herein. Therefore, the present invention also provides an embodiment including a combination of one or more of the illustrative embodiments described above. Without departing from the spirit and scope of the present invention, the present invention can be modified and varied, and therefore, only such restrictions as defined by the appended claims should be applied.
[0045] In the claims herein, any element expressed as a means for performing a particular function is intended to encompass any manner of performing that function, including, for example, a) a combination of circuit elements that perform that function; or b) any form of software (thus including firmware, microcode, etc.), combined with appropriate circuitry for executing that software to perform the function. The invention as defined by such claims resides in the fact that the functions provided by the various described means are combined together in the manner required by the claims. It is therefore considered that any means that can provide those functions are equivalent to the means shown herein.
[0046] In the appended claims and the preceding description of the invention, unless the context requires otherwise due to express language or necessary implication, the word "comprise" or variations such as "including" or "comprising" in the expressions are used in an inclusive sense. That is, in various embodiments of the invention, it is used to specify the presence of the stated features but does not exclude the presence or addition of other features.
[0047] It will be appreciated that, if any prior art publication is referred to herein, this reference does not constitute an admission that the publication forms part of the common general knowledge in the art.
Claims
1. A computer-implemented method for analyzing text, comprising the following steps: 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 sentence of the first text in the second language and the sentence of the second text in the second language into a first representation of the sentence of the first text and a second representation of the sentence of the second text; and The first representation of the sentence of the first text is compared to the second representation of the sentence of the second text to identify one or more similar sentences between the first text and the second text.
2. The computer-implemented method of claim 1 , wherein: The processing step includes converting the sentence of the first text in the second language and the sentence of the second text in the second language into corresponding first and second vectors.
3. The computer-implemented method of claim 2, wherein: The processing step also includes generating a representation including the first representation based on the first vector and the second representation based on the second vector.
4. The computer-implemented method of claim 3, wherein: The processing step includes processing based on computer algorithms including word embedding algorithms.
5. The computer-implemented method of claim 3, wherein: The comparing step includes calculating a distance between the first representation and the second representation to identify one or more similar sentences between the first text and the second text.
6. The computer-implemented method of claim 5, wherein: The identifying similar sentences includes identifying semantically similar sentences.
7. The computer-implemented method of claim 1, further comprising the step of tokenizing the sentences of the first text and the sentences of the second text in the second language prior to the processing step.
8. The computer-implemented method of claim 7, further comprising the step of normalizing the tokenized sentences of the first text and the second text.
9. The computer-implemented method of claim 8, further comprising the step of analyzing the normalized, tokenized sentences of the first text and the second text by filtering one or more stop words.
10. The computer-implemented method of claim 1, further comprising the step of pairing the compared similar sentences between the first text and the second text.
11. A system comprising a memory for storing data and a processor for executing computer-readable instructions, wherein: When used for execution to implement the method according to any one of claims 1 to 10, the processor is configured by the computer readable instructions.
12. A computer-implemented system for analyzing text, comprising: a recognition module for recognizing one or more sentences of a first text in a first language; and one or more sentences for identifying a second text in a second language; a translation module, the translation module being configured to translate the identified one or more sentences of the first text from the first language into the second language; a processing module, the processing module being configured to process the sentence of the first text in the second language and the sentence of the second text in the second language into a first representation of the sentence of the first text and a second representation of the sentence of the second text; and A comparison module is configured to compare the first representation of the sentence of the first text with the second representation of the sentence of the second text to identify one or more similar sentences between the first text and the second text.
