Word vector acquisition method, text correction method, device and electronic equipment

CN116127961BActive Publication Date: 2026-08-21MASHANG CONSUMER FINANCE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210884010.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-26
Publication Date
2026-08-21
Estimated Expiration
2042-07-26

AI Technical Summary

Technical Problem

[0003]本公开提供一种词向量获取方法、装置、电子设备及计算机可读存储介质,以解决相关技术中的词向量表征力不足的问题

Benefits of technology

[0012] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116127961B_ABST
    Figure CN116127961B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a word vector obtaining method, a text error correction method, a device and an electronic equipment. The word vector obtaining method comprises: obtaining a sentence pair comprising a first sentence and a second sentence, a word meaning difference semantic element sequence of a first word included in the first sentence and a second word included in the second sentence; wherein the first sentence and the second sentence are only different in the first word and the second word, and the word meaning difference semantic element sequence is a semantic element sequence reflecting the word meaning difference between the first word and the second word; training a machine learning model based on the sentence pair and the word meaning difference semantic element sequence; obtaining a semantic element sequence of the first word in the machine learning model training process; and obtaining a word vector corresponding to the first word based on a semantic element vector of each semantic element in the semantic element sequence of the first word.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of natural language processing technology, and in particular to a word vector acquisition method, apparatus, electronic device, and computer-readable storage medium. Background Technology

[0002] Currently, most natural language processing tasks employ pre-trained language models, fine-tuning them in downstream tasks to achieve downstream predictions. Words are often represented using word vectors, positional encodings, etc. However, existing methods for obtaining word vectors are based solely on the training corpus itself. Therefore, word vectors change with the training corpus, making it impossible to interpret the semantic changes of a word in different contexts, the aggregation relationships between words, the combinational relationships between words, or the essential difference between good and bad sentences. In summary, the representational power of word vectors needs improvement. Summary of the Invention

[0003] This disclosure provides a word vector acquisition method, apparatus, electronic device, and computer-readable storage medium to address the problem of insufficient word vector representation power in related technologies.

[0004] According to a first aspect of the present disclosure, a word vector acquisition method is provided, comprising: acquiring a sentence pair including a first sentence and a second sentence, and a semantic feature sequence of a first word included in the first sentence and a second word included in the second sentence; wherein the semantic feature sequence is a sequence of features reflecting the semantic difference between the first word and the second word obtained by comparing the sentence pair when only the first word and the second word differ in the first sentence and the second sentence; training a machine learning model based on the sentence pair and the semantic feature sequence; obtaining the feature sequence of the first word during the training of the machine learning model; and obtaining the word vector corresponding to the first word based on the feature vector of each feature in the feature sequence of the first word.

[0005] It can be seen that since the word vector corresponding to the first word is obtained based on the semantic vector of each semantic element in the semantic element sequence of the first word, and the semantic element sequence of the first word is obtained during the training of the machine learning model based on the sentence pair and the semantic difference semantic element sequence, and the semantic difference semantic element sequence is obtained by comparing the sentence meanings of the sentence pair when only the first word and the second word are different, the semantic element sequence of the first word obtained during the training of the machine learning model can reflect the semantic difference between the first word and the second word, so that the word vector obtained based on the semantic vector of each semantic element in the semantic element sequence of the first word takes into account the difference between words in terms of semantic elements, thereby improving the representation power of the word vector.

[0006] According to a second aspect of the present disclosure, a text correction method is provided, comprising: acquiring a first text; performing word segmentation on the first text; acquiring a feature representation of each word in the first text; wherein the feature representation includes a first word vector of each word in the first text, the first word vector being obtained based on a first semantic vector of the corresponding word; performing text correction on a second text based on the feature representation; wherein the second text is the same as the first text or is another text obtained based on the first text.

[0007] It can be seen that after the first text is segmented, the second text (which is the same as the first text or another text obtained based on the first text) is corrected based on the feature representation of the first word vector including each word in the first text. Since the first word vector obtained based on the semantic vector of the corresponding word has stronger representational power, the text correction effect based on the feature representation including such word vector is better. According to a third aspect of the present disclosure, a word vector acquisition apparatus is provided, comprising: a data acquisition unit configured to acquire a sentence pair including a first sentence and a second sentence, and a semantic feature sequence of a first word included in the first sentence and a second word included in the second sentence; wherein the semantic feature sequence is a sequence of features reflecting the semantic difference between the first word and the second word obtained by comparing the sentence pair when only the first word and the second word differ in the first sentence and the second sentence; a training unit configured to train a machine learning model based on the sentence pair and the semantic feature sequence; and to obtain a semantic feature sequence of the first word during the training of the machine learning model; and a word vector acquisition unit configured to obtain a word vector corresponding to the first word based on the semantic feature vector of each semantic feature in the semantic feature sequence of the first word.

[0008] According to a fourth aspect of the present disclosure, a text correction apparatus is provided, comprising: a text acquisition unit configured to acquire a first text; a word segmentation unit configured to perform word segmentation processing on the first text; a feature representation unit configured to acquire a feature representation of each word in the first text; wherein the feature representation includes a first word vector of each word in the first text, the first word vector being obtained based on a first semantic vector of the corresponding word; and an error correction unit configured to perform text correction on a second text based on the feature representation; wherein the second text is the same as the first text or is another text obtained based on the first text.

[0009] According to a fifth aspect of the present disclosure, an electronic device is provided, the electronic device comprising: at least one processor; at least one memory storing computer-executable instructions, wherein, when executed by the at least one processor, the computer-executable instructions cause the at least one processor to perform a word vector acquisition method or a text correction method as described above.

[0010] According to a sixth aspect of the present disclosure, a computer-readable storage medium for storing instructions is provided, characterized in that, when the instructions are executed by at least one processor, they cause the at least one processor to perform the word vector acquisition method or text correction method as described above.

[0011] According to a seventh aspect of the present disclosure, computer software is provided, including computer instructions that, when executed by a processor, implement the word vector acquisition method or text correction method as described above.

[0012] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0013] The accompanying drawings, which are incorporated in and form part of this specification, illustrate exemplary embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.

[0014] Figure 1 This is an exemplary system architecture to which embodiments of this disclosure can be applied;

[0015] Figure 2 This is a flowchart of a word vector acquisition method according to an embodiment of this disclosure;

[0016] Figure 3 This is a schematic diagram illustrating a word vector acquisition method according to an embodiment of the present disclosure;

