Text Processing Method, Apparatus, Device, and Storage Medium

By obtaining the semantic feature vector of the target text and combining the text association relationship information, the target feature vector under the conditional distribution is solved, and the problem of inaccurate text similarity representation in the prior art is achieved, and higher text processing accuracy is achieved.

CN113392180BActive Publication Date: 2025-07-11TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110017491.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-07
Publication Date
2025-07-11
Estimated Expiration
2041-01-07

AI Technical Summary

Technical Problem

The existing text processing methods only consider the semantic features of the text, which leads to the inlaid vectors that accurately represent text similarity and the accuracy of the processing results is poor.

Method used

By obtaining the semantic feature vector of the target text and combining the correlation relationship information between the text, the target feature vector under the conditional distribution is obtained, and the correlation relationship and semantic features between the text are comprehensively considered, and the target feature vector is determined to improve the accuracy of similarity determination.

Benefits of technology

It improves the accuracy of text processing, can more accurately represent the similarity between texts, and enhances the accuracy of similarity determination.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113392180B_ABST
    Figure CN113392180B_ABST
Patent Text Reader

Abstract

The present application discloses a text processing method, apparatus, device, and storage medium, belonging to the field of artificial intelligence technology. In the embodiments of the present application, the correlation relationship information between texts is introduced, which can represent the correlation relationship between texts. From the perspective of the correlation relationship, the similarity between texts is characterized. The prior distribution is determined based on this correlation relationship information. When determining the corresponding target feature vector for the semantic feature vector in the subsequent obtained conditional distribution, this target feature vector takes into account the factor of the correlation relationship between texts. Then, the semantic features are represented by the semantic feature vector. In this way, the trained conditional distribution comprehensively considers the correlation relationship between texts and the semantic features. In this way, the target feature vectors of the text content or texts with a correlation relationship will be relatively close. This target feature vector can more accurately represent the target text. By using this to determine the similarity, a more accurate similarity can be obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a text processing method, apparatus, device, and storage medium. Background Art

[0002] With the development of computer technology, in many scenarios, it is necessary to compare the similarity of texts and then determine other texts similar to a certain text. Through artificial intelligence technology, similarity search of texts can find the most similar items in a large-scale database according to the texts.

[0003] Currently, the text processing method usually performs word segmentation on the text and then performs embedding processing on it to obtain the embedding vector of the text. Subsequently, the similarity between two texts is determined by calculating the distance between the embedding vectors of the two texts. In the above method, only the semantic features of the text are considered, and the embedding vectors of the two texts can only simply describe the words obtained by text segmentation, and the embodied semantics are also relatively weak. Therefore, in the above text processing method, the embedding vector cannot well represent the text, and thus the similarity between two texts cannot be accurately determined, and the accuracy of the processing result is poor. Summary of the Invention

[0004] Embodiments of this application provide a text processing method, apparatus, device, and storage medium, which can improve the accuracy of text processing. The technical solution is as follows:

[0005] On the one hand, a text processing method is provided, and the method includes:

[0006] Obtain a target text;

[0007] Obtain the semantic feature vector of the target text;

[0008] Obtain the conditional distribution of the target feature vector under the condition of the semantic feature vector, where the conditional distribution is obtained by training the prior distribution of the target feature vector jointly with the semantic feature vectors of at least two sample texts, and the prior distribution is the distribution of the target feature vector obtained based on the correlation relationship information between the at least two sample texts;

[0009] Based on the semantic feature vector of the target text, determine the mean value corresponding to the semantic feature vector from the conditional distribution, and use the mean value as the target feature vector of the target text, where the target feature vector is used to determine the similarity with other texts.

[0010] In some embodiments, the target feature vector includes at least two elements; the method of performing hash coding on the target feature vector of the target text to obtain the hash code of the target text includes:

[0011] In response to any element in the target feature vector being greater than the threshold corresponding to the element, determining the hash code corresponding to the element as a first value; the threshold is the median of the elements in the target feature vectors of the at least two sample texts;

[0012] In response to any element in the target feature vector being less than or equal to the threshold corresponding to the element, determining the hash code corresponding to the element as a second value.

[0013] On the one hand, a text processing method is provided, and the method includes:

[0014] Obtaining at least two sample texts and semantic feature vectors of the at least two sample texts;

[0015] Based on the citation relationship between the at least two sample texts or the similarity between the at least two sample texts, obtaining correlation relationship information between the at least two sample texts;

[0016] Based on the correlation relationship information between the at least two sample texts, obtaining the prior distribution of the target feature vector;

[0017] Based on the prior distribution of the target feature vector and the semantic feature vectors of the at least two sample texts, obtaining the conditional distribution of the target feature vector under the condition of the semantic feature vector.

[0018] On the one hand, a text processing device is provided, and the device includes:

[0019] An obtaining module, configured to obtain a target text;

[0020] The obtaining module is further configured to obtain the semantic feature vector of the target text;

[0021] The obtaining module is further configured to obtain the conditional distribution of the target feature vector under the condition of the semantic feature vector, where the conditional distribution is obtained by training based on the prior distribution of the target feature vector combined with the semantic feature vectors of the at least two sample texts, and the prior distribution is the distribution of the target feature vector obtained based on the correlation relationship information between the at least two sample texts;

[0022] A determining module, configured to determine, from the conditional distribution, the mean value corresponding to the semantic feature vector based on the semantic feature vector of the target text, and use the mean value as the target feature vector of the target text, where the target feature vector is used to determine the similarity with other texts.

[0023] In some embodiments, the conditional distribution of the target feature vector under the semantic feature vector is obtained based on the following process: obtaining at least two sample texts and the semantic feature vectors of the at least two sample texts; obtaining the correlation relationship information between the at least two sample texts based on the citation relationship between the at least two sample texts or the similarity between the at least two sample texts; obtaining the prior distribution of the target feature vector based on the correlation relationship information between the at least two sample texts; and obtaining the conditional distribution of the target feature vector under the semantic feature vector based on the prior distribution of the target feature vector and the semantic feature vectors of the at least two sample texts.

[0024] In some embodiments, obtaining the correlation relationship information between the at least two sample texts based on the citation relationship between the at least two sample texts or the similarity between the at least two sample texts includes any of the following:

[0025] Obtaining the citation relationship between the at least two sample texts; and obtaining the correlation relationship information between the at least two sample texts based on the citation relationship.

[0026] Obtaining the embedding vectors of the at least two sample texts; determining the feature vectors of the at least two sample texts based on the embedding vectors at any position in the embedding vectors of the at least two sample texts and the context vectors of the positions; comparing the feature vectors of the at least two sample texts to obtain the similarity between the at least two sample texts; and obtaining the correlation relationship information between the at least two sample texts based on the similarity.

[0027] In some embodiments, the correlation relationship information between the at least two sample texts is a correlation matrix; and an element in the correlation matrix is used to indicate the correlation relationship information between two sample texts.

[0028] Obtaining the citation relationship between the at least two sample texts includes: in response to the existence of a citation relationship between a first sample text and a second sample text, determining that the correlation relationship information between the first sample text and the second sample text is a non-zero value; and in response to the non-existence of a citation relationship between the first sample text and the second sample text, determining that the correlation relationship information between the first sample text and the second sample text is 0.

[0029] In some embodiments, obtaining the conditional distribution of the target feature vector under the semantic feature vector based on the prior distribution of the target feature vector and the semantic feature vectors of the at least two sample texts includes: obtaining a first initial conditional distribution and a second initial conditional distribution based on the prior distribution of the target feature vector, where the first initial conditional distribution is the conditional distribution of the target feature vector under the semantic feature vector, and the second initial conditional distribution is the conditional distribution of the semantic feature vector under the target feature vector; based on the semantic feature vectors of the at least two sample texts, determining the mean and covariance corresponding to the semantic feature vector from the first initial conditional distribution; sampling the candidate target feature vector corresponding to the semantic feature vector from the first initial conditional distribution; based on the candidate target feature vector, the mean, and the covariance, sampling the reconstructed semantic feature vector corresponding to the candidate target feature vector from the second initial conditional distribution; updating the first initial conditional distribution and the second initial conditional distribution based on the semantic feature vector, the reconstructed semantic feature vector, the candidate target feature vector, and the prior distribution until the target condition is met and then stopping to obtain a first conditional distribution and a second conditional distribution, where the first conditional distribution is the conditional distribution of the target feature vector under the semantic feature vector.

[0030] In some embodiments, obtaining the prior distribution of the target feature vector based on the correlation relationship information between the at least two sample texts includes: generating graph data based on the correlation relationship information between the at least two sample texts, where the graph data includes at least two text nodes and edges between the text nodes, and one text node corresponds to one sample text, and the edge between any two text nodes is used to indicate that the correlation relationship information between the two sample texts corresponding to the two text nodes is a non-zero value; obtaining the spanning tree corresponding to the graph data based on the graph data; obtaining the prior distribution of the target feature vector based on the spanning tree, where the prior distribution of the target feature vector is the joint distribution of the target feature vectors of any two sample texts.

[0031] In some embodiments, obtaining the conditional distribution of the target feature vector under the semantic feature vector of the prior distribution based on the target feature vector and the at least two sample texts includes: obtaining a first initial conditional distribution and a second initial conditional distribution of the target feature vectors of any two of the at least two sample texts based on the prior distribution of the target feature vector; determining the degree of association between any two of the sample texts based on the semantic feature vectors of the any two sample texts; determining a mean, a covariance, and a candidate target feature vector corresponding to the semantic feature vectors of the any two sample texts based on the semantic feature vectors of the any two sample texts, the degree of association, and the first initial conditional distribution; sampling a reconstructed semantic feature vector corresponding to the candidate target feature vector from the second initial conditional distribution based on the candidate target feature vector, the mean, and the covariance; and updating the first initial conditional distribution and the second initial conditional distribution based on the semantic feature vectors of the any two sample texts, the reconstructed semantic feature vector, the candidate target feature vector, and the prior distribution until a target condition is met and then stopping.

[0032] In some embodiments, the determination process of the target feature vector is implemented based on a vector generation model; the vector generation model is obtained by modeling the conditional distribution.

[0033] The obtaining module is configured to obtain a vector generation model.

[0034] The determining module is configured to input the semantic feature vector of the target text into the vector generation model, and the vector generation model determines a mean corresponding to the semantic feature vector from the conditional distribution based on model parameters and outputs the mean as the target feature vector of the target text.

[0035] In some embodiments, the obtaining module is configured to perform any one of the following:

[0036] Segment the target text to obtain words included in the target text; obtain one-hot encodings of the words included in the target text based on the words included in the target text, and use the one-hot vectors of the words included in the target text as the semantic feature vectors of the target text.

[0037] Segment the target text to obtain words included in the target text; determine weights of the words included in the target text based on the frequency of occurrence of the words included in the target text in the target text and the inverse document frequency of the words in a corpus; and obtain the semantic feature vector of the target text based on the weights and the words included in the target text.

[0038] Tokenize the target text to obtain the words included in the target text; determine the word vectors of the words included in the target text; use the word vectors of the words included in the target text as the semantic feature vector of the target text.

[0039] In some embodiments, the apparatus further comprises:

[0040] An encoding module, configured to perform hash encoding on the target feature vector of the target text to obtain the hash code of the target text;

[0041] A comparison module, configured to compare the hash code with the hash codes of other texts to determine the similarity between the target text and the other texts.

[0042] On the one hand, a text processing apparatus is provided, the apparatus comprising:

[0043] A vector acquisition module, configured to acquire at least two sample texts and the semantic feature vectors of the at least two sample texts;

[0044] An information acquisition module, further configured to acquire the correlation information between the at least two sample texts based on the citation relationship or the similarity between the at least two sample texts;

[0045] A distribution acquisition module, configured to acquire the prior distribution of the target feature vector based on the correlation information between the at least two sample texts;

[0046] The distribution acquisition module is configured to acquire the conditional distribution of the target feature vector under the semantic feature vector based on the prior distribution of the target feature vector and the semantic feature vectors of the at least two sample texts.

