Model language conversion method and device, electronic equipment and storage medium
By extracting user intent and attribute keywords from the source language model and constructing a vector space mapping dictionary, the problem of mistranslation of key terms when migrating Chinese intelligent decision-making models to emerging markets was solved, achieving high-accuracy business logic transformation and ensuring the consistency and stability of the model's decisions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN LEXIN SOFTWARE TECH CO LTD
- Filing Date
- 2026-03-20
- Publication Date
- 2026-06-02
AI Technical Summary
Existing technologies suffer from mistranslation of key terms when migrating Chinese intelligent decision-making models to emerging markets, leading to distorted model inputs, inability to maintain decision consistency and stability, and difficulty in timely model updates due to a lack of high-quality labeled data and high labeling costs.
By extracting keywords of user business intent and business attributes from user interaction records of the source language model, a core vocabulary is constructed. Then, using vector space mapping and semantic distance calculation, a mapping dictionary for the target language is generated. Combined with machine translation and a verified dictionary, accurate translation is performed to ensure lossless conversion of business logic.
Without requiring large-scale retraining, it achieves high translation accuracy of the target language model and lossless conversion of business logic, avoids mistranslation of key terms, and improves the model's decision consistency and stability.
Smart Images

Figure CN122133682A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and particularly to a model language conversion method, device, electronic device and storage medium. Background Art
[0002] In the process of global business expansion, enterprises often need to convert intelligent decision-making models (such as credit risk control engines, insurance underwriting systems or e-commerce customer service robots) that have been proven effective in the Chinese market into target language models for emerging high-growth markets (such as Indonesia or Mexico).
[0003] However, the existing model language conversion to target language models faces the following problems: On the one hand, existing technologies usually rely on end-to-end general machine translation solutions, which can also quickly deploy intelligent decision-making models. However, due to the lack of vertical knowledge in the financial or e-commerce fields, key terms are often mis-translated. For example, when migrating to the Mexican market, if the Chinese term "流水" is directly translated into Spanish as "flujo de agua" (water flow) instead of the correct "historial de transacciones" (transaction flow), it will cause the income verification module to fail; or, in the Indonesian market, if the term "授信额度" is generally translated as "jumlah pinjaman" (loan amount) instead of the accurate "limit kredit", it may lead to the risk of over-issuing the quota. Such errors cause serious distortion of the input of the intelligent decision-making model, and the rule engine cannot be correctly triggered, ultimately resulting in an increase in the bad debt rate or a collapse of the user experience.
[0004] On the other hand, some existing technologies also adopt the method of training exclusive models for emerging languages from scratch. Although it is theoretically feasible, there are practical bottlenecks in emerging language scenarios: scarce high-quality labeled data, high labeling costs, and fast iteration speed of business rules, making it difficult for the model to be updated in a timely manner and difficult to reproduce the decision consistency and stability of the source model in the Chinese market.
[0005] Therefore, how to convert the complete business logic of the source language model into the target language losslessly and accurately without large-scale retraining is a technical problem that urgently needs to be solved. Summary of the Invention
[0006] In view of the above, it is necessary to provide a model language conversion method, the purpose of which is to convert the complete business logic of the source language model into the target language losslessly and accurately without large-scale retraining, and improve the translation accuracy of the target language model.
[0007] The model language conversion method provided by the present invention includes: From the user interaction records in the source language model, obtain the first text input by the user with preset type labels, and extract the first keyword representing the user's business intent from the first text; From the second text that has business logic related to the source language model, extract the second keywords that represent business attributes, and generate the core vocabulary of the source language model based on the first keywords and the second keywords; Select any keyword from the core vocabulary list, use the first translation method to translate the selected keyword into multiple translation words corresponding to the preset target language, convert the selected keyword into a first vector, and convert each translation word corresponding to the target language into a corresponding second vector; Map the first vector and all the second vectors to a preset vector space, calculate the semantic distance between the first vector and each of the second vectors, select the translation word corresponding to the second vector with the smallest semantic distance as the first target translation word, until the first target translation word corresponding to each keyword in the core vocabulary is obtained; Based on all keywords and their corresponding first target translation terms, construct a mapping dictionary between keywords and target translation terms in the source language model; Using the mapping dictionary, the words in the second text other than the second keyword are translated into second target translation words represented in the target language using the second translation method, thereby obtaining the initial target language model corresponding to the source language model.
[0008] Optionally, extracting the first keyword representing the user's business intent from the first text includes: Based on the source language type of the source language model, the corresponding word segmentation model is called to perform word segmentation on the first text to generate a word sequence; Based on preset business intent recognition rules, candidate words related to the user's business intent are filtered out from the word sequence; The frequency of each candidate word in the first text input by the user under the preset type label is counted, and the candidate words with a frequency greater than a preset threshold are determined as the first keywords.
[0009] Optionally, the step of translating the selected keywords into multiple preset translation terms in the target language using the first translation method includes: The selected keywords are translated using a preset machine translation engine to generate at least one initial translation word; Based on a preset verification dictionary, the at least one initial translation word is calibrated to generate multiple translation words.
[0010] Optionally, mapping the first vector and all second vectors to a preset vector space and calculating the semantic distance between the first vector and each second vector includes: The first vector and each of the second vectors are mapped into the vector space using a pre-trained vector alignment matrix; In the vector space, the cosine distance between the first vector and each of the second vectors is calculated, and the cosine distance is used as the semantic distance.
[0011] Optionally, the step of constructing a keyword-target translation dictionary for the source language model based on all keywords and their corresponding first target translation terms includes: Assign a key to each keyword, assign a value to the first target translation term corresponding to each keyword, and generate key-value pairs for each keyword based on the key and the value. Organize all key-value pairs into a JSON object, and serialize the JSON object into a text format to obtain the mapping dictionary.
[0012] Optionally, the step of constructing a keyword-target translation dictionary for the source language model based on all keywords and their corresponding first target translation terms includes: An initial dictionary table is created in a pre-defined relational database. The initial dictionary table contains source language keyword fields and target translation word fields. Write each keyword into the source language keyword field, and write the first target translation word corresponding to each keyword into the target translation word field to obtain the mapping relationship between each group of keywords and target translation words; The mapping relationship between each group of keywords and the target translation word is stored in the initial dictionary table in the form of row records to generate the mapping dictionary.
[0013] Optionally, the method further includes: Obtain a preset number of target language annotation samples, wherein the target language annotation samples include target language input text and its corresponding business tags; The initial target language model is fine-tuned based on the target language labeled samples to obtain the final target language model.
[0014] To address the above problems, the present invention also provides a model language conversion device, the device comprising: The extraction module is used to obtain the first text input by the user with preset type labels from the user interaction records in the source language model, and extract the first keyword representing the user's business intent from the first text; The generation module is used to extract second keywords representing business attributes from second text that has business logic association with the source language model, and generate the core vocabulary of the source language model based on the first keyword and the second keyword; The translation module is used to select a keyword from the core vocabulary, translate the selected keyword into multiple translation words corresponding to the preset target language using a first translation method, convert the selected keyword into a first vector, and convert each translation word corresponding to the target language into a corresponding second vector. The mapping module is used to map the first vector and all the second vectors to a preset vector space, calculate the semantic distance between the first vector and each of the second vectors, select the translation word corresponding to the second vector with the smallest semantic distance as the first target translation word, until the first target translation word corresponding to each keyword in the core vocabulary is obtained; The building module is used to construct a mapping dictionary between keywords and target translation words in the source language model based on all keywords and their corresponding first target translation words; The module is used to translate the words in the second text, excluding the second keyword, into second target translation words represented in the target language using the mapping dictionary and a second translation method, thereby obtaining the initial target language model corresponding to the source language model.
[0015] To address the above problems, the present invention also provides an electronic device, the electronic device comprising: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores a model language conversion program that can be executed by the at least one processor, the model language conversion program being executed by the at least one processor to enable the at least one processor to perform the above-described model language conversion method.
[0016] To address the aforementioned problems, the present invention also provides a computer-readable storage medium storing a model language conversion program, which can be executed by one or more processors to implement the aforementioned model language conversion method.
[0017] Compared to existing technologies, this invention obtains the first keyword from the first text input by the user and the second keyword from the second text from the source language model. It then combines the first keyword and the second keyword to generate the core vocabulary of the source language model, constructing a business semantic set that covers "business rules - user expression". This ensures that it includes the standardized business elements defined by the system and also covers the user's real natural language expression, providing comprehensive input for subsequent accurate translation.
[0018] The selected keywords are translated using the first translation method to obtain multiple translation words corresponding to the target language. The vectors of the selected keywords and the target translation words are mapped to a shared semantic vector space. Even if the word forms are very different, as long as the meanings are similar, the vector distance is small, which can accurately identify the optimal translation with semantic equivalence and avoid misjudgment due to superficial differences.
[0019] The translation word corresponding to the second vector with the smallest semantic distance is selected as the target translation word for the selected keyword. Based on all keywords and their corresponding first target translation words, a mapping dictionary between keywords and target translation words is constructed for the source language model. This mapping dictionary is used to perform high-precision translation only on keywords, while the remaining parts undergo general translation processing. This hierarchical strategy of "precise conversion of key fields + general context translation" ensures lossless conversion of the overall business logic of the source language model, thereby obtaining the initial target language model corresponding to the source language model. Without the need for large-scale retraining, the complete business logic of the source language model is losslessly and accurately converted into the target language, improving the translation accuracy of the target language model. Attached Figure Description
[0020] Figure 1 This is a flowchart illustrating a model language conversion method provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of a model language conversion device provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of an electronic device that implements a model language conversion method according to an embodiment of the present invention; The objectives, features, and advantages of this invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention.
[0022] It should be noted that the descriptions involving "first," "second," etc., in this invention are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
[0023] Reference Figure 1 The diagram shown is a flowchart of a model-language conversion method provided in an embodiment of the present invention. This method is executed by an electronic device.
[0024] In this embodiment, the model language conversion method includes: S1. Obtain the first text input by the user with preset type labels from the user interaction records in the source language model, and extract the first keyword representing the user's business intent from the first text.
[0025] In this embodiment, a request to convert the source language model into a target language model is received. Based on the request, user input text with preset type tags is retrieved from user interaction records deployed in the source language model (e.g., a credit risk control system in the Chinese market) as the first text. The preset type tags are associated with users of high business value or high credibility, such as users who have completed transaction conversions (e.g., users who have successfully placed orders or received credit approval), or groups of users labeled as high-quality users after manual review. The behavioral data and input text of such users are given higher weight in the training or decision-making process of the source language model, and their language expression patterns have a significant impact on the model's business logic. Therefore, the keywords extracted from them better reflect the true and effective business semantics.
[0026] In one embodiment, obtaining the first text input by the user with preset type tags from the user interaction records in the source language model includes: Retrieve user interaction records from the user behavior database corresponding to the source language model; Filter user behavior records that are associated with preset type tags by user identifiers from the user interaction records; Extract the query text or form-filled text entered by the user from the user behavior records as the first text.
[0027] The user behavior database stores complete operation logs of users in the business system, including but not limited to query requests, form submissions, conversation messages and transaction events; The system filters user behavior records that are associated with user identifiers (such as user IDs or device fingerprints) and preset type tags from user interaction records. It then extracts the natural language content entered by the user from the filtered user behavior records, including search query text, user statements in customer service conversations, or free fields in business application forms (such as "income explanation", "reason for overdue payment", etc.), as the first text for keyword extraction.
[0028] In one embodiment, extracting the first keyword representing the user's business intent from the first text includes: Based on the source language type of the source language model, the corresponding word segmentation model is called to perform word segmentation on the first text to generate a word sequence; Based on preset business intent recognition rules, candidate words related to the user's business intent are filtered out from the word sequence; The frequency of each candidate word in the first text input by the user under the preset type label is counted, and the candidate words with a frequency greater than a preset threshold are determined as the first keywords.
[0029] The user interaction records corresponding to the source language model are obtained as the first text. User interaction records include, for example, natural language text entered by the user in customer service conversations, APP operation logs, voice assistant requests, or online forms.
[0030] The system identifies the source language type used by the source language model (e.g., Chinese, English, Spanish, or Indonesian) and calls a word segmentation model that matches that source language type to segment the first text. For example, when the source language is Chinese, a Chinese word segmenter based on BERT-WWM or Jieba is called; when the source language is English, spaCy or NLTK is used for tokenization. This word segmentation process generates a word sequence composed of words.
[0031] Based on preset business intent recognition rules, semantic filtering is performed on word sequences to obtain candidate words related to the user's business intent. These preset business intent recognition rules include: a predefined whitelist of business intent keywords (such as "refund," "installment payment," "account freeze," "password reset," etc.); or a lightweight intent classification model to determine whether a word belongs to the semantic category of at least one target business intent (such as "payment issue," "account management," "order inquiry"); or excluding stop words, modal particles, and general function words through part-of-speech tagging, retaining only nouns, verbs, and compound business terms. Through these rules, a set of candidate words related to the user's business intent is selected from the word sequence.
[0032] In one embodiment, the step of filtering candidate words related to the user's business intent from the word sequence based on preset business intent recognition rules includes any one or a combination of the following: (1) Match each word in the word sequence with a predefined whitelist of business keywords, and retain the words in the whitelist as candidate words; (2) Use a lightweight intent classification model to classify the first text as a whole, determine the target business intent category to which it belongs, and extract words associated with the target business intent category from the word sequence as candidate words according to the preset intent-keyword mapping relationship; (3) The word sequence is tagged with part of speech, and stop words, modal words and general function words are removed, and words with part of speech of noun, verb or business term are retained as candidate words.
[0033] The primary keyword representing a user's business intent refers to semantically significant words in user interaction text that effectively distinguish different business scenarios and consistently appear among user groups. For example, in financial scenarios, words such as "withdrawal," "freeze," and "credit limit" are often directly associated with specific business operation intentions and are therefore selected as primary keywords.
[0034] Analyze the frequency of each candidate word in the interactive text generated by a preset user group. The preset user group is, for example, a subset of users tagged as "high-value users," "active users," or "users who have completed core business conversions," whose interactive behavior is considered more representative of genuine and effective business needs. Frequency statistics can be performed in the historical interaction log database, with the time window set to the most recent 30 days or 6 months.
[0035] Candidate words with a frequency greater than a preset threshold (e.g., appearing ≥ 50 times, or ranking in the top 5% of word frequency within the user group) are identified as primary keywords. These primary keywords not only reflect the target users' actual expression habits but are also strongly related to core business scenarios. They can serve as semantic units that require high fidelity in subsequent cross-language migration. The identified primary keywords are used as a specific input subset of the first translation method, triggering the first translation method to initiate a dictionary calibration and vector space mapping process to ensure the absolute accuracy of business terms. Simultaneously, it automatically classifies the remaining text fragments after removing keywords as the processing objects of the second translation method, instructing this method to skip the above calibration and mapping steps and only perform end-to-end generation based on an attention mechanism. This achieves dynamic matching between computing resources and the semantic importance of text.
[0036] S2. Extract second keywords representing business attributes from the second text that has business logic related to the source language model, and generate the core vocabulary of the source language model based on the first keyword and the second keyword.
[0037] In one embodiment, extracting second keywords representing business attributes from second text that has business logical association with the source language model includes: The second text is parsed or matched using regular expressions to identify structured tags that represent business attributes. These structured business tags include template slot placeholders, rule variable names, or configuration item key names. The natural language business terms associated with the structured tags are identified as the second keywords.
[0038] Obtain the second text. The second text refers to the system-side structured or semi-structured text used to define or support the business logic of the source language model. Examples include: preset reply templates in the dialogue management module (e.g., "Your order number is currently in order status"); conditional expressions in the business rule engine (e.g., "If the user's risk level is high, authentication is required"); parameter items in the model configuration file (e.g., "Supported payment methods include credit cards and e-wallets"); and slot definition files or business ontology descriptions in the intent recognition module.
[0039] Perform syntax parsing or regular expression matching on the second text to identify structured business tags that represent business attributes. Syntax parsing includes: performing structural analysis on the configuration file of the second text to extract field names, parameter names, or placeholders; regular expression matching, for example, uses preset text pattern matching rules to identify the location of convertible content in the second text, or extracts key variable names from the rule statements of the second text through specific formatting rules.
[0040] Structured business tags include, but are not limited to: placeholders in templates, such as “order number” and “refund reason”, used to dynamically fill positions; variable names in rules, such as “transaction amount” and “whether the user is a high-value customer”, used to represent business status or attributes; and key names in configuration items, such as “maximum installment period” and “whether risk control detection is enabled”, used to identify parameters that control system behavior.
[0041] Based on the pre-defined mapping between tags and natural language terms, the natural language business term associated with each structured business tag is obtained. This mapping can be pre-stored in a mapping table, configuration comments, or localized resource files. For example: the placeholder tag "order status" corresponds to the natural language term "order status"; the variable name "payment method" corresponds to the natural language term "payment method"; and the configuration key "fraud detection switch" corresponds to the natural language term "fraud detection function enabled status".
[0042] The natural language business terms obtained above were identified as secondary keywords. These secondary keywords represent the system's standardized definition of business attributes, have clear semantic boundaries and business meanings, and can serve as core vocabulary that requires strict semantic consistency during the language conversion process.
[0043] The first and second keyword sets are merged and deduplication is performed to generate the final core vocabulary of the source language model. This core vocabulary is stored as a list of strings and serves as the sole authoritative input source for subsequent cross-language terminology mapping. It integrates real-world user expressions while retaining system-level rule definitions, laying a semantic foundation for high-fidelity cross-language transfer.
[0044] This invention integrates the first keyword (from the real expressions of high-value users) and the second keyword (from the system's preset business templates) to generate a core vocabulary, ensuring that it includes both the standardized business elements defined by the system (the second keyword) and the real natural language expressions of users (the first keyword), forming a complete semantic boundary aligned with "business rules - user expressions," providing comprehensive input for subsequent accurate translation.
[0045] S3. Select any keyword from the core vocabulary list, use the first translation method to translate the selected keyword into multiple translation words corresponding to the preset target language, convert the selected keyword into a first vector, and convert each translation word corresponding to the target language into a corresponding second vector.
[0046] In this embodiment, each keyword is selected sequentially from the core vocabulary list, and a translation and filtering process is initiated based on a preset target language (e.g., Indonesian or Spanish). First, the selected keywords are translated using a preset first translation method to generate multiple translated terms.
[0047] In one embodiment, translating the selected keywords into multiple translated terms corresponding to a preset target language using a first translation method includes: The selected keywords are translated using a preset machine translation engine to generate at least one initial translation word; Based on a preset verification dictionary, a calibration operation is performed on the at least one initial translation word to generate multiple translation words. The calibration operation includes replacing, expanding, or retaining the initial translation word.
[0048] First, call a preset general machine translation engine (such as Google Cloud Translation API, Amazon Translate, or Azure Translator) to translate the selected keywords, generating at least one initial translation; the selected keywords are any keywords in the core vocabulary of the source language model (such as the Chinese "credit limit"), and the machine translation engine automatically outputs the corresponding translation according to the preset target language (such as Indonesian or Spanish). For example, "credit limit" is translated into Indonesian as "jumlah pinjaman" or Spanish as "monto del préstamo".
[0049] Perform a calibration operation on the initial translation based on a preset verification dictionary; the verification dictionary is jointly constructed by business experts and local language experts familiar with vertical fields such as finance, e-commerce, or insurance and is pre-stored in a relational database or key-value storage system. Each record in it contains the source language term, the standard translation in the target language, the applicable scenario, and the confidence level. The calibration operation specifically includes the following three situations: Replacement: If there is an entry in the verification dictionary that exactly matches the selected keyword, directly replace the initial translation with the standard translation in the dictionary (for example, replace the "jumlah pinjaman" output by machine translation with the expert-defined "limit kredit"); Expansion: If there are multiple valid translations in the dictionary (e.g., due to regional differences, "credit score" is "puntaje crediticio" in Mexico and "calificación crediticia" in Colombia), then on the basis of retaining the initial translation, append all compliant translations in the dictionary as additional candidates; Retention: If the selected keyword is not included in the verification dictionary (such as the newly emerged business term "income from flexible employment"), then keep the initial translation output by the machine translation engine unchanged as the sole or main candidate.
[0050] Through the above calibration operation, a set containing one or more translation words is finally generated. This set not only inherits the wide coverage ability of machine translation but also integrates the accuracy and compliance of the verification dictionary for key terms, providing high-quality input for subsequent vector alignment and semantic distance screening.
[0051] The construction of the verification dictionary includes: First, extract high-frequency core terms from the business rule templates, user agreements, and customer service knowledge bases used in the source language model. Second, for each high-frequency core term, provide a preliminary translation by local language experts familiar with the target language market, and cross-verify the business accuracy and compliance of the translation by risk control, compliance, or product experts. Store the term-translation pairs that pass the cross-verification in a structured dictionary file classified by the target language (such as Indonesian, Spanish) to form the final verification dictionary. The verification dictionary supports regular updates to incorporate new business concepts or correct localization expression differences.
[0052] The prior art uses a single pure manual dictionary: Although it is accurate, its coverage is limited and it cannot handle out-of-vocabulary words (such as the new business term "flexible employment income"); or, the prior art uses pure machine translation: Although it has a wide coverage, it lacks an understanding of vertical domain terms and is prone to catastrophic mis-translations (such as "running water" → "flujo de agua").
[0053] The first translation method of the present invention ensures 100% accuracy of core terms by first using machine translation and then verifying with the verification dictionary, achieving full vocabulary coverage on the premise of ensuring that key business elements are not distorted, and avoiding the model from failing due to missing or incorrect terms.
[0054] In one embodiment, it may further include: First, use the pre-constructed verification dictionary to translate the selected keywords (for example, map the Chinese "credit limit" to Indonesian "limit kredit" and Spanish "límite de crédito"). If there is a corresponding entry in the dictionary, directly return one or more standard translations; if the word is not covered by the dictionary, call a machine translation service that supports multiple languages (such as Google Translate API or Azure Translator) to generate at least two different translations as supplementary candidates, so as to ensure that each selected keyword obtains at least two translation words that take into account both accuracy and diversity.
[0055] In one embodiment, the converting the selected keyword into a first vector and converting each translation word corresponding to the target language into a corresponding second vector includes: Call a source language word embedding model that matches the source language type to encode the selected keyword into a first vector; Call a target language word embedding model that matches the target language type to encode each translation word into a corresponding second vector.
[0056] The selected keywords (source language words) are input into the pre-trained source language text encoder (e.g., Chinese BERT or RoBERTa model) to obtain their context-independent word vector representations or static embeddings obtained through average pooling, which serve as the first vector. At the same time, each translated word is input into the corresponding target language text encoder (e.g., Indonesian BERT or Spanish BERT) to extract its word vectors or sentence vectors, which serve as the corresponding second vector.
[0057] S4. Map the first vector and all the second vectors to a preset vector space, calculate the semantic distance between the first vector and each of the second vectors, select the translation word corresponding to the second vector with the smallest semantic distance as the first target translation word, until the first target translation word corresponding to each keyword in the core vocabulary is obtained.
[0058] In one embodiment, mapping the first vector and all second vectors to a preset vector space and calculating the semantic distance between the first vector and each second vector includes: The first vector and each of the second vectors are mapped into the vector space using a pre-trained vector alignment matrix; In the vector space, the cosine distance between the first vector and each of the second vectors is calculated, and the cosine distance is used as the semantic distance.
[0059] A pre-trained vector alignment matrix is used to map the first vector and each of the second vectors to the semantic vector space. This alignment matrix, trained through orthogonal Procrustes analysis based on shared word embeddings or parallel corpora of the source and target languages, linearly aligns the vector spaces of different languages, bringing semantically similar cross-linguistic words closer together in the aligned space. Specifically, the first vector and each of the second vectors are multiplied by this alignment matrix to complete the unified mapping of the vector space.
[0060] In one embodiment, the pre-trained vector alignment matrix is constructed through the following steps: Obtain a seed dictionary between the source language and the target language, wherein the seed dictionary contains multiple source language words and target language words that are translation pairs; The source language word vector model and the target language word vector model are used respectively to generate the source language word vector and the target language word vector corresponding to each word in the seed dictionary; Based on the source language word vectors and the corresponding target language word vectors, an orthogonal transformation matrix is solved by the orthogonal transformation optimization algorithm (Procrustes) to minimize the sum of squared errors between the source language word vectors and the corresponding target language word vectors after transformation by the orthogonal transformation matrix; Determine the obtained orthogonal transformation matrix as the vector alignment matrix.
[0061] In the semantic vector space, calculate the cosine distance (i.e., 1 minus the cosine similarity) between the first vector and each second vector, and use this cosine distance as the semantic distance for measuring semantic consistency; the smaller the semantic distance, the closer the translation word is to the selected keyword in terms of semantics. In subsequent steps, the translation words will be sorted and filtered based on this semantic distance to determine the optimal target translation word.
[0062] Traditional methods often rely on exact string matching or fuzzy matching (such as edit distance) to verify translation quality, and cannot recognize translations that are semantically equivalent but have different expressions (for example, the Chinese "monthly income" vs. the Spanish "ingresos mensuales" have completely different glyphs).
[0063] However, in this invention, by mapping the selected keywords and translation words to a shared semantic vector space, even if the lexical forms are very different, as long as the semantics are similar, their vector distances are small, so that the optimal translation with semantic equivalence can be accurately recognized, avoiding misjudgment due to surface differences.
[0064] For each selected keyword, traverse the second vectors generated by its corresponding multiple translation words, select the second vector with the smallest semantic distance from the first vector of the selected keyword, and determine the translation word corresponding to this second vector as the first target translation word of the selected keyword. The semantic distance is calculated using the cosine distance, that is, the smaller the value, the closer the semantics.
[0065] S5. According to all keywords and their corresponding first target translation words, construct a mapping dictionary between the keywords and target translation words of the source language model.
[0066] In one embodiment, the constructing a mapping dictionary between the keywords and target translation words of the source language model according to all keywords and their corresponding first target translation words includes: Assign a key to each keyword, assign a value to each first target translation word corresponding to the keyword, and generate a key-value pair corresponding to each keyword according to the key and the value; Organize all the key-value pairs into a JSON object, and serialize the JSON object into a text format to obtain the mapping dictionary.
[0067] All keywords and their corresponding target language terms are organized into a structured set of key-value pairs, where each keyword is the key and its target language term is the value. This set of key-value pairs is then serialized into standard JSON format to generate the final mapping dictionary. This mapping dictionary can be directly called by the subsequent partitioned translation module for accurate localization of business templates and user interaction logic in the source language model.
[0068] In one embodiment, constructing a keyword-target translation dictionary for the source language model based on all keywords and their corresponding first target translation terms includes: An initial dictionary table is created in a pre-defined relational database. The initial dictionary table contains source language keyword fields and target translation word fields. Write each keyword into the source language keyword field, and write the first target translation word corresponding to each keyword into the target translation word field to obtain the mapping relationship between each group of keywords and target translation words; The mapping relationship between each group of keywords and the target translation word is stored in the initial dictionary table in the form of row records to generate the mapping dictionary.
[0069] Create an initial dictionary table in a pre-defined relational database (such as MySQL, PostgreSQL, or Oracle) to persistently store the mapping relationship between keywords and target translation words; The initial dictionary table contains at least two core fields: the source language keyword field and the target translation word field. The source language keyword field is set to VARCHAR(255) data type and a unique index is created to ensure that each source language keyword corresponds to only one record and avoid duplicate mapping. The target translation word field is also set to VARCHAR(255) and is used to store the optimal target translation word determined after semantic distance filtering.
[0070] Write each source language keyword into the source language keyword field and its corresponding target translation into the target translation field; for example, when processing the keyword "monthly income", if its optimal translation in the Mexican market (Spanish) is "ingresos mensuales", then the word pair is written into both fields of the same row record.
[0071] The mapping relationship between each set of keywords and the target translation is inserted into the initial dictionary table as a separate record. To support multilingual scenarios, the initial dictionary table can also be expanded to include a target language identifier field (such as target_lang, with values of "es-MX" for Mexican Spanish and "id" for Indonesian), allowing the same source keyword to correspond to multiple target language translations and coexist in the same table. After all records are written, this initial dictionary table serves as a structured mapping dictionary, which can be called in real time by the subsequent partitioned translation module through SQL queries or ORM interfaces to achieve accurate conversion of keywords in the business template.
[0072] Existing end-to-end machine translation technologies translate the entire user input or rule template as a "black box," failing to distinguish between core business slots (such as {monthly revenue}) and general context, leading to the generalization or mistranslation of key terms.
[0073] This invention separates core business keywords through a mapping dictionary, performing high-precision translation only on keywords of high-value elements in the source language model, while the remaining text can still be processed using general translation. This layered strategy of "precise conversion of key fields + general translation of context" ensures seamless migration of the overall business logic.
[0074] S6. Using the mapping dictionary, the words in the second text other than the second keyword are translated into second target translation words represented in the target language using the second translation method, thereby obtaining the initial target language model corresponding to the source language model.
[0075] In this embodiment, the second keyword contained in the second text is converted into a first target translation word in the target language by a mapping dictionary, and a preset machine translation engine is called to translate the content in the second text other than the second keyword into a second word in the target language. Based on the first target translation word and the second target translation word, the source language of the source language model is converted into the target language to obtain the initial target language model corresponding to the source language model.
[0076] Apply the mapping dictionary to the localization transformation of the source language model: For all second texts in the source language model that contain business semantic slots (secondary keywords) (e.g., risk control rule "If {monthly income} < 5000 yuan, then risk level = high" or prompt engineering template "Please assess the user's willingness to repay based on {number of historical overdue payments}"), iterate through each placeholder or keyword and use the mapping dictionary to look up its corresponding target language word (e.g., convert "monthly income" to Spanish "ingresos mensuales", or "number of historical overdue payments" to Indonesian "jumlah keterlambatanhistoris") to complete the conversion of core business keywords into the first target translation word.
[0077] Using a mapping dictionary, the remaining text content in the second text, excluding the second keyword (such as logical connectors "if" and "then", unit "yuan", or descriptive statements "please according to the user...", etc.), is translated into the second target translation word. The second translation method is a general machine translation service (such as Google Cloud Translation API or Azure Translator), which has the advantages of high efficiency and broad coverage when handling unstructured contexts, and does not require domain adaptation.
[0078] The present invention uses a dynamic matching translation method based on the semantic importance of resources and text. The first translation method is configured to perform machine translation, dictionary calibration, and semantic vector distance filtering steps to obtain high-confidence term translations. In contrast, the second translation method is configured to directly utilize the context attention mechanism of the neural machine translation model to generate a single target translation end-to-end, and its processing flow does not include dictionary calibration and semantic vector distance filtering steps.
[0079] The first and second translation methods collaborate to construct a "semantic anchor + context filling" architecture: the first method uses high-cost computation to lock in the business logic skeleton and ensures accurate terminology; the second method fills in the language foundation through lightweight processing to ensure smooth writing. By configuring translation methods differently, the high latency caused by high-precision computation throughout the entire document is avoided, while the problem of lost business logic caused by a single general translation is solved, achieving a balance between accuracy and efficiency in vertical domain model migration.
[0080] In one embodiment, the method further includes: Obtain a preset number of target language annotation samples, wherein the target language annotation samples include target language input text and its corresponding business tags; The initial target language model is fine-tuned based on the target language labeled samples to obtain the final target language model.
[0081] To adapt to subtle differences in expression or shifts in user behavior within the target language market, a lightweight training or fine-tuning process is performed on the initial target language model using a predetermined number of labeled target language samples. These labeled samples are typically small (e.g., 500–2000), derived from real user interaction records in the target market, and manually labeled with decision tags (e.g., "pass / reject," "high / medium / low risk"). The fine-tuning process can employ incremental learning: if the source model is a tree model, some split nodes are updated; if it's a neural network, the underlying parameters are frozen, and only the top-level classification head is fine-tuned. The resulting model retains the complete business logic of the source model while also possessing adaptability to local language and user habits, forming a directly deployable final target language model.
[0082] like Figure 2 The diagram shown is a schematic diagram of a model language conversion device provided in an embodiment of the present invention.
[0083] The model language conversion device 100 of this invention can be installed in an electronic device. Depending on the functions implemented, the model language conversion device 100 may include an extraction module 110, a generation module 120, a translation module 130, a mapping module 140, a construction module 150, and an acquisition module 160. The module described in this invention can also be called a unit, referring to a series of computer program segments that can be executed by the processor of an electronic device and perform a fixed function, stored in the memory of the electronic device.
[0084] In this embodiment, the functions of each module / unit are as follows: Extraction module 110 is used to obtain the first text input by the user with preset type labels from the user interaction records in the source language model, and extract the first keyword representing the user's business intent from the first text; The generation module 120 is used to extract second keywords representing business attributes from second text that has business logic association with the source language model, and generate the core vocabulary of the source language model based on the first keyword and the second keyword; The translation module 130 is used to arbitrarily select a keyword from the core vocabulary, translate the selected keyword into multiple translation words corresponding to the preset target language using a first translation method, convert the selected keyword into a first vector, and convert each translation word corresponding to the target language into a corresponding second vector. The mapping module 140 is used to map the first vector and all the second vectors to a preset vector space, calculate the semantic distance between the first vector and each of the second vectors, select the translation word corresponding to the second vector with the smallest semantic distance as the first target translation word, until the first target translation word corresponding to each keyword in the core vocabulary is obtained; Module 150 is used to construct a mapping dictionary between keywords and target translation words in the source language model based on all keywords and their corresponding first target translation words. The module 160 is used to translate the words in the second text, excluding the second keyword, into second target translation words represented in the target language using the mapping dictionary and a second translation method, thereby obtaining the initial target language model corresponding to the source language model.
[0085] In one embodiment, extracting the first keyword representing the user's business intent from the first text includes: Based on the source language type of the source language model, the corresponding word segmentation model is called to perform word segmentation on the first text to generate a word sequence; Based on preset business intent recognition rules, candidate words related to the user's business intent are filtered out from the word sequence; The frequency of each candidate word in the first text input by the user under the preset type label is counted, and the candidate words with a frequency greater than a preset threshold are determined as the first keywords.
[0086] In one embodiment, translating the selected keywords into multiple translated terms corresponding to a preset target language using a first translation method includes: The selected keywords are translated using a preset machine translation engine to generate at least one initial translation word; Based on a preset verification dictionary, the at least one initial translation word is calibrated to generate multiple translation words.
[0087] In one embodiment, mapping the first vector and all second vectors to a preset vector space and calculating the semantic distance between the first vector and each second vector includes: The first vector and each of the second vectors are mapped into the vector space using a pre-trained vector alignment matrix; In the vector space, the cosine distance between the first vector and each of the second vectors is calculated, and the cosine distance is used as the semantic distance.
[0088] In one embodiment, constructing a keyword-target translation dictionary for the source language model based on all keywords and their corresponding first target translation terms includes: Assign a key to each keyword, assign a value to the first target translation term corresponding to each keyword, and generate key-value pairs for each keyword based on the key and the value. Organize all key-value pairs into a JSON object, and serialize the JSON object into a text format to obtain the mapping dictionary.
[0089] In one embodiment, constructing a keyword-target translation dictionary for the source language model based on all keywords and their corresponding first target translation terms includes: An initial dictionary table is created in a pre-defined relational database. The initial dictionary table contains source language keyword fields and target translation word fields. Write each keyword into the source language keyword field, and write the first target translation word corresponding to each keyword into the target translation word field to obtain the mapping relationship between each group of keywords and target translation words; The mapping relationship between each group of keywords and the target translation word is stored in the initial dictionary table in the form of row records to generate the mapping dictionary.
[0090] In one embodiment, the method further includes: Obtain a preset number of target language annotation samples, wherein the target language annotation samples include target language input text and its corresponding business tags; The initial target language model is fine-tuned based on the target language labeled samples to obtain the final target language model.
[0091] like Figure 3 The diagram shown is a structural schematic of an electronic device that implements a model language conversion method according to an embodiment of the present invention.
[0092] In this embodiment, the electronic device 1 includes, but is not limited to, a memory 11, a processor 12, and a network interface 13 that can be interconnected via a system bus. The memory 11 stores a model language conversion program 10, which can be executed by the processor 12. Figure 3 Only the electronic device 1, which includes components 11-13 and the model language conversion program 10, is shown. Those skilled in the art will understand that... Figure 3 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0093] The memory 11 includes RAM and at least one type of readable storage medium. The RAM provides a cache for the operation of the electronic device 1; the readable storage medium can be a non-volatile storage medium such as flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the readable storage medium can be an internal storage unit of the electronic device 1; in other embodiments, the non-volatile storage medium can also be an external storage device of the electronic device 1, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the electronic device 1. In this embodiment, the readable storage medium of the memory 11 is typically used to store the operating system and various application software installed on the electronic device 1, such as storing the code of the model language conversion program 10 in one embodiment of the present invention. Furthermore, the memory 11 can also be used to temporarily store various types of data that have been output or will be output.
[0094] In some embodiments, processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. Processor 12 is typically used to control the overall operation of the electronic device 1, such as performing control and processing related to data interaction or communication with other devices. In this embodiment, processor 12 is used to run program code stored in memory 11 or process data, such as running model language conversion program 10.
[0095] The network interface 13 may include a wireless network interface or a wired network interface, which is used to establish a communication connection between the electronic device 1 and a terminal (not shown in the figure).
[0096] Optionally, the electronic device 1 may further include a user interface, which may include a display, an input unit such as a keyboard, and optionally, a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the electronic device 1 and to display a visual user interface.
[0097] It should be understood that the embodiments described are for illustrative purposes only and are not limited to this structure in the scope of the patent application.
[0098] The model language conversion program 10 stored in the memory 11 of the electronic device 1 is a combination of multiple instructions, which, when run in the processor 12, can achieve the following: From the user interaction records in the source language model, obtain the first text input by the user with preset type labels, and extract the first keyword representing the user's business intent from the first text; From the second text that has business logic related to the source language model, extract the second keywords that represent business attributes, and generate the core vocabulary of the source language model based on the first keywords and the second keywords; Select any keyword from the core vocabulary list, use the first translation method to translate the selected keyword into multiple translation words corresponding to the preset target language, convert the selected keyword into a first vector, and convert each translation word corresponding to the target language into a corresponding second vector; Map the first vector and all the second vectors to a preset vector space, calculate the semantic distance between the first vector and each of the second vectors, select the translation word corresponding to the second vector with the smallest semantic distance as the first target translation word, until the first target translation word corresponding to each keyword in the core vocabulary is obtained; Based on all keywords and their corresponding first target translation terms, construct a mapping dictionary between keywords and target translation terms in the source language model; Using the mapping dictionary, the words in the second text other than the second keyword are translated into second target translation words represented in the target language using the second translation method, thereby obtaining the initial target language model corresponding to the source language model.
[0099] Specifically, the processor 12's implementation method for the aforementioned model language conversion program 10 can be found in [reference needed]. Figure 1 The descriptions of the relevant steps in the corresponding embodiments are not repeated here.
[0100] Furthermore, if the modules / units integrated in the electronic device 1 are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable medium can be non-volatile or non-combustible. The computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, or a read-only memory (ROM).
[0101] The computer-readable storage medium stores a model language conversion program 10, which can be executed by one or more processors. The specific implementation of the computer-readable storage medium of the present invention is basically the same as the various embodiments of the model language conversion method described above, and will not be repeated here.
[0102] In the several embodiments provided by this invention, it should be understood that the disclosed devices, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0103] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0104] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0105] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0106] Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the invention. No appended diagram markings in the claims should be construed as limiting the scope of the claims.
[0107] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in a system claim may also be implemented by a single unit or device through software or hardware. The term "second class" is used to indicate names and does not indicate any specific order.
[0108] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent conversions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A model language conversion method, characterized in that, The method includes: From the user interaction records in the source language model, obtain the first text input by the user with preset type labels, and extract the first keyword representing the user's business intent from the first text; From the second text that has business logic related to the source language model, extract the second keywords that represent business attributes, and generate the core vocabulary of the source language model based on the first keywords and the second keywords; Select any keyword from the core vocabulary list, use the first translation method to translate the selected keyword into multiple translation words corresponding to the preset target language, convert the selected keyword into a first vector, and convert each translation word corresponding to the target language into a corresponding second vector; Map the first vector and all the second vectors to a preset vector space, calculate the semantic distance between the first vector and each of the second vectors, select the translation word corresponding to the second vector with the smallest semantic distance as the first target translation word, until the first target translation word corresponding to each keyword in the core vocabulary is obtained; Based on all keywords and their corresponding first target translation terms, construct a mapping dictionary between keywords and target translation terms in the source language model; Using the mapping dictionary, the words in the second text other than the second keyword are translated into second target translation words represented in the target language using the second translation method, thereby obtaining the initial target language model corresponding to the source language model.
2. The model language conversion method as described in claim 1, characterized in that, The extraction of the first keyword representing the user's business intent from the first text includes: Based on the source language type of the source language model, the corresponding word segmentation model is called to perform word segmentation on the first text to generate a word sequence; Based on preset business intent recognition rules, candidate words related to the user's business intent are filtered out from the word sequence; The frequency of each candidate word in the first text input by the user under the preset type label is counted, and the candidate words with a frequency greater than a preset threshold are determined as the first keywords.
3. The model language conversion method as described in claim 1, characterized in that, The process of translating selected keywords into multiple translated terms corresponding to a preset target language using a first translation method includes: The selected keywords are translated using a preset machine translation engine to generate at least one initial translation word; Based on a preset verification dictionary, the at least one initial translation word is calibrated to generate multiple translation words.
4. The model language conversion method as described in claim 1, characterized in that, The step of mapping the first vector and all second vectors to a preset vector space and calculating the semantic distance between the first vector and each second vector includes: The first vector and each of the second vectors are mapped into the vector space using a pre-trained vector alignment matrix; In the vector space, the cosine distance between the first vector and each of the second vectors is calculated, and the cosine distance is used as the semantic distance.
5. The model language conversion method as described in claim 1, characterized in that, The step of constructing a keyword-target translation dictionary for the source language model based on all keywords and their corresponding first target translation terms includes: Assign a key to each keyword, assign a value to the first target translation term corresponding to each keyword, and generate key-value pairs for each keyword based on the key and the value. Organize all key-value pairs into a JSON object, and serialize the JSON object into a text format to obtain the mapping dictionary.
6. The model language conversion method as described in claim 1, characterized in that, The step of constructing a keyword-target translation dictionary for the source language model based on all keywords and their corresponding first target translation terms includes: An initial dictionary table is created in a pre-defined relational database. The initial dictionary table contains source language keyword fields and target translation word fields. Write each keyword into the source language keyword field, and write the first target translation word corresponding to each keyword into the target translation word field to obtain the mapping relationship between each group of keywords and target translation words; The mapping relationship between each group of keywords and the target translation word is stored in the initial dictionary table in the form of row records to generate the mapping dictionary.
7. The model language conversion method as described in claim 1, characterized in that, The method further includes: Obtain a preset number of target language annotation samples, wherein the target language annotation samples include target language input text and its corresponding business tags; The initial target language model is fine-tuned based on the target language labeled samples to obtain the final target language model.
8. A model language conversion device, characterized in that, The device includes: The extraction module is used to obtain the first text input by the user with preset type labels from the user interaction records in the source language model, and extract the first keyword representing the user's business intent from the first text; The generation module is used to extract second keywords representing business attributes from second text that has business logic association with the source language model, and generate the core vocabulary of the source language model based on the first keyword and the second keyword; The translation module is used to select a keyword from the core vocabulary, translate the selected keyword into multiple translation words corresponding to the preset target language using a first translation method, convert the selected keyword into a first vector, and convert each translation word corresponding to the target language into a corresponding second vector. The mapping module is used to map the first vector and all the second vectors to a preset vector space, calculate the semantic distance between the first vector and each of the second vectors, select the translation word corresponding to the second vector with the smallest semantic distance as the first target translation word, until the first target translation word corresponding to each keyword in the core vocabulary is obtained; The building module is used to construct a mapping dictionary between keywords and target translation words in the source language model based on all keywords and their corresponding first target translation words; The module is used to translate the words in the second text, excluding the second keyword, into second target translation words represented in the target language using the mapping dictionary and a second translation method, thereby obtaining the initial target language model corresponding to the source language model.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores a model language conversion program that can be executed by the at least one processor, the model language conversion program being executed by the at least one processor to enable the at least one processor to perform the model language conversion method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a model language conversion program, which can be executed by one or more processors to implement the model language conversion method as described in any one of claims 1 to 7.