[0017] Figure 4 This is a flowchart of a text correction method according to an embodiment of the present disclosure;

[0018] Figure 5 This is a schematic diagram illustrating an example of a text correction method according to an embodiment of the present disclosure;

[0019] Figure 6 This is a block diagram of a word vector acquisition device according to an embodiment of the present disclosure;

[0020] Figure 7 This is a block diagram of a text correction device according to an embodiment of the present disclosure;

[0021] Figure 8 This is a block diagram of an electronic device according to an embodiment of the present disclosure. Detailed Implementation

[0022] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0023] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following examples do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0024] It should be noted that the phrase "at least one of several items" in this disclosure refers to three parallel cases: "any one of the several items", "a combination of any number of the several items", and "all of the several items". For example, "including at least one of A and B" includes the following three parallel cases: (1) including A; (2) including B; (3) including A and B. As another example, "performing at least one of step one and step two" indicates the following three parallel cases: (1) performing step one; (2) performing step two; (3) performing both step one and step two.

[0025] As stated in the background section of this application, current word vector acquisition methods are based solely on the training corpus itself. These methods rely on the probabilities of words appearing in the training corpus to determine the correlation between words, and then use this correlation to determine the word vector for each word. Because such methods do not consider the semantic differences between words, the connections between words cannot be explained, and the representational power of the obtained word vectors needs improvement. To address this, this invention proposes to consider the semantic differences between words to acquire word vectors based on semantic vectors, thereby improving the representational power of the acquired word vectors. This improved representational power will enhance the effectiveness of using word vectors in natural language processing tasks.

[0026] For example, current text correction methods only perform text correction based on word vectors obtained through traditional methods. Since they do not consider semantic features at the micro-level, the text correction effect is poor. To address this, this disclosure proposes a text correction method based on semantic feature vectors. Because text correction is performed at the micro-level of semantics based on word vectors obtained from semantic feature vectors, the text correction effect can be improved.

[0027] Figure 1 An exemplary system architecture 100 to which embodiments of this disclosure may be applied is shown.

[0028] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables. Users can use terminal devices 101, 102, and 103 to interact with server 105 through network 104 to receive or send messages (e.g., text data upload requests, text data download requests, etc.). Various communication client applications may be installed on terminal devices 101, 102, and 103, such as text correction software, text translation software, audio / video communication software, audio / video recording software, instant messaging software, conferencing software, email clients, social media platform software, etc. Terminal devices 101, 102, and 103 may be hardware or software. When terminal devices 101, 102, and 103 are hardware, they can be various electronic devices with displays capable of text display, audio and video playback, recording, editing, etc., including but not limited to smartphones, tablets, laptops, and desktop computers. When terminal devices 101, 102, and 103 are software, they can be installed in the aforementioned electronic devices. They can be implemented as multiple software programs or software modules (e.g., to provide distributed services) or as a single software program or software module. No specific limitations are made here.

[0029] Terminal devices 101, 102, and 103 may be equipped with image acquisition devices to acquire image or video data, which may include text data. For example, the text correction method of this disclosure embodiment can be used to correct such text data. Alternatively, the text correction method of this disclosure embodiment can be used to correct text obtained by translating such text data. Furthermore, terminal devices 101, 102, and 103 may also be equipped with components for converting electrical signals into sound (e.g., speakers) to play sound, and may also be equipped with devices for converting analog audio signals into digital audio signals (e.g., microphones) to acquire sound. Additionally, terminal devices 101, 102, and 103 can communicate with each other via voice or video. The acquired or communicated sound can be converted into text data, and subsequently, the text correction method of this disclosure embodiment can be used to correct such text data.

[0030] Server 105 can be a server providing various services, such as a backend server supporting multimedia applications installed on terminal devices 101, 102, and 103. The backend server can parse and store received text data upload requests, and can also receive text data download requests sent by terminal devices 101, 102, and 103, and feed back the text data indicated by the download request to terminal devices 101, 102, and 103. Terminal devices 101, 102, and 103 can use the text correction method of this disclosure to correct errors in the obtained text data. The above are merely examples of application scenarios for the text correction method of this disclosure; however, its application is not limited to the above scenarios, but can be applied to any scenario where text exists and text correction is required.

[0031] In addition, server 105 or terminal devices 101, 102, and 103 can acquire a large amount of text data and use the word vector acquisition method of this disclosure to obtain word vectors for various words. The acquired word vectors can be used for various natural language processing applications, such as text correction, but are not limited thereto.

[0032] It should be noted that a server can be either hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When the server is software, it can be implemented as multiple software programs or software modules (e.g., used to provide distributed services), or as a single software program or software module. No specific limitations are made here.

[0033] It should be noted that the word vector acquisition method or text correction method provided in this disclosure can be executed by a server, a terminal device, or by a combination of both. Accordingly, the word vector acquisition device or text correction device can be located in the terminal device, the server, or both.

[0034] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Any number of terminal devices, networks, and servers can be used as needed, and this disclosure places no limitation on this.

[0035] The following reference Figure 2 and Figure 3 A word vector acquisition method according to an embodiment of the present disclosure is described.

[0036] Figure 2 This is a flowchart of a word vector acquisition method according to an embodiment of the present disclosure.

[0037] Reference Figure 2, in step S210, obtain a sentence pair including a first sentence and a second sentence, and a semantic difference morpheme sequence of a first word included in the first sentence and a second word included in the second sentence. According to an embodiment, the first sentence and the second sentence are different only in the first word and the second word. In short, the first sentence and the second sentence are different only in one word. For example, the first sentence can be "I love the sea", and the second sentence can be "I love the river", and the first sentence and the second sentence are different only in "sea" and "river". According to an embodiment, the second word can be a synonym or an antonym of the first word, but is not limited thereto. According to an embodiment, the semantic difference morpheme sequence is a morpheme sequence reflecting the semantic difference between the first word and the second word. For example, the semantic difference morpheme sequence of the first word and the second word can be determined by comparing the definitions (lexical entries) of the first word and the second word in a dictionary. Specifically, there is at least one lexical entry for each word in the dictionary, and a word usually can have several meanings at the same time, and one meaning of a word is a lexical entry. The morphemes of a word obtained by analyzing the lexical entries of the word are the smallest units constituting the word meaning. For example, the lexical entry of "man" in Chinese can be "male adult", and its morphemes can be "person", "male", "adult". The lexical entry of "woman" in Chinese can be "female adult", and its morphemes can be "person", "female", "adult". The semantic difference morphemes between "man" and "woman" can include "male". In addition to the above method, the semantic difference morpheme sequence of the first word and the second word can also be obtained by comparing the sentence meanings of the sentence pair including the first sentence and the second sentence. That is, the words are placed in sentences to further compare their semantic differences, and then their more hidden semantic difference morphemes are obtained. For example, by comparing the sentence meanings of the sentence "I swam across Qinghai" and the sentence "I swam across the ocean", for example, the semantic difference morphemes between "Qinghai" and "ocean" can be "place name", "province", etc. A semantic difference morpheme sequence can be composed of multiple semantic difference morphemes.