[0047] In some embodiments, the vector acquisition module is further configured to, in response to a vector acquisition instruction of the target text, acquire the semantic feature vector of the target text;

[0048] The apparatus further comprises:

[0049] A vector generation module, configured to, based on the semantic feature vector of the target text, determine the mean value corresponding to the semantic feature vector from the conditional distribution, and use the mean value as the target feature vector of the target text, where the target feature vector is used to determine the similarity with other texts.

[0050] On the one hand, an electronic device is provided. The electronic device includes one or more processors and one or more memories. At least one computer program is stored in the one or more memories. The at least one computer program is loaded and executed by the one or more processors to implement various alternative implementations of the above text processing method.

[0051] On the one hand, a computer-readable storage medium is provided. At least one computer program is stored in the storage medium. The at least one computer program is loaded and executed by a processor to implement various alternative implementations of the above text processing method.

[0052] In one aspect, a computer program product or a computer program is provided. The computer program product or the computer program includes one or more computer programs. The one or more computer programs are stored in a computer-readable storage medium. One or more processors of an electronic device can read the one or more computer programs from the computer-readable storage medium. The one or more processors execute the one or more computer programs, so that the electronic device can execute the text processing method of any of the above possible embodiments.

[0053] The embodiments of the present application introduce the correlation relationship information between texts. Since the correlation relationship information between texts can represent the correlation relationship between texts, the similarity between texts is characterized from the perspective of the correlation relationship. The prior distribution is determined based on the correlation relationship information. When determining the corresponding target feature vector for the semantic feature vector in the subsequent obtained conditional distribution, the target feature vector takes into account the factor of the correlation relationship between texts. Then, the semantic features are characterized by the semantic feature vector. In this way, the trained conditional distribution comprehensively considers the correlation relationship between texts and the semantic features. As a result, the target feature vectors of the text content or texts with a correlation relationship will be relatively close. The target feature vector can more accurately represent the target text. By using this to determine the similarity, a more accurate similarity can be obtained. Description of the Drawings

[0054] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0055] Figure 1 It is a schematic diagram of the implementation environment of a text processing method provided by an embodiment of the present application;

[0056] Figure 2 It is a terminal interface diagram provided by an embodiment of the present application;

[0057] Figure 3 It is a terminal interface diagram provided by an embodiment of the present application;

[0058] Figure 4 It is a schematic diagram of an application scenario of a text processing method provided by an embodiment of the present application;

[0059] Figure 5 It is a schematic diagram of an application scenario of a text processing method provided by an embodiment of the present application;

[0060] Figure 6 It is a flowchart of a text processing method provided by an embodiment of the present application;

[0061] Figure 7 It is a flowchart of a text processing method provided by an embodiment of the present application;

[0062] Figure 8 It is a flowchart of a text processing method provided by an embodiment of the present application;

[0063] Fig. 9 It is a schematic diagram of a lower bound of evidence provided by an embodiment of the present application;

[0064] Fig.10 It is a flowchart of a text processing method provided by an embodiment of the present application;

[0065] Fig.11 It is a schematic diagram of the structure of a text processing device provided by an embodiment of the present application;

[0066] Fig.12 It is a schematic diagram of the structure of a text processing device provided by an embodiment of the present application;

[0067] Fig.13 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application;

[0068] Fig.14 It is a structural block diagram of a terminal provided by an embodiment of the present application;

[0069] Fig.15 It is a schematic diagram of the structure of a server provided by an embodiment of the present application. Detailed implementation manners

[0070] To make the objectives, technical solutions, and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings.

[0071] In this application, terms such as "first" and "second" are used to distinguish identical or similar items with basically the same functions and effects. It should be understood that there is no logical or chronological dependency between "first", "second", and "nth", nor are the quantity and execution order limited. It should also be understood that although the following description uses the terms first and second to describe various elements, these elements should not be limited by the terms. These terms are only used to distinguish one element from another. For example, without departing from the scope of the various examples described, a first image can be referred to as a second image, and similarly, a second image can be referred to as a first image. Both the first image and the second image can be images, and in some cases, they can be separate and different images.

[0072] In this application, the meaning of the term "at least one" refers to one or more, and the meaning of the term "multiple" refers to two or more. For example, multiple data packets refer to two or more data packets.

[0073] It should be understood that the terms used in the description of the various examples herein are only for the purpose of describing specific examples and are not intended to be limiting. As used in the description of the various examples and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.

[0074] It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items. The term "and / or" is a description of the associative relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. Additionally, the character " / " in this application generally represents an "or" relationship between the associated objects before and after.

[0075] It should also be understood that in the various embodiments of this application, the magnitude of the serial numbers of the various processes does not imply the order of execution. The order of execution of each process should be determined by its function and internal logic and should not constitute any limitation on the implementation process of the embodiments of this application.

[0076] It should also be understood that determining B based on A does not mean determining B solely based on A. B can also be determined based on A and / or other information.

[0077] It should also be understood that the term "comprises" (also referred to as "includes", "including", "comprises" and / or "comprising") when used in this specification specifies the presence of the stated features, integers, steps, operations, elements, and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0078] It should also be understood that the term "if" can be interpreted to mean "when" ("when" or "upon") or "in response to determining" or "in response to detecting". Similarly, depending on the context, the phrase "if it is determined..." or "if [the stated condition or event] is detected" can be interpreted to mean "when it is determined..." or "in response to determining..." or "when [the stated condition or event] is detected" or "in response to detecting [the stated condition or event]".

[0079] The following describes the terms involved in this application.

[0080] Semantic hashing: refers to a hashing algorithm that maps high-dimensional space vectors to a low-dimensional Hamming space and maintains the similarity of the original space vectors, such that the Hamming distance of the new space vectors reflects the similarity of the original space vectors.

[0081] Hamming distance: The number of different bit values in two codewords is called the Hamming distance. The exclusive OR operation can be performed on two codewords, and the number of results that are 1 is counted, and this number is the Hamming distance.

[0082] Variational inference: A class of techniques used to approximate intractable integrals that arise in Bayesian inference and machine learning.

[0083] Similarity search, also known as nearest neighbor search, aims to find the most similar items in a large-scale database according to a user query statement. It has important applications in large-scale data retrieval.

[0084] The text processing method provided by the embodiments of this application relates to the field of artificial intelligence technology. The following describes the related artificial intelligence technologies.

[0085] Artificial Intelligence (AI) uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, including theories, methods, technologies, and application systems for perceiving the environment, acquiring knowledge, and using knowledge to achieve optimal results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a way similar to human intelligence. Artificial intelligence also studies the design principles and implementation methods of various intelligent machines to enable machines to have the functions of perception, reasoning, and decision-making.

[0086] Artificial intelligence technology is an interdisciplinary subject with a wide range of fields, including both hardware-level and software-level technologies. Artificial intelligence basic technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, and mechatronics. Artificial intelligence software technologies mainly include several major directions such as computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0087] Natural Language Processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between humans and computers in natural language. Natural language processing is a science that combines linguistics, computer science, and mathematics. Therefore, the research in this field will involve natural language, that is, the language people use in daily life, so it has a close connection with the research of linguistics. Natural language processing technologies usually include technologies such as text processing, semantic understanding, machine translation, robot question answering, and knowledge graphs.

[0088] Machine Learning (ML) is an interdisciplinary subject that involves multiple disciplines such as probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize the existing knowledge structure to continuously improve their own performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent, and its applications cover all fields of artificial intelligence. Machine learning and deep learning usually include technologies such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learning from demonstration.

[0089] Autopilot technology usually includes technologies such as high-precision maps, environmental perception, behavior decision-making, path planning, and motion control. Autopilot technology has a wide range of application prospects.

[0090] With the research and progress of artificial intelligence technology, artificial intelligence technology has been studied and applied in multiple fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, driverless, autonomous driving, drones, robots, smart healthcare, smart customer service, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.

[0091] The solution provided by the embodiments of this application involves technologies such as text processing, semantic understanding, and machine learning in natural language processing of artificial intelligence, and will be specifically described through the following embodiments.

[0092] The implementation environment of this application will be described below.

[0093] Figure 1 It is a schematic diagram of the implementation environment of a text processing method provided by the embodiments of this application. This implementation environment includes a terminal 101, or this implementation environment includes a terminal 101 and a text processing platform 102. The terminal 101 is connected to the text processing platform 102 through a wireless network or a wired network.

[0094] The terminal 101 can be at least one of a smart phone, a game console, a desktop computer, a tablet computer, an e-book reader, an MP3 (Moving Picture Experts Group Audio Layer III) player or an MP4 (Moving Picture Experts Group Audio Layer IV) player, a laptop portable computer, a smart robot, and a self-service payment device. The terminal 101 installs and runs an application program that supports text processing. For example, this application program can be a system application, an instant messaging application, a news push application, a shopping application, an online video application, or a social application.

[0095] Exemplarily, the terminal 101 can have an image acquisition function and an image processing function, can process the acquired image, and execute corresponding functions according to the processing results. The terminal 101 can complete this work independently or can obtain data services provided by the text processing platform 102. The embodiments of this application do not make any limitations in this regard.

[0096] The text processing platform 102 includes at least one of a server, multiple servers, a cloud computing platform, and a virtualization center. The text processing platform 102 is used to provide background services for applications that support text processing. Optionally, the text processing platform 102 undertakes the main processing work, and the terminal 101 undertakes the secondary processing work; or, the text processing platform 102 undertakes the secondary processing work, and the terminal 101 undertakes the main processing work; or, the text processing platform 102 or the terminal 101 can separately undertake the processing work. Alternatively, collaborative computing is performed between the text processing platform 102 and the terminal 101 using a distributed computing architecture.

[0097] Optionally, the text processing platform 102 includes at least one server 1021 and a database 1022. The database 1022 is used to store data. In the embodiments of the present application, the database 1022 can store sample texts or vector generation models and provide data services for at least one server 1021.

[0098] The server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto.

[0099] Those skilled in the art can know that the number of the above-mentioned terminals 101 and servers 1021 can be more or less. For example, the above-mentioned terminals 101 and servers 1021 can be only one, or the above-mentioned terminals 101 and servers 1021 can be dozens or hundreds, or a larger number. The embodiments of the present application do not limit the number and device types of the terminals or servers.

[0100] The application scenarios of the present application will be described below.

[0101] The text processing method provided by the embodiments of the present application can be applied to a variety of text processing scenarios. The text processing scenario can be a text retrieval scenario, a text recognition scenario, a smart home application scenario, or other scenarios involving determining the similarity between texts. The embodiments of the present application do not limit the specific application scenarios of the text processing method.

[0102] In some embodiments, the text processing scenario can be applied to a text retrieval scenario. A user can input the text to be retrieved, i.e., the target text, in a retrieval input box. The electronic device can display the target text in the retrieval interface and process the target text to determine the target feature vector of the target text. By comparing the target feature vector with the target feature vectors of other texts, the similarity between the target text and other texts can be determined. Furthermore, in the text retrieval result display area of the retrieval interface, other texts with a similarity greater than a threshold are displayed. When comparing using the target feature vector, it can be converted into a hash code to compare the hash codes of two texts.

[0103] For example, the text processing scenario can be applied to a target application, or a mini-program or application service of the target application. The target application can be a social software or other types of software. As Figure 2 shown, taking a certain social software as an example, the electronic device can display multiple application services 201 provided by the social software. The multiple application services 201 can provide services in different fields. For example, the multiple application services 201 can include credit card services, mobile phone recharge services, life payment services, virtual currency recharge services, urban transportation services, public welfare services, medical and health services, insurance services, etc. Taking the medical and health service as an example, if a user needs a medical and health service, a triggering operation can be performed at the application service 201 corresponding to the medical and health service to trigger the electronic device to display the retrieval interface 301 of the medical and health service. As Figure 3 shown, in the retrieval interface 301, the user can input the text "What should be noted for skin allergies", i.e., the target text 303, in the retrieval input box 302. The electronic device can display the target text 303 in the retrieval interface 301 and process the target text 303 to determine the target feature vector of the target text 303. The target feature vector is converted into a hash code and compared with the hash codes of other texts to determine the similarity between the target text 303 and other texts. Furthermore, in the text retrieval result display area 304 of the retrieval interface 303, other texts 305 with a similarity greater than a threshold are displayed.

