Language transformation method, model training method and product
By combining symbol reasoning and feature fusion methods, the language conversion of website content is solved, and errors and inconsistencies are solved in the existing technology in the processing of complex grammatical structures and language contexts, and higher accuracy and consistency of language conversion.
Patent Information
- Application Number
- CN202411505259.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-03-25
AI Technical Summary
When the prior art deals with complex grammatical structures and language contexts, it is easy to cause language conversion errors and inconsistencies, resulting in a decrease in the accuracy of website language conversion.
By combining symbolic reasoning and feature fusion methods, the website content is structured, feature extraction, symbolic reasoning and feature fusion, and language conversion is carried out.
Improve the accuracy and consistency of website language conversion, ensure that the conversion result logic complies with the rules of the target language, and covers all information of the original content.
Smart Images

Figure CN119692363A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and specifically to a language conversion method, a model training method and a product. Background Art
[0002] With the development of the Internet and globalization, more and more websites need to support multiple languages to meet the needs of users in different countries and regions. Traditional language conversion of multilingual website content mainly relies on large-scale training data to convert the input data to be processed, or rule-based symbol systems to convert the data to be processed. However, these two methods are prone to language conversion errors and inconsistencies when dealing with complex grammatical structures and language contexts, thereby reducing the accuracy of website language conversion. Summary of the invention
[0003] The embodiments of the present application provide a language conversion method, a model training method and a product, which perform website language conversion by combining symbolic reasoning and feature fusion to improve the accuracy of website language conversion.
[0004] In a first aspect, an embodiment of the present application provides a language conversion method, the method comprising:
[0005] Structuring the first initial content of the first website to obtain a first initial data set;
[0006] Performing feature extraction on the first initial data set to obtain a first feature;
[0007] Performing symbolic reasoning on the first feature based on a rule of a first language to obtain a first symbolic reasoning result;
[0008] Performing feature fusion on the first symbolic reasoning result and the first initial data set to obtain a first conversion result;
[0009] The language of the first website is converted based on the first conversion result to obtain a second website, wherein the language of the second website is the first language.
[0010] In a possible implementation, performing language conversion on the first website based on the first conversion result to obtain a second website, wherein the language of the second website is the first language, includes:
[0011] Decoding the first conversion result to obtain a plurality of first conversion contents corresponding to the first website;
[0012] Get the label of each first conversion content;
[0013] Each first conversion content is typeset by a processing module corresponding to the tag of each first conversion content to obtain a second website.
[0014] In a possible implementation manner, structuring the first initial content of the first website to obtain the first initial data set includes:
[0015] Performing data cleaning on the first initial content to obtain cleaned first initial content;
[0016] Standardizing the cleaned first initial content to obtain standardized first initial content;
[0017] De-noising the standardized first initial content to obtain the de-noised first initial content;
[0018] Performing word segmentation on the first initial content after denoising to obtain the first initial content after word segmentation;
[0019] Annotating the first initial content after the word segmentation based on the grammatical structure tree to obtain the second initial content;
[0020] Perform word embedding on the second initial content to obtain the first initial data set.
[0021] In a possible implementation manner, extracting features from the first initial data set to obtain the first feature includes:
[0022] Extracting semantic features from the first initial data set to obtain a first semantic feature of the first initial data set;
[0023] Extracting context information from the first semantic feature to obtain a first context feature;
[0024] Extracting pragmatic information from the first context feature to obtain a first pragmatic feature;
[0025] The first semantic feature, the first context feature, and the first pragmatic feature are fused to obtain the first feature.
[0026] In a possible implementation, the process of performing language conversion on the target website is implemented by a website language conversion model, and the method further includes:
[0027] Back-translate the content of the preset type in the first conversion result to obtain a back-translation result;
[0028] Acquire a second initial data set of the preset type in the first initial data set;
[0029] Obtaining a first similarity between the back-translation result and a second initial data set;
[0030] Acquire first feedback data for the second website;
[0031] activating the first feedback data to obtain second feedback data;
[0032] Scaling the first feedback data to obtain third feedback data;
[0033] Obtaining fourth feedback data based on the second feedback data and the third feedback data;
[0034] The model is adjusted based on the first similarity and the fourth feedback data.
[0035] In a second aspect, an embodiment of the present application provides a model training method, the method comprising:
[0036] Structuring the third initial content of the sample website to obtain a third initial data set;
[0037] Performing feature extraction on the third initial data set to obtain a second feature;
[0038] Training the first model based on the second feature to obtain a trained first model;
[0039] Based on the rules of the first language, symbolic reasoning is performed on the second feature to obtain a fourth symbolic reasoning result;
[0040] Training the second model based on the fourth symbolic reasoning result to obtain a trained second model;
[0041] Performing feature fusion on the fourth symbolic reasoning result and the third initial data set to obtain a second conversion result;
[0042] Training a third model based on the second conversion result to obtain a trained third model;
[0043] The model is obtained based on the trained first model, the trained second model and the trained third model.
[0044] In a third aspect, an embodiment of the present application provides a language conversion device, the device comprising: a first transceiver unit and a first processing unit;
[0045] The first transceiver unit is used to obtain the first initial content of the first website;
[0046] The first processing unit is used to structure the first initial content of the first website to obtain a first initial data set;
[0047] The first processing unit is used to extract features from the first initial data set to obtain a first feature;
[0048] The first processing unit is used to perform symbolic reasoning on the first feature based on a rule of a first language to obtain a first symbolic reasoning result;
[0049] The first processing unit is used to perform feature fusion on the first symbolic reasoning result and the first initial data set to obtain a first conversion result;
[0050] The first processing unit is configured to perform language conversion on the first website based on the first conversion result to obtain a second website, wherein the language of the second website is the first language.
[0051] In a fourth aspect, an embodiment of the present application provides a model training device, the device comprising: a second transceiver unit and a second processing unit;
[0052] The second transceiver unit is used to obtain the third initial content of the sample website;
[0053] The second processing unit is used to structure the third initial content of the sample website to obtain a third initial data set;
[0054] The second processing unit is used to extract features from the third initial data set to obtain second features;
[0055] The second processing unit is used to train the first model based on the second feature to obtain a trained first model;
[0056] The second processing unit is used to perform symbolic reasoning on the second feature based on the rule of the first language to obtain a fourth symbolic reasoning result;
[0057] The second processing unit is used to train the second model based on the fourth symbolic reasoning result to obtain a trained second model;
[0058] The second processing unit is used to perform feature fusion on the fourth symbolic reasoning result and the third initial data set to obtain a second conversion result;
[0059] The second processing unit is used to train the third model based on the second conversion result to obtain a trained third model;
[0060] The second processing unit is used to obtain the model based on the trained first model, the trained second model and the trained third model.
[0061] In a fifth aspect, an embodiment of the present application provides an electronic device, comprising: a processor and a memory, the processor being connected to the memory, the memory being used to store a computer program, and the processor being used to execute the computer program stored in the memory, so that the electronic device executes the methods of the first and second aspects.
[0062] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method of the first aspect and the second aspect is implemented.
[0063] In a fifth aspect, an embodiment of the present application provides a computer program product, the computer program product comprising a computer program, and when the computer program is executed by a processor, the method of the first aspect and the second aspect is implemented.
[0064] Implementing the embodiments of the present application has the following beneficial effects:
[0065] It can be seen that in the embodiment of the present application, the first initial content of the first website is structured to obtain the first initial data set; the first initial data set is feature extracted to obtain the first feature; the first feature is symbolically reasoned based on the rules of the first language to obtain the first symbolic reasoning result; the first symbolic reasoning result and the first initial data set are feature fused to obtain the first conversion result; the first website is language-converted based on the first conversion result to obtain the second website, wherein the language of the second website is the first language. In the present application, the first feature is first symbolically reasoned based on the rules of the first language, and the complex language structure and language context in the first feature can be symbolically reasoned to obtain the first symbolic reasoning result, so that the logic of the first symbolic reasoning result is consistent with the rules of the first language, thereby ensuring the accuracy of the first conversion result finally obtained.
[0066] Furthermore, the first symbolic reasoning result is fused with the initial data set. Since the initial data set contains all the content of the first website, the content of the first website can be not omitted during the fusion process. That is to say, after the first symbolic reasoning result is fused with the initial data set, the first conversion result obtained can be logically consistent with the rules of the first language and cover the initial data set of the first website, so that the determination of the first conversion result is both accurate and comprehensive. Furthermore, based on the first conversion result, the language of the first website is converted to obtain the second website, thereby improving the accuracy, consistency and comprehensiveness of the content translation of the second website. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0068] Figure 1 A schematic diagram of a model training process provided in an embodiment of the present application;
[0069] Figure 2 A structural diagram of an initial feature extraction model provided in an embodiment of the present application;
[0070] Figure 3 A structural diagram of an initial symbolic reasoning model provided in an embodiment of the present application;
[0071] Figure 4 A schematic diagram of a feature fusion process provided in an embodiment of the present application;
[0072] Figure 5 A structural diagram of an initial feature fusion model provided in an embodiment of the present application;
[0073] Figure 6 A flow chart of a language conversion method provided in an embodiment of the present application;
[0074] Figure 7 A structural diagram of a language conversion model provided in an embodiment of the present application;
[0075] Figure 8 A schematic diagram of another feature fusion process provided in an embodiment of the present application;
[0076] Fig. 9 A schematic diagram of a website model application provided in an embodiment of the present application;
[0077] Fig.10 A schematic diagram of an application scenario of a model provided in an embodiment of the present application;
[0078] Fig.11 A block diagram of the functional units of a language conversion device provided in an embodiment of the present application;
[0079] Fig.12 A block diagram of the functional units of a model training device provided in an embodiment of the present application;
[0080] Fig.13 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0081] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0082] The terms "first", "second", "third" and "fourth" etc. in the specification, claims and drawings of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0083] Reference to "embodiments" herein means that a particular feature, result, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0084] In order to facilitate understanding of the technical solution of the present application, the relevant technical terms involved in the present application are first explained.
[0085] First, the defects of the existing technology in the field of language conversion are explained. The existing language conversion of multilingual website content mainly relies on large-scale training data to convert the input data to be processed (i.e., conversion through a pure neural network model), or a rule-based symbol system to convert the data to be processed.
[0086] On the one hand, although pure neural network models perform well in perception and pattern recognition, they have limitations in logical reasoning and semantic understanding. This is because neural network models usually learn language features through large-scale data training, but when faced with long sentences, complex grammar, and contextual dependencies, pure neural network models are prone to lose accuracy and consistency. Especially for content with rich grammatical structures and complex language backgrounds, neural network models often produce language conversion bias and cannot provide high-quality multilingual conversion results.
[0087] On the other hand, although rule-based symbolic systems are superior in logical reasoning and can handle grammatical rules and language logic well, they are less efficient in dealing with the diversity and complexity of natural languages. Because symbolic systems rely on a predefined set of rules, they are often difficult to expand and adapt when faced with new language data or unseen syntactic structures.
[0088] Therefore, both methods are prone to language conversion errors and inconsistencies when dealing with complex grammatical structures and language contexts, thereby reducing the accuracy of website language conversion.
[0089] Target object: The target object in this application can be a user, a virtual person, a robot, a digital person, etc. In this application, the target object is a user as an example.
[0090] Symbolic Reasoning is a reasoning method based on logical rules and symbolic representation. It symbolizes facts and rules and applies logical operations and reasoning rules to derive new conclusions.
[0091] In order to facilitate a better understanding of the technical solution of the present application, the training process of the model of the present application (in the present application, the model can be understood as a language conversion model, and the present application does not make a distinction here) is first introduced. It should be noted that the model training process in the present application includes training the first model in the initial model (in the present application, the first model can also be called an initial feature extraction model, and the present application does not make a distinction here), the second model (in the present application, the second model can also be called an initial symbolic reasoning model, and the present application does not make a distinction here) and the third model (in the present application, the third model can also be called an initial feature fusion model, and the present application does not make a distinction here) to finally obtain a language conversion model, and the language conversion model includes: a trained first model (in the present application, the trained first model can also be called a trained feature extraction model, and the present application does not make a distinction here), a trained second model (in the present application, the trained second model can also be called a trained symbolic reasoning model, and the present application does not make a distinction here) and a trained third model (in the present application, the trained third model can also be called a trained feature fusion model, and the present application does not make a distinction here). First, during the training process, the initial feature extraction model, the initial symbolic reasoning model, and the initial feature fusion model can be trained sequentially or simultaneously. This application does not make any specific limitations on this. This application uses the example of training the initial feature extraction model, the initial symbolic reasoning model, and the initial feature fusion model sequentially as an example.
[0092] The network structure of the model involved in this application can be a recurrent neural network (RNN), Transformer, etc., and this application does not limit this.
[0093] It should be noted that before training, a sample data set needs to be constructed, wherein the sample data set may include the source language content of multiple sample websites, sample features corresponding to each sample website, sample symbolic reasoning results corresponding to each sample website, and first language content corresponding to each sample website, wherein the first language refers to the target translation language, and the first language may be any one of multiple languages except the source language of the first website. It should be noted that there may be multiple sample websites, and for ease of description, this application only takes one as an example for description.
[0094] See also Figure 1 , Figure 1 A flow chart of a model training process provided in an embodiment of the present application. It should be noted that the model can also be called a language conversion model, and the present application does not make a distinction between the two. The method includes but is not limited to steps S101-S108:
[0095] S101: Structuring the third initial content of the sample website to obtain a third initial data set.
[0096] It should be noted that before step S101, the method further includes: obtaining the third initial content (i.e., source language content) of the sample website, wherein the third initial content may include: the text content of the sample website, the target object generated content, the target object interactive data, the target object browsing behavior data, the target object feedback data, etc. In the present application, the sample website is taken as an international news website as an example for explanation. In the international news website, the text content of the sample website may include the news body, news title, and news link in the website; the target object generated content may include the target object's comments on the news in the international news website; the target object interactive data may include the target object's clicks, likes, and shares on the international news website; the target object browsing behavior data may include the target object's page dwell time, scrolling depth, and browsing path on the international news website; the target object feedback data may include the feedback form, ratings, and suggestions submitted by the target object. It should be noted that in the present application, the third initial content is not specifically limited.
[0097] Optionally, the text content of the sample website is collected in real time by adopting a method combining depth-first crawling and breadth-first crawling, which is recorded as. The target object generated content in the sample website may not be obtained by the method combining depth-first crawling and breadth-first crawling. Therefore, it is necessary to use the application programming interface (Application Programming Interface, API) interface to obtain the target object generated content, which is recorded as, and the security and privacy protection of the data are ensured through the OAuth authentication mechanism. The target object interaction data is collected through event monitoring technology, which is recorded as, and event monitoring includes front-end page event binding and back-end log recording to ensure the real-time and accuracy of the data. The target object browsing behavior data is collected using browser plug-ins and embedding technology, which is recorded as, and the browser plug-in is combined with the embedding script to improve the accuracy and comprehensiveness of the data. The target object feedback data is collected through asynchronous submission and data encryption technology and database interface, which is recorded as to ensure the safe transmission and storage of data.
[0098] Exemplarily, the third initial content of the sample website is structured to obtain a third initial data set, including: performing data cleaning on the third initial content to obtain cleaned third initial content; standardizing the cleaned third initial content to obtain standardized third initial content; denoising the standardized third initial content to obtain denoised third initial content; segmenting the denoised third initial content to obtain the third initial content; annotating the third initial content based on a grammatical structure tree to obtain a fourth initial content; and obtaining a third initial data set based on the fourth initial data set.
[0099] Optionally, performing data cleaning on the third initial content to obtain the cleaned third initial content includes: performing data cleaning on the collected third initial content D total Perform data cleaning to remove duplicate data and redundant information, and obtain the cleaned third initial content D clean , as shown in formula (1):
[0100] D clean =D total -D redundant Formula (1)
[0101] Among them, D redundant is a redundant data set, D total It is the third initial content.
[0102] Redundant data sets refer to unnecessary, duplicate or irrelevant data that needs to be identified and removed during the data preprocessing stage. In the context of multilingual website content conversion, the definition of redundant data sets includes the following types:
[0103] Duplicate content: The same content on a website may be copied and pasted in multiple locations. Especially in large websites or multilingual websites, duplicate data not only increases the complexity of processing, but also affects the accuracy of the final data analysis. Irrelevant data: When collecting website content, some data that is irrelevant to the conversion task will be collected, such as advertisements, copyright notices, and legal terms. These contents usually do not need to be converted because they are not helpful for users' actual use and may also disrupt the final multilingual output. Invalid or erroneous data: When automatically collecting data from websites, you may encounter data with incorrect format, corruption, or inability to parse. Such data should be removed from the dataset. Non-text elements: Although pictures, videos, and other multimedia elements are important for websites, they may be considered redundant in the context of text content conversion. Unless these multimedia contents are directly related to the conversion task (such as pictures containing text), they are usually excluded in the preliminary data cleaning stage. When defining redundant data sets, automated tools and scripts are usually used to identify and remove these data types to ensure that the processed data sets are as clean and relevant as possible.
[0104] Optionally, the cleaned third initial content is standardized to obtain the standardized third initial content. The cleaned third initial content is character-encoding-converted and file-format-standardized to obtain the standardized third initial content.
[0105] Optionally, the standardized third initial content is denoised to obtain the denoised third initial content, the standardized third initial content is denoised, and the noise information in the data is removed by using a median filter and a noise detection algorithm to obtain a website content data set after the noise is removed. The noise information includes the following types:
[0106] Random noise: Random errors or interference in the data collection process, such as data corruption caused by network fluctuations, system errors, or sensor failures. In text data, it manifests as randomly inserted characters or incorrect words. Format errors: Noise generated when data is entered or stored in an inconsistent or incorrect format. For example, when the date, time, or number format is not uniform, or when the text uses different encoding systems, resulting in character parsing errors. Grammatical errors: Noise caused by typing errors, spelling errors, or incorrect grammar. Errors are particularly common in user-generated content, such as in social media posts, comments, or user feedback. Anomalies and outliers: Values that deviate significantly from other data points in a data set. They are caused by incorrect data entry, system errors, or unusual user behavior. Duplicate data: Duplicate records appear during the data collection process, especially when the same data is collected from multiple sources or multiple times. Duplicate data can cause bias in analysis and difficulties in processing. Background noise: When collecting network data, some irrelevant or non-target information will be included, such as advertising content, navigation menus, copyright information, etc., which are usually irrelevant to the main content but affect data cleaning and processing.
[0107] Optionally, the denoised third initial content is segmented to obtain the segmented third initial content. The denoised third initial content is segmented using a dictionary and rule-based segmentation algorithm to decompose text data into independent word units to obtain the segmented third initial content.
[0108] Optionally, the third initial content after word segmentation is annotated based on the grammatical structure tree to obtain the fourth initial content. The fourth initial content obtained after the word segmentation process is subjected to a statistical and rule-based parsing algorithm to generate a grammatical structure tree including part-of-speech tagging and dependency relationships, and obtain a website content data set after grammatical structure parsing. The grammatical structure tree provides the neural network with clear information about the structure and grammatical relationships of the sentence. This includes part-of-speech tagging and dependency relationships, which helps the Multi-Head Attention (MHA) model to more effectively understand the relationship between words, such as subject-verb-object relationships or modification relationships. When the neural network processes language, this structured input can enhance the model's grasp of the deep semantics of the sentence.
[0109] It can be seen that in the embodiment of the present application, the fourth initial content is obtained by annotating the third initial content after word segmentation based on the grammatical structure tree. The focus of the attention mechanism can be improved by annotating the third initial content after word segmentation based on the grammatical structure tree. MHA captures information in different subspaces through parallel attention heads. The introduction of the grammatical structure tree can help each attention head focus more effectively on grammatically relevant or important words. For example, for a given verb, attention can be more targeted to focus on its direct object or subject, rather than any vocabulary in the entire sentence. The accuracy of language conversion and content generation can also be improved. In the language conversion task, it is very important to maintain the correct representation of the grammatical structure of the original text. The information of the grammatical structure tree can guide MHA to maintain grammatical correctness when generating language, thereby improving the quality of language conversion and ensuring that the generated content is consistent with the original text in both grammar and semantics. The processing of long-distance dependency problems can also be optimized. Long-distance dependency in language is a challenge in natural language processing. For example, there may be a direct grammatical dependency relationship between the words at the beginning of a sentence and the words at the end of the sentence. The grammatical structure tree provides a global view that helps MHA capture these dependencies across long distances, thereby providing support when processing complex sentence structures.
[0110] The fourth initial content is word-embedded to obtain a third initial data set. The fourth initial content can be directly used as the third initial data set, or the fourth initial content can be word-embedded to obtain the third initial data set. It should be noted that in this application, the third initial data set is mainly obtained by word-embedding the fourth initial content, which is denoted as D parsed To illustrate, the fourth initial content is word-embedded, such as word embedding vectors (Word Embeddings from Word Vectors, Word2Vec), global word representation vectors (Global Vectors for Word Representation, GloVe) and fast text representation (Fast Text Representations of Words and Phrases, FastText) or other forms of feature extraction, such as term frequency-inverse document frequency (Term Frequency-Inverse Document Frequency, TF-IDF), etc., and each word or tag (i.e., token) in the fourth initial content is converted into a feature vector of fixed dimension. Among them, the third initial data set can be a multidimensional matrix composed of feature vectors of multiple words (also called tokens, which are not distinguished in this application).
[0111] S102: Extract features from the third initial data set to obtain second features.
[0112] It should be noted that the third initial data set can be subjected to feature extraction through the initial feature extraction model to obtain the second feature. Specifically, the third initial data set is subjected to semantic feature extraction to obtain the second semantic feature of the third initial data set; context information is extracted from the second semantic feature to obtain the second context feature; pragmatic information is extracted from the second context feature to obtain the second pragmatic feature; the second semantic feature, the second context feature and the second pragmatic feature are subjected to feature fusion to obtain the second feature.
[0113] Optionally, semantic feature extraction is performed on the third initial data set to obtain a second semantic feature of the third initial data set. parsed Input the pre-trained neural network model to extract the second semantic feature F s , the second semantic feature F s The extraction formula (2) is:
[0114]
[0115] Among them, MHA represents the multi-head attention mechanism, LayerNorm is the layer normalization operation, Conv1D represents the one-dimensional convolution operation, and W conv1 and b conv1 are the weight and bias of the convolution operation, PE(i,j) is the position code, and d k is the dimension of k, and is Q S Query, K s is key, V s is value, through D parsed After linear transformation, i represents F s The i-th word in , j is the j-th feature dimension corresponding to the i-th word.
[0116] Through D jarsed Semantic feature extraction can unify semantic information and learn the connotation relationship between various contents. For example, clicks and comments, likes and comments may have implicit relationships, which can be obtained through semantic feature F. s The extraction formula learns the connotation relationship between them. The second semantic feature F s It is extracted from the entire third initial data set (which may be articles, comments or other visible texts on the website) through a pre-trained neural network model and represents the semantic information of the entire third initial data set.
[0117] The third initial data set can be processed in batches, and each batch contains multiple data sets (for example, multiple articles or multiple user comments). For text data, the sequence length represents the number of words in each sample, which is standardized to a fixed length by truncation or padding before being input into the neural network. In the preprocessing stage of the third initial data set, i.e., the stage recorded in step S101, each word is converted into a feature vector of fixed dimension through word embedding (such as Word2Vec, GloVe, and FastText) or other forms of feature extraction (such as TF-IDF). For example, if news articles are processed, each article has an average of 200 words, and a 100-dimensional word vector is used to represent each word, then an article in each batch can be represented as a 200x100 matrix. If 10 articles are processed each time, then D parsed The data shape will be [10, 200, 100].
[0118] Context information is extracted from the second semantic feature to obtain the second context feature. s Extract context information and use the context embedding model to generate the second context feature F c , the second context feature F c The extraction formula (3) is:
[0119]
[0120] Among them, BiLSTM represents a bidirectional long short-term memory network, HighwayNet represents a highway network, and α i and β i is the learnable attention weight, and are the weight matrix and bias term of the context embedding model respectively; F s is a matrix consisting of feature vectors of n words, F s is a matrix consisting of the feature vectors of n words, is the feature vector corresponding to the second semantic feature of the i-th word.
[0121] Among them, F s is a matrix consisting of the feature vectors of n words, Understood as F s The components of F, that is, individual feature elements, can correspond to a specific part of the text or a single word (token). In many neural network models, especially those that process natural language, the input text is broken down into a series of words or tokens, and each word or token is converted into a semantic feature vector by the model. s These single eigenvectors A set or sequence composed of It can also be understood as the feature vector corresponding to the second semantic feature of the i-th word.
[0122] The pragmatic information is extracted from the second context feature to obtain the second pragmatic feature. For the pragmatic information extraction scenario, the present application converts the context feature f c Input pragmatic information extraction model to generate the second pragmatic feature F p , the second pragmatic feature F p Formula (4) is:
[0123]
[0124] Among them, sigmoid(·) is the activation function, LayerNorm is the layer normalization operation, express and The attention weight between them, ResNet represents the residual network; n is F p The number of words in Refers to F p The second context feature of the i-th word in , refers to the second context feature of the j-th word.
[0125] The second semantic feature, the second context feature and the second pragmatic feature are fused to obtain the second feature. s , the second context feature F c and the second pragmatic feature F p Perform feature fusion to generate comprehensive feature representation F combined , comprehensive feature representation F combined Formula (5) is:
[0126]
[0127] Among them, γ and β are hyperparameters, MLP represents multi-layer perceptron, concat represents feature fusion operation, dropout(p) represents random inactivation operation with a dropout ratio of p, and DenseNet represents densely connected convolutional network. refers to the second pragmatic feature of the i-th word, refers to the second semantic feature of the i-th word, Refers to the second context feature of the i-th word.
[0128] It can be seen that in the embodiment of the present application, the second semantic feature, the second context feature and the second pragmatic feature are feature fused to obtain the second feature. The second semantic feature, the second context feature and the second pragmatic feature are processed at multiple levels, not just simply spliced, but also combined with a multi-layer perceptron and a densely connected convolutional network, and a discarding mechanism is introduced, so that the feature extraction model has higher nonlinear expression ability and anti-overfitting performance, significantly improves the generalization ability and robustness of the feature extraction model, can solve the problems of information redundancy and insufficient feature relationship capture in the traditional splicing method, thereby improving the effect of feature fusion.
[0129] S103: Train the first model based on the second feature to obtain a trained first model.
[0130] It should be noted that step S102 in the present application extracts the second feature through the initial feature extraction model, such as Figure 2 As shown, the initial feature extraction model also includes an initial semantic feature extraction layer, an initial context information embedding layer, and an initial pragmatic information extraction layer. The third initial data set is input into the initial feature extraction model to obtain the second feature. The initial feature extraction model can be trained by the first loss between the sample feature corresponding to each sample website in the training data set and the second feature, and the network parameters in the initial feature extraction model are updated until the initial feature extraction model converges to obtain a trained feature extraction model, wherein the trained feature extraction model includes a semantic feature extraction layer, a context information embedding layer, and a pragmatic information extraction layer. It should be noted that each semantic feature extraction layer or context information embedding layer or pragmatic information extraction layer can also be understood as a model.
[0131] S104: Based on the rules of the first language, perform symbolic reasoning on the second feature to obtain a fourth symbolic reasoning result.
[0132] It should be noted that step S103 can be performed by the initial symbolic reasoning model. Exemplarily, the second feature is converted into a second symbolic representation; the symbolic feature extraction is performed on the second symbolic representation to obtain a second symbolic feature corresponding to the second feature; the second symbolic feature is inferred based on the rules of the first language to obtain a fourth symbolic reasoning result. It should be noted that the first language refers to the target translation language, and the first language is any one of the multiple languages except the source language of the first website.
[0133] Optionally, converting the second feature into a second symbolic representation can be achieved by using a symbol transformation function φ(x) formula (6):
[0134]
[0135] Where x is the input feature vector, c is a set of predefined symbol centers (e.g., each center represents a specific language symbol or concept), and c m is the symbol center with position m in the symbol center set, c m is also a eigenvector, and the argmin operation is used to select the symbol center that is closest to the input eigenvector, ||xc m || indicates the determination of x and c m distance.
[0136] Optionally, performing symbol feature extraction on the second symbolic representation to obtain a second symbol feature corresponding to the second feature can be implemented by using a symbol feature extraction function ψ(S) formula (7):
[0137]
[0138] Among them, S represents the symbol representation generated by the symbol transformation function, key_features and secondary_features represent the main symbol feature set and the secondary symbol feature set respectively. To combine and extract the most relevant features. When extracting symbol features, if the symbol representation s has any feature in the main symbol feature set, then ψ(S) is equal to the intersection of s and key-features; otherwise, ψ(S) is equal to the intersection of s and secondary-features, which can accurately extract the symbol features most relevant to the symbol representation in the process of symbol feature extraction.
[0139] Furthermore, by combining the symbol conversion function and the symbol feature extraction function described above, the second feature is converted into a second symbol representation; and then the symbol feature extraction is performed on the second symbol representation to obtain a second symbol feature S corresponding to the second feature. symbolic It can be expressed by the following formula (8):
[0140]
[0141] Among them, φ(·) is the symbol transformation function, ψ(·) is the symbol feature extraction function, and W symbol and b symbol are the weights and biases of symbol feature extraction, n is F combined The number of words (or tokens) in F combined The second feature of the i-th word in .
[0142] In this process, we first transform F by using the sign transformation function φ(·) combined The second feature vector corresponding to each word in ) is used to transform the second feature into a second symbolic representation, and finally, the symbolic feature extraction function ψ(·) is used to accurately extract the symbolic feature most relevant to the symbolic representation in the process of symbolic feature extraction, so that the symbolic reasoning model can effectively capture the semantic and contextual information in the second feature, and the generated second symbolic feature S can also be ensured by applying the modified linear unit activation function relu(·). symbolic It has a high nonlinear expression capability. It should be noted that the application of the rectified linear unit activation function relu (·) can also be omitted in the present application, and the present application does not make any limitation here.
[0143] Exemplarily, the second symbol feature is inferred based on the rules of the first language to obtain a fourth symbol reasoning result, specifically including: performing grammatical rule mapping on each element in the second symbol feature to obtain a third grammatical mapping result of each element in the second symbol feature; performing semantic rule mapping on each element in the second symbol feature to obtain a third semantic mapping result of each element in the second symbol feature; and obtaining a fourth symbol reasoning result based on the second symbol feature, the third grammatical mapping result of each element in the second symbol feature, and the third semantic mapping result of each element in the second symbol feature. It should be noted that different first languages correspond to different rules, and the rules include grammatical rules and semantic rules. Each first language can correspond to a different set of grammatical rules and a set of semantic rules. The grammatical rule set includes a set of rules that define how to correctly construct a sentence. It includes language features such as word order, tense, voice, and agreement. For example: Subject-verb agreement rule: ensure the consistency of the subject and predicate in person and number. For example, in English, a singular third-person subject should be consistent with a singular verb form (such as "He runs" instead of "He run").
[0144] Tense conversion rules: Maintain the tense of the original text during the language conversion process, for example, accurately convert the past tense of Chinese into the corresponding tense of English.
[0145] Word order adjustment rules: Especially when switching between English and Japanese, the word order needs to be adjusted according to the grammatical structure of the first language, because Japanese is usually SOV (subject-object-verb) order, while English is SVO (subject-verb-object) order.
[0146] The semantic rule set focuses on maintaining the consistency of meaning conversion between different languages, which is particularly critical in cultural and contextual conversion. For example:
[0147] Polysemous word selection rules: For polysemous words, the correct meaning is selected in a specific context. For example, the choice between "river bank" and "financial bank" in the English word "bank" needs to be determined according to the context.
[0148] Rules for idiom and fixed expression language conversion: In language conversion, idioms and expressions in the first language must be considered to ensure that the language conversion result conforms to the cultural habits of the first language. For example, when converting the English idiom "Kick the bucket" into Chinese, it should be converted into "pass away" instead of a literal translation.
[0149] Logical coherence rule: Ensure that the text after language conversion is logically coherent, especially in complex argumentative or explanatory texts. This requires precise handling of semantic rules for causal relationships, conditional sentences, and contrast structures.
[0150] By representing the above grammar rules and semantic rules in a logical programming language and then converting them into feature vectors, a set of grammar rules and a set of semantic rules that can be recognized by a computer are obtained.
[0151] Exemplarily, a predefined set of grammar rules R g and a set of semantic rules R s for the first language that can be obtained by processing the above set of grammar rules and set of semantic rules are (represented as formulas (9) and (10) respectively):
[0152]
[0153] where x is the number of grammar rules in the set of grammar rules R g and y is the number of semantic rules in the set of semantic rules R s , m is the dimension of the feature vector corresponding to each grammar rule or semantic rule, α hf is the weight of the grammar rule corresponding to the position of h*f, r gh is the h-th grammar rule in the set of grammar rules R g , and λ(g f ) represents the grammar rule mapping function at position f corresponding to the h-th grammar rule in the set of grammar rules R g ; β qk is the weight of the semantic rule corresponding to the position of q*k, r sq is the q-th semantic rule in the set of semantic rules R s , and μ(s k ) represents the semantic rule mapping function at position k corresponding to the q-th semantic rule in the set of semantic rules R s .
[0154] It can be seen that in this application, through the assignment of rule weights α hf and β qk , the reasonable weight distribution of grammar rules and semantic rules in the reasoning process is ensured. Further, the mapping function λ(gf ) and μ(s k ) can map the corresponding rules into a specific numerical value, making the expression of grammatical rules and semantics more specific and systematic.
[0155] Further, a grammar rule mapping is performed on each element in the second symbol feature to obtain a third grammar mapping result for each element in the second symbol feature, and each element in the second symbol feature is mapped through the grammar rule set R g Perform grammatical rule mapping to obtain a third grammatical mapping result. Perform semantic rule mapping on each element in the second symbolic feature to obtain a third semantic mapping result for each element in the second symbolic feature; Map each element of the second symbolic feature through the semantic rule set R s Perform semantic rule mapping to obtain a third semantic mapping result.
[0156] Furthermore, based on the second symbolic feature, the third grammatical mapping result of each element in the second symbolic feature, and the third semantic mapping result of each element in the second symbolic feature, a fourth symbolic reasoning result is obtained, specifically including: based on the second symbolic feature, the third grammatical mapping result of each element in the second symbolic feature, a fifth symbolic reasoning result is obtained; linearly transforming the fifth symbolic reasoning result to obtain a third feature matrix; activating the third feature matrix to obtain a fourth feature matrix; acquiring second time series data of the second initial data set; determining a second time penalty coefficient corresponding to the second initial data set based on the second time series data; and determining the fourth symbolic reasoning result based on the fourth feature matrix and the second time penalty coefficient.
[0157] Exemplary. Based on the second symbolic feature, the third grammatical mapping result of each element in the second symbolic feature, and the third semantic mapping result of each element in the second symbolic feature, a fifth symbolic reasoning result is obtained. It should be noted that each element in the second symbolic feature, the third grammatical mapping result of each element in the second symbolic feature, and the third semantic mapping result of each element in the second symbolic feature can be directly multiplied to obtain the fifth symbolic reasoning result; different weights can also be set for each element in the second symbolic feature, the third grammatical mapping result of each element in the second symbolic feature, and the third semantic mapping result of each element in the second symbolic feature, and then multiplied to obtain the symbolic reasoning result; a matching weight can also be set for each element in the second symbolic feature, the third grammatical mapping result of each element in the second symbolic feature, and the third semantic mapping result of each element in the second symbolic feature, and then multiplied; further, the third grammatical mapping result of each element in the second symbolic feature can also be transformed by a transformation function to obtain a transformed third grammatical mapping result, and the third semantic mapping result of each element in the second symbolic feature can be transformed by a transformation function to obtain a transformed third semantic mapping result, and then the matching weight and each element in the second symbolic feature can be combined to obtain the fifth symbolic reasoning result. The present application does not limit the method for obtaining the fifth symbolic reasoning result. In the present application, the third grammatical mapping result of each element in the second symbolic feature is transformed by a transformation function to obtain a transformed third grammatical mapping result, the third semantic mapping result of each element in the second symbolic feature is transformed by a transformation function to obtain a transformed third semantic mapping result, and then the fifth symbolic reasoning result is obtained by combining the matching weight and each element in the second symbolic feature as an example for explanation.
[0158] The third grammatical mapping result of each element in the second symbolic feature is transformed by the first symbolic transformation function to obtain a transformed third grammatical mapping result, and the third semantic mapping result of each element in the second symbolic feature is transformed by the second symbolic transformation function to obtain a transformed third semantic mapping result, and then the matching weight and each element in the second symbolic feature are combined to obtain a fifth symbolic reasoning result S inference , the fifth symbolic reasoning result S inference It can be expressed by the following formula (11):
[0159]
[0160] Where n is S inference The number of words (i.e., tokens) in g, m is the dimension of the feature vector corresponding to each word, and λ(g j ) is the mapping function of the grammatical rule, μ(s j) is the mapping function of the semantic rule, γ ij For S symbolic The matching weight of the i*jth element in position, For S symbolic The middle position is the i*jth element, ω i (·) is the first sign transformation function, θ i (·) is the second sign transformation function.
[0161] Exemplarily, in the symbolic reasoning process, each element in is respectively mapped to a grammatical rule to obtain a third grammatical mapping result for each element in the second symbolic feature, and then transformed by the first symbolic transformation function to obtain a transformed third grammatical mapping result (corresponding to the formula ); semantic rule mapping will also be performed on each element in the second symbol feature to obtain the third semantic mapping result of each element in the second symbol feature, and then transformed by the second symbol transformation function to obtain the transformed third semantic mapping result (corresponding to the formula in Then, the product of the matching weight of the i*jth element, the second symbolic feature of the i*jth element, the transformed third grammatical mapping result of the i*jth element, and the transformed third semantic mapping result of the i*jth element is taken as the fifth symbolic reasoning result.
[0162] It should be noted that the first symbol transformation function and the second symbol transformation function in the present application may be the same or different, and the present application does not limit this. Secondly, the first symbol transformation function and the second symbol transformation function may be defined as a 0,1 binary operation, that is, judging whether the third grammatical mapping result and the third semantic mapping result are greater than a threshold value, if greater than the threshold value, it is recorded as 1, and if less than the threshold value, it is recorded as 0.
[0163] Optionally, in the embodiment of the present application, the fifth symbolic reasoning result S obtained above can be directly inference As the fourth symbolic reasoning result. That is, based on the second symbolic feature, the third grammatical mapping result of each element in the second symbolic feature, and the third semantic mapping result of each element in the second symbolic feature, the fourth symbolic reasoning result is obtained, specifically including: performing grammatical rule mapping on each element in the second symbolic feature to obtain the third grammatical mapping result; performing semantic rule mapping on each element in the second symbolic feature to obtain the third semantic mapping result; based on each element in the second symbolic feature, the third grammatical mapping result of each element in the second symbolic feature, and the third semantic mapping result of each element in the second symbolic feature, the fifth symbolic reasoning result is obtained; and the fifth symbolic reasoning result is used as the fourth symbolic reasoning result.
[0164] It can be seen that in the present application, a grammatical rule mapping is performed on each element in the second symbolic feature to obtain a third grammatical mapping result; a semantic rule mapping is performed on each element in the second symbolic feature to obtain a third semantic mapping result; based on each element in the second symbolic feature, the third grammatical mapping result of each element in the second symbolic feature, and the third semantic mapping result of each element in the second symbolic feature, a fifth symbolic reasoning result is obtained, and the fifth symbolic reasoning result is used as the fourth symbolic reasoning result. This symbolic reasoning method can avoid the disadvantages of traditional data processing that only relies on pure neural network models, because pure neural network models are trained with a large amount of historical data. Therefore, in the field of language conversion, it is easy to have problems such as tense inconsistency, which leads to the final language conversion result being inconsistent with the tense of the source language. However, this symbolic reasoning method of the present application can avoid the problem of inconsistent language conversion that only relies on pure neural network models. The symbolic reasoning method in the present application obtains the fourth symbolic reasoning result by performing grammatical rule mapping and semantic rule mapping on each element in the second symbolic feature respectively. This can ensure to the greatest extent that the grammatical rules and semantic rules of each element in the fourth symbolic reasoning result are consistent with the grammatical rules and semantic rules of the first language, thereby enhancing the logical rigor of the reasoning, improving the accuracy of the fourth symbolic reasoning result, and providing a guarantee for obtaining the final correct conversion result.
[0165] Optionally, the fifth symbolic reasoning result may be further processed to obtain a fourth symbolic reasoning result, specifically including: performing a linear transformation on the fifth symbolic reasoning result to obtain a third characteristic matrix; activating the third characteristic matrix to obtain a fourth characteristic matrix; obtaining second time series data of the second initial data set; determining a second time penalty coefficient corresponding to the second initial data set based on the second time series data; and determining the fourth symbolic reasoning result based on the fourth characteristic matrix and the second time penalty coefficient.
[0166] Fourth symbolic reasoning result T initial It can be expressed by formula (12):
[0167]
[0168] Among them, θ i is the first verification weight, is the logic verification function as shown in the above formula (13), For S inference The feature vector of the i-th word in is W inf The second verification weight is b inf validation bias, ξ(t) is the time-dependent validation function, sigmoid(·) is the activation function, and (0, T) is the integration interval.
[0169] In the logic verification process, through the logic verification function κ(·) and the verification weight θ i The reasonable distribution of ensures the rigor of logical verification and the high accuracy of reasoning results. The application of the S-shaped activation function sigmoid(·) and the time-related verification function ξ(t) further improves the dynamics and real-time nature of the verification process. It should be noted that the verification function ξ(t) can be the timestamp of the second initial data set.
[0170] First, the fifth symbolic reasoning result is linearly transformed to obtain the third feature matrix, that is, each word in the fifth symbolic reasoning result is weighted and summed by the second verification weight and the verification bias, and combined with the first verification weight, each word in the fifth symbolic reasoning result is reasonably distributed in the overall logic. The third feature matrix is activated to obtain the fourth feature matrix, and the sigmoid activation function is applied to each word in the third feature matrix for nonlinear transformation, so that the output value of the fourth feature matrix is between (0,1), thereby smoothing the data and avoiding the influence of extreme values on the overall result. Further, the second time series data of the second initial data set is obtained; based on the second time series data, the second time penalty coefficient corresponding to the second initial data set is determined, and the combination of the time-related verification function and the softmax function is introduced. The second time penalty coefficient corresponding to the second initial data set is obtained by normalizing the time series data, thereby capturing the important features in the time series. Furthermore, based on the fourth feature matrix and the second time penalty coefficient, the fourth symbolic reasoning result is determined, and the characteristics of the time dimension are introduced in the verification process to ensure the real-time and dynamic adjustment capabilities of the logic verification.
[0171] By applying weighted summation and sigmoid activation functions, the reasonable distribution of each inference result in the overall logic is ensured, avoiding excessive influence of extreme values on the results; the introduction of time-related verification functions and softmax functions enables the verification process to dynamically capture changes in the time dimension, ensuring the real-time and dynamic adjustment capabilities of logic verification; through the reasonable allocation of logic verification functions, the strict verification of reasoning results and the high accuracy of reasoning results are ensured, improving the rigor and precision of the logic verification process.
[0172] It can be seen that in the embodiment of the present application, the third characteristic matrix is obtained by linearly transforming the fifth symbolic reasoning result; the third characteristic matrix is activated to obtain the fourth characteristic matrix; the second time series data of the second initial data set is obtained; based on the second time series data, the second time penalty coefficient corresponding to the second initial data set is determined; based on the fourth characteristic matrix and the second time penalty coefficient, the fourth symbolic reasoning result is determined. First, in the process of linear transformation, the weight and bias terms are verified to ensure the reasonable distribution of each word in the fifth symbolic reasoning result in the overall logic, and then the third characteristic matrix is activated to obtain the fourth characteristic matrix, that is, the activation function is applied to each word in the third characteristic matrix for nonlinear transformation, so that the output value of the fourth characteristic matrix is between (0,1), thereby smoothing the data and avoiding the influence of extreme values on the overall result. Further, the second time series data of the second initial data set is obtained; based on the second time series data, the second time penalty coefficient corresponding to the second initial data set is determined, time-related information is introduced, and the important features in the time series are captured from the second time series data, and the second time penalty coefficient is obtained. Furthermore, the fourth characteristic matrix is penalized based on the second time penalty coefficient to determine the fourth symbolic reasoning result, and the characteristics of the time dimension are introduced in the verification process to ensure the real-time and dynamic adjustment capabilities of the logic verification and improve the logical correctness of the fourth symbolic reasoning result.
[0173] S105: Train the second model based on the fourth symbolic reasoning result to obtain a trained second model.
[0174] It should be noted that step S104 in this application performs reasoning of the fourth symbolic reasoning result through the initial symbolic reasoning model, such as Figure 3 As shown, the initial symbolic reasoning model also includes an initial symbolic reasoning layer and an initial logic verification layer. The second feature is input into the initial symbolic reasoning model to obtain a fourth symbolic reasoning result. The initial symbolic reasoning model is trained by the second loss between the sample symbolic reasoning result corresponding to the sample website in the training data set and the fourth symbolic reasoning result, and the network parameters in the initial symbolic reasoning model are updated until the initial symbolic reasoning model converges to obtain a trained symbolic reasoning model. The trained symbolic reasoning model includes a symbolic reasoning layer and a logic verification layer. It should be noted that each symbolic reasoning layer or logic verification layer can also be understood as a model.
[0175] S106: Perform feature fusion on the fourth symbolic reasoning result and the third initial data set to obtain a second conversion result.
[0176] Exemplarily, the fourth symbolic reasoning result and the third initial data set are subjected to feature fusion by an initial feature fusion model in the initial model to obtain a second conversion result, wherein the language of the second conversion result is the first language. Figure 4 , Figure 4 A schematic diagram of a feature fusion process provided in an embodiment of the present application, the method includes but is not limited to steps S1061-S1063:
[0177] S1061: Obtain a fifth matching matrix between the fourth symbolic reasoning result and the initial data set.
[0178] Specifically, obtaining the fifth matching matrix between the fourth symbolic reasoning result and the initial data set specifically includes: obtaining the sixth matching matrix between the fourth symbolic reasoning result and the third initial data set; performing position encoding based on the sixth matching matrix to obtain a seventh matching matrix; performing random inactivation on the sixth matching matrix to obtain an eighth matching matrix; and fusing the seventh matching matrix and the eighth matching matrix to obtain a fifth matching matrix. Among them, obtaining the fifth matching matrix between the fourth symbolic reasoning result and the initial data set refers to obtaining the matching degree of the elements at the corresponding positions in the fourth symbolic reasoning result and the initial data set, and then combining the matching degree of the elements at each position into the fifth matching matrix.
[0179] Optionally, obtaining a sixth matching matrix between the fourth symbolic reasoning result and the third initial data set specifically includes: obtaining the similarity between the fourth symbolic reasoning result and the elements at corresponding positions of the third initial data set to obtain a fifth weight matrix; normalizing the fifth weight matrix to obtain a sixth weight matrix; performing a linear transformation on the sixth weight matrix to obtain a seventh weight matrix; activating the seventh weight matrix to obtain an eighth weight matrix; and obtaining a sixth matching matrix based on the eighth weight matrix and the sixth weight matrix.
[0180] Specifically, the formula (14) for obtaining the sixth matching matrix is:
[0181]
[0182] Among them, tanh(·) and relu(·) represent the hyperbolic tangent activation function and the rectified linear unit activation function respectively, and softmax(·) is the normalized exponential function W match and b match are matching weight and matching bias respectively, d is the feature dimension, and n is T initial and D parsed The number of words in T, m is initial and D parsed The dimension of the feature vector for each word in , T initial The i*jth element in D parsed The i*jth element in .
[0183] Combined with the formula for obtaining the sixth matching matrix, the sixth matching matrix of the fourth symbolic reasoning result and the third initial data set is explained. The similarity between the elements at the corresponding positions of the fourth symbolic reasoning result and the third initial data set is obtained to obtain the fifth weight matrix. It should be explained that the complex relationship between the features can be captured by multiplying the fourth symbolic reasoning result and the third initial data set element by element, thereby obtaining the similarity Of course, similarity can also be obtained by setting different weights for each element, and this application does not limit this. Further, the fifth weight matrix is normalized to obtain a sixth weight matrix. Specifically, the normalization function can be used to normalize the fifth weight matrix, and the normalized fifth weight matrix can be directly used as the sixth weight matrix. The normalized fifth weight matrix can also be further scaled by the feature dimension to obtain the sixth weight matrix (i.e. ). Further, the sixth weight matrix is linearly transformed to obtain the seventh weight matrix, and the seventh weight matrix is activated to obtain the eighth weight matrix. The sixth weight matrix is linearly transformed by matching weights and matching bias terms to obtain the seventh weight matrix, and then the seventh weight matrix is activated by the modified linear activation unit function to obtain the eighth weight matrix (i.e. ). Finally, based on the eighth weight matrix and the sixth weight matrix, a sixth matching matrix is obtained. Specifically, the eighth weight matrix and the sixth weight matrix can be directly multiplied or weighted to obtain the sixth matching matrix, or the product of the eighth weight matrix and the sixth weight matrix can be further activated by a hyperbolic tangent activation function to obtain the sixth weight matrix.
[0184] It can be seen that in the present application, the similarity between the fourth symbolic reasoning result and the elements at the corresponding position of the third initial data set is obtained to obtain the fifth weight matrix; the fifth weight matrix is normalized to obtain the sixth weight matrix; the sixth weight matrix is linearly transformed to obtain the seventh weight matrix; the seventh weight matrix is activated to obtain the eighth weight matrix; based on the eighth weight matrix and the sixth weight matrix, the sixth matching matrix is obtained. First, the similarity between the fourth symbolic reasoning result and the elements at the corresponding position of the third initial data set is obtained, and the element-by-element multiplication captures the complex relationship between the features; further, the fifth weight matrix is normalized, so that the sixth weight matrix can have stronger data expression ability; further, the sixth weight matrix is linearly transformed to obtain the seventh weight matrix, and the similarity of each element obtained in the linear transformation process can be made greater than the matching bias term, thereby enhancing the expression ability of the data; further, the seventh weight matrix is activated to obtain the eighth weight matrix; further, based on the eighth weight matrix and the sixth weight matrix, the sixth matching matrix is obtained, and the element-by-element multiplication in the weight matrix is used to enhance the matching effect.
[0185] Optionally, position encoding is performed based on the sixth matching matrix to obtain a seventh matching matrix; random inactivation is performed on the sixth matching matrix to obtain an eighth matching matrix; and the seventh matching matrix and the eighth matching matrix are fused to obtain a fifth matching matrix. It should be noted that this process can be regarded as an optimization of the sixth matching matrix.
[0186] Specifically, the fifth matching matrix can be obtained by the following formula (15):
[0187]
[0188] Among them, σ(·) represents the sigmoid activation function, concat(·) represents the feature concatenation operation, PE(k) represents the position encoding, dropout(·) is the random inactivation operation, gelu(·) is the Gaussian error linear unit activation function, and Optimize weights and biases for the kth layer, where p is the number of layers in the model.
[0189] Specifically, the optimization process of the sixth matching matrix is described in combination with the formula for obtaining the fifth matching matrix. Position encoding is performed based on the sixth matching matrix to obtain the seventh matching matrix, including: position encoding is performed based on the sixth matching matrix to obtain the sixth matching matrix after position encoding; the sixth matching matrix and the sixth matching matrix after position encoding are spliced to obtain the spliced sixth matching matrix; the spliced sixth matching matrix is linearly transformed by optimizing weights and optimizing bias items to obtain the sixth matching matrix after linear transformation, and finally, the sixth matching matrix after linear transformation is activated by the sigmoid activation function to obtain the seventh matching matrix. Further, the sixth matching matrix is randomly inactivated to obtain the eighth matching matrix, and finally, the seventh matching matrix and the eighth matching matrix are fused, wherein the fusion process can be direct multiplication of each element, or different weights can be set for the elements and then multiplied to obtain the fifth matching matrix.
[0190] It can be seen that in the present application, the seventh matching matrix is obtained by performing position encoding based on the sixth matching matrix; the eighth matching matrix is obtained by performing random inactivation on the sixth matching matrix; and the seventh matching matrix and the eighth matching matrix are fused to obtain the fifth matching matrix. In the process of feature extraction and optimization, the use of position encoding and random inactivation operations enhances the nonlinear expression ability and anti-overfitting performance in the model.
[0191] S1062: Reasoning the fifth matching matrix based on the rules of the first language to obtain a sixth symbolic reasoning result.
[0192] Exemplarily, reasoning on the fifth matching matrix based on the rules of the first language to obtain a sixth symbolic reasoning result includes: normalizing the fifth matching matrix to obtain a normalized fifth matching matrix; performing grammatical rule mapping on each element in the fifth matching matrix to obtain a fourth grammatical mapping result for each element in the fifth matching matrix; performing semantic rule mapping on each element in the fifth matching matrix to obtain a fourth semantic mapping result for each element in the fifth matching matrix; obtaining a sixth symbolic reasoning result based on the fifth matching matrix, the fourth grammatical mapping result for each element in the fifth matching matrix, the fourth semantic mapping result for each element in the fifth matching matrix, and the normalized fifth matching matrix.
[0193] Specifically, the sixth symbolic reasoning result S opt-inference It can be expressed by formula (16):
[0194]
[0195] Where n is F optimized The number of words (i.e., tokens) in g, m is the dimension of the feature vector corresponding to each word, and λ(g j ) is the mapping function of the grammatical rule, μ(s j ) is the mapping function of the semantic rule, γ ij is the matching weight of the position at the i*jth element, F optimized The i*jth element in η i (·) is the third sign transformation function, and LayerNorm(·) is the layer normalization operation.
[0196] Combined with the above formula, the sixth reasoning process is explained. First, the fifth matching matrix is normalized in this application to obtain the normalized fifth matching matrix. Each element in the fifth matching matrix is normalized by layer normalization operation to obtain the normalized fifth matching matrix. The grammar rule mapping is performed on each element in the fifth matching matrix to obtain the fourth grammar mapping result of each element in the fifth matching matrix. Perform semantic rule mapping on each element in the fifth matching matrix to obtain a fourth semantic mapping result for each element in the fifth matching matrix Based on the fifth matching matrix, the fourth grammatical mapping result of each element in the fifth matching matrix, the fourth semantic mapping result of each element in the fifth matching matrix, and the normalized fifth matching matrix, the sixth symbolic reasoning result is obtained, which can include: transforming the product of the fourth grammatical mapping result of each element and the fourth semantic mapping result of each element through the third symbolic transformation function to obtain the transformed grammatical and semantic fusion result, and then multiplying each element in the fifth matching matrix, the grammatical and semantic fusion result of the corresponding position, and the normalized fifth matching matrix of the corresponding position to obtain the sixth symbolic reasoning result. Furthermore, each element in the fifth matching matrix, the grammatical and semantic fusion result of the corresponding position, the normalized fifth matching matrix of the corresponding position, and the matching weight can also be multiplied to obtain the sixth symbolic reasoning result (that is, the processing method corresponding to the formula for obtaining the sixth symbolic reasoning result), which is not limited in this application.
[0197] It should be noted that the third symbol transformation function, the first symbol transformation function, and the second symbol transformation function in the present application may be the same or different, and the present application does not limit this. Secondly, the third symbol transformation function may also be defined as a 0,1 binary operation, that is, judging whether the third grammatical mapping result and the third semantic mapping result are greater than a threshold value, if greater than the threshold value, it is recorded as 1, and if less than the threshold value, it is recorded as 0.
[0198] It can be seen that in the embodiment of the present application, the fifth matching matrix is normalized to obtain the normalized fifth matching matrix; the grammatical rule mapping is performed on each element in the fifth matching matrix to obtain the fourth grammatical mapping result of each element in the fifth matching matrix; the semantic rule mapping is performed on each element in the fifth matching matrix to obtain the fourth semantic mapping result of each element in the fifth matching matrix; based on the fifth matching matrix, the fourth grammatical mapping result of each element in the fifth matching matrix, the fourth semantic mapping result of each element in the fifth matching matrix and the normalized fifth matching matrix, the sixth symbolic reasoning result is obtained. The fifth matching matrix is symbolically reasoned again by symbolic reasoning, which realizes a more detailed reasoning process, prevents the loss of key symbolic reasoning results in the processing process of step S1041, and can ensure that the grammatical rules and semantic rules of each element in the obtained sixth symbolic reasoning result are consistent with the grammatical rules and semantic rules of the first language to the greatest extent, enhances the logical rigor of the reasoning, improves the accuracy of the sixth symbolic reasoning result, and improves the convergence speed of the model through the layer normalization operation, avoids the problem of gradient disappearance or gradient explosion, and increases the stability and generalization ability of the model, so as to provide a guarantee for obtaining the final correct conversion result.
[0199] S1063: Fusing the fourth symbolic reasoning result and the sixth symbolic reasoning result to obtain a second conversion result.
[0200] Exemplarily, the second conversion result T final The formula (17) can be:
[0201]
[0202] Among them, DenseNet(·) represents a densely connected convolutional network, HighwayNet(·) represents a highway network, sigmoid(·) is an S-shaped activation function, and W fusion and b fusion is the fusion weight and bias term, α is the first fusion weight and β is the second fusion weight, W fusion is the third fusion weight, b fusion is the fusion bias term, n is S opt-inference and T initial The number of words in S, m is opt-inference and T initial The dimension of the feature vector for each word in , T initial The i*jth element in For S opt-inference The i*jth element in .
[0203] It can be seen that in the embodiment of the present application, the fourth symbolic reasoning result and the sixth symbolic reasoning result are fused to obtain the second conversion result. By introducing a densely connected convolutional network, it is ensured that the maximum amount of information flows between the layers in the network. In order to retain the feedforward characteristics, each layer obtains additional inputs from all previous layers and passes its own features to all subsequent layers. The sixth symbolic reasoning result obtained for the second time through the highway network interacts with the fourth symbolic reasoning result again to ensure that the network will not lose information after so many layers of calculation. It can be understood as strengthening the weight of the fourth symbolic reasoning result and strengthening the influence of the fourth symbolic reasoning result on the final second conversion result in the network. Furthermore, each element in the sixth symbolic reasoning result is linearly transformed by the third fusion weight and the fusion bias term, and then nonlinearly changed by the S-shaped activation function to enhance the generalization ability of the model. In addition, the accuracy and efficiency of the conversion model are ensured by reasonably dividing the first fusion weight and the second fusion weight.
[0204] It can be seen that in the embodiment of the present application, a fifth matching matrix of the fourth symbolic reasoning result and the initial data set is obtained; the fifth matching matrix is reasoned based on the rules of the first language to obtain a sixth symbolic reasoning result; the fourth symbolic reasoning result and the sixth symbolic reasoning result are fused to obtain a second conversion result. First, the fifth matching matrix of the fourth symbolic reasoning result and the initial data set is obtained through the neural network mechanism; then, the fifth matching matrix is again inferred based on the rules of the first language to obtain the sixth symbolic reasoning result, realizing a more detailed reasoning process and preventing the loss of key symbolic reasoning results during the data processing process. It can ensure to the greatest extent that the grammatical rules and semantic rules of each element in the obtained sixth symbolic reasoning result are consistent with the grammatical rules and semantic rules of the first language, enhance the logical rigor of the reasoning, and improve the accuracy of the sixth symbolic reasoning result; finally, the fourth symbolic reasoning result and the sixth symbolic reasoning result are fused based on the neural network mechanism to ensure that the network will not lose information after multiple layers of calculation, which can be understood as strengthening the weight of the fourth symbolic reasoning result. Because the neural network has strong generalization and flexibility, it can enable the feature fusion model to have strong predictive ability for new data that has never appeared before, so it can handle multiple languages and complex grammatical structures, and is applied to global websites such as international news websites, global e-commerce platforms, and multilingual education websites, etc., and can provide high-quality small language translation support.
[0205] S107: Training the third model based on the second conversion result to obtain a trained third model.
[0206] It should be noted that the initial model in this application may include a trained feature extraction model, a trained symbolic reasoning model, and an initial feature fusion model, that is, only the initial feature fusion model in the initial model may be trained. Figure 5 As shown, the initial feature fusion model includes an initial feature matching layer, an initial feature optimization layer, an initial symbolic reasoning layer and an initial feature fusion layer. It should be noted that the initial feature matching layer, the initial feature optimization layer, the initial symbolic reasoning layer or the initial feature fusion layer can also be understood as one model.
[0207] It should be noted that before training, a sample data set is constructed, wherein the sample data set includes the source language content of the sample website and the first language content corresponding to the sample website, and the first language refers to the target translation language, which is any one of multiple languages except the source language of the first website. For example, if the source language is Chinese and the target translation language of the sample website is English, then the first language is English. It should be noted that there are multiple sample websites, and this application only takes one as an example. Specifically, the initial feature fusion model is trained based on the second conversion result to obtain a trained feature fusion model, including: decoding the second conversion result through a decoder to obtain the predicted conversion content corresponding to the sample website; obtaining the third loss of the predicted conversion content and the first language content corresponding to the sample website; training the initial feature fusion model based on the third loss to obtain a trained feature fusion model. It should be noted that the decoder is a decoder trained in advance, and only the initial feature fusion model needs to be trained. Figure 5 As shown, the fourth symbolic reasoning result and the second feature are input into the initial feature fusion model to obtain a second conversion result, the second conversion result is decoded by a decoder to obtain a predicted conversion content, and the initial feature fusion model is trained based on the third loss of the predicted conversion content and the first language content corresponding to the sample website.
[0208] Specifically, the third loss of the predicted conversion content and the first language content corresponding to the sample website is obtained, wherein the third loss may be the cross entropy loss mean square error, mean absolute error, negative log likelihood, Hinge loss, etc., which is not limited in this application. Specifically, the model is trained based on the third loss to obtain a trained feature fusion model. It should be noted that in the specific application process, multiple third losses of the predicted conversion content of multiple sample websites and the first language content corresponding to the corresponding sample websites will be obtained. The initial feature fusion model can be trained directly based on multiple third losses, and the grid parameters are adjusted until the model converges to obtain a trained feature fusion model. It is also possible to weight multiple third losses to obtain weighted losses, use the weighted losses to train the initial feature fusion model, adjust the grid parameters until the model converges, and obtain a trained feature fusion model; it is also possible to use each third loss to train the initial feature fusion model one by one, adjust the grid parameters until the model converges, and obtain a trained feature fusion model, which is not limited in this application.
[0209] S108: Obtain a model based on the trained first model, the trained second model, and the trained third model.
[0210] It should be noted that the trained feature extraction model, the trained symbolic reasoning model and the trained feature fusion model can be directly spliced into the model, which can be called a language conversion model. The trained feature extraction model, the trained symbolic reasoning model and the trained feature fusion model can also be spliced, and then the model is trained through part of the training data to obtain a language conversion model, which is not limited in this application. The specific model training method is similar to the model training method recorded in the above step S107, and this application will not repeat it here.
[0211] It can be seen that in the embodiment of the present application, since the initial model is relatively large, if the initial model is directly trained as a whole, the training cycle is long and the initial model is difficult to converge. Therefore, training the initial feature extraction model, the initial symbolic reasoning model and the initial feature fusion model in the initial model separately can reduce the complexity of the training process and improve the convergence speed. Further, the trained feature extraction model, the trained symbolic reasoning model and the trained feature fusion model can be spliced, and then the model training is performed through part of the training data to obtain a language conversion model. Since the trained feature extraction model, the trained symbolic reasoning model and the trained feature fusion model have converged, therefore, after the trained feature extraction model, the trained symbolic reasoning model and the trained feature fusion model are spliced, the model training is performed through part of the training data, while ensuring the speed of model convergence, the fit between the trained feature extraction model, the trained symbolic reasoning model and the trained feature fusion model can also be increased, thereby improving the model performance of the final language conversion model.
[0212] Furthermore, in the present application, symbolic reasoning is performed on the second feature based on the rules of the first language, and symbolic reasoning can be performed on the complex language structure and language context in the second feature to obtain a fourth symbolic reasoning result, so that the logic of the fourth symbolic reasoning result conforms to the rules of the first language, thereby ensuring the accuracy of the final second conversion result.
[0213] Furthermore, the fourth symbolic reasoning result and the third initial data set are fused. Since the third initial data set contains all the content of the sample website, the content of the sample website can be kept intact during the fusion process, ensuring that the neural network does not lose information during layer-by-layer calculations. That is, after the fourth symbolic reasoning result and the third initial data set are fused, the second conversion result obtained can be both logically consistent with the rules of the first language and cover the third initial data set of the sample website, making the determination of the second conversion result both accurate and comprehensive. Furthermore, model training based on the second conversion result can make the obtained model have higher accuracy, consistency and comprehensiveness when performing translation.
[0214] Through the contents recorded in the above steps S101-S108, a model (ie, a language conversion model) is obtained. Therefore, the application of the language conversion model is explained.
[0215] See also Figure 6 , Figure 6 A flow chart of a language conversion method provided in an embodiment of the present application, the method includes but is not limited to steps S601-S605, and the process of converting the language of a first website to obtain a second website is implemented by a model (i.e., a language conversion model):
[0216] like Figure 7 As shown, the language conversion model includes a feature extraction model, a symbolic reasoning model and a feature fusion model. It should be noted that the feature extraction model is the feature extraction model trained in the above steps, the symbolic reasoning model is the symbolic reasoning model trained in the above steps, and the feature fusion model is the feature fusion model trained in the above steps. The first initial data set is input into the language conversion model, and the model reasoning is performed in sequence through the feature extraction model, the symbolic reasoning model and the feature fusion model in the language conversion model to obtain a first conversion result. Then, the language conversion model also includes a decoder. The first conversion result is decoded by the decoder in the language conversion model to obtain multiple first conversion contents corresponding to the first website, wherein the decoder is a decoder trained in advance, and the present application does not elaborate on the training method of the decoder.
[0217] It should be noted that the second website in this application is not another website relative to the first website. The second website in this application can be equivalent to another language version of the first website. For example, the first website is the Chinese version of website A, the second website is the English version of website A, and the first language is English.
[0218] S601: Structuring first initial content of a first website to obtain a first initial data set.
[0219] It should be noted that before step S601, the process also includes: obtaining the first initial content of the first website. The method of obtaining the first initial content of the first website is similar to the method of obtaining the second initial content of the sample website recorded in step S101, and this application will not repeat it here. The first initial content may include: text content of the first website, target object generated content, target object interaction data, target object browsing behavior data, target object feedback data, etc.
[0220] Optionally, the text content of the first website is collected in real time by adopting a method combining depth-first crawling and breadth-first crawling. The target object generated content in the first website may not be obtained by the method combining depth-first crawling and breadth-first crawling. Therefore, it is necessary to use the API interface to obtain the target object generated content, recorded as, and ensure the security and privacy of the data through the OAuth authentication mechanism. The target object interaction data is collected through event monitoring technology, recorded as, and event monitoring includes front-end page event binding and back-end log recording to ensure the real-time and accuracy of the data. The target object browsing behavior data is collected using browser plug-ins and embedding technology, recorded as, and the browser plug-in is combined with the embedding script to improve the accuracy and comprehensiveness of the data. The target object feedback data is collected through asynchronous submission and data encryption technology and database interface, recorded as, to ensure the safe transmission and storage of data.
[0221] It can be seen that in the embodiment of the present application, when obtaining the first initial content of the first website, a method combining depth-first crawling and breadth-first crawling is adopted to collect the content data of the first website in real time to ensure the timeliness of the data. Secondly, the user-generated content is obtained by using the API interface, and the security and privacy protection of the data are ensured through the OAuth authentication mechanism, so as to ensure the real-time nature of the user-generated content. User interaction data is collected through event monitoring technology, including clicks, likes and shares, etc., to ensure the real-time and accuracy of user interaction data. In addition, browsing behavior data is collected through browser plug-ins and buried point technology to ensure the accuracy and comprehensiveness of the data. User feedback data is collected through asynchronous submission and data encryption technology and database interface to ensure the safe transmission and storage of data. This real-time processing mechanism can ensure the timeliness and consistency of the first initial content of the first website, can quickly respond to user needs and feedback, realize real-time website language conversion, greatly reduce delays, and improve the user's browsing experience. Especially in dynamic first websites where content is frequently updated and needs to be responded to quickly, such as social media platforms, online news websites, and e-commerce websites, it can provide smooth real-time multilingual conversion to meet the immediate needs of users (target objects).
[0222] Exemplarily, the first initial content is cleaned to obtain the cleaned first initial content; the cleaned first initial content is standardized to obtain the standardized first initial content; the standardized first initial content is denoised to obtain the denoised first initial content; the denoised first initial content is segmented to obtain the segmented first initial content; the segmented first initial content is annotated based on the grammatical structure tree to obtain the second initial content; the second initial content is word embedded to obtain the first initial data set. It should be noted that the method of structuring the first initial content of the first website to obtain the first initial data set is similar to the method of structuring the second initial content of the sample website recorded in step S101 to obtain the third initial data set, and this application will not elaborate on it here.
[0223] It can be seen that in the embodiment of the present application, the second initial content is obtained by annotating the first initial content after word segmentation based on the grammatical structure tree. The focusing of the attention mechanism can be improved by annotating the first initial content after word segmentation based on the grammatical structure tree. MHA captures information in different subspaces through parallel attention heads. The introduction of the grammatical structure tree can help each attention head to focus more effectively on grammatically relevant or important words. For example, for a given verb, attention can be more targeted to focus on its direct object or subject, rather than any vocabulary in the entire sentence. The accuracy of language conversion and content generation can also be improved. In the language conversion task, it is very important to keep the grammatical structure of the original text correctly represented in the first language. The information of the grammatical structure tree can guide MHA to maintain grammatical correctness when generating language, thereby improving the quality of language conversion and ensuring that the generated content is consistent with the original text in both grammar and semantics. The processing of long-distance dependency problems can also be optimized. Long-distance dependency in language is a challenge in natural language processing. For example, there may be a direct grammatical dependency relationship between the words at the beginning of a sentence and the words at the end of the sentence. The syntax structure tree provides a global view that helps MHA capture these dependencies across long distances, thus providing support when processing complex sentence structures.
[0224] S602: Extract features from the first initial data set to obtain a first feature.
[0225] It should be noted that the first initial data set can be input into the feature extraction model in the language conversion model to obtain the first feature. Specifically, the feature extraction model performs semantic feature extraction on the first initial data set to obtain the first semantic feature of the first initial data set; context information extraction is performed on the first semantic feature to obtain the first context feature; pragmatic information extraction is performed on the first context feature to obtain the first pragmatic feature; the first semantic feature, the first context feature and the first pragmatic feature are feature fused to obtain the first feature. It should be noted that the method of extracting features from the first initial data set to obtain the first feature is similar to the method of extracting features from the third initial data set to obtain the second feature as recorded in the above step S102, and this application will not repeat them here.
[0226] It can be seen that in the embodiment of the present application, the first semantic feature, the first context feature and the first pragmatic feature are feature fused to obtain the first feature. The first semantic feature, the first context feature and the first pragmatic feature are processed at multiple levels, not just simply spliced, but also combined with a multi-layer perceptron and a densely connected convolutional network, and a discarding mechanism is introduced, which can solve the problems of information redundancy and insufficient feature relationship capture in the traditional splicing method, thereby improving the effect of feature fusion.
[0227] S603: Perform symbolic reasoning on the first feature based on the rule of the first language to obtain a first symbolic reasoning result.
[0228] It should be noted that the first feature can be input into the symbolic reasoning model in the language conversion model (that is, the trained symbolic reasoning model, which is not distinguished in this application) to obtain a first symbolic reasoning result. Specifically, the first feature is converted into a first symbolic representation; symbolic feature extraction is performed on the first symbolic representation to obtain a first symbolic feature corresponding to the first feature; the first symbolic feature is inferred based on the rules of the first language to obtain a first symbolic reasoning result. It should be noted that the method of converting the first feature into the first symbolic representation is similar to the method of converting the second feature into the second symbolic representation in the model process, and this application will not repeat them here. It should be noted that the method of performing symbolic feature extraction on the first symbolic representation to obtain a first symbolic feature corresponding to the first feature is similar to the method of performing symbolic feature extraction on the second symbolic representation in the model process to obtain a second symbolic feature corresponding to the second feature, and this application will not repeat them here.
[0229] Exemplarily, the rules of the first language include grammatical rules and semantic rules; reasoning on the first symbolic feature based on the rules of the first language to obtain a first symbolic reasoning result includes: performing grammatical rule mapping on each element in the first symbolic feature to obtain a second grammatical mapping result for each element in the first symbolic feature. It should be noted that the method of performing grammatical rule mapping on each element in the first symbolic feature to obtain a second grammatical mapping result for each element in the first symbolic feature is similar to the method of performing grammatical rule mapping on each element in the second symbolic feature in the model process to obtain a third grammatical mapping result, which is not described in detail in this application; performing semantic rule mapping on each element in the first symbolic feature to obtain a second semantic mapping result for each element in the first symbolic feature. It should be noted that the method of performing semantic rule mapping on each element in the first symbolic feature to obtain a second semantic mapping result for each element in the first symbolic feature is similar to the method of performing semantic rule mapping on each element in the second symbolic feature in the model process to obtain a third semantic mapping result, which is not described in detail in this application; obtaining the first symbolic reasoning result based on the first symbolic feature, the second grammatical mapping result for each element in the first symbolic feature, and the second semantic mapping result for each element in the first symbolic feature.
[0230] Based on the first symbolic feature, the second grammatical mapping result of each element in the first symbolic feature, and the second semantic mapping result of each element in the first symbolic feature, a first symbolic reasoning result is obtained, including: based on the first symbolic feature, the second grammatical mapping result of each element in the first symbolic feature, and the second semantic mapping result of each element in the first symbolic feature, a third symbolic reasoning result is obtained. It should be noted that the method for obtaining the third symbolic reasoning result based on the first symbolic feature, the second grammatical mapping result of each element in the first symbolic feature, and the second semantic mapping result of each element in the first symbolic feature is similar to the method for obtaining the fifth symbolic reasoning result based on the second symbolic feature, the third grammatical mapping result of each element in the second symbolic feature, and the third semantic mapping result of each element in the second symbolic feature in the model training process, and the present application will not repeat them here; linearly transform the third symbolic reasoning result to obtain a first feature matrix. It should be noted that the method for linearly transforming the third symbolic reasoning result to obtain the first feature matrix is similar to the method for obtaining the third feature matrix based on the mapping result and the third semantic mapping result of each element in the second symbolic feature in the model training process, and the fifth symbolic reasoning result is obtained; linearly transform the fifth symbolic reasoning result to obtain the third feature matrix. The application will not be repeated here; the first feature matrix is activated to obtain the second feature matrix. It should be noted that the method for activating the first feature matrix to obtain the second feature matrix is similar to the method for activating the third feature matrix in the model training process to obtain the fourth feature matrix, and the application will not be repeated here; the first time series data of the first initial data set is obtained. It should be noted that the method for obtaining the first time series data of the first initial data set is similar to the method for obtaining the second time series data of the second initial data set in the model training process, and the application will not be repeated here; based on the first time series data, the first time penalty coefficient corresponding to the first initial data set is determined. It should be noted that the method for determining the first time penalty coefficient corresponding to the first initial data set based on the first time series data is similar to the method for determining the second time penalty coefficient corresponding to the second initial data set based on the second time series data in the model training process, and the application will not be repeated here; based on the second feature matrix and the first time penalty coefficient, the first symbolic reasoning result is determined. It should be noted that the method for determining the first symbolic reasoning result based on the second feature matrix and the first time penalty coefficient is similar to the method for determining the fourth symbolic reasoning result based on the fourth feature matrix and the second time penalty coefficient in the model training process, and the application will not be repeated here.
[0231] Optionally, in an embodiment of the present application, the third symbolic reasoning result obtained above can be directly used as the second symbolic reasoning result. That is, based on the first symbolic feature, the second grammatical mapping result of each element in the first symbolic feature, and the second semantic mapping result of each element in the first symbolic feature, the first symbolic reasoning result is obtained, specifically including: performing grammatical rule mapping on each element in the first symbolic feature to obtain the second grammatical mapping result of each element in the first symbolic feature; performing semantic rule mapping on each element in the first symbolic feature to obtain the second semantic mapping result of each element in the first symbolic feature; based on the first symbolic feature, the second grammatical mapping result of each element in the first symbolic feature, and the second semantic mapping result of each element in the first symbolic feature, the third symbolic reasoning result is obtained, and the third symbolic reasoning result obtained above is used as the first symbolic reasoning result.
[0232] It can be seen that in the present application, a grammatical rule mapping is performed on each element in the first symbolic feature to obtain a second grammatical mapping result for each element in the first symbolic feature; a semantic rule mapping is performed on each element in the first symbolic feature to obtain a second semantic mapping result for each element in the first symbolic feature; based on the first symbolic feature, the second grammatical mapping result for each element in the first symbolic feature, and the second semantic mapping result for each element in the first symbolic feature, a third symbolic reasoning result is obtained, and the third symbolic reasoning result obtained above is used as the first symbolic reasoning result. This symbolic reasoning method can avoid the disadvantages of traditional data processing that only relies on pure neural network models, because pure neural network models are trained with a large amount of historical data. Therefore, in the field of language conversion, it is easy to have problems such as tense inconsistency, which leads to the final language conversion result being inconsistent with the tense of the source language. However, this symbolic reasoning method of the present application can avoid the problem of inconsistent language conversion that only relies on pure neural network models. The symbolic reasoning method in the present application obtains a first symbolic reasoning result by performing grammatical rule mapping and semantic rule mapping on each element in the first symbolic feature respectively. This can ensure to the greatest extent that the grammatical rules and semantic rules of each element in the first symbolic reasoning result are consistent with the grammatical rules and semantic rules of the first language, thereby enhancing the logical rigor of the reasoning, improving the accuracy of the first symbolic reasoning result, and providing a guarantee for obtaining the final correct conversion result.
[0233] Furthermore, based on the first symbolic feature, the second grammatical mapping result of each element in the first symbolic feature, and the second semantic mapping result of each element in the first symbolic feature, a first symbolic reasoning result is obtained, including: based on the first symbolic feature, the second grammatical mapping result of each element in the first symbolic feature, a third symbolic reasoning result is obtained; linearly transforming the third symbolic reasoning result to obtain a first feature matrix; activating the first feature matrix to obtain a second feature matrix; acquiring first time series data of a first initial data set; determining a first time penalty coefficient corresponding to the first initial data set based on the first time series data; and determining the first symbolic reasoning result based on the second feature matrix and the first time penalty coefficient.
[0234] It can be seen that in the embodiment of the present application, the first characteristic matrix is obtained by linearly transforming the third symbolic reasoning result; the first characteristic matrix is activated to obtain the second characteristic matrix; the first time series data of the first initial data set is obtained; based on the first time series data, the first time penalty coefficient corresponding to the first initial data set is determined; based on the second characteristic matrix and the first time penalty coefficient, the first symbolic reasoning result is determined. First, in the process of linear transformation, the weight and bias terms are verified to ensure the reasonable distribution of each word in the third symbolic reasoning result in the overall logic, and then the first characteristic matrix is activated to obtain the second characteristic matrix, that is, the activation function is applied to nonlinearly transform each word in the first characteristic matrix, so that the output value of the second characteristic matrix is between (0,1), thereby smoothing the data and avoiding the influence of extreme values on the overall result. Further, the first time series data of the first initial data set is obtained; based on the first time series data, the first time penalty coefficient corresponding to the first initial data set is determined, time-related information is introduced, important features in the time series are captured from the first time series data, and the first time penalty coefficient is obtained. Furthermore, the second characteristic matrix is penalized based on the first time penalty coefficient to determine the first symbolic reasoning result, and the characteristics of the time dimension are introduced in the verification process to ensure the real-time and dynamic adjustment capabilities of the logic verification and improve the logical correctness of the first symbolic reasoning result.
[0235] S604: Perform feature fusion on the first symbolic reasoning result and the first initial data set to obtain a first conversion result.
[0236] Exemplarily, the first symbolic reasoning result and the first initial data set are subjected to feature fusion by a feature fusion model in the language conversion model to obtain a first conversion result. Figure 8 , Figure 8 A schematic diagram of another feature fusion process provided in an embodiment of the present application, the method includes but is not limited to steps S6041-S6043:
[0237] S6041: Obtain a first matching matrix between the first symbolic reasoning result and the first initial data set.
[0238] Exemplarily, a second matching matrix of the first symbolic reasoning result and the first initial data set is obtained; position encoding is performed based on the second matching matrix to obtain a third matching matrix; random inactivation is performed on the second matching matrix to obtain a fourth matching matrix; the third matching matrix and the fourth matching matrix are fused to obtain a first matching matrix.
[0239] Obtaining a second matching matrix between the first symbolic reasoning result and the first initial data set includes: obtaining the similarity between the first symbolic reasoning result and the elements at corresponding positions of the first initial data set to obtain a first weight matrix; normalizing the first weight matrix to obtain a second weight matrix; performing a linear transformation on the first weight matrix to obtain a third weight matrix; activating the third weight matrix to obtain a fourth weight matrix; and obtaining a second matching matrix based on the second weight matrix and the fourth weight matrix. It should be noted that the method for obtaining the second matching matrix between the first symbolic reasoning result and the first initial data set is similar to the method for obtaining the sixth matching matrix between the fourth symbolic reasoning result and the third initial data set during the model training process, and this application will not repeat them here.
[0240] It can be seen that in the present application, the similarity between the first symbolic reasoning result and the elements at the corresponding position of the first initial data set is obtained to obtain the first weight matrix; the first weight matrix is normalized to obtain the second weight matrix; the first weight matrix is linearly transformed to obtain the third weight matrix; the third weight matrix is activated to obtain the fourth weight matrix; based on the second weight matrix and the fourth weight matrix, the second matching matrix is obtained. First, the similarity between the first symbolic reasoning result and the elements at the corresponding position of the first initial data set is obtained, and the element-by-element multiplication captures the complex relationship between the features; further, the first weight matrix is normalized, so that the second weight matrix can have stronger data expression ability; further, the second weight matrix is linearly transformed to obtain the third weight matrix, and in the process of linear transformation, the similarity of each element obtained can be greater than the matching bias term, thereby enhancing the expression ability of the data; further, the third weight matrix is activated to obtain the fourth weight matrix; further, based on the second weight matrix and the fourth weight matrix, the second matching matrix is obtained, and the element-by-element multiplication in the weight matrix is used to enhance the matching effect.
[0241] Obtaining a first matching matrix between the first symbolic reasoning result and the first initial data set includes: obtaining a second matching matrix between the first symbolic reasoning result and the first initial data set; performing position encoding based on the second matching matrix to obtain a third matching matrix; performing random inactivation on the second matching matrix to obtain a fourth matching matrix; and fusing the third matching matrix and the fourth matching matrix to obtain a first matching matrix. It should be noted that the method for obtaining the first matching matrix between the first symbolic reasoning result and the first initial data set is similar to the method for obtaining the seventh matching matrix during the model training process, and this application will not repeat them here.
[0242] It can be seen that in the present application, the third matching matrix is obtained by performing position encoding based on the second matching matrix; the fourth matching matrix is obtained by performing random deactivation on the second matching matrix; and the third matching matrix and the fourth matching matrix are fused to obtain the first matching matrix. In the process of feature extraction and optimization, the position encoding and random deactivation operations are used to enhance the nonlinear expression ability of the first matching matrix.
[0243] S6042: Reasoning the first matching matrix based on the rules of the first language to obtain a second symbolic reasoning result.
[0244] Exemplarily, the first matching matrix is normalized to obtain a normalized first matching matrix; a grammatical rule mapping is performed on each element in the first matching matrix to obtain a first grammatical mapping result for each element in the first matching matrix; a semantic rule mapping is performed on each element in the first matching matrix to obtain a first semantic mapping result for each element in the first matching matrix; based on the first matching matrix, the first grammatical mapping result of each element in the first matching matrix, the first semantic mapping result corresponding to each element in the first matching matrix, and the normalized first matching matrix, a second symbolic reasoning result is obtained. It should be noted that the method for obtaining the first symbolic reasoning result and the first matching matrix of the first initial data set is similar to the method for obtaining the seventh matching matrix in the model process, and this application will not repeat them here. It should be noted that the method for inferring the first matching matrix based on the rules of the first language to obtain the second symbolic reasoning result is similar to the method for inferring the fifth matching matrix based on the rules of the first language in the model process to obtain the sixth symbolic reasoning result, and this application will not repeat them here.
[0245] It can be seen that in the embodiment of the present application, the first matching matrix is normalized to obtain the normalized first matching matrix; the grammatical rule mapping is performed on each element in the first matching matrix to obtain the first grammatical mapping result of each element in the first matching matrix; the semantic rule mapping is performed on each element in the first matching matrix to obtain the first semantic mapping result of each element in the first matching matrix; based on the first matching matrix, the first grammatical mapping result of each element in the first matching matrix, the first semantic mapping result corresponding to each element in the first matching matrix and the normalized first matching matrix, the second symbolic reasoning result is obtained. The symbolic reasoning is performed on the first matching matrix again by symbolic reasoning, which realizes a more detailed reasoning process, prevents the loss of key symbolic reasoning results in the processing of step S6041, and can ensure to the greatest extent that the grammatical rules and semantic rules of each element in the obtained second symbolic reasoning result are consistent with the grammatical rules and semantic rules of the first language, enhances the logical rigor of the reasoning, improves the accuracy of the second symbolic reasoning result, and provides a guarantee for obtaining the final correct conversion result.
[0246] S6043: Fusing the first symbolic reasoning result and the second symbolic reasoning result to obtain a first conversion result.
[0247] It should be noted that the method of fusing the first symbolic reasoning result and the second symbolic reasoning result to obtain the first conversion result is similar to the method of fusing the fourth symbolic reasoning result and the sixth symbolic reasoning result to obtain the second conversion result during the model training process, and this application will not repeat them here.
[0248] It can be seen that in the embodiment of the present application, the first symbolic reasoning result and the second symbolic reasoning result are fused to obtain the first conversion result. Ensuring that no information is lost after a series of reasoning processes can be understood as strengthening the weight of the first symbolic reasoning result and strengthening the influence of the first symbolic reasoning result on the first conversion result finally obtained.
[0249] It can be seen that in the embodiment of the present application, a first matching matrix of the first symbolic reasoning result and the first initial data set is obtained; the first matching matrix is inferred based on the rules of the first language to obtain the second symbolic reasoning result; the first symbolic reasoning result and the second symbolic reasoning result are fused to obtain the first conversion result. First, the first matching matrix of the first symbolic reasoning result and the first initial data set is obtained; then, the first matching matrix is inferred again based on the rules of the first language to obtain the second symbolic reasoning result, which implements a more detailed reasoning process and prevents the data from losing key symbolic reasoning results during the processing process. It can ensure to the greatest extent that the grammatical rules and semantic rules of each element in the obtained second symbolic reasoning result are consistent with the grammatical rules and semantic rules of the first language, enhance the logical rigor of the reasoning, and improve the accuracy of the second symbolic reasoning result; finally, the first symbolic reasoning result and the second symbolic reasoning result are fused to ensure that no information is lost after a series of reasoning processes, which can be understood as strengthening the weight of the first symbolic reasoning result and ensuring the integrity of the obtained first conversion result.
[0250] S605: Perform language conversion on the first website based on the first conversion result to obtain a second website.
[0251] Exemplarily, language conversion is performed on the first website based on the first conversion result to obtain the second website, wherein the language of the second website is the first language, including: decoding the first conversion result to obtain multiple first conversion contents corresponding to the first website; obtaining a label of each first conversion content; and typeset each first conversion content through a processing module corresponding to the label of each first conversion content to obtain the second website.
[0252] Optionally, the first conversion result is decoded to obtain multiple first conversion contents corresponding to the first website, that is, the multiple first conversion contents corresponding to the first website are the output of the language conversion model. When the language conversion model outputs the result, each first conversion content can be marked with a predefined tag. The predefined tags may include user-generated content tags, multimedia content tags, and dynamic text tags. The first conversion contents with different tags correspond to different processing modules, the user-generated content tags correspond to the user-generated content processing module, the multimedia content tags correspond to the multimedia processing module, and the dynamic text tags correspond to the dynamic text processing module. Fig. 9As shown, a plurality of first conversion contents are obtained by inputting the first initial data set into the language conversion model, and then, each first conversion content is typeset through the processing module corresponding to the tag of each first conversion content to obtain the conversion result of the first website, that is, the second website. The processing module includes: a user-generated content processing module, a multimedia processing module and a dynamic text processing module. Each first conversion content is typeset through the processing module corresponding to the tag of each first conversion content to obtain the second website. It should be noted that the present application will also mark the positions of the plurality of first conversion contents to ensure that when each first conversion content is processed in each processing module, it can be correctly integrated into the correct position of the second website, and each first conversion content is typeset to obtain the second website. In addition, a templated web page structure can be used to place each first conversion content in a fixed template position, so that after each first conversion content is generated, the content in the template can be directly replaced without changing the page structure. The DOM is operated by JavaScript to dynamically insert each first conversion content according to the position and mark to ensure that each first conversion content is inserted into the correct position. After the integration is completed, the automated testing and verification mechanism is used to verify whether each first conversion content appears in the correct position, and the visual difference detection tool or HTML structure comparison tool is used for verification. Through these measures, it is ensured that each generated first conversion content can be accurately integrated into the second website, maintaining the unity and consistency of the content and layout of the second website and the first website.
[0253] It can be seen that in the embodiment of the present application, by decoding the first conversion result, multiple first conversion contents corresponding to the first website are obtained; the label of each first conversion content is obtained; and each first conversion content is typeset through the processing module corresponding to the label of each first conversion content to obtain the second website. In the language conversion process, each first conversion content is typeset through the processing module corresponding to the label of each first conversion content, so as to identify and retain the original layout and function of the first website, and ensure that the second website in different first languages is consistent in appearance and operation. For application scenarios that require high user experience, such as multinational company websites, localized online service platforms, and applications supported in multiple languages, it can improve user satisfaction and provide a consistent user experience.
[0254] After step S605, the present application also provides three methods for adjusting the model (the model may be referred to as a language conversion model, and the present application does not make a distinction between the two).
[0255] The first adjustment method is: back-translating the preset type of content in the first conversion result to obtain a back-translation result; obtaining a second initial data set of the preset type in the first initial data set; obtaining a first similarity between the back-translation result and the second initial data set; and adjusting the model based on the first similarity.
[0256] Specifically, the content of the preset type in the first conversion result (represented as T target ) to perform back translation and obtain the back translation result. It should be noted that the preset type of content may be text content, including articles and product descriptions in the first website, but not including non-text content such as likes, frequency, and forwarding in the first conversion result. In the initial stage of acquiring data, the text content may be tagged to facilitate marking the text content.
[0257] The preset type of content in the first conversion result can be back-translated by the back-translation model to obtain the back-translation result, or the preset type of content in the first conversion result can be back-translated by the bidirectional translation model and the back-translation model to obtain the back-translation result.
[0258] When the content of the preset type in the first conversion result is back-translated by the bidirectional translation model and the back-translation model, the back-translation result T back It can be obtained by the following formula (18):
[0259]
[0260] Among them, softmax(·) and tanh(·) represent the normalized exponential function and hyperbolic tangent function respectively, W bt and b bt are the weight and bias of the bidirectional translation model, W rev and b rev are the weight and bias of the back-translation model, ∈ is the minimum constant to prevent division by zero, and n is T target The number of words in T target The feature vector of the i-th word in .
[0261] It can be seen that in the embodiment of the present application, the content of the preset type in the first conversion result is back-translated, and when the back-translation result is obtained, T target Translate back to the source language, and then multiply the features obtained by the two models to ensure that the complex relationship between the features can be fully expressed in the element-by-element multiplication operation, resulting in a more complex feature representation T back , which can effectively capture errors and deviations in the language conversion process.
[0262] Exemplarily, a second initial data set D of a preset type is obtained from the first initial data set.source ; Obtain a first similarity between the back-translation result and the second initial data set; It should be noted that the first similarity can be the cosine similarity, Euclidean distance, Manhattan distance, Jaccard similarity coefficient and Pearson correlation coefficient between the back-translation result and the second initial data set, and this application does not impose any restrictions on this.
[0263] In this application, only the first similarity C is obtained by consistency As an example, the first similarity between the back-translation result and the second initial data set is explained to obtain the first similarity C consistency Formula (19) can be expressed as:
[0264]
[0265] Where <·,·> represents the vector inner product, ||·|| represents the Euclidean norm of the vector, γ is the bandwidth parameter of the Gaussian kernel function, Z is the normalization factor, and n is T back and D source The number of words in T back The feature vector of the i-th word in D source for The feature vector of the i-th word in .
[0266] First, determine D source and T back The cosine similarity at the corresponding position in the , and then the Gaussian kernel function is used to capture D source and T back The cosine similarity and the subtle differences are finally merged to achieve a more detailed similarity determination process, which can more accurately capture the D source and T back The difference between the contents.
[0267] Based on the first similarity, the model is adjusted. The first similarity can be directly used as a loss to adjust the network parameters of the model to obtain an optimized model. In practical applications, multiple first similarities can be obtained based on multiple and multiple, and then multiple first similarities can be weighted to obtain a weighted loss, and the grid parameters of the model can be adjusted using the weighted loss; or each first similarity can be used to adjust the grid parameters of the model one by one to obtain an optimized model. This application is not limited here.
[0268] It can be seen that in the embodiment of the present application, the preset type of content in the first conversion result is back-translated to obtain a back-translated result; a second initial data set of the preset type in the first initial data set is obtained; a first similarity between the back-translated result and the second initial data set is obtained; and the model is adjusted based on the first similarity. First, only the preset type of content in the first conversion result is back-translated, that is, only the main text content, which requires higher accuracy of language conversion and is more difficult to convert, is converted, while the content with less conversion difficulty such as likes and reposts is not converted. Differentiated processing of different content can reduce the complexity of data processing. Secondly, after the model is applied, the model will be adjusted based on the first similarity, so that the model has the functions of dynamic learning and adaptive adjustment, and continuously improves the accuracy of the model in the language conversion process.
[0269] The second adjustment method is: obtaining first feedback data for the second website, wherein the first feedback data may be multiple; activating the first feedback data to obtain second feedback data; scaling the first feedback data to obtain multiple third feedback data; obtaining fourth feedback data based on the second feedback data and the multiple third feedback data; and adjusting the model based on the fourth feedback data. It should be noted that the feedback data may be one or more of the feedback score, feedback opinion, and feedback suggestion of the target object, which is not limited in this application. This application only takes the feedback data as the feedback score as an example for explanation.
[0270] Specifically, the fourth feedback data S is obtained. satisfaction It can be expressed by the following formula (20):
[0271]
[0272] Among them, |U| is the number of target objects, α j is the feedback weight of the j-th target object, sigmoid(·) is the S-shaped activation function, log(·) is the logarithmic function, and f is the feedback score of the j-th target object.
[0273] The first feedback data is activated to obtain the second feedback data, that is, the nonlinear expression ability of the feedback score is improved through the S-shaped activation function; the first feedback data is scaled to obtain multiple third feedback data, that is, the first feedback data is scaled through a logarithmic function, so that smaller numerical differences are amplified and larger numerical differences are compressed, making it more sensitive to changes in the feedback score and enhancing the expression ability of the feedback score.
[0274] Based on the fourth feedback data, the model is adjusted. The fourth feedback data can be directly used as the loss to adjust the network parameters of the model to obtain an optimized model. In practical applications, multiple fourth feedback data can be weighted to obtain weighted losses, and the weighted fourth feedback data can be used to adjust the grid parameters of the model; or each fourth feedback data can be used to adjust the grid parameters of the model one by one to obtain an optimized model. This application is not limited here.
[0275] It can be seen that in the embodiment of the present application, the first feedback data for the second website is obtained; the first feedback data is activated to obtain the second feedback data; the first feedback data is scaled to obtain multiple third feedback data; based on the second feedback data and the multiple third feedback data, the fourth feedback data is obtained; based on the fourth feedback data, the model is adjusted. By activating the first feedback data, the nonlinear expression ability of the feedback score is improved; the first feedback data is scaled so that smaller numerical differences are amplified and larger numerical differences are compressed, making it more sensitive to changes in the feedback score and enhancing the expression ability of the feedback score. Further, based on the fourth feedback data, the model is adjusted so that the optimized model is more in line with the expectations of the target object and improves the experience of the target object.
[0276] The third adjustment method is: back-translate the preset type of content in the first conversion result to obtain the back-translation result; obtain the second initial data set of the preset type in the first initial data set; obtain the first similarity between the back-translation result and the second initial data set; obtain the first feedback data for the second website; activate the first feedback data to obtain the second feedback data; scale the first feedback data to obtain multiple third feedback data; obtain fourth feedback data based on the second feedback data and the multiple third feedback data; adjust the model based on the first similarity and the fourth feedback data.
[0277] It should be noted that the method of back-translating the preset type of content in the first conversion result to obtain the back-translation result; obtaining the second initial data set of the preset type in the first initial data set; and obtaining the first similarity between the back-translation result and the second initial data set is similar to the above-mentioned method of back-translating the preset type of content in the first conversion result to obtain the back-translation result; obtaining the second initial data set of the preset type in the first initial data set; and obtaining the first similarity between the back-translation result and the second initial data set. This application will not be repeated here. In this application, the first similarity and the first similarity may not be distinguished. The method of obtaining the first feedback data for the second website; activating the first feedback data to obtain the second feedback data; scaling the first feedback data to obtain multiple third feedback data; and obtaining the fourth feedback data based on the second feedback data and the multiple third feedback data is similar to the above-mentioned method of obtaining the first feedback data for the second website; activating the first feedback data to obtain the second feedback data; scaling the first feedback data to obtain multiple third feedback data; and obtaining the fourth feedback data based on the second feedback data and the multiple third feedback data. This application will not be repeated here. In this application, the fourth feedback data and the fourth feedback data may not be distinguished.
[0278] Based on the first similarity and the fourth feedback data, the model is adjusted. Specifically, the fourth loss is determined based on the first similarity and the fourth feedback data, wherein the fourth loss L final_checked It can be expressed by the following formula (21):
[0279]
[0280] Among them, β is the first adjustment coefficient, α is the second adjustment coefficient, relu(·) is the rectified linear unit activation function, C consistency is the first similarity, S satisfaction This is the fourth feedback data.
[0281] The first similarity and the fourth feedback data are weighted reasonably by using the first adjustment coefficient and the second adjustment coefficient, and then the nonlinear expression capability of the first similarity and the fourth feedback data is improved by modifying the linear unit activation function.
[0282] Based on the fourth loss, the model is adjusted. The network parameters of the model can be adjusted directly based on the fourth loss to obtain an optimized model. In practical applications, multiple fourth losses can be weighted to obtain weighted losses, and the weighted fourth losses can be used to adjust the grid parameters of the model; or each fourth loss can be used to adjust the grid parameters of the model one by one to obtain an optimized model. This application is not limited here.
[0283] It can be seen that in the embodiment of the present application, based on the first similarity and the fourth feedback data, the model is adjusted. The consistency result (i.e. the first similarity) of the back-translation result and the satisfaction (i.e. the fourth feedback data) of the target object are used as input, and the model is adjusted together. The consistency result (i.e. the first similarity) of the back-translation result and the satisfaction (i.e. the fourth feedback data) of the target object are combined, and the real conversion effect of the conversion content of the first website can be obtained, because the model may be lazy in the language conversion process, and the situation of directly outputting the original text appears. In this case, the consistency result (i.e. the first similarity) of the back-translation result will be very high, and the model does not translate the content of the first website, and this situation is not desirable. However, in this case, the satisfaction (i.e. the fourth feedback data) of the target object will be very low, therefore, the consistency result (i.e. the first similarity) of the back-translation result and the satisfaction (i.e. the fourth feedback data) of the target object are combined to obtain the language conversion effect of the more realistic website language conversion model, thereby improving the adaptive adjustment function of the model, continuously optimizing the website language conversion model, and improving the language conversion effect. In websites that need to frequently update content and provide real-time responses, such as real-time news websites, social media platforms, and online customer service systems, the performance of the model can be continuously improved, providing better user experience and higher language conversion quality.
[0284] See also Fig.10 , Fig.10 A schematic diagram of an application scenario of a model provided for the present application. It should be noted that in the embodiments of the present application, the model may also be referred to as a language conversion model, and the present application does not make any distinction between the two.
[0285] First, the target object visits the first website on the client, and the first website displays the source language, that is, Fig.10 The target object can click the language switch virtual control (in Fig.10 The client selects the first language, sends a language conversion request to the server, and the server converts the language of the first website through the model, and then sends the conversion result of the first language to the client. Finally, the client displays the second website (i.e. Fig.10 It should be noted that the model can also be built into the client so that the client can achieve language conversion without interacting with the server. This application does not limit this.
[0286] Furthermore, the application scenario diagram of the model may not interact with the target object and directly perform language conversion on the first website. This application does not limit the specific application method.
[0287] See also Fig.11 , Fig.11This is a functional unit block diagram of a language conversion device provided in an embodiment of the present application. The language conversion device 110 includes: a first transceiver unit 111 and a first processing unit 112;
[0288] The first transceiver unit 111 is used to obtain the first initial content of the first website;
[0289] The first processing unit 112 is used to structure the first initial content of the first website to obtain a first initial data set;
[0290] The first processing unit 112 is used to extract features from the first initial data set to obtain first features;
[0291] The first processing unit 112 is used to perform symbolic reasoning on the first feature based on a rule of a first language to obtain a first symbolic reasoning result;
[0292] The first processing unit 112 is used to perform feature fusion on the first symbolic reasoning result and the first initial data set to obtain a first conversion result;
[0293] The first processing unit 112 is configured to perform language conversion on the first website based on the first conversion result to obtain a second website, wherein the language of the second website is the first language.
[0294] In one embodiment of the present application, in performing feature fusion on the first symbolic reasoning result and the first initial data set to obtain a first conversion result, the first processing unit 112 is specifically configured to:
[0295] Obtaining a first matching matrix between the first symbolic reasoning result and the first initial data set;
[0296] Reasoning the first matching matrix based on the rules of the first language to obtain a second symbolic reasoning result;
[0297] The first symbolic reasoning result and the second symbolic reasoning result are merged to obtain the first conversion result.
[0298] In one embodiment of the present application, in terms of obtaining a first matching matrix between the first symbolic reasoning result and the first initial data set, the first processing unit 112 is specifically configured to:
[0299] Obtaining a second matching matrix between the first symbolic reasoning result and the first initial data set;
[0300] Performing position encoding based on the second matching matrix to obtain a third matching matrix;
[0301] Performing random deactivation on the second matching matrix to obtain a fourth matching matrix;
[0302] The third matching matrix and the fourth matching matrix are merged to obtain the first matching matrix.
[0303] In one embodiment of the present application, in terms of obtaining a second matching matrix between the first symbolic reasoning result and the first initial data set, the first transceiver unit 111 is specifically configured to:
[0304] Obtaining similarities between the first symbolic reasoning result and elements at corresponding positions of the first initial data set to obtain a first weight matrix;
[0305] Normalizing the first weight matrix to obtain a second weight matrix;
[0306] Performing a linear transformation on the first weight matrix to obtain a third weight matrix;
[0307] activating the third weight matrix to obtain a fourth weight matrix;
[0308] The second matching matrix is obtained based on the second weight matrix and the fourth weight matrix.
[0309] In one embodiment of the present application, in terms of generating website language conversion speech according to the current abnormal behaviors of the R actors, the first processing unit 112 is specifically configured to:
[0310] In one embodiment of the present application, the rules of the first language include grammatical rules and semantic rules. In the aspect of reasoning the first matching matrix based on the rules of the first language to obtain the second symbolic reasoning result, the first processing unit 112 is specifically configured to:
[0311] Normalizing the first matching matrix to obtain a normalized first matching matrix;
[0312] Performing the grammar rule mapping on each element in the first matching matrix to obtain a first grammar mapping result for each element in the first matching matrix;
[0313] Performing the semantic rule mapping on each element in the first matching matrix to obtain a first semantic mapping result for each element in the first matching matrix;
[0314] The second symbolic reasoning result is obtained based on the first matching matrix, the first grammatical mapping result of each element in the first matching matrix, the first semantic mapping result corresponding to each element in the first matching matrix, and the normalized first matching matrix.
[0315] In one embodiment of the present application, in performing symbolic reasoning on the first feature based on the rule of the first language to obtain the first symbolic reasoning result, the first processing unit 112 is specifically configured to:
[0316] converting the first feature into a first symbolic representation;
[0317] Performing symbol feature extraction on the first symbol representation to obtain a first symbol feature corresponding to the first feature;
[0318] The first symbol feature is inferred based on the rule of the first language to obtain the first symbol reasoning result.
[0319] In one embodiment of the present application, the rules of the first language include grammatical rules and semantic rules; in the aspect of reasoning the first symbol feature based on the rules of the first language to obtain the first symbol reasoning result, the first processing unit 112 is specifically configured to:
[0320] Performing the grammar rule mapping on each element in the first symbol feature to obtain a second grammar mapping result for each element in the first symbol feature;
[0321] Performing the semantic rule mapping on each element in the first symbol feature to obtain a second semantic mapping result for each element in the first symbol feature;
[0322] The first symbolic reasoning result is obtained based on the first symbolic feature, the second grammatical mapping result of each element in the first symbolic feature, and the second semantic mapping result of each element in the first symbolic feature.
[0323] In one embodiment of the present application, in obtaining the first symbolic reasoning result based on the first symbolic feature, the second grammatical mapping result of each element in the first symbolic feature, and the second semantic mapping result of each element in the first symbolic feature, the first processing unit 112 is specifically configured to:
[0324] Obtaining a third symbolic reasoning result based on the first symbolic feature, a second grammatical mapping result of each element in the first symbolic feature, and a second semantic mapping result of each element in the first symbolic feature;
[0325] Performing a linear transformation on the third symbolic reasoning result to obtain a first characteristic matrix;
[0326] activating the first characteristic matrix to obtain a second characteristic matrix;
[0327] Acquire first time series data of the first initial data set;
[0328] Determining a first time penalty coefficient corresponding to the first initial data set based on the first time series data;
[0329] The first symbolic reasoning result is determined based on the second feature matrix and the first time penalty coefficient.
[0330] In one embodiment of the present application, in the aspect of structuring the first initial content of the first website to obtain the first initial data set, the first processing unit 112 is specifically configured to:
[0331] Performing data cleaning on the first initial content to obtain cleaned first initial content;
[0332] Standardizing the cleaned first initial content to obtain standardized first initial content;
[0333] De-noising the standardized first initial content to obtain the de-noised first initial content;
[0334] Performing word segmentation on the first initial content after denoising to obtain the first initial content after word segmentation;
[0335] Annotating the first initial content after the word segmentation based on the grammatical structure tree to obtain the second initial content;
[0336] Perform word embedding on the second initial content to obtain the first initial data set.
[0337] In one embodiment of the present application, in extracting features from the first initial data set to obtain the first features, the first processing unit 112 is specifically configured to:
[0338] Extracting semantic features from the first initial data set to obtain a first semantic feature of the first initial data set;
[0339] Extracting context information from the first semantic feature to obtain a first context feature;
[0340] Extracting pragmatic information from the first context feature to obtain a first pragmatic feature;
[0341] The first semantic feature, the first context feature, and the first pragmatic feature are fused to obtain the first feature.
[0342] In one embodiment of the present application, the process of language conversion for the first website is implemented through a model, and the first processing unit 112 is further specifically configured to:
[0343] Back-translate the content of the preset type in the first conversion result to obtain a back-translation result;
[0344] Acquire a second initial data set of the preset type in the first initial data set;
[0345] Obtaining a first similarity between the back-translation result and a second initial data set;
[0346] Based on the first similarity, the model is adjusted.
[0347] In one embodiment of the present application, the process of language conversion for the first website is implemented through a model, and the first processing unit 112 is further specifically configured to:
[0348] Acquire first feedback data for the second website;
[0349] activating the first feedback data to obtain second feedback data;
[0350] Scaling the first feedback data to obtain a plurality of third feedback data;
[0351] Obtain fourth feedback data based on the second feedback data and a plurality of third feedback data;
[0352] The model is adjusted based on the fourth feedback data.
[0353] In one embodiment of the present application, the process of language conversion for the first website is implemented through a model, and the first processing unit 112 is further specifically configured to:
[0354] Back-translate the content of the preset type in the first conversion result to obtain a back-translation result;
[0355] Acquire a second initial data set of the preset type in the first initial data set;
[0356] Obtaining a first similarity between the back-translation result and a second initial data set;
[0357] Acquire first feedback data for the second website;
[0358] activating the first feedback data to obtain second feedback data;
[0359] Scaling the first feedback data to obtain a plurality of third feedback data;
[0360] Based on the second feedback data and a plurality of third feedback data, fourth feedback data is obtained; based on the first similarity and the fourth feedback data, the model is adjusted.
[0361] See also Fig.12 , Fig.12A functional unit composition block diagram of a model training device provided in an embodiment of the present application. The model training device 120 includes: a second transceiver unit 121 and a second processing unit 122;
[0362] The second transceiver unit 121 is used to obtain the third initial content of the sample website;
[0363] The second processing unit 122 is used to structure the third initial content of the sample website to obtain a third initial data set;
[0364] Performing feature extraction on the third initial data set to obtain a second feature;
[0365] Training the first model based on the second feature to obtain a trained first model;
[0366] Based on the rules of the first language, symbolic reasoning is performed on the second feature to obtain a fourth symbolic reasoning result;
[0367] Training the second model based on the fourth symbolic reasoning result to obtain a trained second model;
[0368] Performing feature fusion on the fourth symbolic reasoning result and the third initial data set to obtain a second conversion result;
[0369] Training a third model based on the second conversion result to obtain a trained third model;
[0370] The model is obtained based on the trained first model, the trained second model and the trained third model.
[0371] The specific implementation process of the second transceiver unit 121 and the second processing unit 122 can refer to the description in the embodiment, and the present application will not repeat them here.
[0372] See also Fig.13 , Fig.13 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig.13 As shown, the electronic device 130 includes a transceiver 131, a processor 132 and a memory 133. They are connected via a bus 134. The memory 133 is used to store computer programs and data, and can transmit the data stored in the memory 133 to the processor 132.
[0373] Optionally, the processor 132 is configured to read a computer program in the memory 133 to perform the following operations:
[0374] Controlling the transceiver 131 to structure the first initial content of the first website to obtain a first initial data set;
[0375] Performing feature extraction on the first initial data set to obtain a first feature;
[0376] Performing symbolic reasoning on the first feature based on a rule of a first language to obtain a first symbolic reasoning result;
[0377] Performing feature fusion on the first symbolic reasoning result and the first initial data set to obtain a first conversion result;
[0378] The language of the first website is converted based on the first conversion result to obtain a second website, wherein the language of the second website is the first language.
[0379] Specifically, the transceiver 131 may be Fig.11 The first transceiver unit 111 of the language conversion device 110 of the embodiment, the processor 132 may be Fig.11 The first processing unit 112 of the language conversion device 110 of the embodiment.
[0380] Specifically, the transceiver 131 may be Fig.11 The first transceiver unit 111 of the language conversion device 110 of the embodiment, the processor 132 may be Fig.11 Therefore, the specific functions of the processor 132 may refer to the specific functions of the first processing unit 112, and the specific functions of the transceiver 131 may refer to the specific functions of the first transceiver unit 111.
[0381] Optionally, the processor 132 is configured to read a computer program in the memory 133 to perform the following operations:
[0382] Controlling the transceiver 131 to structure the third initial content of the sample website to obtain a third initial data set;
[0383] Performing feature extraction on the third initial data set to obtain a second feature;
[0384] Training the first model based on the second feature to obtain a trained first model;
[0385] Based on the rules of the first language, symbolic reasoning is performed on the second feature to obtain a fourth symbolic reasoning result;
[0386] Training the second model based on the fourth symbolic reasoning result to obtain a trained second model;
[0387] Performing feature fusion on the fourth symbolic reasoning result and the third initial data set to obtain a second conversion result;
[0388] Training a third model based on the second conversion result to obtain a trained third model;
[0389] The model is obtained based on the trained first model, the trained second model and the trained third model.
[0390] Specifically, the transceiver 131 may be Fig.12 The second transceiver unit 121 of the model training device 120 of the embodiment, the processor 132 may be Fig.12 The second processing unit 122 of the model training device 120 of the embodiment.
[0391] Specifically, the transceiver 131 may be Fig.12 The second transceiver unit 121 of the model training device 120 of the embodiment, the processor 132 may be Fig.12 Therefore, the specific functions of the processor 132 can refer to the specific functions of the second processing unit 122, and the specific functions of the transceiver 131 can refer to the specific functions of the second transceiver unit 121.
[0392] It should be understood that the electronic devices in this application may include smart phones (such as Android phones, iOS phones, Windows Phone phones, etc.), tablet computers, PDAs, laptops, mobile Internet devices MID (Mobile Internet Devices, referred to as: MID) or wearable devices, etc. The above electronic devices are only examples, not exhaustive, and include but are not limited to the above electronic devices. In practical applications, the above electronic devices may also include: smart vehicle terminals, computer equipment, etc.
[0393] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. The computer program is executed by a processor to implement part or all of the steps of any language conversion method and model training method recorded in the above method embodiments.
[0394] An embodiment of the present application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute part or all of the steps of any one of the language conversion methods and model training methods recorded in the above method embodiments.
[0395] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action splicing, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by this application.
[0396] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0397] In the several embodiments provided in the present application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0398] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0399] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of a software program module.
[0400] If the integrated unit is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of each embodiment method of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0401] A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, and the memory can include: a flash drive, a read-only memory (English: Read-Only Memory, abbreviated as: ROM), a random access memory (English: Random Access Memory, abbreviated as: RAM), a magnetic disk or an optical disk, etc.
[0402] The embodiments of the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A language conversion method, characterized in that: The method comprises: Structuring the first initial content of the first website to obtain a first initial data set; Performing feature extraction on the first initial data set to obtain a first feature; Performing symbolic reasoning on the first feature based on a rule of a first language to obtain a first symbolic reasoning result; Performing feature fusion on the first symbolic reasoning result and the first initial data set to obtain a first conversion result; The language of the first website is converted based on the first conversion result to obtain a second website, wherein the language of the second website is the first language.
2. The method according to claim 1, characterized in that The step of performing feature fusion on the first symbolic reasoning result and the first initial data set to obtain a first conversion result includes: Obtaining a first matching matrix between the first symbolic reasoning result and the first initial data set; Reasoning the first matching matrix based on the rules of the first language to obtain a second symbolic reasoning result; The first symbolic reasoning result and the second symbolic reasoning result are merged to obtain the first conversion result.
3. The method according to claim 2, characterized in that The obtaining a first matching matrix between the first symbolic reasoning result and the first initial data set includes: Obtaining a second matching matrix between the first symbolic reasoning result and the first initial data set; Performing position encoding based on the second matching matrix to obtain a third matching matrix; Performing random deactivation on the second matching matrix to obtain a fourth matching matrix; The third matching matrix and the fourth matching matrix are merged to obtain the first matching matrix.
4. The method according to claim 3, characterized in that The obtaining a second matching matrix between the first symbolic reasoning result and the first initial data set includes: Obtaining similarities between the first symbolic reasoning result and elements at corresponding positions of the first initial data set to obtain a first weight matrix; Normalizing the first weight matrix to obtain a second weight matrix; Performing a linear transformation on the first weight matrix to obtain a third weight matrix; activating the third weight matrix to obtain a fourth weight matrix; The second matching matrix is obtained based on the second weight matrix and the fourth weight matrix.
5. The method according to any one of claims 2 to 4, characterized in that: The rules of the first language include grammatical rules and semantic rules, and the reasoning on the first matching matrix based on the rules of the first language to obtain a second symbolic reasoning result includes: Normalizing the first matching matrix to obtain a normalized first matching matrix; Performing the grammar rule mapping on each element in the first matching matrix to obtain a first grammar mapping result for each element in the first matching matrix; Performing the semantic rule mapping on each element in the first matching matrix to obtain a first semantic mapping result for each element in the first matching matrix; The second symbolic reasoning result is obtained based on the first matching matrix, the first grammatical mapping result of each element in the first matching matrix, the first semantic mapping result corresponding to each element in the first matching matrix, and the normalized first matching matrix.
6. The method according to any one of claims 1 to 5, characterized in that: The performing symbolic reasoning on the first feature based on the rule of the first language to obtain a first symbolic reasoning result includes: converting the first feature into a first symbolic representation; Performing symbol feature extraction on the first symbol representation to obtain a first symbol feature corresponding to the first feature; The first symbol feature is inferred based on the rule of the first language to obtain the first symbol reasoning result.
7. The method according to claim 6, characterized in that The rules of the first language include grammatical rules and semantic rules; the reasoning on the first symbol feature based on the rules of the first language to obtain the first symbol reasoning result includes: Performing the grammar rule mapping on each element in the first symbol feature to obtain a second grammar mapping result for each element in the first symbol feature; Performing the semantic rule mapping on each element in the first symbol feature to obtain a second semantic mapping result for each element in the first symbol feature; The first symbolic reasoning result is obtained based on the first symbolic feature, the second grammatical mapping result of each element in the first symbolic feature, and the second semantic mapping result of each element in the first symbolic feature.
8. The method according to claim 7, characterized in that The obtaining the first symbolic reasoning result based on the first symbolic feature, the second grammatical mapping result of each element in the first symbolic feature, and the second semantic mapping result of each element in the first symbolic feature includes: Obtaining a third symbolic reasoning result based on the first symbolic feature, a second grammatical mapping result of each element in the first symbolic feature, and a second semantic mapping result of each element in the first symbolic feature; Performing a linear transformation on the third symbolic reasoning result to obtain a first characteristic matrix; activating the first characteristic matrix to obtain a second characteristic matrix; Acquire first time series data of the first initial data set; Determining a first time penalty coefficient corresponding to the first initial data set based on the first time series data; The first symbolic reasoning result is determined based on the second feature matrix and the first time penalty coefficient.
9. The method according to any one of claims 1 to 7, characterized in that: The process of language conversion for the first website is implemented through a model; the method further includes: Back-translate the content of the preset type in the first conversion result to obtain a back-translation result; Acquire a second initial data set of the preset type in the first initial data set; Obtaining a first similarity between the back-translation result and a second initial data set; Based on the first similarity, the model is adjusted.
10. The method according to any one of claims 1 to 9, characterized in that: The process of language conversion for the first website is implemented through a model; the method further includes: Acquire first feedback data for the second website; activating the first feedback data to obtain second feedback data; Scaling the first feedback data to obtain third feedback data; Obtaining fourth feedback data based on the second feedback data and the third feedback data; The model is adjusted based on the fourth feedback data.
11. A model training method, characterized in that: The method comprises: Structuring the third initial content of the sample website to obtain a third initial data set; Performing feature extraction on the third initial data set to obtain a second feature; Training the first model based on the second feature to obtain a trained first model; Based on the rules of the first language, symbolic reasoning is performed on the second feature to obtain a fourth symbolic reasoning result; Training the second model based on the fourth symbolic reasoning result to obtain a trained second model; Performing feature fusion on the fourth symbolic reasoning result and the third initial data set to obtain a second conversion result; Training a third model based on the second conversion result to obtain a trained third model; The model is obtained based on the trained first model, the trained second model and the trained third model.
12. A language conversion device, characterized in that: The device comprises: a first transceiver unit and a first processing unit; The first transceiver unit is used to obtain the first initial content of the first website; The first processing unit is used to structure the first initial content of the first website to obtain a first initial data set; The first processing unit is used to extract features from the first initial data set to obtain a first feature; The first processing unit is used to perform symbolic reasoning on the first feature based on a rule of a first language to obtain a first symbolic reasoning result; The first processing unit is used to perform feature fusion on the first symbolic reasoning result and the first initial data set to obtain a first conversion result; The first processing unit is configured to perform language conversion on the first website based on the first conversion result to obtain a second website, wherein the language of the second website is the first language.
13. An electronic device, characterized in that: include: A processor and a memory, the processor is connected to the memory, the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the electronic device executes the method as claimed in any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 11.