[0038] In step S220, train a machine learning model based on the sentence pair and the semantic difference morpheme sequence. According to an embodiment, a morpheme sequence of the first word is obtained during the training process of the machine learning model. Specifically, the morpheme sequence of the first word can be obtained based on the output of the machine learning model during the training process. According to an embodiment, the machine learning model can be a pre-trained language model with the target task of obtaining the morphemes of the first word, that is, the output of the machine learning model is the morphemes of the first word. Generally, the pre-trained language model can learn a good feature representation for words by running a self-supervised learning method based on a large amount of corpus. In an embodiment of the present invention, the sentence pair is used as a sample, and at the same time, supervised by the semantic difference morpheme sequence, the pre-trained language model is trained. Each output during the training process of the pre-trained language model is the morphemes of the first word, and the morpheme sequence of the first word can be obtained by arranging all the morphemes output by the pre-trained language model during the training process.

[0039] Specifically, when training a machine learning model, first, obtain multiple sememe vectors corresponding to each word in the first sentence and the second sentence, and the sememe vectors of each sememe in the sememe difference sequence of the word meaning from the sememe space set. Subsequently, train the machine learning model based on the obtained sememe vectors. According to an embodiment, the sememe space set includes multiple sememe spaces, and each sememe space is constructed based on sememes of the same type in the sememe lists of multiple words. The sememe list includes the basic sememes and the differentiating sememes of the corresponding word meaning. According to an embodiment, the above-mentioned multiple words can be any words in the general field or the specific field, and the more the number of the multiple words, the more likely the constructed sememe space is to cover more sememes. The word vector acquisition method proposed in the present disclosure can be used to obtain word vectors of words in the general field, and can also be used to obtain word vectors of specific words in the specific field. The only difference is the different fields to which the used words belong.

[0040] According to an embodiment, each sememe space in the multiple sememe spaces can be a sememe space reflecting a class of sememes. For example, the multiple sememe spaces can include a syntactic sememe space, a categorical sememe space, and a connotative sememe space.

[0041] As described above, the sememe list includes the basic sememes and the differentiating sememes of the corresponding word meaning. As an example, the basic sememes of the word meaning are obtained based on the result of splitting the character form of the word and / or based on the semantic items of the word in the dictionary. For example: For "river", "lake", "stream", and "sea", by splitting the character form, "氵" can be obtained, and "氵" has the meaning of "water", so "water" can be used as a basic sememe of "river", "lake", "stream", and "sea". For another example, the basic sememes of the word meaning can also be obtained through the semantic items of the word in an authoritative explanatory dictionary (e.g., "Modern Chinese Dictionary" (7th edition)). For example, each of the following explanations after each small label in the dictionary definition represents a semantic item of the word. For example, the dictionary definitions of "river", "lake", "stream", and "sea" are as follows (each of the following contents after each small label represents a corresponding semantic item of the word):

[0042] River: A large river: ~flow|~bank;

[0043] Lake: A large area of water surrounded by land; ~pond, Dongting ~;

[0044] Stream: A natural or artificial large watercourse: river~|inland~|shipping~|a~;

[0045] Sea: The part of the ocean close to the land, and some large lakes are also called seas, such as Qinghai Lake and the Caspian Sea.

[0046] A metaphor for a large number of similar things joined together: people ~ | fire ~

[0047] Large (utensil or capacity, etc.): ~ bowl | ~ quantity

[0048] After obtaining the above-mentioned semantic items of the word, the semantic items can be processed to obtain the basic semantic elements. For example, the semantic item processing rule can be: remove the commonly used words for interpretation such as "metaphor", and if "de" (的) exists in the interpretation, truncate according to "de", and all the semantic elements before "de" belong to the connotative semantic elements, and all the semantic elements after "de" belong to the categorical semantic elements. In addition, the word serving as a semantic item can be further decomposed into semantic elements, that is, obtain the interpretation of the word serving as a semantic item in the dictionary, and further obtain more fine-grained semantic elements based on these interpretations.

[0049] In addition to including the basic semantic elements of the corresponding word's meaning, the semantic element list can also include the differential semantic elements of the corresponding word's meaning. The differential semantic elements of the word's meaning can be obtained based on the semantic comparison between the word and its synonyms or antonyms, and the sentence meaning comparison between sentence pairs with only the word being different. The basic semantic elements of the word's meaning can be called显性义素 (explicit semantic elements), and the sequence of differential semantic elements of the word's meaning can be called隐性义素 (implicit semantic elements).

[0050] The explicit semantic elements reflect the semantics of the word itself, and sometimes only these semantic elements are not enough to reflect the true semantics of the word. Therefore, it is also necessary to挖掘词的隐性义素 (mine the implicit semantic elements of the word) through the comparison between words and the comparison between sentences. For example, a synonym and antonym comparison task can be constructed, and the sequence of differential semantic elements of each word and its synonyms or antonyms can be marked through the comparison between words. In addition, a sentence comparison task can be further constructed (for example, the previous sentence is a legal sentence, the latter sentence is an illegal sentence, and the two sentences have only one word different). By comparing the semantics of the sentences when only one word is different in the sentence pair, the implicit semantic elements of this uniquely different word can be further mined. Through the above comparison process, the implicit semantic elements of the word can be gradually mined. The method of mining the semantic elements of words in a specific domain is the same as the method of obtaining or mining the semantic elements of words in the general domain, and the difference is that the words and sentences used belong to the specific domain. Since the words in the specific domain involve some words in the general domain, when obtaining the semantic elements of the words in the specific domain, if the semantic elements of the words in the general domain have been generated before, then for some words in the obtaining process, the semantic elements of this word in the general domain that have been obtained before can also be utilized.