[0104] Another example is in a text recognition scenario. After the electronic device obtains the target text, it determines the target feature vector of the target text. By determining the similarity between the target feature vector and the target feature vectors of texts with known categories, the category of the text can then be determined as the category to which the text with the highest similarity belongs. Among them, when determining the similarity using the target feature vector, the target feature vector can be converted into a hash code to compare the hash codes of two texts.

[0105] As Figure 4As shown, after the electronic device obtains the target text 401, it determines the target feature vector 402 of the target text, converts the target feature vector 402 into a hash code, and compares the hash code with the hash code obtained by converting the target feature vector of the text 403 of the known categories. Among the texts 403 of the known categories, there can be texts of multiple categories. For example, the multiple categories can include Category 1, Category 2, Category 3, …, Category j, where j is greater than 3. Each category corresponds to multiple texts, and then for each category, it can determine that the category of the text is the category to which the text with the highest similarity belongs, 404. For example, if the text with the highest similarity to the target text 401 is text a + n + 2, then the category of the target text 401 is Category 3.

[0106] For another example, in the smart home application scenario, the target text can be obtained by performing speech recognition on a voice command issued by a user. For example, as Figure 5 shown, after the user 501 issues a voice signal, the voice signal 503 can be collected by the microphone 502 of the smart home device, and the voice signal 503 is subjected to speech recognition based on the speech recognition system 504 to obtain the target text 505 corresponding to the voice signal. Then, the smart home device can determine the similarity between the target text 505 and the seed sentences 506 of multiple intents. During this similarity determination process, the target feature vector of the target text 505 can be determined, and then the target feature vector of the target text 505 is converted into a hash code, and then the hash code is compared with the hash code of the seed sentence 506. Then, the smart home device takes the intent corresponding to the seed sentence with the highest similarity as the intent 507 of the target text 505, such as Figure 3 .

[0107] Figure 6 is a flowchart of a text processing method provided by an embodiment of the present application. This method is applied to an electronic device, and the electronic device is a terminal or a server. Refer to Figure 6 . This method includes the following steps.

[0108] 601. The electronic device obtains a target text.

[0109] The target text can be any text with text content in any form. For example, the target text can be a sentence, a paragraph, or a document, and the target text can be any discourse fixed by writing.

[0110] 602. The electronic device obtains the semantic feature vector of the target text.

[0111] The semantic feature vector is a feature vector of the semantic aspect of the target text. Since the semantic feature vector is used to represent the semantics of the target text, the semantic feature vector can be a feature vector obtained by processing the text content of the target text and can reflect the text content of the target text.

[0112] 603. The electronic device obtains the conditional distribution of the target feature vector under the condition of the semantic feature vector. The conditional distribution is obtained by training the prior distribution of the target feature vector jointly with the semantic feature vectors of the at least two sample texts. The prior distribution is the distribution of the target feature vector obtained based on the correlation relationship information between the at least two sample texts.

[0113] Here, the joint distribution and the conditional distribution will be described first.

[0114] Joint distribution: Also known as the joint distribution function or the multi-dimensional distribution function, it is the distribution function of a random vector. Taking the two-dimensional case as an example, if (X, Y) is a two-dimensional random variable and x, y are any two real numbers, then the binary function. The F(x, y) = P{(X <= x) ∩ (Y <= y)} => P(X <= x, Y <= y) can be called the distribution function of the two-dimensional random variable (X, Y), or the joint distribution of the random variables X and Y. This joint distribution can be denoted as P(X, Y).

[0115] Conditional distribution. For the two-dimensional random variable (X, Y), the probability distribution of the other random variable can be considered under the condition that one of the random variables takes a (possible) fixed value. The probability distribution of X or Y obtained in this way is called the conditional probability distribution, simply referred to as the conditional distribution. For example, the conditional distribution of Y under the condition of X can be expressed as P(Y|X).

[0116] In the embodiments of the present application, the correlation relationship information between texts is introduced. The correlation relationship information between texts can characterize the similarity between texts from the perspective of the correlation relationship. The prior distribution is determined based on the correlation relationship information. When determining the corresponding target feature vector for the semantic feature vector in the subsequent obtained conditional distribution, the target feature vector takes into account the factor of the correlation relationship between texts, and then the semantic aspect features are represented by the semantic feature vector. The conditional distribution obtained by such training comprehensively considers the correlation relationship between texts and the semantic aspect features. Using this conditional distribution to determine the target feature vector for the target text, the target feature vector can more accurately represent the target text. By using this to determine the similarity, a more accurate similarity can be obtained.

[0117] The conditional distribution of the target feature vector under this semantic feature vector can be pre-trained according to the sample text in advance. When it is necessary to process the target text, the trained conditional distribution is obtained for processing. The training process of this conditional distribution can be referred to the following Figure 7 illustrated embodiment or Figure 8 the training process of the conditional distribution in the illustrated embodiment. The embodiments of the present application will not elaborate too much here.

[0118] 604. The electronic device determines the mean value corresponding to the semantic feature vector from this conditional distribution based on the semantic feature vector of the target text, and uses this mean value as the target feature vector of the target text. The target feature vector is used to determine the similarity with other texts.

[0119] This conditional distribution already includes the probability distribution of the semantic feature vector conditional target feature vector. After obtaining the semantic feature vector of the target text, the target feature vector corresponding to this semantic feature vector can be determined from the conditional distribution.

[0120] The embodiments of the present application introduce the correlation relationship information between texts. Since this correlation relationship information can characterize the correlation relationship between texts, the similarity between texts is characterized from the perspective of the correlation relationship. The prior distribution is determined based on this correlation relationship information. When determining the corresponding target feature vector for the semantic feature vector in the subsequent obtained conditional distribution, this target feature vector takes into account the factor of the correlation relationship between texts. Then, the semantic features are characterized through the semantic feature vector. In this way, the trained conditional distribution comprehensively considers the correlation relationship between texts and the semantic features. In this way, the target feature vectors of the text content or texts with a correlation relationship will be relatively close. This target feature vector can more accurately represent the target text. By determining the similarity based on this, a more accurate similarity can be obtained.

[0121] Figure 7 is a flowchart of a text processing method provided by the embodiments of the present application. Refer to Figure 7 , and this method includes the following steps.

[0122] 701. The electronic device obtains at least two sample texts and the semantic feature vectors of the at least two sample texts.

[0123] This semantic feature vector can characterize the semantic features of the sample text.

[0124] 702. The electronic device obtains the correlation relationship information between the at least two sample texts based on the citation relationship between the at least two sample texts or the similarity between the at least two sample texts.

[0125] There may be a citation relationship between different sample texts. For example, one sample text cites another sample text as a reference text. Understandably, there is a certain similarity between the sample texts with a citation relationship because there is a certain relevance in the text content, and thus there is the above-mentioned citation relationship. Based on this citation relationship, to determine the association relationship information between the sample texts can reflect the association relationship between the sample texts.

[0126] The association relationship information can also be determined by the similarity between the sample texts. By determining the association relationship information based on the similarity, a conditional distribution is trained. Subsequently, when determining the target feature vector of the text, the target feature vectors of similar texts will be relatively close.

[0127] 703. The electronic device obtains the prior distribution of the target feature vector based on the association relationship information between the at least two sample texts.

[0128] This prior distribution can reflect the association relationship between different sample texts, and the sample texts with an association relationship will be distributed relatively close.

[0129] 704. The electronic device obtains the conditional distribution of the target feature vector under the semantic feature vector based on the prior distribution of the target feature vector and the semantic feature vectors of the at least two sample texts.

[0130] The process of obtaining the conditional distribution can be a process of training the conditional distribution based on the sample texts. In this process, by combining the prior distribution and the semantic feature vector, the semantic features of the text itself and the association relationship between the texts are synthesized. Therefore, the target feature vectors between texts with similar content and an association relationship will be relatively close.

[0131] The embodiments of the present application introduce the association relationship information between texts. Since this association relationship information between texts can characterize the association relationship between texts, the similarity between texts is characterized from the perspective of the association relationship. The prior distribution is determined based on this association relationship information. When determining the corresponding target feature vector for the semantic feature vector in the subsequent obtained conditional distribution, this target feature vector takes into account the factor of the association relationship between texts. Then, the semantic features are characterized by the semantic feature vector. The conditional distribution trained in this way comprehensively considers the association relationship between texts and the semantic features. In this way, the target feature vectors of texts with text content or an association relationship will be relatively close, and this target feature vector can more accurately characterize the target text. By determining the similarity based on this, a more accurate similarity can be obtained.

[0132] Figure 8 It is a flowchart of a text processing method provided by the embodiments of the present application. See Figure 8, the method includes the following steps.

[0133] 801. An electronic device obtains at least two sample texts and semantic feature vectors of the at least two sample texts.

[0134] In an embodiment of the present application, the electronic device can obtain sample texts, and based on the sample texts, train the conditional distribution of the target feature vector under the semantic feature vector. In this way, based on this conditional distribution, the semantic feature vector of the text can be directly processed to determine the target feature vector of the text. The target feature vector is used to characterize the text, so that the target feature vector can be used as a basis for determining the similarity between the target text and other texts.

[0135] The at least two sample texts can be stored in different locations. Correspondingly, the electronic device can obtain the at least two sample texts in different ways.

[0136] In some embodiments, the at least two sample texts can be stored in a text database. Correspondingly, the electronic device can extract the at least two sample texts from the text database. For example, the text database can be a corpus.

[0137] In other embodiments, the at least two sample texts can also be stored in the electronic device. Correspondingly, the electronic device can extract the at least two sample texts from local storage.

[0138] For the process of obtaining the semantic feature vector, the semantic feature vector is used to characterize the semantic features of the text. Therefore, it is necessary to process the text content to obtain it. The following provides several possible implementation methods for obtaining the semantic feature vector, and the embodiments of the present application do not limit which specific method to adopt.

[0139] Method 1: Segment any sample text to obtain the words included in the sample text; based on the words included in the sample text, obtain one-hot encoding for the words included in the sample text to obtain one-hot vectors of the words included in the sample text, and use the one-hot vectors of the words included in the sample text as the semantic feature vectors of the sample text.

[0140] In Method 1, the sample text can be understood as a word sequence, and the word sequence can be x = {w1, w2,..., w |x|}, where w iDenote the i-th word. |x| is the number of words. After tokenizing each word, it can be one-hot encoded and transformed into a multi-dimensional one-hot vector. For example, in a specific example, the one-hot vector can be a vector of dimension |V|, where |V| is the total number of words included in all sample texts of the corpus. In this way, through this one-hot vector, it can be clearly known which words are included in each sample text to represent the text content of the sample text, that is, to represent the semantics of the sample text.

[0141] Method 2: Tokenize any sample text to obtain the words included in the sample text; determine the weights of the words included in the sample text based on the frequency of occurrence of the words included in the sample text in the sample text and the inverse document frequency of the words in the corpus; obtain the semantic feature vector of the sample text based on the weights and the words included in the sample text.

[0142] In Method 2, it can be understood that words with a high frequency of occurrence can better represent the main content of the sample text. Determine the weights for each word based on the probability of occurrence of the word in the sample text and the inverse document frequency of the word in all documents in the corpus, and filter the words included in the sample text with these weights to select more representative words, thereby obtaining the semantic feature vector. For example, this semantic feature vector can be a term frequency–inverse document frequency (TF-IDF) feature vector or a BM25 feature vector.

[0143] Method 3: Tokenize any sample text to obtain the words included in the sample text; determine the word vectors of the words included in the sample text; use the word vectors of the words included in the sample text as the semantic feature vector of the sample text.

[0144] In Method 3, this semantic feature vector can be a word vector, and the word vector can be obtained in various ways. For example, it can be obtained through models such as GLOVE and Word2vec. Through existing vector generation models, the semantic feature vector of the sample text can be determined quickly and efficiently.

[0145] 802. The electronic device obtains the association relationship information between the at least two sample texts based on the reference relationship or the similarity between the at least two sample texts.

[0146] In addition to the above semantic feature vectors, the electronic device also considers the correlation relationship between sample texts. Therefore, the electronic device can determine the correlation relationship information through the citation relationship or similarity, and combine the above semantic feature vectors to train the conditional distribution. This correlation relationship information can also be referred to as neighbor information.

[0147] The following provides two ways to obtain the correlation relationship information, and the embodiments of the present application do not limit which one is specifically adopted.

[0148] Method 1: Obtain the citation relationship between the at least two sample texts; based on the citation relationship, obtain the correlation relationship information between the at least two sample texts.

[0149] In Method 1, the correlation relationship information is determined based on the citation relationship between at least two sample texts. This citation relationship can also be called a link relationship. There is a certain similarity between sample texts with a citation relationship. For example, there is a certain relevance in the text content of two sample texts at a certain place, so one sample text can cite the other sample text, that is, it has the above citation relationship. Taking this citation relationship as the criterion to determine the correlation relationship information between sample texts can reflect the correlation relationship between sample texts.

[0150] In some embodiments, the correlation relationship information between the at least two sample texts is a correlation matrix; an element in the correlation matrix is used to indicate the correlation relationship information between two sample texts.

[0151] In some embodiments, for the correlation relationship information between any two sample texts, it can be determined in the following manner. Specifically, the electronic device can determine that the correlation relationship information between the first sample text and the second sample text is a non-zero value in response to the existence of a citation relationship between the first sample text and the second sample text. The electronic device can determine that the correlation relationship information between the first sample text and the second sample text is 0 in response to the non-existence of a citation relationship between the first sample text and the second sample text.

[0152] For example, the number of the sample texts can be N, then the correlation matrix used to characterize the correlation relationship information can be an N×N matrix. Wherein, N is a positive integer. This non-zero value can be 1 or other values, and this non-zero value can be set by those skilled in the art according to needs, and the embodiments of the present application do not limit this.

[0153] Method 2: Obtain the embedding vectors of the at least two sample texts; determine the feature vectors of the at least two sample texts based on the embedding vectors at any position among the embedding vectors of the at least two sample texts and the context vectors of the positions; compare the feature vectors of the at least two sample texts to obtain the similarity between the at least two sample texts; and obtain the correlation relationship information between the at least two sample texts based on the similarity.

[0154] In some embodiments, the similarity between sample texts can be calculated by other means, and the correlation relationship information can be determined based on the similarity, and then used to train the conditional distribution, so that the similarity between texts with higher accuracy can be obtained after combining the correlation relationship information and semantic features.

[0155] For example, each element in the correlation matrix can be expressed as the following Formula 1:

[0156]

[0157] where a ij indicates that (i,j) is an element of A, and N k (x) represents the k texts most similar to the text x.

[0158] 803. The electronic device obtains the prior distribution of the target feature vector based on the correlation relationship information between the at least two sample texts.

[0159] After the electronic device obtains the correlation relationship information, it can use this to obtain the prior distribution of the target feature vector. Specifically as follows:

[0160] When not considering the correlation relationship information, the joint distribution of the target feature vector and the semantic feature vector can be expressed as the following Formula 2:

[0161] p θ (x,z) = p θ (x|z)p(z), Formula 2

[0162] where p(z) is the prior distribution, and this prior distribution can be assumed to be the standard Gaussian distribution N(z; 0, I d ), where I d is the b-dimensional identity matrix. Where x is the semantic feature vector and z is the latent variable of the joint distribution, that is, the target feature vector.

[0163] Performing decomposition on it, the likelihood function can be decomposed into the following Formula 3 and Formula 4:

[0164]

[0165] where W ∈ R L×|V|is a parameter matrix, where L is the dimension of the latent variable z, and w j is a one - hot vector, which is 1 only at the j - th position and 0 at other positions, and b i is the bias term, and θ = {W, d1, …, d D}. For all sample texts X = {x1, x2, …, x N} in the corpus, due to the i.i.d. assumption, their joint distribution can be written as Formula Five below.

[0166]

[0167] where N represents the number of sample texts.

[0168] In the embodiments of the present application, considering the above - mentioned correlation relationship information, the covariance in the above - mentioned prior distribution may no longer be the identity matrix. After introducing the correlation relationship information, we can obtain a new prior distribution, as shown in Formula Six below:

[0169]

[0170] where represents the Kronecker product. By introducing the correlation matrix A, the covariance I N + λA can characterize the neighbor information between sample texts, where λ ∈ [0, 1) is used to control the degree of correlation. If two sample texts are neighbors, then I N + λA will be large. If they are not correlated, it is 0.

[0171] Among them, the joint distribution before introducing the correlation relationship information is expressed as Formula Seven and Formula Eight below:

[0172] p(X, Z) = p θ (X|Z)p I (p θ (X|Z)), Formula Seven

[0173]

[0174] For the prior distribution, it can be expressed as Formula Nine below, or it can also be expressed as Formula Ten below.

[0175]

[0176] where represents the Kronecker product. Here, by introducing the correlation relationship information, that is, the correlation matrix A, the covariance changes from I N to I N + λA. I N+λA can characterize the correlation information (also known as neighbor information) between sample texts, where λ ∈ [0, 1) is used to control the degree of correlation. If two sample texts are neighbors, that is, they have a correlation relationship, then I N +λA will be very large. If they have no correlation relationship, then I N +λA is 0.

[0177] 804. The electronic device obtains the conditional distribution of the target feature vector under the semantic feature vectors of the at least two sample texts based on the prior distribution of the target feature vector and the semantic feature vectors of the at least two sample texts.

[0178] After obtaining the prior distribution, the electronic device can obtain the conditional distribution required for subsequent processed texts with the prior distribution.

[0179] Specifically, the process of obtaining the conditional distribution can be implemented through the following steps 1 to 5.

[0180] Step 1. The electronic device can obtain a first initial conditional distribution and a second initial conditional distribution based on the prior distribution of the target feature vector. The first initial conditional distribution is the conditional distribution of the target feature vector under the semantic feature vector, and the second initial conditional distribution is the conditional distribution of the semantic feature vector under the target feature vector.

[0181] For example, the second initial conditional distribution can be determined by the above joint distribution and the marginal probability distribution of the following target feature vector. The marginal probability distribution of the target feature vector is as shown in Formula 11 below.

[0182]

[0183] The second initial conditional distribution can be expressed as p θ (x i |z i ), or it can be expressed as p θ (x|z).

[0184] The first initial conditional distribution can be expressed as q φ (z i |x i ), or the first initial conditional distribution can be expressed as Formula 12 below:

[0185]

[0186] Among them,

[0187] Step 2. The electronic device determines the mean and covariance corresponding to the semantic feature vector from the first initial conditional distribution for the semantic feature vectors of the at least two sample texts.

[0188] Step 3: The electronic device samples from the first initial condition distribution to obtain a candidate target feature vector corresponding to the semantic feature vector.

[0189] These Step 2 and Step 3 are variational encoding processes. By inputting the semantic feature vector, the corresponding mean, covariance, and candidate target feature vector can be determined through the first initial condition distribution, and the mean, covariance, and candidate target feature vector are output.

[0190] Step 4: The electronic device samples from the second initial condition distribution based on the candidate target feature vector, the mean, and the covariance to obtain a reconstructed semantic feature vector corresponding to the candidate target feature vector.

[0191] This Step 4 is a reconstruction process, which can also be considered as the reverse process of the above Step 2 and Step 3. The above Step 2 and Step 3 are encoding processes, and this Step 4 is also a decoding process. By comparing the reconstructed semantic feature vector with the original semantic feature vector, the accuracy of encoding and decoding can be determined.

[0192] In this Step 4, the input is the candidate target feature vector, the mean, and the covariance, and the output is the reconstructed semantic feature vector. This reconstruction process can be implemented based on the second initial condition distribution.

[0193] Step 5: The electronic device updates the first initial condition distribution and the second initial condition distribution based on the semantic feature vector, the reconstructed semantic feature vector, the candidate target feature vector, and the prior distribution, and stops until the target condition is met, obtaining a first condition distribution and a second condition distribution. The first condition distribution is the conditional distribution of the target feature vector under the semantic feature vector.

[0194] In this Step 5, through the above semantic feature vector, the reconstructed semantic feature vector, the candidate target feature vector, and the prior distribution, the electronic device can determine the evidence lower bound (ELBO) of the joint distribution or conditional distribution. The evidence lower bound can be referred to Fig. 9 , and the optimization objective is to maximize this evidence lower bound. In this way, the reconstructed semantic feature vector is infinitely close to the original semantic feature vector, and the obtained target feature vector is also closer to the target feature vector representation introducing the correlation relationship information. Therefore, the accuracy of the encoding process can be improved through the optimization process, and the correlation relationship information can also be reflected in the target feature vector.

[0195] In some embodiments, when obtaining the prior distribution in step 803 above, it is possible to convert it into graph data and then determine the prior distribution by means of a spanning tree. Furthermore, in the above joint distribution, conditional distribution, and evidence lower bound, all sample texts in the corpus can be decomposed, but data in the form of sample text pairs are obtained, thereby simplifying the calculation process and improving the calculation efficiency.

[0196] Specifically, the electronic device can generate graph data based on the correlation relationship information between the at least two sample texts. The graph data includes at least two text nodes and the edges between the text nodes. One text node corresponds to one sample text, and the edge between any two text nodes is used to indicate that the correlation relationship information between the two sample texts corresponding to the two text nodes is a non-zero value; based on the graph data, obtain the spanning tree corresponding to the graph data; based on the spanning tree, obtain the prior distribution of the target feature vector, and the prior distribution of the target feature vector is the joint distribution of the target feature vectors of any two sample texts.

[0197] In the above method of spanning tree, the electronic device can optimize the objective based on the form of sample text pairs. Specifically, the electronic device can obtain the first initial conditional distribution and the second initial conditional distribution of the target feature vectors of any two sample texts among the at least two sample texts based on the prior distribution of the target feature vector, determine the degree of association between the any two sample texts based on the semantic feature vectors of the any two sample texts; determine the mean, covariance, and candidate target feature vectors corresponding to the semantic feature vectors of the any two sample texts based on the semantic feature vectors of the any two sample texts, the degree of association, and the first initial conditional distribution; sample the reconstructed semantic feature vector corresponding to the candidate target feature vector from the second initial conditional distribution based on the candidate target feature vector, the mean, and the covariance; update the first initial conditional distribution and the second initial conditional distribution based on the semantic feature vectors of the any two sample texts, the reconstructed semantic feature vector, the candidate target feature vector, and the prior distribution until the target conditions are met and then stop.

[0198] For example, matrix A can be represented as a graph G=(V, E), where V={1, 2, …, N} represents document nodes, and E={(i, j)|a ij ≠0} represents the link relationship between documents. From a graph, a spanning tree T=(V, T_E) can be obtained. Based on the spanning tree, we can construct a new prior distribution, as shown in Equation XIII below:

[0199]

[0200] where, p T(z i ) and p T (z i , z j ) represents the marginal probability distribution of p G (Z). By the properties of the Gaussian distribution, the following formulas XIV and XV can be obtained:

[0201] p g (z i ) = N(z i ; 0, I d ), Formula XIV

[0202]

[0203] Among them, Similarly, we can design the approximate posterior distribution q φ (Z|X) in the same form, as shown in the following formula XVI:

[0204]