[0051] After obtaining a list of semantic features for multiple words (including basic semantic features and semantic distinguishing features), multiple semantic feature spaces can be constructed based on the obtained list. For example, all semantic features in the list can be categorized, such as into grammatical features, categorical features, and connotative features. Then, a semantic feature space can be constructed based on each type of semantic feature. For example, each type of semantic feature can be mapped to a high-dimensional vector space containing all semantic feature vectors of that type. For example, grammatical feature spaces, categorical feature spaces, and connotative feature spaces can be constructed based on the obtained list. As examples, the grammatical feature space may include: part-of-speech, legal syntactic collocation slots, and illegal syntactic collocation slots. The categorical feature space may include: biological and non-biological. The connotative feature space may include: time dimension, spatial dimension, color dimension, etc.

[0052] With multiple semantic feature spaces pre-constructed, in step S220, by searching the constructed semantic feature spaces, multiple semantic feature vectors corresponding to each word in the first and second sentences, and the semantic feature vector of each semantic feature in the semantic distinction sequence, can be obtained. Subsequently, the machine learning model can be trained based on the obtained semantic feature vectors. Since the semantic feature vectors of each word and the semantic distinction sequence between words are used in the training of the machine learning model, the machine learning model can learn richer and more accurate semantic features that reflect the meaning of the corresponding words. Therefore, the word vectors of the corresponding words obtained based on such a semantic feature sequence will have stronger representational power.

[0053] Finally, in step S230, the word vector corresponding to the first word is obtained based on the semantic vector of each semantic element in the semantic element sequence of the first word. For example, the semantic vector of each semantic element in the semantic element sequence can be obtained from the semantic element space set, and the word vector corresponding to the first word is obtained based on the obtained semantic vector. As mentioned above, for example, the semantic element space set may include multiple semantic element spaces, which may include: syntactic semantic element space, categorical semantic element space, and connotative semantic element space. In this case, for example, the semantic elements in the semantic element sequence can be arranged in the order of syntactic semantic elements, categorical semantic elements, and connotative semantic elements, and the word vector corresponding to the first word can be obtained based on the semantic vector of the arranged semantic elements. In addition, the semantic elements within each category can also be arranged in a certain order. Finally, the word vector of the first word can be obtained by concatenating or weighting the semantic vectors of the arranged semantic elements. However, this disclosure does not limit the operation method of obtaining the word vector based on the semantic vector of each semantic element.

[0054] Optionally, Figure 2The word vector acquisition method shown may further include storing a semantic vector table. The semantic vector table (also called a "semantic mapping table") may include each semantic element in the semantic element sequence and its semantic vector. For example, the semantic elements and their semantic vectors of each word obtained through training can be placed in a two-dimensional table, where each semantic element corresponds to a semantic vector. The stored semantic vector table can then be applied to various natural language processing tasks.

[0055] The above has been referred to Figure 2 A word vector acquisition method according to embodiments of this disclosure is described. For a more intuitive understanding, please refer to the following... Figure 3 The diagram shown illustrates an example of the word vector acquisition method described above.

[0056] like Figure 3 As shown, in step S310, the basic semantic features of each word can be extracted. In step S320, the semantic features that distinguish each word are obtained by comparing synonyms or antonyms. In step S330, the semantic features that distinguish each word are obtained by comparing sentence pairs. Sentence pairs may differ by only one word. Through steps S310 to S330, a list of semantic features for each word can be obtained, which may include basic semantic features (dominant semantic features) and semantic features that distinguish each word (latent semantic features). In step S340, multiple semantic feature spaces (including grammatical semantic feature space, categorical semantic feature space, and connotative semantic feature space) can be constructed based on the list of semantic features for each word. Subsequently, in step S350, the machine learning model is trained based on the sentence pairs and the semantic feature sequence of the only different word in the sentence pairs, and the semantic feature sequence of the only different word is obtained during the model training process. In step S360, a semantic feature vector table can be stored, which includes the semantic features of each word obtained during model training and the semantic feature vector of that semantic feature. In step S370, the semantic features in the semantic feature sequence can be arranged in the order of syntactic semantic features, categorical semantic features, and connotative semantic features. In step S380, the word vector of the word is obtained based on the semantic feature vectors of the arranged semantic features.

[0057] It should be noted that, Figure 3 The above-described word vector acquisition method is merely an example; the word vector acquisition method disclosed herein is not limited to... Figure 3 Example of steps.

[0058] The above text has already referred to Figure 2 and Figure 3A word vector acquisition method according to embodiments of this disclosure is described. According to this method, since the semantic feature sequence of words is learned during model training by considering the semantic distinction sequence between words, the word vectors obtained from the semantic feature vectors of each semantic feature in the sequence take into account the semantic relationship between words, thus making the obtained word vectors more representative. This will provide a better foundation for various natural language processing tasks performed using word vectors, improving the performance of various natural language processing tasks.

[0059] The word vector acquisition method according to the embodiments of this disclosure can be used in various scenarios that require word vectors for natural language processing, such as text correction, machine translation, information retrieval, automatic question answering, etc.

[0060] The following reference Figure 4 and Figure 5 A text correction method according to embodiments of the present disclosure is described.

[0061] Figure 4 This is a flowchart of a text correction method according to an embodiment of the present disclosure.

[0062] Reference Figure 4 In step S410, the first text is acquired. The first text can be a sentence or a paragraph composed of sentences. For example, the first text can be loaded directly from a storage device, or it can be acquired through text recognition. This disclosure does not impose any restrictions on the method of acquiring the first text or the type of the first text.

[0063] In step S420, the first text can be segmented. Any existing or future segmentation method can be used to segment the first text. This disclosure does not limit the segmentation method, as long as it can extract the words from the first text.

[0064] After word segmentation, in step S430, the feature representation of each word in the first text is obtained. Here, the feature representation includes the first word vector of each word in the first text, which is obtained based on the first semantic vector of the corresponding word. For example, the stored semantic vector table mentioned above can be obtained, and the first semantic vector of the corresponding word can be obtained by querying the first semantic vector in the semantic vector table, and the first word vector (i.e., the initial word vector) of each word in the first text is obtained based on the first semantic vector of the corresponding word. Since the feature representation of each word in the first text obtained by this disclosure includes the first word vector obtained based on the first semantic vector of the corresponding word, and such word vectors have strong representational power, performing text correction based on such feature representation will achieve better error correction results.

[0065] Optionally, the feature representation may further include a second word vector for each word in the first text, wherein the first word vector and the second word vector are obtained in different ways. As described above, the first word vector may be obtained using... Figure 2 The method shown yields word vectors, while the second word vector can be obtained using traditional word vector methods. Combining the first and second word vectors further enriches the word feature representation, improving subsequent text correction. Optionally, the feature representation may also include the position vector of each word in the first text, etc. The feature representation can be obtained by concatenating (using the concat operation) the word vectors and position vectors (which have the same dimension) of each word.

[0066] Finally, in step S440, text correction is performed on the second text based on the feature representation. Here, the second text is either the same as the first text or another text obtained based on the first text. That is, text correction can be performed on the first text itself based on the feature representation, or it can be performed on another text obtained based on the first text based on the feature representation. For example, the other text may have the same or similar meaning as the first text, or it may have a different meaning from the first text, depending on the specific application using the first text. For example, in translation applications, the other text may be text obtained by translating the first text, or in other text prediction tasks, the other text may be text predicted by a text prediction model based on the first text.

[0067] Specifically, for example, in step S440, a second semantic element vector for each word in the second text can be obtained based on the feature representation; then, text correction is performed on the second text based on the second semantic element vector for each word in the second text. Since text correction is performed on the second text based on the second semantic element vector for each word in the second text, rather than on the word vector for each word, text correction can be performed at a deeper semantic micro-level, achieving better correction results.

[0068] For example, the feature representation can first be encoded using an attention mechanism to obtain another feature representation corresponding to the first feature representation. Then, based on the other feature representation and a pre-constructed semantic vector table, the second semantic vector is obtained. Here, the pre-constructed semantic vector table can be the one described above. Figure 2 The description mentions a semantic vector table, which includes semantic vectors for each semantic element of various words.

[0069] For example, the feature representation can be encoded using an encoder in a transformer to obtain the other feature representation. For instance, this encoder can use a multi-head additive attention mechanism to encode the input feature representation to obtain the other feature representation. The other feature representation obtained through the attention mechanism contains information about other words in the text (reflecting relevance to other words) in addition to the semantic information of the word itself. Therefore, text correction based on this other feature representation can further improve the text correction effect. Here, the other feature representation can be a high-dimensional vector.

[0070] As described above, the second text can be either the first text or another text obtained based on the first text. When the second text is the first text itself, obtaining the second semantic vector based on the other feature representation and the pre-built semantic vector table can be achieved by splitting the other feature representation (high-dimensional vector) according to the semantic vector table to obtain the second semantic vector of each word in the second text. However, if the second text is another text obtained based on the first text, obtaining the second semantic vector based on the other feature representation and the pre-built semantic vector table can include: first, predicting the word vector of each word in the second text based on the other feature representation; then, based on the predicted word vector of each word in the second text, obtaining the second semantic vector of each word in the second text using the semantic vector table. For example, the decoder in a transformer can be used to decode the other feature representation to obtain the word vector of each word in the second text. For instance, the decoder can use a multi-head additive mask attention mechanism to decode the other feature representation to obtain the word vector of each word in the second text. Furthermore, the decoder output can be linearly transformed through a Linear layer, then passed through a Softmax layer to determine the probability of each word appearing at various positions in the sentence, thereby determining the predicted second text. Subsequently, the word vectors of each word in the second text can be split according to the aforementioned semantic vector table to obtain the second semantic vector of each word in the second text. Although the above example mentions the use of a transformer encoder and decoder, this disclosure does not impose any restrictions on the model used for feature representation encoding and decoding. Moreover, when the object of error correction is the first text itself rather than another text obtained based on the first text, a decoder may not be required, and only an encoder may be needed.

[0071] After obtaining the second semantic vector of each word in the second text, text correction can be performed on the second text based on the second semantic vector of each word. For example, firstly, erroneous words in the second text can be identified based on the similarity between the second semantic vector of each word and the word vector. Then, replacement words for the erroneous words can be determined based on the second semantic vector of the erroneous words. Finally, the second text is corrected based on the replacement words.

[0072] For example, regarding the identification of erroneous words, firstly, the semantic features of each word in the second text can be determined based on the second semantic feature vector (e.g., by querying the aforementioned semantic feature vector table based on the second semantic feature vector). Secondly, the semantic features of all words in the second text are sorted in descending order of frequency of occurrence. Next, the similarity between the semantic feature vector of each semantic feature after descending order and the word vector of each word in the second text is calculated. Finally, erroneous words in the second text are identified based on the calculation results. As an example, the similarity distance between the second semantic feature vector and the word vector of each word in the second text can be calculated, and words whose similarity distance meets certain conditions (e.g., a negative similarity distance) are identified as erroneous words. By sorting the semantic features of all words in the second text in descending order of frequency of occurrence, the key semantic information of the second text can be determined. By sequentially determining the similarity between the semantic feature vector of each semantic feature and the word vector of each word in the second text in this order, high-priority erroneous words can be identified. The reason is that the more frequently a semantic feature appears (i.e., the earlier the semantic feature appears in the ranking), the more it reflects the information of the entire text. If the word vector of a certain word has a low similarity to such a semantic feature, then this word is very likely to be an error word (i.e., the word is a high-priority error word). If there are multiple high-priority error words, they can be corrected sequentially. Optionally, the ranked semantic features can also be output.

[0073] After identifying the erroneous word, a replacement word can be determined based on the second semantic vector of the erroneous word, and the second text can be corrected based on the replacement word. Specifically, for example, the semantic vector closest to the second semantic vector of the erroneous word can be found from a pre-constructed semantic vector table (mentioned above), and the word corresponding to the found semantic vector is used as the replacement word, and the second text is corrected based on the replacement word. Here, the closest semantic vector to the second semantic vector of the erroneous word can be determined by calculating the similarity distance between the second semantic vector of the erroneous word and the semantic vectors in the semantic vector table.

[0074] Furthermore, specifically, the aforementioned correction of the second text based on the replacement word can include: if the semantic features of the replacement word include a semantic feature not found in any other word in the second text besides the erroneous word, then the erroneous word is deleted from the second text; if the semantic features of the replacement word do not include a semantic feature not found in any other word in the second text besides the erroneous word, then the erroneous word in the second text is replaced with the replacement word. The first case (i.e., the semantic features of the replacement word include a semantic feature not found in any other word in the second text besides the erroneous word) indicates that the previously identified erroneous word is likely a redundant word in the text; therefore, the corrected text can be obtained by deleting the erroneous word. The second case (i.e., the semantic features of the replacement word do not include a semantic feature not found in any other word in the second text besides the erroneous word) indicates that the replacement word is likely a correct word; therefore, the corrected text can be obtained by replacing the erroneous word with the replacement word.