[0205] Among them, q φ (z i |x i ) is the same as defined before, and q φ (z i , z j |x i , x j ) is also defined as a Gaussian distribution, whose mean is [μ i ; μ j , and the covariance is the following formula XVII:

[0206]

[0207] Among them, γ ij ∈(0, 1] controls the correlation degree between z i and z j , and ⊙ represents the Hadamard product. Therefore, ELBO can be written as the following formula XVIII:

[0208]

[0209] Among them, E qT(Z|X) [logp θ(X|Z) can be solved by the method of reparameterization. Since the KL distances are all low-dimensional Gaussian distributions, an analytical expression can be written. Since the whole graph is approximated by a spanning tree, the final expression is decomposed into the form of single documents and document pairs, rather than the joint expression of all sample texts in the whole corpus. Thus, when inputting the sample texts, they can be processed in the form of sample text pairs, which is convenient for model training.

[0210] It should be noted that steps 801 to 804 are the training process of the conditional distribution of the target feature vector under the semantic feature vector, and the conditional distribution can be modeled. In this way, the process of determining the target feature vector based on the semantic feature vector is implemented by a vector generation model. Specifically, the process of determining the target feature vector is implemented based on a vector generation model; the vector generation model is obtained by modeling the conditional distribution. That is, the vector generation model is used to determine the target feature vector based on the conditional distribution and the semantic feature vector. Correspondingly, steps 801 to 804 are the process of training the vector generation model.

[0211] In some embodiments, the vector generation model may include three parts: a variational encoder, a correlation encoder, and a generator. The generator is used to obtain the reconstructed semantic feature vector based on the candidate target feature vector. The variational encoder is used to determine the target feature vector based on the conditional distribution and the semantic feature vector. The correlation encoder is used to process the input sample text pairs and output the correlation degree γ of the sample text pairs ij =f φ (x i ,x j ).

[0212] 805. The electronic device obtains the target text.

[0213] The target text is the text to be processed. It should be noted that the electronic device in steps 801 to 804 may be the same as or different from the electronic device in steps 805 to 807. In different application scenarios, whether they are the same or not may also include different situations.

[0214] The electronic device in the above steps 801 to 804 may be a server or a terminal. The electronic device in steps 805 to 807 may be a server or a terminal. In some embodiments, after the terminal obtains the target text, it sends it to the server, and the server processes it based on the received target text through the pre-trained conditional distribution. In other embodiments, after the server trains the conditional distribution, it can package it into a configuration file and send it to the terminal. After the terminal obtains the target text, it can process the target text based on the conditional distribution in the configuration file.

[0215] 806. The electronic device obtains the semantic feature vector of the target text in response to the vector acquisition instruction of the target text.

[0216] For this vector acquisition instruction, the vector acquisition instruction can be triggered by the user's search operation on the target text, or by the user's processing operation on the target text, or when the electronic device obtains the target text. The triggering manner of the vector acquisition instruction can be set by those skilled in the relevant art according to requirements, and the embodiments of the present application do not limit this.

[0217] The process of obtaining the semantic feature vector in step 806 is the same as the process of obtaining the semantic feature vector in step 801 above, and will not be elaborated here.

[0218] Similarly, in some embodiments, the acquisition process may include the following three methods, and the embodiments of the present application do not limit which one is specifically adopted.

[0219] Method 1: Segment the target text to obtain the words included in the target text; based on the words included in the target text, perform one-hot encoding on the words included in the target text to obtain the one-hot vectors of the words included in the target text, and use the one-hot vectors of the words included in the target text as the semantic feature vector of the target text.

[0220] Method 2: Segment the target text to obtain the words included in the target text; determine the weights of the words included in the target text based on the occurrence frequency of the words included in the target text in the target text and the inverse document frequency of the words in the corpus; based on the weights and the words included in the target text, obtain the semantic feature vector of the target text.

[0221] Method 3: Segment the target text to obtain the words included in the target text; determine the word vectors of the words included in the target text; use the word vectors of the words included in the target text as the semantic feature vector of the target text.

[0222] 807. The electronic device determines the mean value corresponding to the semantic feature vector from the conditional distribution based on the semantic feature vector of the target text, and uses the mean value as the target feature vector of the target text. The target feature vector is used to determine the similarity with other texts.

[0223] The conditional distribution of the target feature vector under the condition that the electronic device has obtained the semantic feature vector. Therefore, after determining the semantic feature vector of the target text

[0224] In the way of modeling the above-mentioned conditional distribution to obtain a vector generation model, the electronic device may input the semantic feature vector of the target text into the vector generation model. Based on the model parameters, the vector generation model determines the mean value corresponding to the semantic feature vector from the conditional distribution and outputs the mean value as the target feature vector of the target text.

[0225] In some embodiments, the target feature vector can characterize the target text. The electronic device can then determine the similarity between the target text and other texts based on the target feature vector. When obtaining the similarity, each text can be characterized by the hash code of each text, and then the similarity between the texts can be determined by the similarity between the hash codes.

[0226] Specifically, the electronic device can perform hash encoding on the target feature vector of the target text to obtain the hash code of the target text, and compare the hash code with the hash codes of other texts to determine the similarity between the target text and the other texts.

[0227] For hash encoding, the hash encoding process is actually mapping the latent vector z into a hash code encoding {0, 1} T , where the latent vector z is the target feature vector. Specifically, the hash encoding process can be: in response to any element in the target feature vector being greater than the threshold corresponding to the element, the hash code corresponding to the element is determined as the first value; the threshold is the median of the elements in the target feature vectors of the at least two sample texts; in response to any element in the target feature vector being less than or equal to the threshold corresponding to the element, the hash code corresponding to the element is determined as the second value.

[0228] The comparison result between the hash codes can be represented by the Hamming distance. Specifically, the electronic device can perform an exclusive OR operation on the hash codes of two texts to obtain the Hamming distance between the two hash codes, and determine the Hamming distance as the similarity between the two texts.

[0229] For example, the first value can be 1 and the second value can be 0. Through the above hash encoding process, the target feature vector is binarized to obtain the hash code.

[0230] The following provides a specific example. In the text retrieval scenario shown above Figure 3 and Figure 4 , the electronic device can obtain the target text, then determine its target feature vector, and then convert the target feature vector into a hash code to compare with the hash codes of other known texts, and then display the text with the closest distance as the retrieval result. Specifically, as Fig.10As shown, the electronic device 1000 can display a search box 1002 in the search interface 1001, where the user can enter the text to be searched. The electronic device takes the text in the search box 1002 as the target text 1003: What should be noted for skin allergies. Further, the electronic device processes the target text 1003 through the vector generation model 1004 to obtain the target feature vector 1005 of the target text, and then performs hash encoding on it to obtain the hash code 1006 of the target text. Then, the Hamming distance 1007 between the hash code of the target text and the hash codes of the existing texts can be calculated, and then the similar texts 1008 of the target text can be determined. Then, the similar texts 1008 of the target text can be returned. The electronic device can display the similar texts in the search result display interface 1011, which are text 1009 and text 1010 in the figure respectively.

[0231] Next, the method provided in this application (identified by ours) is tested on different data sets with other related technologies, and the following test results are obtained.

[0232] In one example, each method is executed through the data sets Reuters21578 and 20Newsgroups respectively, and the test results shown in Table 1 and Table 2 are obtained. Compared with other models in the related technologies, the model trained by the method provided in this application has made a major breakthrough in performance. When the hash code is set to different dimensions, the accuracy obtained by the method provided in this application is generally higher than that of other models in the related technologies. In this experiment, multiple methods are analyzed. Among them, the method provided in this application is identified by ours (ours). The comparison methods also include SpH (Spectrum hash), STH (Self taught hash), S-RBM (S-Restricted Boltzmann Machine), DVSH (Deep Visual-Semantic Hashing), NASH (Neural Architecture Semantic Hashing), GMSH (Gaussian Mixture Semantic Hashing), and Node2hash. Among them, Node2hash is a graph-aware deep semantic text hashing method.

[0233] Table 1

[0234] method 8 bits 16 bits 32bits 64bits 128 bits S H 0.6080 0.6340 0.6513 0.6290 0.6045 STH 0.6616 0.7351 0.7554 0.7350 0.6986 S-RBM 0.5113 0.5740 0.6154 0.6177 0.6452 DVSH 0.6859 0.7165 0.7753 0.7456 0.7318 NASH 0.7113 0.7624 0.7993 0.7812 0.7559 GMSH na 0.7672 0.8183 0.8212 0.7846 Node2hash 0.7313 0.7802 0.8233 0.8248 0.8290 Ours 0.7468 0.7989 0.8293 0.8470 0.8477

[0235] Table 2

[0236] method 8bits 16 bits 32bits 64bits 128 bits S H 0.2545 0.3200 0.3709 0.3196 0.2716 STH 0.3664 0.5237 0.5860 0.5806 0.5443 S-RBM 0.0594 0.0604 0.0533 0.0623 0.0642 DVSH 0.3643 0.3904 0.4327 0.1731 0.0522 NASH 0.3786 0.5108 0.5671 0.5071 0.4664 GMSH na 0.4855 0.5381 0.5869 0.5583 Node2hash 0.4235 0.5596 0.5821 0.6028 0.6014 Ours 0.5475 0.5995 0.6204 0.6213 0.6046

[0237] The embodiments of the present application introduce the correlation relationship information between texts. Since the correlation relationship information between texts can represent the correlation relationship between texts, the similarity between texts is characterized from the perspective of the correlation relationship. The prior distribution is determined based on this correlation relationship information. When determining the corresponding target feature vector for the semantic feature vector in the subsequent obtained conditional distribution, this target feature vector takes into account the factor of the correlation relationship between texts. Then, the semantic features are characterized by the semantic feature vector. In this way, the trained conditional distribution comprehensively considers the correlation relationship between texts and the semantic features. In this way, the target feature vectors of the text content or texts with a correlation relationship will be relatively close. This target feature vector can more accurately represent the target text. By determining the similarity based on this, a more accurate similarity can be obtained.

[0238] All the above optional technical solutions can be combined arbitrarily to form the optional embodiments of the present application, which will not be elaborated one by one here.

[0239] Fig.11 is a schematic structural diagram of a text processing device provided by the embodiments of the present application. Refer to Fig.11 and the device includes:

[0240] An acquisition module 1101, configured to acquire a target text;

[0241] The acquisition module 1101 is further configured to acquire the semantic feature vector of the target text;

[0242] The acquisition module 1101 is further configured to acquire the conditional distribution of the target feature vector under the condition of the semantic feature vector. The conditional distribution is obtained based on the correlation relationship information between at least two sample texts, and the distribution of the target feature vector is the prior distribution. It is trained by combining the prior distribution with the semantic feature vectors of the at least two sample texts;

[0243] A determination module 1102, configured to determine, based on the semantic feature vector of the target text, the mean value corresponding to the semantic feature vector from the conditional distribution, and use the mean value as the target feature vector of the target text. The target feature vector is used to determine the similarity with other texts.

[0244] In some embodiments, the conditional distribution of the target feature vector under the semantic feature vector is obtained based on the following process: obtaining at least two sample texts and the semantic feature vectors of the at least two sample texts; obtaining the association relationship information between the at least two sample texts based on the citation relationship between the at least two sample texts or the similarity between the at least two sample texts; obtaining the prior distribution of the target feature vector based on the association relationship information between the at least two sample texts; and obtaining the conditional distribution of the target feature vector under the semantic feature vector based on the prior distribution of the target feature vector and the semantic feature vectors of the at least two sample texts.

[0245] In some embodiments, obtaining the association relationship information between the at least two sample texts based on the citation relationship between the at least two sample texts or the similarity between the at least two sample texts includes any of the following:

[0246] Obtaining the citation relationship between the at least two sample texts; and obtaining the association relationship information between the at least two sample texts based on the citation relationship.

[0247] Obtaining the embedding vectors of the at least two sample texts; determining the feature vectors of the at least two sample texts based on the embedding vectors at any position in the embedding vectors of the at least two sample texts and the context vectors of the positions; comparing the feature vectors of the at least two sample texts to obtain the similarity between the at least two sample texts; and obtaining the association relationship information between the at least two sample texts based on the similarity.

[0248] In some embodiments, the association relationship information between the at least two sample texts is an association matrix; and an element in the association matrix is used to indicate the association relationship information between two sample texts.

[0249] Obtaining the citation relationship between the at least two sample texts includes: in response to a citation relationship existing between a first sample text and a second sample text, determining that the association relationship information between the first sample text and the second sample text is a non-zero value; and in response to no citation relationship existing between the first sample text and the second sample text, determining that the association relationship information between the first sample text and the second sample text is 0.

[0250] In some embodiments, obtaining the conditional distribution of the target feature vector under the semantic feature vector based on the prior distribution of the target feature vector and the semantic feature vectors of the at least two sample texts includes: obtaining a first initial conditional distribution and a second initial conditional distribution based on the prior distribution of the target feature vector, where the first initial conditional distribution is the conditional distribution of the target feature vector under the semantic feature vector, and the second initial conditional distribution is the conditional distribution of the semantic feature vector under the target feature vector; based on the semantic feature vectors of the at least two sample texts, determining the mean and covariance corresponding to the semantic feature vector from the first initial conditional distribution; sampling the candidate target feature vector corresponding to the semantic feature vector from the first initial conditional distribution; based on the candidate target feature vector, the mean, and the covariance, sampling the reconstructed semantic feature vector corresponding to the candidate target feature vector from the second initial conditional distribution; based on the semantic feature vector, the reconstructed semantic feature vector, the candidate target feature vector, and the prior distribution, updating the first initial conditional distribution and the second initial conditional distribution until the target condition is met and then stopping to obtain a first conditional distribution and a second conditional distribution, where the first conditional distribution is the conditional distribution of the target feature vector under the semantic feature vector.

[0251] In some embodiments, obtaining the prior distribution of the target feature vector based on the association relationship information between the at least two sample texts includes: generating graph data based on the association relationship information between the at least two sample texts, where the graph data includes at least two text nodes and the edges between the text nodes, with one text node corresponding to one sample text, and the edge between any two text nodes being used to indicate that the association relationship information between the two sample texts corresponding to the two text nodes is a non-zero value; obtaining the spanning tree corresponding to the graph data based on the graph data; and obtaining the prior distribution of the target feature vector based on the spanning tree, where the prior distribution of the target feature vector is the joint distribution of the target feature vectors of any two sample texts.

[0252] In some embodiments, obtaining the conditional distribution of the target feature vector under the semantic feature vector of the prior distribution based on the target feature vector and the at least two sample texts includes: obtaining the first initial conditional distribution and the second initial conditional distribution of the target feature vectors of any two of the at least two sample texts based on the prior distribution of the target feature vector; determining the degree of association between any two of the sample texts based on the semantic feature vectors of the any two sample texts; determining the mean, covariance, and candidate target feature vector corresponding to the semantic feature vectors of the any two sample texts based on the semantic feature vectors of the any two sample texts, the degree of association, and the first initial conditional distribution; sampling from the second initial conditional distribution based on the candidate target feature vector, the mean, and the covariance to obtain the reconstructed semantic feature vector corresponding to the candidate target feature vector; and updating the first initial conditional distribution and the second initial conditional distribution based on the semantic feature vectors of the any two sample texts, the reconstructed semantic feature vector, the candidate target feature vector, and the prior distribution until the target condition is met and then stopping.

[0253] In some embodiments, the determination process of the target feature vector is implemented based on a vector generation model; the vector generation model is obtained by modeling the conditional distribution.

[0254] The obtaining module 1101 is configured to obtain a vector generation model.

[0255] The determining module 1102 is configured to input the semantic feature vector of the target text into the vector generation model, and the vector generation model determines the mean corresponding to the semantic feature vector from the conditional distribution based on the model parameters, and outputs the mean as the target feature vector of the target text.

[0256] In some embodiments, the obtaining module 1101 is configured to perform any one of the following:

[0257] Segment the target text to obtain the words included in the target text; based on the words included in the target text, obtain one-hot encodings of the words included in the target text to obtain one-hot vectors of the words included in the target text, and use the one-hot vectors of the words included in the target text as the semantic feature vectors of the target text.

[0258] Segment the target text to obtain the words included in the target text; determine the weights of the words included in the target text based on the frequency of occurrence of the words included in the target text in the target text and the inverse document frequency of the words in the corpus; and obtain the semantic feature vector of the target text based on the weights and the words included in the target text.

[0259] Tokenize the target text to obtain the words included in the target text; determine the word vectors of the words included in the target text; use the word vectors of the words included in the target text as the semantic feature vector of the target text.

[0260] In some embodiments, the apparatus further includes:

[0261] An encoding module, configured to perform hash encoding on the target feature vector of the target text to obtain the hash code of the target text;

[0262] A comparison module, configured to compare the hash code with the hash codes of other texts to determine the similarity between the target text and the other texts.

[0263] It should be noted that: when the text processing apparatus provided in the above embodiments processes text, only the above-mentioned division of each functional module is used for illustration. In practical applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the text processing apparatus is divided into different functional modules to complete all or part of the functions described above. In addition, the text processing apparatus provided in the above embodiments and the text processing method embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be elaborated here.

[0264] Fig.12 is a schematic structural diagram of a text processing apparatus provided by an embodiment of the present application. Refer to Fig.12 , the apparatus includes:

[0265] A vector acquisition module 1201, configured to acquire at least two sample texts and the semantic feature vectors of the at least two sample texts;

[0266] An information acquisition module 1202 is further configured to acquire the correlation relationship information between the at least two sample texts based on the citation relationship between the at least two sample texts or the similarity between the at least two sample texts;

[0267] A distribution acquisition module 1203, configured to acquire the prior distribution of the target feature vector based on the correlation relationship information between the at least two sample texts;

[0268] The distribution acquisition module 1203 is configured to acquire the conditional distribution of the target feature vector under the condition of the semantic feature vector based on the prior distribution of the target feature vector and the semantic feature vectors of the at least two sample texts.

[0269] In some embodiments, the vector acquisition module 1201 is further configured to acquire the semantic feature vector of the target text in response to a vector acquisition instruction of the target text;

[0270] The device further includes:

[0271] A vector generation module, configured to determine, from the conditional distribution, a mean value corresponding to the semantic feature vector based on the semantic feature vector of the target text, and use the mean value as the target feature vector of the target text, where the target feature vector is used to determine a similarity with other texts.

[0272] It should be noted that: when the text processing device provided in the above embodiment processes text, only the division of the above functional modules is used for illustration. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the text processing device is divided into different functional modules to complete all or part of the functions described above. In addition, the text processing device provided in the above embodiment and the text processing method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be elaborated here.

[0273] Fig.13 FIG. 11 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. The electronic device 1300 may vary greatly due to different configurations or performances, and may include one or more processors (Central Processing Units, CPUs) 1301 and one or more memories 1302. Among them, at least one computer program is stored in the memory 1302, and the at least one computer program is loaded and executed by the processor 1301 to implement the text processing method provided in each of the above method embodiments. The electronic device may further include other components for implementing device functions. For example, the electronic device may further have components such as a wired or wireless network interface and an input / output interface for input and output. Details are not described in this embodiment of the present application.

[0274] The electronic device in the above method embodiment can be implemented as a terminal. For example, Fig.14 FIG. 14 is a block diagram of a terminal provided in an embodiment of the present application. The terminal 1400 may be a portable mobile terminal, such as: a smart phone, a tablet computer, an MP3 (Moving Picture Experts Group Audio Layer III) player, an MP4 (Moving Picture Experts Group Audio Layer IV) player, a notebook computer or a desktop computer. The terminal 1400 may also be referred to by other names such as a user equipment, a portable terminal, a laptop terminal, a desktop terminal, etc.

[0275] Generally, the terminal 1400 includes: a processor 1401 and a memory 1402.

[0276] The processor 1401 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. The processor 1401 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 1401 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the wake state, also known as the CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1401 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1401 may further include an AI (Artificial Intelligence) processor, and the AI processor is used to process computational operations related to machine learning.

[0277] The memory 1402 may include one or more computer-readable storage media, and the computer-readable storage media may be non-transitory. The memory 1402 may further include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash storage devices. In some embodiments, the non-transitory computer-readable storage media in the memory 1402 is used to store at least one instruction, and the at least one instruction is used to be executed by the processor 1401 to implement the text processing method provided in the method embodiments of the present application.

[0278] In some embodiments, the terminal 1400 may further optionally include: a peripheral device interface 1403 and at least one peripheral device. The processor 1401, the memory 1402, and the peripheral device interface 1403 may be connected through a bus or signal lines. Each peripheral device may be connected to the peripheral device interface 1403 through a bus, signal lines, or a circuit board. Specifically, the peripheral devices include at least one of a radio frequency circuit 1404, a display screen 1405, a camera assembly 1406, an audio circuit 1407, and a power supply 1409.

[0279] The peripheral device interface 1403 can be used to connect at least one I / O (Input / Output) related peripheral device to the processor 1401 and the memory 1402. In some embodiments, the processor 1401, the memory 1402, and the peripheral device interface 1403 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1401, the memory 1402, and the peripheral device interface 1403 can be implemented on a separate chip or circuit board, and this embodiment does not limit this.

[0280] The radio frequency circuit 1404 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 1404 communicates with a communication network and other communication devices through electromagnetic signals. The radio frequency circuit 1404 converts an electrical signal into an electromagnetic signal for transmission, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 1404 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so on. The radio frequency circuit 1404 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes but is not limited to: the World Wide Web, a metropolitan area network, an intranet, various generations of mobile communication networks (2G, 3G, 4G, and 5G), a wireless local area network, and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 1404 may further include a circuit related to NFC (Near Field Communication), and this application does not limit this.

[0281] The display screen 1405 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 1405 is a touch display screen, the display screen 1405 also has the ability to collect touch signals on or above the surface of the display screen 1405. The touch signals can be input to the processor 1401 as control signals for processing. At this time, the display screen 1405 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there may be one display screen 1405, which is provided on the front panel of the terminal 1400; in other embodiments, there may be at least two display screens 1405, which are respectively provided on different surfaces of the terminal 1400 or are in a foldable design; in other embodiments, the display screen 1405 may be a flexible display screen, which is provided on the curved surface or the folding surface of the terminal 1400. Even further, the display screen 1405 can also be set to an irregular non-rectangular shape, that is, an irregular-shaped screen. The display screen 1405 can be prepared using materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).

[0282] The camera module 1406 is used to capture images or videos. Optionally, the camera module 1406 includes a front camera and a rear camera. Generally, the front camera is provided on the front panel of the terminal, and the rear camera is provided on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth-of-field camera, a wide-angle camera, and a telephoto camera respectively, to implement functions such as background blurring by fusing the main camera and the depth-of-field camera, panoramic shooting by fusing the main camera and the wide-angle camera, and VR (Virtual Reality) shooting function or other fused shooting functions. In some embodiments, the camera module 1406 may also include a flash. The flash can be a single-color-temperature flash or a two-color-temperature flash. A two-color-temperature flash refers to a combination of a warm-light flash and a cold-light flash, which can be used for light compensation under different color temperatures.

[0283] The audio circuit 1407 may include a microphone and a speaker. The microphone is used to collect sound waves of the user and the environment, and convert the sound waves into electrical signals for input to the processor 1401 for processing, or input to the radio frequency circuit 1404 to achieve voice communication. For the purpose of stereo collection or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal 1400. The microphone may also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert the electrical signal from the processor 1401 or the radio frequency circuit 1404 into sound waves. The speaker may be a traditional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for uses such as ranging. In some embodiments, the audio circuit 1407 may also include a headphone jack.

[0284] The power supply 1409 is used to supply power to each component in the terminal 1400. The power supply 1409 may be alternating current, direct current, a disposable battery or a rechargeable battery. When the power supply 1409 includes a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery charged through a wired line, and a wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.

[0285] In some embodiments, the terminal 1400 further includes one or more sensors 1410. The one or more sensors 1410 include but are not limited to: an acceleration sensor 1411, a gyroscope sensor 1412, a pressure sensor 1413, an optical sensor 1415, and a proximity sensor 1416.

[0286] The acceleration sensor 1411 can detect the magnitudes of accelerations on the three coordinate axes of the coordinate system established with the terminal 1400. For example, the acceleration sensor 1411 can be used to detect the components of the gravitational acceleration on the three coordinate axes. The processor 1401 can control the display screen 1405 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 1411. The acceleration sensor 1411 can also be used for collecting game or user's motion data.

[0287] The gyroscope sensor 1412 can detect the body direction and rotation angle of the terminal 1400. The gyroscope sensor 1412 can cooperate with the acceleration sensor 1411 to collect the 3D actions of the user on the terminal 1400. According to the data collected by the gyroscope sensor 1412, the processor 1401 can achieve the following functions: motion sensing (such as changing the UI according to the user's tilting operation), image stabilization during shooting, game control, and inertial navigation.

[0288] The pressure sensor 1413 can be disposed on the side frame of the terminal 1400 and / or the lower layer of the display screen 1405. When the pressure sensor 1413 is disposed on the side frame of the terminal 1400, it can detect the holding signal of the user on the terminal 1400, and the processor 1401 can perform left / right hand recognition or quick operation according to the holding signal collected by the pressure sensor 1413. When the pressure sensor 1413 is disposed on the lower layer of the display screen 1405, the processor 1401 can control the operable controls on the UI interface according to the pressure operation of the user on the display screen 1405. The operable controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.

[0289] The optical sensor 1415 is used to collect the ambient light intensity. In one embodiment, the processor 1401 can control the display brightness of the display screen 1405 according to the ambient light intensity collected by the optical sensor 1415. Specifically, when the ambient light intensity is high, the display brightness of the display screen 1405 is increased; when the ambient light intensity is low, the display brightness of the display screen 1405 is decreased. In another embodiment, the processor 1401 can also dynamically adjust the shooting parameters of the camera module 1406 according to the ambient light intensity collected by the optical sensor 1415.

[0290] The proximity sensor 1416, also known as the distance sensor, is usually disposed on the front panel of the terminal 1400. The proximity sensor 1416 is used to collect the distance between the user and the front of the terminal 1400. In one embodiment, when the proximity sensor 1416 detects that the distance between the user and the front of the terminal 1400 is gradually decreasing, the processor 1401 controls the display screen 1405 to switch from the lit state to the off state; when the proximity sensor 1416 detects that the distance between the user and the front of the terminal 1400 is gradually increasing, the processor 1401 controls the display screen 1405 to switch from the off state to the lit state.

[0291] Those skilled in the art can understand that Fig.14 the structure shown in does not constitute a limitation on the terminal 1400, and it may include more or fewer components than shown in the figure, or combine some components, or adopt different component arrangements.

[0292] The electronic device in the above method embodiment can be implemented as a server. For example, Fig.15It is a schematic structural diagram of a server provided by an embodiment of the present application. The server 1500 may vary greatly due to different configurations or performances, and can include one or more processors (Central Processing Units, CPU) 1501 and one or more memories 1502. Among them, at least one computer program is stored in the memory 1502, and the at least one computer program is loaded and executed by the processor 1501 to implement the text processing methods provided by the above various method embodiments. Of course, the server can also have components such as wired or wireless network interfaces and input / output interfaces for input / output. The server can also include other components for implementing device functions, which will not be elaborated here.

[0293] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including at least one computer program. The at least one computer program can be executed by a processor to complete the text processing method in the above embodiment. For example, the computer-readable storage medium can be a read-only memory (Read-Only Memory, abbreviated as: ROM), a random access memory (Random Access Memory, abbreviated as: RAM), a compact disc read-only memory (Compact Disc Read-Only Memory, abbreviated as: CD-ROM), magnetic tape, floppy disk, and optical data storage device, etc.

[0294] In an exemplary embodiment, a computer program product or a computer program is also provided. The computer program product or the computer program includes one or more computer programs, and the one or more computer programs are stored in a computer-readable storage medium. One or more processors of an electronic device can read the one or more computer programs from the computer-readable storage medium, and the one or more processors execute the one or more computer programs, so that the electronic device can execute the above text processing method.

[0295] It should be understood that in various embodiments of the present application, the magnitudes of the serial numbers of the above processes do not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.

[0296] It should be understood that determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.

[0297] Those of ordinary skill in the art can understand that all or part of the steps to implement the above embodiments can be completed by hardware, or can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable storage medium. The above-mentioned storage medium can be a read-only memory, a disk, an optical disc, etc.

[0298] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included within the protection scope of the present application.

Claims

1. A text processing method, characterized in that, The method includes: Obtain a target text; Obtain a semantic feature vector of the target text; Obtain a conditional distribution of a target feature vector under the condition of the semantic feature vector, where the conditional distribution is obtained by training the prior distribution of the target feature vector in combination with the semantic feature vectors of at least two sample texts, and the prior distribution is a distribution of the target feature vector obtained based on the correlation relationship information between the at least two sample texts; Based on the semantic feature vector of the target text, determine the mean value corresponding to the semantic feature vector from the conditional distribution, and use the mean value as the target feature vector of the target text, where the target feature vector is used to determine the similarity with other texts; Among them, the process of obtaining the conditional distribution of the target feature vector under the condition of the semantic feature vector by training the prior distribution of the target feature vector in combination with the semantic feature vectors of the at least two sample texts includes: Based on the prior distribution of the target feature vector, obtain a first initial conditional distribution and a second initial conditional distribution, where the first initial conditional distribution is the conditional distribution of the target feature vector under the condition of the semantic feature vector, and the second initial conditional distribution is the conditional distribution of the semantic feature vector under the condition of the target feature vector; Using the semantic feature vectors of the at least two sample texts as inputs, through variational encoding, obtain candidate target feature vectors corresponding to the semantic feature vectors from the first initial conditional distribution; using the candidate target feature vectors as inputs, through reconstruction, obtain reconstructed semantic feature vectors corresponding to the candidate target feature vectors from the second initial conditional distribution, and the reconstruction process is the inverse process of the variational encoding process; Based on the semantic feature vector, the reconstructed semantic feature vector, the candidate target feature vector, and the prior distribution, update the first initial conditional distribution and the second initial conditional distribution until the target conditions are met and then stop to obtain a first conditional distribution, where the first conditional distribution is the conditional distribution of the target feature vector under the condition of the semantic feature vector.

2. The method according to claim 1, wherein The conditional distribution of the target feature vector under the condition of the semantic feature vector is obtained based on the following process: Obtain at least two sample texts and the semantic feature vectors of the at least two sample texts; Based on the citation relationship between the at least two sample texts or the similarity between the at least two sample texts, obtain the correlation relationship information between the at least two sample texts; Based on the correlation relationship information between the at least two sample texts, obtain the prior distribution of the target feature vector; Execute the step of obtaining the conditional distribution of the target feature vector under the condition of the semantic feature vector by training the prior distribution of the target feature vector in combination with the semantic feature vectors of the at least two sample texts.

3. The method according to claim 2, wherein The obtaining of the correlation relationship information between the at least two sample texts based on the citation relationship between the at least two sample texts or the similarity between the at least two sample texts includes any one of the following: Obtain the citation relationship between the at least two sample texts; based on the citation relationship, obtain the correlation relationship information between the at least two sample texts; Obtain the embedding vectors of the at least two sample texts; determine the feature vectors of the at least two sample texts based on the embedding vectors at any position in the embedding vectors of the at least two sample texts and the context vectors of the positions; compare the feature vectors of the at least two sample texts to obtain the similarity between the at least two sample texts; based on the similarity, obtain the correlation relationship information between the at least two sample texts.

4. The method according to claim 3, wherein The correlation relationship information between the at least two sample texts is a correlation matrix; an element in the correlation matrix is used to indicate the correlation relationship information between two sample texts; The obtaining of the citation relationship between the at least two sample texts includes: In response to the existence of a citation relationship between the first sample text and the second sample text, determine that the correlation relationship information between the first sample text and the second sample text is a non-zero value; In response to the non-existence of a citation relationship between the first sample text and the second sample text, determine that the correlation relationship information between the first sample text and the second sample text is 0.

5. The method according to claim 2, wherein The training of the conditional distribution of the target feature vector under the semantic feature vectors of the at least two sample texts by jointly using the prior distribution of the target feature vector includes: Based on the semantic feature vectors of the at least two sample texts, determine the mean and covariance corresponding to the semantic feature vectors from the first initial conditional distribution; Sample the candidate target feature vectors corresponding to the semantic feature vectors from the first initial conditional distribution; Based on the candidate target feature vectors, the mean, and the covariance, sample the reconstructed semantic feature vectors corresponding to the candidate target feature vectors from the second initial conditional distribution; Based on the semantic feature vectors, the reconstructed semantic feature vectors, the candidate target feature vectors, and the prior distribution, update the first initial conditional distribution and the second initial conditional distribution until the target conditions are met and then stop to obtain the second conditional distribution.

6. The method according to claim 2, wherein The obtaining of the prior distribution of the target feature vector based on the correlation relationship information between the at least two sample texts includes: Based on the correlation relationship information between the at least two sample texts, generate graph data, which includes at least two text nodes and edges between the text nodes, where one text node corresponds to one sample text, and the edge between any two text nodes is used to indicate that the correlation relationship information between the two sample texts corresponding to the two text nodes is a non-zero value; Based on the graph data, obtain the spanning tree corresponding to the graph data; Based on the spanning tree, obtain the prior distribution of the target feature vector, and the prior distribution of the target feature vector is the joint distribution of the target feature vectors of any two sample texts.

7. The method according to claim 6, characterized in that The training of the conditional distribution of the target feature vector under the semantic feature vectors of the at least two sample texts by jointly using the prior distribution of the target feature vector includes: Based on the prior distribution of the target feature vectors, obtain the first initial conditional distribution and the second initial conditional distribution of the target feature vectors of any two of the at least two sample texts; Based on the semantic feature vectors of the any two sample texts, determine the degree of association between the any two sample texts; Based on the semantic feature vectors of the any two sample texts, the degree of association, and the first initial conditional distribution, determine the mean, covariance, and candidate target feature vectors corresponding to the semantic feature vectors of the any two sample texts; Based on the candidate target feature vectors, the mean, and the covariance, sample from the second initial conditional distribution to obtain the reconstructed semantic feature vectors corresponding to the candidate target feature vectors; Based on the semantic feature vectors of the any two sample texts, the reconstructed semantic feature vectors, the candidate target feature vectors, and the prior distribution, update the first initial conditional distribution and the second initial conditional distribution until the target conditions are met and then stop.

8. The method according to claim 1, wherein The determination process of the target feature vectors is implemented based on a vector generation model; the vector generation model is obtained by modeling the conditional distribution; The obtaining of the conditional distribution of the target feature vectors under the condition of obtaining the semantic feature vectors includes: obtaining a vector generation model; The determining of the mean corresponding to the semantic feature vectors from the conditional distribution based on the semantic feature vectors of the target text includes: Input the semantic feature vectors of the target text into the vector generation model, and the vector generation model determines the mean corresponding to the semantic feature vectors from the conditional distribution based on the model parameters, and outputs the mean as the target feature vectors of the target text.

9. The method according to claim 1, wherein The obtaining of the semantic feature vectors of the target text includes any one of the following: Segment the target text to obtain the words included in the target text; based on the words included in the target text, obtain the one-hot encoding of the words included in the target text to obtain the one-hot vectors of the words included in the target text, and use the one-hot vectors of the words included in the target text as the semantic feature vectors of the target text; Segment the target text to obtain the words included in the target text; based on the occurrence frequencies of the words included in the target text in the target text and the inverse document frequencies of the words in the corpus, determine the weights of the words included in the target text; based on the weights and the words included in the target text, obtain the semantic feature vectors of the target text; Segment the target text to obtain the words included in the target text; determine the word vectors of the words included in the target text; use the word vectors of the words included in the target text as the semantic feature vectors of the target text.

10. The method according to claim 1, characterized in that, The method further includes: Perform hash encoding on the target feature vectors of the target text to obtain the hash code of the target text; Compare the hash code with the hash codes of other texts to determine the similarity between the target text and the other texts.

11. The method according to claim 10, characterized in that, The target feature vector includes at least two elements; performing hash encoding on the target feature vector of the target text to obtain the hash code of the target text includes: In response to any element in the target feature vector being greater than the threshold corresponding to the element, determining the hash code corresponding to the element as a first value; the threshold is the median of the elements in the target feature vectors of the at least two sample texts; In response to any element in the target feature vector being less than or equal to the threshold corresponding to the element, determining the hash code corresponding to the element as a second value.

12. A text processing method, characterized in that, The method includes: Obtaining at least two sample texts and the semantic feature vectors of the at least two sample texts; Based on the citation relationship between the at least two sample texts or the similarity between the at least two sample texts, obtaining the association relationship information between the at least two sample texts; Based on the association relationship information between the at least two sample texts, obtaining the prior distribution of the target feature vector; Based on the prior distribution of the target feature vector, obtaining a first initial conditional distribution and a second initial conditional distribution, where the first initial conditional distribution is the conditional distribution of the target feature vector under the condition of the semantic feature vector, and the second initial conditional distribution is the conditional distribution of the semantic feature vector under the condition of the target feature vector; Using the semantic feature vectors of the at least two sample texts as input, through variational encoding, obtaining the candidate target feature vector corresponding to the semantic feature vector from the first initial conditional distribution; using the candidate target feature vector as input, through reconstruction, obtaining the reconstructed semantic feature vector corresponding to the candidate target feature vector from the second initial conditional distribution, and the reconstruction process is the inverse process of the variational encoding process; Based on the semantic feature vector, the reconstructed semantic feature vector, the candidate target feature vector, and the prior distribution, updating the first initial conditional distribution and the second initial conditional distribution until the target condition is met and then stopping, to obtain a first conditional distribution, where the first conditional distribution is the conditional distribution of the target feature vector under the condition of the semantic feature vector.

13. The method according to claim 12, wherein The method further includes: In response to a vector acquisition instruction for the target text, acquiring the semantic feature vector of the target text; Based on the semantic feature vector of the target text, determining the mean value corresponding to the semantic feature vector from the conditional distribution, and using the mean value as the target feature vector of the target text, where the target feature vector is used to determine the similarity with other texts.

14. A text processing device, characterized in that, The device includes: An acquisition module, configured to acquire a target text; The acquisition module is further configured to acquire the semantic feature vector of the target text; The acquisition module is further configured to acquire the conditional distribution of the target feature vector under the condition of the semantic feature vector, where the conditional distribution is obtained by jointly training the prior distribution of the target feature vector and the semantic feature vectors of at least two sample texts, and the prior distribution is the distribution of the target feature vector obtained based on the association relationship information between the at least two sample texts; A determination module, configured to determine, from the conditional distribution, a mean value corresponding to the semantic feature vector based on the semantic feature vector of the target text, and use the mean value as the target feature vector of the target text, where the target feature vector is used to determine a similarity with other texts; Wherein, the process of training the conditional distribution of the target feature vector under the semantic feature vector by jointly using the prior distribution of the target feature vector and the semantic feature vectors of at least two sample texts includes: Based on the prior distribution of the target feature vector, obtain a first initial conditional distribution and a second initial conditional distribution, where the first initial conditional distribution is the conditional distribution of the target feature vector under the semantic feature vector, and the second initial conditional distribution is the conditional distribution of the semantic feature vector under the target feature vector; Using the semantic feature vectors of the at least two sample texts as inputs, through variational encoding, obtain candidate target feature vectors corresponding to the semantic feature vectors from the first initial conditional distribution; using the candidate target feature vectors as inputs, through reconstruction, obtain reconstructed semantic feature vectors corresponding to the candidate target feature vectors from the second initial conditional distribution, where the reconstruction process is the inverse process of the variational encoding process; Based on the semantic feature vector, the reconstructed semantic feature vector, the candidate target feature vector, and the prior distribution, update the first initial conditional distribution and the second initial conditional distribution until the target condition is met and then stop, to obtain a first conditional distribution, where the first conditional distribution is the conditional distribution of the target feature vector under the semantic feature vector.

15. The device according to claim 14, wherein The conditional distribution of the target feature vector under the semantic feature vector is obtained based on the following process: Obtain at least two sample texts and the semantic feature vectors of the at least two sample texts; Based on the citation relationship between the at least two sample texts or the similarity between the at least two sample texts, obtain the association relationship information between the at least two sample texts; Based on the association relationship information between the at least two sample texts, obtain the prior distribution of the target feature vector; Execute the step of training the conditional distribution of the target feature vector under the semantic feature vector by jointly using the prior distribution of the target feature vector and the semantic feature vectors of at least two sample texts.

16. The device according to claim 15, characterized in that, The obtaining the association relationship information between the at least two sample texts based on the citation relationship between the at least two sample texts or the similarity between the at least two sample texts includes any one of the following: Obtain the citation relationship between the at least two sample texts; based on the citation relationship, obtain the association relationship information between the at least two sample texts; Obtain the embedding vectors of the at least two sample texts; determine the feature vectors of the at least two sample texts based on the embedding vectors at any position in the embedding vectors of the at least two sample texts and the context vectors of the positions; compare the feature vectors of the at least two sample texts to obtain the similarity between the at least two sample texts; based on the similarity, obtain the correlation relationship information between the at least two sample texts.

17. The device according to claim 16, characterized in that, The correlation relationship information between the at least two sample texts is a correlation matrix; an element in the correlation matrix is used to indicate the correlation relationship information between two sample texts; The obtaining the citation relationship between the at least two sample texts includes: In response to the existence of a citation relationship between the first sample text and the second sample text, determine that the correlation relationship information between the first sample text and the second sample text is a non-zero value; In response to the non-existence of a citation relationship between the first sample text and the second sample text, determine that the correlation relationship information between the first sample text and the second sample text is 0.

18. The device according to claim 15, characterized in that, The training the conditional distribution of the target feature vector under the semantic feature vectors of the at least two sample texts by jointly using the prior distribution of the target feature vector includes: Based on the semantic feature vectors of the at least two sample texts, determine the mean and covariance corresponding to the semantic feature vectors from the first initial conditional distribution; Sample the candidate target feature vectors corresponding to the semantic feature vectors from the first initial conditional distribution; Based on the candidate target feature vectors, the mean, and the covariance, sample the reconstructed semantic feature vectors corresponding to the candidate target feature vectors from the second initial conditional distribution; Based on the semantic feature vectors, the reconstructed semantic feature vectors, the candidate target feature vectors, and the prior distribution, update the first initial conditional distribution and the second initial conditional distribution until the target conditions are met and then stop to obtain the second conditional distribution.

19. The device according to claim 15, characterized in that, The obtaining the prior distribution of the target feature vector based on the correlation relationship information between the at least two sample texts includes: Based on the correlation relationship information between the at least two sample texts, generate graph data, which includes at least two text nodes and edges between the text nodes, where one text node corresponds to one sample text, and the edge between any two text nodes is used to indicate that the correlation relationship information between the two sample texts corresponding to the two text nodes is a non-zero value; Based on the graph data, obtain the spanning tree corresponding to the graph data; Based on the spanning tree, obtain the prior distribution of the target feature vector, and the prior distribution of the target feature vector is the joint distribution of the target feature vectors of any two sample texts.

20. The device according to claim 19, characterized in that, The training the conditional distribution of the target feature vector under the semantic feature vectors of the at least two sample texts by jointly using the prior distribution of the target feature vector includes: Based on the prior distribution of the target feature vectors, obtain the first initial conditional distribution and the second initial conditional distribution of the target feature vectors of any two of the at least two sample texts; Based on the semantic feature vectors of any two of the sample texts, determine the degree of association between the any two sample texts; Based on the semantic feature vectors of any two sample texts, the degree of association, and the first initial conditional distribution, determine the mean, covariance, and candidate target feature vectors corresponding to the semantic feature vectors of the any two sample texts; Based on the candidate target feature vectors, the mean, and the covariance, sample from the second initial conditional distribution to obtain the reconstructed semantic feature vectors corresponding to the candidate target feature vectors; Based on the semantic feature vectors of any two sample texts, the reconstructed semantic feature vectors, the candidate target feature vectors, and the prior distribution, update the first initial conditional distribution and the second initial conditional distribution until the target conditions are met and then stop.

21. The device according to claim 14, wherein, The determination process of the target feature vectors is implemented based on a vector generation model; the vector generation model is obtained by modeling the conditional distribution; The obtaining module is used to obtain a vector generation model; The determination module is used to input the semantic feature vectors of the target text into the vector generation model, and the vector generation model, based on the model parameters, determines the mean corresponding to the semantic feature vectors from the conditional distribution and outputs the mean as the target feature vectors of the target text.

22. The device according to claim 14, characterized in that, The obtaining module is used to perform any one of the following: Segment the target text to obtain the words included in the target text; based on the words included in the target text, obtain one-hot encodings of the words included in the target text to get the one-hot vectors of the words included in the target text, and use the one-hot vectors of the words included in the target text as the semantic feature vectors of the target text; Segment the target text to obtain the words included in the target text; based on the occurrence frequencies of the words included in the target text in the target text and the inverse document frequencies of the words in the corpus, determine the weights of the words included in the target text; based on the weights and the words included in the target text, obtain the semantic feature vectors of the target text; Segment the target text to obtain the words included in the target text; determine the word vectors of the words included in the target text; use the word vectors of the words included in the target text as the semantic feature vectors of the target text.

23. The device according to claim 14, wherein, The device further includes: An encoding module, used to perform hash encoding on the target feature vectors of the target text to obtain the hash code of the target text; A comparison module, used to compare the hash code with the hash codes of other texts to determine the similarity between the target text and the other texts.

24. A text processing device, characterized in that, The device includes: A vector obtaining module, used to obtain at least two sample texts and the semantic feature vectors of the at least two sample texts; An information acquisition module, configured to acquire the correlation relationship information between the at least two sample texts based on the citation relationship or the similarity between the at least two sample texts; A distribution acquisition module, configured to acquire the prior distribution of the target feature vector based on the correlation relationship information between the at least two sample texts; The distribution acquisition module is further configured to: Based on the prior distribution of the target feature vector, acquire a first initial condition distribution and a second initial condition distribution, where the first initial condition distribution is the conditional distribution of the target feature vector under the semantic feature vector, and the second initial condition distribution is the conditional distribution of the semantic feature vector under the target feature vector; Using the semantic feature vectors of the at least two sample texts as inputs, through variational encoding, obtain the candidate target feature vectors corresponding to the semantic feature vectors from the first initial condition distribution; using the candidate target feature vectors as inputs, through reconstruction, obtain the reconstructed semantic feature vectors corresponding to the candidate target feature vectors from the second initial condition distribution, and the reconstruction process is the inverse process of the variational encoding process; Based on the semantic feature vectors, the reconstructed semantic feature vectors, the candidate target feature vectors, and the prior distribution, update the first initial condition distribution and the second initial condition distribution until the target conditions are met and then stop, to obtain a first conditional distribution, where the first conditional distribution is the conditional distribution of the target feature vector under the semantic feature vector.

25. The apparatus according to claim 24, wherein The vector acquisition module is further configured to, in response to a vector acquisition instruction of a target text, acquire the semantic feature vector of the target text; The apparatus further comprises: A vector generation module, configured to, based on the semantic feature vector of the target text, determine the mean value corresponding to the semantic feature vector from the conditional distribution, and use the mean value as the target feature vector of the target text, where the target feature vector is used to determine the similarity with other texts.

26. An electronic device, characterized in that, The electronic device comprises one or more processors and one or more memories, and at least one computer program is stored in the one or more memories, and the at least one computer program is loaded and executed by the one or more processors to implement the text processing method according to any one of claims 1 to 13.

27. A computer-readable storage medium, characterized in that, At least one computer program is stored in the storage medium, and the at least one computer program is loaded and executed by a processor to implement the text processing method according to any one of claims 1 to 13.

28. A computer program product, characterized in that, The computer program product comprises one or more computer programs, the one or more computer programs are stored in a computer-readable storage medium, and one or more processors of an electronic device can read the one or more computer programs from the computer-readable storage medium, and the one or more processors execute the one or more computer programs, so that the electronic device can execute the text processing method according to any one of claims 1 to 13.

Citation Information

Patent Citations

  • Chapter similarity judgment method based on recessive high-dimensional distributed feature representation

    CN107729509A

  • Scoring method and device and electronic equipment

    CN111221939A