[0075] Optionally, Figure 4 The text correction method shown can not only correct text errors, but also calculate the error rate of the text, and then use this error rate to measure the severity of text errors. Specifically, Figure 4 The text correction method shown may further include: calculating the error rate of the second text based on the semantic features of the erroneous words. Since the text error rate is calculated based on the semantic features of the erroneous words, rather than directly based on the number of erroneous words, the degree of error in the text can be measured more accurately.

[0076] For example, the error rate of the second text can be calculated based on the frequency of occurrence of the semantic features of the erroneous word among all semantic features of all words contained in the second text. For instance, the error rate could be equal to 1 - (erroneous semantic feature 1 * frequency 1 + erroneous semantic feature 2 * frequency 2 + ... + erroneous semantic feature n * frequency n) / total number of semantic features. Here, erroneous semantic feature n is the nth semantic feature contained in the erroneous word, and frequency n is the frequency of occurrence of the nth semantic feature in the entire second text. Optionally, the erroneous semantic feature and its importance determined based on its frequency of occurrence can also be output as the cause of the error.

[0077] The above has been referred to Figure 4 The text correction method according to embodiments of this disclosure is described. According to the above text correction method, text is corrected based on feature representations including word vectors for each word. Since the word vectors used are obtained based on the semantic vectors of each word in the first text, and such word vectors have stronger representational power, the text correction effect can be improved.

[0078] The text correction method according to the embodiments of this disclosure can be applied to scenarios where there is text and text correction is required, such as text proofreading and machine translation.

[0079] To better understand the text correction methods described above, we will now combine them with... Figure 5 Let's use an example to briefly describe it. Figure 5 This is a schematic diagram illustrating an example of a text correction method according to an embodiment of the present disclosure.

[0080] Reference Figure 5 In step S510, input the first text. In step S520, perform word segmentation on the first text. In step S530, look up the semantic vector table (mentioned above) to determine the first word vector of each word in the first text (the first word vector is obtained based on the first semantic vector of each word). In step S540, obtain the position vector of each word in the first text. In step S550, perform vector addition (concat operation) on the first word vector and the position vector to obtain the first high-dimensional vector (embedding). In step S560, look up the word vector table obtained by traditional methods to determine the second word vector of each word in the first text. In step S570, obtain the position vector of each word in the first text. In step S580, perform vector addition (concat operation) on the second word vector and the position vector to obtain the second high-dimensional vector. In step S590, perform vector addition on the first high-dimensional vector and the second high-dimensional vector to obtain the feature representation of each word in the first text. In step S591, the feature representation is encoded using an attention mechanism to obtain another feature representation corresponding to the feature representation. In step S592, the word vector of each word in the second text is decoded based on the other feature. In step S593, a linear transformation is performed on the decoding result, and in step S594, the probability of each word appearing at each position in the sentence is determined, thereby determining the predicted second text. In step S595, the probability can be output. In step S596, the word vector of each word in the second text is split according to the above-mentioned semantic vector table to obtain the second semantic vector of each word in the second text. In step S597, the semantic elements of all words in the second text are arranged in descending order of their frequency of occurrence in the second text. In step S598, the similarity between the semantic vector of each semantic element after descending order and the word vector of each word in the second text is calculated, and the erroneous word is determined based on the calculation result. In step S599, the replacement word of the erroneous word is determined based on the semantic vector of the erroneous word, so as to correct the text according to the replacement word.

[0081] Despite Figure 5 In the example, the text correction method is performed on another text corresponding to the first text. However, the text correction method of this disclosure is not limited to this, and the first text can also be corrected directly.

[0082] The word vector acquisition method and text correction method of this disclosure have been described above. The following refers to... Figure 6 and Figure 7 A brief description is given of the word vector acquisition device and text correction device according to embodiments of the present disclosure.

[0083] Figure 6 This is a block diagram of a word vector acquisition device according to an embodiment of the present disclosure.

[0084] Reference Figure 6 The word vector acquisition device 600 may include a data acquisition unit 610, a training unit 620, and a word vector acquisition unit 630. Specifically, the data acquisition unit 610 may be configured to acquire a sentence pair including a first sentence and a second sentence, and a semantic feature sequence of the first word included in the first sentence and the second word included in the second sentence; wherein, the first sentence and the second sentence differ only in the first word and the second word, and the semantic feature sequence is a sequence of features reflecting the semantic difference between the first word and the second word. The training unit 620 may be configured to train a machine learning model based on the sentence pair and the semantic feature sequence, and obtain the semantic feature sequence of the first word during the machine learning model training process. The word vector acquisition unit 630 may be configured to obtain the word vector corresponding to the first word based on the semantic feature vector of each feature in the semantic feature sequence of the first word. Figure 2 The word vector acquisition method shown can be obtained by Figure 6 The word vector acquisition device 600 shown is used to perform this operation, and the data acquisition unit 610, training unit 620, and word vector acquisition unit 630 can respectively perform the operations related to... Figure 2 The operations corresponding to steps S210, S220, and S230 in the text, therefore, regarding Figure 6 Any relevant details regarding the operations performed by each unit within the [system / component] can be found in the [document / reference / etc.]. Figure 2 The corresponding descriptions will not be repeated here.

[0085] Optionally, according to an embodiment, the word vector acquisition device 600 further includes a semantic element space construction unit ( Figure 6 (Not shown in the text). The semantic feature space construction unit can be configured to obtain a list of semantic features for each of a plurality of words and construct multiple semantic feature spaces based on the obtained list of semantic features. Each semantic feature space is constructed based on semantic features of the same type in the list of semantic features of the plurality of words. The list of semantic features may include the basic semantic features and the semantic distinguishing features of the corresponding word. Optionally, the word vector acquisition device 600 may also include a storage unit (not shown). The storage unit can be configured to store a semantic feature vector table. The semantic feature vector table may include each semantic feature in the semantic feature sequence and the semantic feature vector of each semantic feature.

[0086] Furthermore, it should be noted that although the word vector acquisition device 600 has been divided into units for performing corresponding processes in the above description, those skilled in the art will understand that the processes performed by the aforementioned units can also be performed without any specific unit division or clear boundaries between the units. In addition, the word vector acquisition device 600 may also include other units, such as a data preprocessing unit.

[0087] Figure 7 This is a block diagram illustrating a text correction apparatus according to an embodiment of the present disclosure.

[0088] Reference Figure 7 The text correction device 700 may include a text acquisition unit 710, a word segmentation unit 720, a feature representation unit 730, and a correction unit 740. Specifically, the text acquisition unit 710 may be configured to acquire a first text. The word segmentation unit 720 may be configured to perform word segmentation processing on the first text.

[0089] The feature representation unit 730 can be configured to acquire a feature representation of each word in the first text. According to an embodiment, the feature representation includes a first word vector for each word in the first text, which is obtained based on the first semantic element vector of the corresponding word. The error correction unit 740 can be configured to perform text correction on the second text based on the feature representation. According to an embodiment, the second text is the same as the first text or is another text obtained based on the first text. Specifically, the error correction unit 740 can obtain a second semantic element vector for each word in the second text based on the feature representation, and perform text correction on the second text based on the second semantic element vector of each word in the second text. For example, the error correction unit 740 can determine erroneous words in the second text based on the similarity between the second semantic element vector and the word vector of each word in the second text, and can determine replacement words for the erroneous words based on the second semantic element vector of the erroneous words. Optionally, the text correction device 700 may further include an error rate calculation unit (not shown), which can be configured to calculate the error rate of the second text based on the semantic elements of the erroneous words.

[0090] because Figure 4 The text correction method shown can be derived from... Figure 7 The text correction device 700 shown is used to perform this operation, and the text acquisition unit 710, word segmentation unit 720, feature representation unit 730, and correction unit 740 can respectively perform the operations related to... Figure 4 The operations corresponding to steps S410, S420, S430, and S440 in the text, therefore, regarding... Figure 7 Any relevant details regarding the operations performed by each unit within the [system / component] can be found in the [document / reference / etc.]. Figure 4 The corresponding descriptions will not be repeated here.

[0091] Furthermore, it should be noted that although the text correction device 700 has been divided into units for performing corresponding processes in the above description, those skilled in the art will understand that the processes performed by the aforementioned units can also be performed without any specific unit division in the text correction device 700 or without clear boundaries between the units. In addition, the text correction device 700 may also include other units, such as a text output unit, a storage unit, etc.

[0092] Figure 8 This is a block diagram of an electronic device according to an embodiment of the present disclosure.

[0093] Reference Figure 8 The electronic device 800 may include at least one memory 801 and at least one processor 802. The at least one memory stores computer-executable instructions, which, when executed by the at least one processor, cause the at least one processor 802 to perform a word vector acquisition method or a text correction method according to embodiments of the present disclosure.

[0094] As an example, an electronic device can be a PC, tablet, personal digital assistant, smartphone, or other device capable of executing the aforementioned set of instructions. Here, the electronic device is not necessarily a single device; it can be any collection of devices or circuits capable of executing the aforementioned instructions (or instruction sets) individually or in combination. The electronic device can also be part of an integrated control system or system manager, or can be configured to interconnect locally or remotely (e.g., via wireless transmission) through an interface.

[0095] In electronic devices, processors may include central processing units (CPUs), graphics processing units (GPUs), programmable logic devices, dedicated processor systems, microcontrollers, or microprocessors. By way of example and not limitation, processors may also include analog processors, digital processors, microprocessors, multi-core processors, processor arrays, network processors, etc.

[0096] The processor can execute instructions or code stored in memory, which can also store data. Instructions and data can also be sent and received over a network via a network interface device, which can employ any known transport protocol.

[0097] Memory can be integrated with the processor, for example, by placing RAM or flash memory within an integrated circuit microprocessor. Alternatively, memory can comprise a separate device, such as an external disk drive, storage array, or other storage device that can be used by any database system. Memory and processor can be operationally coupled, or can communicate with each other, for example, via I / O ports, network connections, etc., enabling the processor to read text stored in the memory.

[0098] In addition, electronic devices may include video displays (such as liquid crystal displays) and user interaction interfaces (such as keyboards, mice, touch input devices, etc.). All components of the electronic device may be interconnected via buses and / or networks.

[0099] According to embodiments of this disclosure, a computer-readable storage medium storing instructions may also be provided, wherein when the instructions are executed by at least one processor, they cause the at least one processor to perform a word vector acquisition method or a text error correction method according to embodiments of this disclosure. Examples of computer-readable storage media herein include: read-only memory (ROM), random access programmable read-only memory (PROM), electrically erasable programmable read-only memory (EEPROM), random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), flash memory, non-volatile memory, CD-ROM, CD-R, CD+R, CD-RW, CD+RW, DVD-ROM, DVD-R, DVD+R, DVD-RW, DVD+RW, DVD-RAM, BD-ROM, BD-R, BD-R LTH, BD-RE, Blu-ray or optical disc storage, hard disk drive (HDD), solid-state drive (SSD), card storage (such as multimedia cards, secure digital (SD) cards, or ultra-fast digital (XD) cards), magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid-state drive, and any other device configured to store a computer program (or software) and any associated data, data text, and data structures in a non-transitory manner and to provide the computer program and any associated data, data text, and data structures to a processor or computer so that the processor or computer can execute the computer program. The instructions or computer program in the aforementioned computer-readable storage medium can run in an environment deployed in computer devices such as clients, hosts, agent devices, servers, etc. Furthermore, in one example, the computer program and any associated data, data text, and data structures are distributed across a networked computer system, such that the computer program and any associated data, data text, and data structures are stored, accessed, and executed in a distributed manner through one or more processors or computers.

[0100] According to embodiments of this disclosure, computer software may also be provided, the computer software including computer instructions, which, when executed by a processor, implement a word vector acquisition method or a text correction method according to embodiments of this disclosure.

[0101] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are defined by the claims.

Claims

1. A method for obtaining word vectors, characterized in that, include: Obtain a sentence pair including a first sentence and a second sentence, and a semantic feature sequence that distinguishes the meaning of the first word in the first sentence and the second word in the second sentence; wherein, the first sentence and the second sentence differ only in the first word and the second word, and the semantic feature sequence is a sequence of features that reflects the semantic difference between the first word and the second word; The machine learning model is trained based on the sentence pairs and the semantic feature sequences that distinguish word meanings; the semantic feature sequence of the first word is obtained during the training process of the machine learning model; The word vector corresponding to the first word is obtained based on the semantic vector of each semantic element in the semantic element sequence of the first word.

2. The word vector acquisition method as described in claim 1, characterized in that, The training of the machine learning model based on the sentence pairs and the semantic distinguishing feature sequences includes: The semantic feature set is used to obtain multiple semantic feature vectors corresponding to each word in the first and second sentences, and the semantic feature vector of each semantic feature in the semantic feature sequence. The semantic feature set includes multiple semantic feature spaces, each of which is constructed based on semantic features of the same type in the semantic feature list of multiple words. The semantic feature list includes the basic semantic features and semantic feature distinguishing features of the corresponding words. The machine learning model is trained based on the obtained semantic vectors.

3. The word vector acquisition method as described in claim 2, characterized in that, The semantic basis of the word is obtained based on the result of glyph decomposition of the word and / or based on the semantic entries of the word in the dictionary; The semantic features that distinguish the word are obtained by comparing the word with its synonyms or antonyms, and by comparing the sentence meanings of sentence pairs that differ only in the word.

4. The word vector acquisition method as described in claim 2, characterized in that, The step of obtaining the word vector corresponding to the first word based on the semantic vector of each semantic element in the semantic element sequence of the first word includes: Obtain the semantic vector of each semantic element in the semantic element sequence from the semantic element space set; Based on the acquired semantic vector, the word vector corresponding to the first word is obtained.

5. A text correction method, comprising: Get the first text; Perform word segmentation on the first text; Obtain the feature representation of each word in the first text; wherein, the feature representation includes the first word vector of each word in the first text, and the first word vector is obtained based on the first semantic vector of the corresponding word; Text correction is performed on the second text based on the aforementioned feature representation; wherein the second text is the same as the first text or is another text obtained based on the first text. The first word vector is obtained in the following way: Obtain a sentence pair including a first sentence and a second sentence, and a semantic feature sequence that distinguishes the meaning of the first word in the first sentence and the second word in the second sentence; wherein, the first sentence and the second sentence differ only in the first word and the second word, and the semantic feature sequence is a sequence of features that reflects the semantic difference between the first word and the second word; The machine learning model is trained based on the sentence pairs and the semantic feature sequences that distinguish word meanings; the semantic feature sequence of the first word is obtained during the training process of the machine learning model; The first word vector is obtained based on the semantic vector of each semantic element in the semantic element sequence of the first word.

6. The text correction method as described in claim 5, characterized in that, The text correction based on the feature representation includes: Based on the feature representation, obtain the second semantic vector of each word in the second text; Text correction is performed on the second text based on the second semantic vector of each word in the second text.

7. The text correction method as described in claim 6, characterized in that, The text correction based on the second semantic vector of each word in the second text includes: Based on the similarity between the second semantic element vector and the word vector of each word in the second text, the erroneous words in the second text are identified. The replacement word for the erroneous word is determined based on the second semantic vector of the erroneous word, and the second text is corrected based on the replacement word.

8. The text correction method as described in claim 6, characterized in that, The step of obtaining the second semantic vector of each word in the second text based on the feature representation includes: The feature representation is encoded using an attention mechanism to obtain another feature representation corresponding to the feature representation; The second semantic vector is obtained based on the other feature representation and the pre-constructed semantic vector table.

9. The text correction method as described in claim 8, characterized in that, The second text is another text obtained based on the first text; the step of obtaining the second semantic vector based on the other feature representation and a pre-constructed semantic vector table includes: Predict the word vector for each word in the second text based on the other feature representation; Based on the predicted word vector of each word in the second text, the second semantic vector of each word in the second text is obtained using the semantic vector table.

10. The text correction method as described in claim 7, characterized in that, Also includes: The error rate of the second text is calculated based on the semantic features of the erroneous words.

11. A word vector acquisition device, comprising: The data acquisition unit is configured to acquire a sentence pair including a first sentence and a second sentence, and a semantic feature sequence of the first word included in the first sentence and the second word included in the second sentence; wherein, the first sentence and the second sentence are different only in the first word and the second word, and the semantic feature sequence is a sequence of features that reflect the semantic difference between the first word and the second word; The training unit is configured to train a machine learning model based on the sentence pairs and the semantic feature sequences that distinguish word meanings; and to obtain the semantic feature sequence of the first word during the training process of the machine learning model. The word vector acquisition unit is configured to obtain the word vector corresponding to the first word based on the semantic vector of each semantic element in the semantic element sequence of the first word.

12. A text correction device, comprising: The text acquisition unit is configured to acquire the first text; The word segmentation unit is configured to perform word segmentation processing on the first text; The feature representation unit is configured to acquire a feature representation of each word in the first text; wherein the feature representation includes a first word vector of each word in the first text, the first word vector being obtained based on a first semantic vector of the corresponding word; The error correction unit is configured to perform text error correction on the second text based on the feature representation; wherein the second text is the same as the first text or is another text obtained based on the first text. The first word vector is obtained in the following way: Obtain a sentence pair including a first sentence and a second sentence, and a semantic feature sequence that distinguishes the meaning of the first word in the first sentence and the second word in the second sentence; wherein, the first sentence and the second sentence differ only in the first word and the second word, and the semantic feature sequence is a sequence of features that reflects the semantic difference between the first word and the second word; The machine learning model is trained based on the sentence pairs and the semantic feature sequences that distinguish word meanings; the semantic feature sequence of the first word is obtained during the training process of the machine learning model; The first word vector is obtained based on the semantic vector of each semantic element in the semantic element sequence of the first word.

13. An electronic device, characterized in that, include: At least one processor; At least one memory that stores computer-executable instructions. Wherein, when the computer-executable instructions are executed by the at least one processor, the at least one processor causes the at least one processor to perform the word vector acquisition method as described in any one of claims 1 to 4 or the text correction method as described in any one of claims 5 to 10.

14. A computer-readable storage medium for storing instructions, characterized in that, When the instruction is executed by at least one processor, it causes the at least one processor to perform the word vector acquisition method as described in any one of claims 1 to 4 or the text correction method as described in any one of claims 5 to 10.

15. A computer software comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the word vector acquisition method according to any one of claims 1 to 4 or the text correction method according to any one of claims 5 to 10.

Citation Information

Patent Citations

  • Method, device, and storage medium for correcting error in text

    US20210397780A1