Semantic flow type multi-language translation method and system based on AI (artificial intelligence) and electronic equipment
Through the AI-based semantic streaming multilingual translation method, real-time input monitoring and AI model translation are used to solve the problems of high development cost, poor flexibility and large resource consumption of multilingual support in existing technologies. Dynamic and continuous multilingual switching is achieved, which reduces development costs and resource consumption and improves user experience.
Patent Information
- Application Number
- CN202510769057.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-10
- Publication Date
- 2025-09-16
AI Technical Summary
The existing method of implementing multi-language support by configuring language packs has the problems of high development cost, poor flexibility and large resource occupation.
It adopts an AI-based semantic streaming multi-language translation method, monitors input in real time through the user interaction layer, uses the language recognition and translation models of the AI large model service layer to perform real-time translation, and stores the results in the data storage layer to achieve dynamic interface updates and avoid configuring static language packages.
Reduce development costs, increase flexibility, reduce resource usage, achieve real-time translation updates, and enhance user experience.
Smart Images

Figure CN120654711A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of multilingual translation, and in particular to an AI-based semantic streaming multilingual translation method and its system, electronic device, and storage medium. Background Art
[0002] With the acceleration of globalization, multilingual support for software or web interfaces has become crucial. Currently, in existing technologies, multilingual support is achieved through the configuration of language packs. Developers need to write different resource files for different languages. When the software or web page is running, the corresponding language pack is loaded according to the user's selected language to display the text content. However, the existing method of achieving multilingual support through the configuration of language packs has the following technical problems:
[0003] High development costs: Developing and maintaining multiple language packs requires a lot of manpower and time, increasing the cost of software development and web page production.
[0004] Poor flexibility: Adding a new language requires rewriting and deploying the language pack, making it difficult to quickly respond to market demand for new languages.
[0005] Large resource usage: A large number of language packs will occupy a lot of storage space, which may affect performance, especially for resource-sensitive scenarios such as mobile applications. Summary of the Invention
[0006] The embodiments of the present invention aim to provide an AI-based semantic streaming multilingual translation method and its system, electronic device, and storage medium, aiming to solve the problems of high development cost, poor flexibility, and large resource consumption in the existing technology of achieving multilingual support by configuring language packages.
[0007] To solve the above technical problems, the first embodiment of the present invention provides an AI-based semantic streaming multilingual translation method, which is applied to an AI-based semantic streaming multilingual translation system. The AI-based semantic streaming multilingual translation system includes a user interaction layer, an AI large model service layer, and a data storage layer. The method includes:
[0008] The user interaction layer monitors the input of a specific input box in real time, collects the input of the specific input box and the content to be translated on the target interface, obtains the text material to be translated, and sends it to the AI large model service layer;
[0009] The AI large model service layer calls a preset AI translation model to translate the received text material to be translated to obtain a translation result, returns the translation result to the user interaction layer, and stores the translation result in the data storage layer;
[0010] The user interaction layer completes the target interface update display according to the translation result to achieve language switching.
[0011] Optionally, the user interaction layer monitors the input of a specific input box in real time, collects the input of the specific input box and the content to be translated on the target interface, obtains the text material to be translated, and sends it to the AI big model service layer, including:
[0012] The user interaction layer serves as the interactive interface between the user and the target interface, monitoring the input behavior of a specific input box in real time. Once the user completes input in the specific input box, the user input text is immediately extracted, and the user input text is collected and organized together with various elements to be translated in the target interface to obtain text data to be translated, which is sent to the AI large model service layer. The content to be translated in the target interface includes various elements to be translated in the target interface.
[0013] Optionally, collecting and collating the user input text and various elements to be translated in the target interface to obtain text data to be translated includes: encapsulating the user input text and various elements to be translated in the target interface in JSON format to obtain text data to be translated in JSON format.
[0014] Optionally, the preset AI translation model includes a language recognition AI model and a large language model;
[0015] The AI large model service layer calls a preset AI translation model to translate the received text material to be translated to obtain a translation result, including:
[0016] The AI large model service layer first calls the language recognition AI model to determine the target language from the text material to be translated;
[0017] The AI large model service layer then calls the large language model to perform text translation on the text material to be translated, and generates a translation result that matches the target language.
[0018] Optionally, the AI large model service layer first calls the language recognition AI model to determine the target language from the text material to be translated, including:
[0019] The AI large model service layer calls the language recognition AI model;
[0020] The language recognition AI model is based on a deep learning algorithm to analyze the character features, vocabulary patterns and / or grammatical structure information of the user input text in the text material to be translated to determine the target language.
[0021] Optionally, the AI large model service layer calls a preset AI translation model to translate the received text material to be translated to obtain a translation result, further comprising:
[0022] The AI big model service layer interacts with the data storage layer at the same time, reads the historical translation data stored in the data storage layer for optimizing translation, and then combines the context to generate high-quality translation results that match the target language.
[0023] Optionally, the user interaction layer completes target interface update display according to the translation result to implement language switching, including:
[0024] The user interaction layer updates and displays the target interface according to the translation result, in accordance with the original position and style of the target interface elements, and completes the language switch.
[0025] Accordingly, the second embodiment of the present invention provides an AI-based semantic streaming multilingual translation system, which is applied to the AI-based semantic streaming multilingual translation method described in the first embodiment of the present invention. The AI-based semantic streaming multilingual translation system includes: a user interaction layer, an AI large model service layer, and a data storage layer, wherein:
[0026] The user interaction layer is used to monitor the input of a specific input box in real time, collect the input of the specific input box and the content to be translated on the target interface, obtain the text data to be translated, and send it to the AI large model service layer;
[0027] The AI large model service layer calls a preset AI translation model to translate the received text material to be translated to obtain a translation result, returns the translation result to the user interaction layer, and stores the translation result in the data storage layer;
[0028] The user interaction layer is further used to update and display the target interface according to the translation result to achieve language switching.
[0029] Accordingly, an embodiment of the third aspect of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored on the memory and running on the processor, wherein when the computer program is executed by the processor, the AI-based semantic streaming multilingual translation method described in the embodiment of the first aspect of the present invention is implemented.
[0030] Accordingly, the fourth aspect of the present invention provides a storage medium on which a program of an AI-based semantic streaming multilingual translation method is stored. When the program of the AI-based semantic streaming multilingual translation method is executed by a processor, the AI-based semantic streaming multilingual translation method described in the first aspect of the present invention is implemented.
[0031] Compared with the prior art, the embodiment of the present invention provides an AI-based semantic streaming multilingual translation method and its system, electronic device, and storage medium. The AI-based semantic streaming multilingual translation method includes: the user interaction layer monitors the input of a specific input box in real time, collects the input of the specific input box and the content to be translated of the target interface, obtains the text data to be translated, and sends it to the AI large model service layer; the AI large model service layer calls the preset AI translation model to translate the received text data to obtain the translation result, returns the translation result to the user interaction layer, and stores the translation result in the data storage layer; the user interaction layer completes the target interface update display based on the translation result returned by the AI large model service layer to realize language switching. Therefore, the present invention realizes the system-level integration of dynamic translation and target interface update through the three-layer architecture design of user interaction layer, AI large model service layer, and data storage layer, deeply applies the AI large model to the multilingual switching of the target interface without the need to configure a static language package, and triggers the translation process in real time through the semantic streaming processing mode, from input completion, recognition, translation, to updating the target interface, to realize dynamic and continuous multilingual switching, rather than relying on batch loading of static language packages. Therefore, the AI-based semantic streaming multilingual translation method provided by the present invention has the following technical effects:
[0032] Reduce development costs: There is no need to develop and maintain multiple language packs, significantly reducing the workload and time costs of developers.
[0033] Improved flexibility: New languages can be quickly supported. As long as the AI model supports the language, multi-language switching can be achieved.
[0034] Reduced resource usage: No need to store large numbers of language packs, saving storage space for software and web pages. This is especially suitable for resource-constrained scenarios such as mobile applications.
[0035] Real-time translation updates: For dynamically changing text content, such as real-time chat messages, language switching can be performed in real time to improve the user experience.
[0036] This can solve the problems of high development cost, poor flexibility and large resource occupation in the prior art method of achieving multi-language support by configuring language packages. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] One or more embodiments are exemplarily illustrated by pictures in the corresponding drawings. These exemplifications do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings are represented as similar elements. Unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0038] Figure 1This is a flowchart of an AI-based semantic streaming multilingual translation method provided by the present invention;
[0039] Figure 2 This is a structural diagram of an AI-based semantic streaming multilingual translation system provided by the present invention;
[0040] Figure 3 It is a structural schematic diagram of an electronic device provided by the present invention. DETAILED DESCRIPTION
[0041] In order to facilitate the understanding of the present invention, the present invention will be described in more detail below with reference to the accompanying drawings and specific embodiments. It should be noted that when an element is described as being "fixed to" another element, it can be directly on the other element, or there can be one or more centered elements therebetween. When an element is described as being "electrically connected" to another element, it can be directly connected to the other element, or there can be one or more centered elements therebetween. The orientation or positional relationship indicated by the terms "upper", "lower", "inner", "outer", "bottom" etc. used in this specification is based on the orientation or positional relationship shown in the accompanying drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", "third", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0042] Unless otherwise defined, all technical and scientific terms used in this specification have the same meanings as those commonly understood by those skilled in the art to which this invention pertains. The terms used in this specification are intended only to describe specific embodiments and are not intended to limit the invention. The term "and / or" as used in this specification includes any and all combinations of one or more of the associated listed items.
[0043] In addition, the technical features involved in different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0044] First, here are some explanations of the terms that appear below:
[0045] AI Large-Scale Model: An AI model with large-scale parameters and powerful language understanding and generation capabilities, such as GPT and BERT.
[0046] User Interaction Layer: The part of the software or web page that directly interacts with the user, responsible for receiving user input and displaying information to the user.
[0047] AI Large-scale Model Service Layer: This layer integrates large AI models and provides language processing services for other layers.
[0048] Data Storage Layer: The part used to store data required for system operation, such as user language preferences, historical translation records, etc.
[0049] Language Recognition AI Model: An artificial intelligence model specifically designed to identify the language of a text. It uses deep learning algorithms to analyze text features to determine the language.
[0050] In one embodiment, Figure 1 As shown, the present invention provides an AI-based semantic streaming multilingual translation method, which is applied to a semantic streaming multilingual translation system. The semantic streaming multilingual translation system includes: a user interaction layer, an AI (Artificial Intelligence) large model service layer, and a data storage layer; the method includes:
[0051] S1. The user interaction layer monitors the input of specific input boxes in real time, collects the input of specific input boxes and the content to be translated on the target interface, obtains the text data to be translated, and sends it to the AI large model service layer;
[0052] S2. The AI large model service layer calls the preset AI translation model to translate the received text data to obtain the translation result, returns the translation result to the user interaction layer, and stores the translation result in the data storage layer;
[0053] S3. The user interaction layer updates the target interface based on the translation results returned by the AI large model service layer, realizing language switching.
[0054] In this embodiment, a semantic streaming multilingual translation method based on AI is provided, including: the user interaction layer monitors the input of a specific input box in real time, collects the input of the specific input box and the content to be translated of the target interface, obtains the text data to be translated, and sends it to the AI large model service layer; the AI large model service layer calls the preset AI translation model to translate the received text data to obtain the translation result, returns the translation result to the user interaction layer, and stores the translation result in the data storage layer; the user interaction layer completes the target interface update display based on the translation result returned by the AI large model service layer to achieve language switching. Therefore, the present invention realizes the system-level integration of dynamic translation and target interface update through the three-layer architecture design of the user interaction layer, the AI large model service layer, and the data storage layer, deeply applies the AI large model to the multilingual switching of the target interface without the need to configure a static language package, and triggers the translation process in real time through the semantic streaming processing method, from input completion, recognition, translation, and updating of the target interface, to achieve dynamic and continuous multilingual switching, rather than relying on batch loading of static language packages. Therefore, the semantic streaming multilingual translation method based on AI provided by the present invention has the following technical effects:
[0055] Reduce development costs: There is no need to develop and maintain multiple language packs, significantly reducing the workload and time costs of developers.
[0056] Improved flexibility: New languages can be quickly supported. As long as the AI model supports the language, multi-language switching can be achieved.
[0057] Reduced resource usage: No need to store large numbers of language packs, saving storage space for software and web pages. This is especially suitable for resource-constrained scenarios such as mobile applications.
[0058] Real-time translation updates: For dynamically changing text content, such as real-time chat messages, language switching can be performed in real time to improve the user experience.
[0059] This can solve the problems of high development cost, poor flexibility and large resource occupation in the prior art method of achieving multi-language support by configuring language packages.
[0060] The present invention uses an AI-based semantic streaming multilingual translation method. Semantic streaming refers to a system that triggers the translation process (input completion → recognition → translation → update of the target interface) in real time using a streaming processing method based on the semantics of the user input (target language text), achieving dynamic and continuous multilingual switching, rather than relying on batch loading of static language packages. The core features of semantic streaming include real-time (input is processed immediately), semantic-driven (automatically determining the target language based on the user's input intent), and streaming interaction (an uninterrupted continuous translation experience).
[0061] In one embodiment, in step S1, the user interaction layer monitors the input of a specific input box in real time, collects the input of the specific input box and the content to be translated on the target interface, obtains the text material to be translated, and sends it to the AI big model service layer.
[0062] Specifically, the user interaction layer serves as the interactive interface between the user and the target interface, and is used to monitor the input behavior of a specific input box in real time. Once the user interaction layer captures the user's input in a specific input box, it immediately extracts the user's input text and collects and organizes it together with various elements to be translated in the target interface to obtain the text data to be translated and send it to the AI big model service layer.
[0063] The target interface includes a software interface or a web page interface. In various embodiments of the present invention, a web page interface is used as an example for description. The operations on the software interface are similar to those on the web page interface. Therefore, the operations on the software interface can refer to the operations on the web page interface.
[0064] The way to capture the completion of user input in a specific input box is to detect that the Enter key is pressed or the specific input box loses focus.
[0065] The content to be translated on the target interface includes: various elements to be translated on the target interface, wherein the various elements to be translated include menu bar text, button text and / or prompt information.
[0066] Specifically, in step S1, the user interaction layer monitors the input of a specific input box in real time, collects the input of the specific input box and the content to be translated on the target interface, obtains the text data to be translated, and sends it to the AI large model service layer; specifically, it includes:
[0067] S11. Use web development tools to locate the input box and various elements to be translated on the target interface through DOM operations (for example, JavaScript, Vue.js, and React's "document.querySelectorAll" / custom instructions), add a unique identifier to the input box in the HTML web page ("id="translate-input""), and obtain the location and content of the input box through "document.getElementById".
[0068] S12. Identify a specific input box, locate all input boxes by traversing the DOM tree, or specify a specific input box by a custom tag (for example, "data-translate-input="true"").
[0069] S13. The user interaction layer embeds an event listener in the webpage interface to monitor input behavior in a specific input box. The event listener uses JavaScript's "onkeypress" function to monitor whether the Enter key is pressed and / or "onblur" to monitor whether the specific input box loses focus. If the "onkeypress" function monitors whether the Enter key is pressed and / or the "onblur" function monitors whether the specific input box loses focus, the user's input in the specific input box is detected to be complete.
[0070] S14, collect static text of HTML webpage, use "document.getElementsByTagName" to traverse all tags, extract elements containing text, and the elements containing text include " <button>”、" ”.
[0071] S15. After extracting the text, set specific tags for the user input text and the elements to be translated, and encapsulate them into the text data to be translated in JSON format.
[0072] Specifically, custom attributes are added to the elements to be translated during development. User input text and DOM elements marked with "data-translate="true"" are precisely filtered using "document.querySelectorAll([data-translate="true"])"; the user input text and various elements to be translated on the target interface are encapsulated in JSON format to generate the text data to be translated.
[0073] The user input text and various elements to be translated in the target interface are encapsulated in JSON format to obtain the text data to be translated in JSON format. The implementation method is as follows:
[0074] This invention uses JSON format to encapsulate user input text and elements to be translated, and distinguishes data types by fields to ensure that the AI large model service layer can accurately identify and process them. The specific structure is as follows:
[0075] {
[0076] "user_input": "Chinese text entered by the user", / / Chinese content entered by the user in a specific input box "static_texts": [ / / A collection of English static text elements in software / web pages
[0077] {"element_id":"menu_about", / / unique identifier of the element (such as the ID of the menu bar "About")
[0078] "text":"About", / / English text to be translated
[0079] "element_type":"menu" / / element type (optional, such as menu / button / tooltip)},{"element_id":"button_submit",
[0080] "text":"Submit",
[0081] "element_type":"button"}],
[0082] "other_inputs":[ / / User input in other locations (such as chat box, search box, etc., if any) {"element_id":
[0083] "chat_input_123","text":"Hello", / / English content in other input boxes (if any)
[0084] "element_type":"chat"}],
[0085] "software_type":"ecommerce" / / Software type (e.g., e-commerce / social / tools, used for translation optimization)
[0086] S16. Send the text material to be translated to the AI big model service layer based on the HTTP / HTTPS protocol through "fetch" or "XMLHttpRequest".
[0087] In addition, for HTML web pages without input boxes, the present invention adds an independent input box by positioning it through CSS in the software or HTML web page. In order not to interfere with the original layout, the independent input box can be fixed in the upper right corner of the target interface; and a "placeholder" is set to prompt the user to enter the target language example (for example, "Enter the target language text to switch languages").
[0088] In one embodiment, in step S2, the AI big model service layer calls the preset AI translation model to translate the received text material to be translated to obtain a translation result, returns the translation result to the user interaction layer, and stores the translation result in the data storage layer.
[0089] Specifically, the preset AI translation models include language recognition AI models and large language models. For example, language recognition AI models include deep learning models such as fastText or CLD3 (lightweight) and XLM-RoBERTa (high-precision). Large language models include Transformer architecture large language models.
[0090] Therefore, the AI large model service layer of the present invention integrates the Transformer architecture large language model and the language recognition AI model specifically for language recognition. The AI large model service layer is used to translate the received text materials to obtain the translation results and return the translation results to the user interaction layer. At the same time, it interacts with the data storage layer, reads the historical translation data stored in the data storage layer for translation optimization, and transmits the new translation result data and user preference data to the data storage layer for storage.
[0091] To integrate the language recognition AI model with the large language model, the present invention uses an application programming interface (API) (e.g., OpenAI's ChatGPTAPI) to implement functional integration. The user inputs text to the language recognition AI model, which outputs the target language code (e.g., "zh" for Chinese). The target language code and the text to be translated are then passed to the large language model, which then calls the translation interface. Specifically, the code is: specify "prompt="Translate the following text into {target language}: {content to be translated}"".
[0092] Specifically, in step S2, the AI large model service layer calls the preset AI translation model to translate the received text material to obtain the translation result, returns the translation result to the user interaction layer, and stores the translation result in the data storage layer. Specifically, it includes:
[0093] S21. The AI large model service layer first calls the language recognition AI model to determine the target language from the text material to be translated.
[0094] Specifically, the AI big model service layer calls the language recognition AI model; the language recognition AI model is based on a deep learning algorithm, and on this basis further adds analysis of the character features, vocabulary patterns and / or grammatical structure information of the user input text in the text material to be translated to determine the target language.
[0095] For example, when the user input text in the text material to be translated is a text containing Japanese characteristic words such as "こんにちは", the language recognition AI model can quickly determine that the target language is Japanese.
[0096] The character feature analysis method is as follows:
[0097] Statistical character sets (for example, Japanese includes Hiragana, Katakana, and Kanji; Arabic is written from right to left) use One-Hot encoding or Embedding vectors to represent characters. For example: Kana such as "あ" and "い" are detected and determined to be Japanese; etc. Arabic letters, it is determined to be Arabic.
[0098] The analysis of vocabulary patterns is as follows:
[0099] Extract high-frequency words (for example, French "le" and "la" are definite articles, and German "der" and "die" are definite articles) and match language-specific word combinations using n-gram models (for example, bigrams). For example, if the input text contains "le chat" (French for "cat"), it is recognized as French.
[0100] The analysis method for the grammatical structure is as follows:
[0101] Analyze the order of sentence components (for example, in Japanese, the subject-object-verb order is "subject-object-verb", and in English, it is "subject-verb-object"). Determine the language type through a syntactic parsing tree (for example, dependency syntactic analysis). Model training: Use a large-scale multilingual corpus (such as OPUS) to train a classifier, output the language probability distribution (for example, P(Japanese)=0.95, P(Chinese)=0.05), and take the highest probability as the target language.
[0102] The multilingual classification model based on deep learning does not require a predefined language pack and automatically learns language features through training data.
[0103] S22, the AI large model service layer further calls a large language model to perform text translation on the text to be translated, generating a translation result that matches the target language; specifically including:
[0104] The AI large model service layer calls a large language model and, based on the target language and context, performs real-time translation on the text to be translated, generating a translation result that matches the target language.
[0105] For example, in real time, translate the English "Settings" in the menu bar into Chinese "设置".
[0106] Furthermore, during the translation process, the AI large model service layer interacts with the data storage layer at the same time, reads the historical translation data stored in the data storage layer for translation optimization, and then combines the context to generate a high-quality translation result that matches the target language.
[0107] For example, for the text of the "Send Message" button in a social software, the model will refer to the historical translation data and the common translation methods in the social scenario and accurately translate it into "发送消息".
[0108] In the present invention, the data storage layer is used to store the user's language preferences, historical translation data records, and translation optimization data for elements of different target interfaces (such as different software target interfaces or web page target interfaces), etc. These data not only help to improve the accuracy and efficiency of translation but also provide a more personalized multilingual switching service for users.
[0109] The content stored in the data storage layer includes user preferences, historical translation data records, and optimization data, where:
[0110] User preferences include the default setting of the target language, font size preference, and / or translation style (such as formal / spoken).
[0111] Historical translation data records include the user input text, corresponding translation results, and / or interaction timestamps.
[0112] Optimized data, including customized translations of target interface elements (such as fixedly translating "Settings" as "设置" instead of "设定") and optimal translation methods for high-frequency words.
[0113] The storage methods in the data storage layer include structured storage and cloud storage. Structured storage uses a SQL database (e.g., MySQL) or a NoSQL database (e.g., MongoDB), and stores data in separate tables according to user ID and software ID. Cloud storage is deployed on a cloud server (e.g., AWS S3, Alibaba Cloud OSS) and supports cross-device synchronization; or local storage (e.g., "localStorage" of the browser, applicable to web applications).
[0114] To improve translation accuracy and efficiency, the AI large model service layer of the present invention adopts a context optimization mechanism and a customized translation mechanism. Among them:
[0115] 1. Context optimization mechanism: When translating, the translation method in the same context in the historical translation data record is preferably adopted (e.g., in a chat scenario, "Hi" is translated as "嗨" instead of "你好").
[0116] 2. Customized translation mechanism: When inputting the text data to be translated into the large language model, the software type (such as e-commerce / social) is simultaneously passed in, so that it calls the corresponding optimized data (e.g., "Checkout" in e-commerce is fixedly translated as "结账").
[0117] S23. The AI large model service layer returns the translation result to the user interaction layer and stores the translation result in the data storage layer. <According to the unique identifier of the input box in step S11 ("id="translate-input""), directly replace its "value" attribute so that the translated text is accurately displayed in the input box, ensuring the correct position. The specific code is:
[0123] "document.getElementById("translate-input").value=translation text".
[0124] Therefore, in order to update the translation content according to the original position and style of the target interface element, the present invention associates the original text with the translation result through "element_id" or DOM reference.
[0125] For example, when extracting text, log " < / button> <button id="login-btn"> Login< / button> ", after translation, the text content of "#login-btn" is replaced with "Login".
[0126] In this way, the original language is not deleted, but the text node of the element is directly covered (for example, "element.textContent = translated text"), retaining the original HTML structure and style.
[0127] In addition, the user interaction layer of the present invention is also provided with layout adaptation technology, which includes dynamic style adjustment, elastic layout and overflow processing.
[0128] The specific methods for dynamic style adjustment are as follows:
[0129] Measure the original text width before translation (element.getBoundingClientRect().width), and calculate the target text width after translation. If it exceeds the container:
[0130] Set "white-space:normal" or "word-wrap:break-word" to achieve automatic line wrapping.
[0131] Font scaling: Use JavaScript to dynamically adjust the font size (for example, "element.style.fontSize = `${Math.max(12, original font size * original text width / translated width)}px").
[0132] The specific methods of elastic layout are as follows:
[0133] Use CSS Flexbox or Grid to allow elements to automatically adjust space allocation (for example, when the translated text is too long, adjacent elements will compress margins or wrap).
[0134] Overflow handling is as follows:
[0135] For text that cannot be adapted, add ellipsis ("text-overflow:ellipsis") and display the full translation through a tooltip.
[0136] The present invention uses an AI-based semantic streaming multilingual translation method. Semantic streaming refers to a system that triggers the translation process (input completion → recognition → translation → update of the target interface) in real time using a streaming processing method based on the semantics of the user input (target language text), achieving dynamic and continuous multilingual switching, rather than relying on batch loading of static language packages. The core features of semantic streaming include real-time (input is processed immediately), semantic-driven (automatically determining the target language based on the user's input intent), and streaming interaction (an uninterrupted continuous translation experience).
[0137] The present invention provides an AI-based semantic streaming multilingual translation method that can achieve zero delay. To achieve zero delay, the present invention adopts the following technical means:
[0138] 1. Streaming processing: The request is triggered immediately after the user completes the input (not sent character by character in real time to reduce network overhead).
[0139] 2. Caching mechanism: High-frequency translation results (such as menu and button text) are cached locally and directly read during secondary loading without repeated API calls.
[0140] 3. Asynchronous processing: The target interface update is executed asynchronously with the translation request to avoid blocking user interaction (e.g. displaying the loading status first and then refreshing the target interface after the translation is completed).
[0141] This invention provides an AI-based semantic streaming multilingual translation method. This method achieves system-level integration of dynamic translation and target interface updates through a three-layer architecture design consisting of a user interaction layer, an AI large model service layer, and a data storage layer. This method deeply applies the AI large model to multilingual switching of the target interface without the need to configure static language packages. Its core technology lies in:
[0142] Eliminate pre-built language resources: Use a dynamic AI translation engine to avoid language pack storage and maintenance.
[0143] Achieve real-time semantic adaptation: Automatically adjust target UI elements based on context, cultural characteristics, and device environment.
[0144] Supports multi-language mixed input: accurately identifies language types and performs delay-free conversion.
[0145] Avoid regional setting dependency: Users do not need to manually switch languages, the system dynamically adapts.
[0146] Based on the same inventive concept, Figure 2 As shown, the present invention further provides an AI-based semantic streaming multilingual translation system 100, which is applied to the AI-based semantic streaming multilingual translation method described in any of the above embodiments. The AI-based semantic streaming multilingual translation system 100 includes: a user interaction layer 10, an AI large model service layer 20 and a data storage layer 30, wherein:
[0147] The user interaction layer 10 is used to monitor the input of a specific input box in real time, collect the input of the specific input box and the content to be translated on the target interface, obtain the text data to be translated, and send it to the AI large model service layer 20;
[0148] The AI large model service layer 20 is used to call the preset AI translation model to translate the received text material to obtain a translation result, return the translation result to the user interaction layer 10, and store the translation result in the data storage layer 30;
[0149] The user interaction layer 10 is also used to update the target interface and display it according to the translation results, thereby achieving language switching.
[0150] In this embodiment, an AI-based semantic streaming multilingual translation system is provided, including: a user interaction layer, an AI large model service layer and a data storage layer, wherein: the user interaction layer is used to monitor the input of a specific input box in real time, collect the input of the specific input box and the content to be translated of the target interface, obtain the text material to be translated, and send it to the AI large model service layer; the AI large model service layer is used to call the pre-AI translation model to translate the received text material to be translated to obtain a translation result, return the translation result to the user interaction layer, and store the translation result in the data storage layer; the user interaction layer is also used to complete the update and display of the target interface based on the translation result to realize language switching.
[0151] Therefore, the present invention realizes the system-level integration of dynamic translation and target interface update through the three-layer architecture design of user interaction layer, AI large model service layer, and data storage layer. The AI large model is deeply applied to the multi-language switching of the target interface without the need to configure static language packages. The translation process is triggered in real time through semantic streaming processing. From input completion, recognition, translation, to updating the target interface, dynamic and continuous multi-language switching is achieved, rather than relying on batch loading of static language packages. Therefore, the AI-based semantic streaming multi-language translation method provided by the present invention has the following technical effects:
[0152] Reduce development costs: There is no need to develop and maintain multiple language packs, significantly reducing the workload and time costs of developers.
[0153] Improved flexibility: New languages can be quickly supported. As long as the AI model supports the language, multi-language switching can be achieved.
[0154] Reduced resource usage: No need to store large numbers of language packs, saving storage space for software and web pages. This is especially suitable for resource-constrained scenarios such as mobile applications.
[0155] Real-time translation updates: For dynamically changing text content, such as real-time chat messages, language switching can be performed in real time to improve the user experience.
[0156] This can solve the problems of high development cost, poor flexibility and large resource occupation in the prior art method of achieving multi-language support by configuring language packages.
[0157] In one embodiment, the user interaction layer 10 is used to monitor the input of a specific input box in real time, collect the input of the specific input box and the content to be translated on the target interface, obtain the text material to be translated, and send it to the AI big model service layer 20.
[0158] Specifically, the user interaction layer 10 serves as the interactive interface between the user and the target interface, and is used to monitor the input behavior of a specific input box in real time. Once the user interaction layer captures the user's input completion in a specific input box, it immediately extracts the user input text and collects and organizes it together with various elements to be translated in the target interface to obtain the text data to be translated, and sends it to the AI big model service layer 20.
[0159] The target interface includes a software interface or a web page interface. In various embodiments of the present invention, a web page interface is used as an example for description. The operations on the software interface are similar to those on the web page interface. Therefore, the operations on the software interface can refer to the operations on the web page interface.
[0160] The way to capture the completion of user input in a specific input box is to detect that the Enter key is pressed or the specific input box loses focus.
[0161] The content to be translated on the target interface includes: various elements to be translated on the target interface, wherein the various elements to be translated include menu bar text, button text and / or prompt information.
[0162] Specifically, the user interaction layer 10 is used to monitor the input of a specific input box in real time, collect the input of the specific input box and the content to be translated on the target interface, obtain the text data to be translated, and send it to the AI large model service layer 20. Specifically, it includes:
[0163] Use web development tools to locate the input box and various elements to be translated on the target interface through DOM operations (for example, JavaScript, Vue.js, and React's "document.querySelectorAll" / custom instructions), add a unique identifier to the input box in the HTML web page ("id="translate-input""), and use "document.getElementById" to obtain the location and content of the input box.
[0164] Identify a specific input box, locate all input boxes by traversing the DOM tree, or specify a specific input box through a custom tag (for example, "data-translate-input="true"").
[0165] The user interaction layer embeds an event listener in the web page interface to monitor input behavior in specific input boxes. The event listener uses JavaScript's "onkeypress" to monitor whether the Enter key is pressed and / or "onblur" to monitor whether the specific input box loses focus. If the "onkeypress" listener monitors the Enter key being pressed and / or the "onblur" listener monitors the specific input box losing focus, the user's input in the specific input box is captured.
[0166] Collect static text from HTML pages, use "document.getElementsByTagName" to traverse all tags, and extract elements containing text, including " <button>”、" ”.
[0167] After extracting the text, specific tags are set for the user input text and the elements to be translated, and then encapsulated into the text data to be translated in JSON format.
[0168] Specifically, custom attributes are added to the elements to be translated during development. User input text and DOM elements marked with "data-translate="true"" are precisely filtered using "document.querySelectorAll([data-translate="true"])"; the user input text and various elements to be translated on the target interface are encapsulated in JSON format to generate the text data to be translated.
[0169] The text material to be translated is sent to the AI big model service layer 20 based on the HTTP / HTTPS protocol through "fetch" or "XMLHttpRequest".
[0170] In addition, for HTML web pages without input boxes, the present invention adds an independent input box by positioning it through CSS in the software or HTML web page. In order not to interfere with the original layout, the independent input box can be fixed in the upper right corner of the target interface; and a "placeholder" is set to prompt the user to enter the target language example (for example, "Enter the target language text to switch languages").
[0171] In one embodiment, the AI large model service layer 20 is used to call a preset AI translation model to translate the received text material to obtain a translation result, return the translation result to the user interaction layer 10, and store the translation result in the data storage layer 30.
[0172] Specifically, the preset AI translation models include language recognition AI models and large language models. For example, language recognition AI models include deep learning models such as fastText or CLD3 (lightweight) and XLM-RoBERTa (high-precision). Large language models include Transformer architecture large language models.
[0173] Therefore, the AI large model service layer 20 of the present invention integrates a large language model with a Transformer architecture and a language recognition AI model specifically for language recognition. The AI large model service layer 20 is used to translate the received text to be translated, obtain the translation results, and return the translation results to the user interaction layer. It also interacts with the data storage layer 30, reading historical translation data stored there for translation optimization, and transmitting new translation results and user preference data to the data storage layer 30 for storage.
[0174] To integrate the language recognition AI model with the large language model, the present invention uses an application programming interface (API) (e.g., OpenAI's ChatGPTAPI) to implement functional integration. The user inputs text to the language recognition AI model, which outputs the target language code (e.g., "zh" for Chinese). The target language code and the text to be translated are then passed to the large language model, which then calls the translation interface. Specifically, the code is: specify "prompt="Translate the following text into {target language}: {content to be translated}"".
[0175] Specifically, the AI large model service layer 20 is used to call the preset AI translation model to translate the received text material to obtain a translation result, return the translation result to the user interaction layer 10, and store the translation result in the data storage layer 30; specifically, it includes:
[0176] The AI large model service layer 20 first calls the language recognition AI model to determine the target language from the text material to be translated.
[0177] Specifically, the AI big model service layer calls the language recognition AI model; the language recognition AI model is based on a deep learning algorithm, and on this basis further adds analysis of the character features, vocabulary patterns and / or grammatical structure information of the user input text in the text material to be translated to determine the target language.
[0178] The character feature analysis method is as follows:
[0179] Statistical character sets (for example, Japanese includes Hiragana, Katakana, and Kanji; Arabic is written from right to left) use One-Hot encoding or Embedding vectors to represent characters. For example: Kana such as "あ" and "い" are detected and determined to be Japanese; etc. Arabic letters, it is determined to be Arabic.
[0180] The analysis of vocabulary patterns is as follows:
[0181] Extract high-frequency words (for example, French "le" and "la" are definite articles, and German "der" and "die" are definite articles) and match language-specific word combinations using n-gram models (for example, bigrams). For example, if the input text contains "le chat" (French for "cat"), it is recognized as French.
[0182] The analysis method for grammatical structure is as follows:
[0183] Analyze the order of sentence components (e.g., in Japanese, the subject-object-verb order is "subject-object-verb", while in English it is "subject-verb-object"), and determine the language type through a syntactic parsing tree (e.g., dependency syntactic analysis). Model training: Use a large-scale multilingual corpus (e.g., OPUS) to train a classifier, output the language probability distribution (e.g., P(Japanese)=0.95, P(Chinese)=0.05), and take the highest probability as the target language.
[0184] The multilingual classification model based on deep learning does not require a predefined language pack and automatically learns language features through training data.
[0185] The AI large model service layer 20 then calls the large language model to perform text translation on the text to be translated, generating a translation result that matches the target language; specifically including:
[0186] The AI large model service layer 20 calls the large language model to perform real-time translation on the text to be translated according to the target language and context, generating a translation result that matches the target language.
[0187] Furthermore, during the translation process, the AI large model service layer 20 interacts with the data storage layer 30 at the same time, reads the historical translation data stored in the data storage layer 30 for optimizing translation, and then combines the context to generate a high-quality translation result that matches the target language.
[0188] In the present invention, the data storage layer 30 is used to store the user's language preferences, historical translation data records, and translation optimization data for different target interface (e.g., different software target interfaces or web page target interfaces) elements, etc. These data not only help improve the accuracy and efficiency of translation, but also provide a more personalized multilingual switching service for users.
[0189] The content stored in the data storage layer 30 includes user preferences, historical translation data records, and optimization data, where:
[0190] User preferences include the default setting of the target language, font size preference, and / or translation style (such as formal / spoken).
[0191] Historical translation data records include the user input text, corresponding translation results, and / or interaction timestamps.
[0192] Optimization data includes customized translations of target interface elements (such as always translating "Settings" as "设置" instead of "设定") and the optimal translation methods for high-frequency words.
[0193] The storage methods of the data storage layer include structured storage and cloud storage. Structured storage uses a SQL database (e.g., MySQL) or a NoSQL database (e.g., MongoDB) to store data in separate tables according to user ID and software ID. Cloud storage is deployed on a cloud server (e.g., AWS S3, Alibaba Cloud OSS) and supports cross-device synchronization; or local storage (e.g., the "localStorage" of a browser, applicable to Web applications).
[0194] To improve translation accuracy and efficiency, the AI large model service layer 20 of the present invention adopts a context optimization mechanism and a customized translation mechanism. Among them:
[0195] 1. Context optimization mechanism: When translating, the translation method in the same context in the historical translation data record is preferentially adopted (e.g., in a chat scenario, "Hi" is translated as "嗨" instead of "你好").
[0196] 2. Customized translation mechanism: When inputting the text data to be translated into the large language model, the software type (e.g., e-commerce / social) is also passed in, so that it can call the corresponding optimized data (e.g., in e-commerce, "Checkout" is fixedly translated as "结账").
[0197] The AI large model service layer 20 returns the translation result to the user interaction layer 10 and stores the translation result in the data storage layer 30.
[0198] Specifically, the AI large model service layer 20 returns the translation result to the user interaction layer 10, and at the same time, it also transmits the translation result and user preference data to the data storage layer 30 for storage, so that the data storage layer 30 stores the translation result as a historical translation data record.
[0199] In one embodiment, the user interaction layer 10 is further configured to complete the update display of the target interface according to the translation result and implement language switching.
[0200] Specifically, the user interaction layer 10 updates the target interface according to the translation result based on the original position and style of the target interface elements according to the translation result returned by the AI large model service layer 20, and redisplays the translated menu bar text, button text, and / or user input text to complete the whole process of language switching.
[0201] The user interaction layer 10 accurately displays the content in the translation result on the target interface. The specific implementation method is as follows:
[0202] According to the unique identifier of the input box ("id="translate-input””), directly replace its "value" attribute, so that the translated text is accurately displayed in the input box and the position is ensured to be accurate. The specific code is as follows:
[0203] "document.getElementById("translate-input").value=translation text".
[0204] Therefore, in order to update the translation content according to the original position and style of the target interface element, the present invention associates the original text with the translation result through "element_id" or DOM reference.
[0205] For example, when extracting text, log " < / button> <button id="login-btn"> Login< / button> ", after translation, the text content of "#login-btn" is replaced with "Login".
[0206] In this way, the original language is not deleted, but the text node of the element is directly covered (for example, "element.textContent = translated text"), retaining the original HTML structure and style.
[0207] In addition, the user interaction layer 10 of the present invention is also provided with layout adaptation technology, which includes dynamic style adjustment, elastic layout and overflow processing.
[0208] The specific methods for dynamic style adjustment are as follows:
[0209] Measure the original text width before translation (element.getBoundingClientRect().width), and calculate the target text width after translation. If it exceeds the container:
[0210] Set "white-space:normal" or "word-wrap:break-word" to achieve automatic line wrapping.
[0211] Font scaling: Use JavaScript to dynamically adjust the font size (for example, "element.style.fontSize = `${Math.max(12, original font size * original text width / translated width)}px").
[0212] The specific methods of elastic layout are as follows:
[0213] Use CSS Flexbox or Grid to allow elements to automatically adjust space allocation (for example, when the translated text is too long, adjacent elements will compress margins or wrap).
[0214] Overflow handling is as follows:
[0215] For text that cannot be adapted, add ellipsis ("text-overflow:ellipsis") and display the full translation through a tooltip.
[0216] The present invention provides an AI-based semantic streaming multilingual translation system that can achieve zero delay. To achieve zero delay, the present invention adopts the following technical means:
[0217] 1. Streaming processing: The request is triggered immediately after the user completes the input (not sent character by character in real time to reduce network overhead).
[0218] 2. Caching mechanism: High-frequency translation results (such as menu and button text) are cached locally and directly read during secondary loading without repeated API calls.
[0219] 3. Asynchronous processing: The target interface update is executed asynchronously with the translation request to avoid blocking user interaction (e.g. displaying the loading status first and then refreshing the target interface after the translation is completed).
[0220] The present invention provides an AI-based semantic streaming multilingual translation system. This system achieves system-level integration of dynamic translation and target interface updates through a three-tier architecture design consisting of a user interaction layer, an AI large model service layer, and a data storage layer. This system deeply applies the AI large model to multilingual switching of the target interface without the need to configure static language packages. Its core technology lies in:
[0221] Eliminate pre-built language resources: Use a dynamic AI translation engine to avoid language pack storage and maintenance.
[0222] Achieve real-time semantic adaptation: Automatically adjust target UI elements based on context, cultural characteristics, and device environment.
[0223] Supports multi-language mixed input: accurately identifies language types and performs delay-free conversion.
[0224] Avoid regional setting dependency: Users do not need to manually switch languages, the system dynamically adapts.
[0225] It should be noted that the above-mentioned AI-based semantic streaming multilingual translation system embodiment and the method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment, and the technical features in the method embodiment are correspondingly applicable in the above-mentioned AI-based semantic streaming multilingual translation system embodiment, which will not be repeated here.
[0226] The present invention provides an AI-based semantic streaming multilingual translation method and / or an AI-based semantic streaming multilingual translation system, which can be applied to real-time translation scenarios such as software interfaces or web page interfaces.
[0227] The following are practical application scenarios of an AI-based semantic streaming multilingual translation method and / or an AI-based semantic streaming multilingual translation system provided by the present invention.
[0228] Application scenario 1: Multi-language switching for web applications.
[0229] For example, an online shopping website needs to support multiple languages such as English, Chinese, and Japanese.
[0230] The specific implementation process of application scenario 1 is as follows:
[0231] When a user opens the website, the default language is English.
[0232] The user enters a Chinese text in a specific input box on the website, for example: "I want to buy a piece of clothing."
[0233] After the user interaction layer detects that the user has completed input in a specific input box, it extracts the user input text and collects text information such as product names, descriptions, menu bars, buttons, etc. on the web page and sends it to the AI large model service layer.
[0234] The AI big model service layer calls the language recognition AI model to determine that the target language is Chinese, and then calls the big language model to translate the English text into Chinese text.
[0235] The user interaction layer receives the translated Chinese text and re-updates the website page display, displaying product information, menu bars, buttons and other text in Chinese.
[0236] Application scenario 2: Multi-language switching for mobile applications.
[0237] For example, a social mobile application has users distributed all over the world and needs to support communication in multiple languages.
[0238] The specific implementation process of application scenario 2 is as follows:
[0239] When a user opens a social mobile application, the social mobile application is displayed in the user's mobile phone system language (assuming Spanish) by default according to the user's mobile phone system language setting.
[0240] The user enters a French text in a specific input box of a social mobile application, for example: "Comment va?".
[0241] After the user interaction layer detects that the user has completed input in a specific input box, it extracts the message content and other elements to be translated (such as fixed prompts in the chat interface) of the user input text and sends them together with the user input text to the AI large model service layer.
[0242] The AI large model service layer translates Spanish messages and other content to be translated into French and returns them to the user interaction layer.
[0243] The user interaction layer displays the translated French messages and interface element texts on the chat interface, completing the language switching display.
[0244] Based on the same concept, the present invention also provides an electronic device, such as Figure 3 As shown, electronic device 900 includes: memory 902, processor 901, and one or more computer programs stored in memory 902 and executable on processor 901. Memory 902 and processor 901 are coupled together via a bus system 903. When one or more computer programs are executed by processor 901, the following steps of an AI-based semantic streaming multi-language translation method provided in an embodiment of the present invention are implemented:
[0245] S1. The user interaction layer monitors the input of specific input boxes in real time, collects the input of specific input boxes and the content to be translated on the target interface, obtains the text data to be translated, and sends it to the AI large model service layer;
[0246] S2. The AI large model service layer calls the preset AI translation model to translate the received text data to obtain the translation result, returns the translation result to the user interaction layer, and stores the translation result in the data storage layer;
[0247] S3. The user interaction layer updates the target interface based on the translation results returned by the AI large model service layer, realizing language switching.
[0248] The methods disclosed in the above embodiments of the present invention can be applied to or implemented by processor 901. Processor 901 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be performed by hardware integrated logic circuits or software instructions within processor 901. Processor 901 can be a general-purpose processor, a DSP, or other programmable logic device, a discrete gate or transistor logic device, or discrete hardware components. Processor 901 can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of the present invention can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules within the decoding processor. The software modules can be located in a storage medium located in memory 902. Processor 901 reads information from memory 902 and, in conjunction with its hardware, completes the steps of the above method.
[0249] It can be understood that the memory 902 in the embodiment of the present invention may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic random access memory (FRAM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical disk storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage device; the volatile memory can be random access memory (RAM), by way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), etc. Memory), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), SyncLink Dynamic Random Access Memory (SLDRAM), Direct Rambus Random Access Memory (DRRAM).The memories described in the embodiments of the present invention are intended to include, but are not limited to, these and any other suitable types of memories.
[0250] In the present invention, the electronic device 900 may be any device equipped with a processor and having processing capabilities, such as a smart phone, a tablet computer, a PDA, a laptop computer, a server, a workstation, or other electronic device equipped with a processor.
[0251] It should be noted that the above-mentioned electronic device embodiment and method embodiment belong to the same concept, and their specific implementation process is detailed in the method embodiment, and the technical features in the method embodiment are applicable to the electronic device embodiment, which will not be repeated here.
[0252] In addition, in an exemplary embodiment, the present invention further provides a storage medium, specifically a computer-readable storage medium, for example, including a memory 902 storing a computer program. The computer storage medium stores one or more programs of an AI-based semantic streaming multilingual translation method. When the one or more programs of the AI-based semantic streaming multilingual translation method are executed by the processor 901, the following steps of the AI-based semantic streaming multilingual translation method provided in the embodiment of the present invention are implemented:
[0253] S1. The user interaction layer monitors the input of specific input boxes in real time, collects the input of specific input boxes and the content to be translated on the target interface, obtains the text data to be translated, and sends it to the AI large model service layer;
[0254] S2. The AI large model service layer calls the preset AI translation model to translate the received text data to obtain the translation result, returns the translation result to the user interaction layer, and stores the translation result in the data storage layer;
[0255] S3. The user interaction layer updates the target interface based on the translation results returned by the AI large model service layer, realizing language switching.
[0256] It should be noted that the AI-based semantic streaming multilingual translation method program embodiment on the above-mentioned computer-readable storage medium and the method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment, and the technical features in the method embodiment are correspondingly applicable in the embodiment of the above-mentioned computer-readable storage medium, which will not be repeated here.
[0257] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0258] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Under the concept of the present invention, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations in different aspects of the present invention as described above. For the sake of simplicity, they are not provided in detail. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in this field should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A semantic streaming multilingual translation method based on AI, characterized in that: Applied to an AI-based semantic streaming multi-language translation system, the AI-based semantic streaming multi-language translation system includes a user interaction layer, an AI large model service layer, and a data storage layer; the method includes: The user interaction layer monitors the input of a specific input box in real time, collects the input of the specific input box and the content to be translated on the target interface, obtains the text material to be translated, and sends it to the AI large model service layer; The AI large model service layer calls a preset AI translation model to translate the received text material to be translated to obtain a translation result, returns the translation result to the user interaction layer, and stores the translation result in the data storage layer; The user interaction layer completes the target interface update display according to the translation result to achieve language switching.
2. The AI-based semantic streaming multilingual translation method according to claim 1, characterized in that: The user interaction layer monitors the input of a specific input box in real time, collects the input of the specific input box and the content to be translated on the target interface, obtains the text data to be translated, and sends it to the AI large model service layer, including: The user interaction layer serves as the interactive interface between the user and the target interface, monitoring the input behavior of a specific input box in real time. Once the user completes input in the specific input box, the user input text is immediately extracted, and the user input text is collected and organized together with various elements to be translated in the target interface to obtain text data to be translated, which is sent to the AI large model service layer. The content to be translated in the target interface includes various elements to be translated in the target interface.
3. The AI-based semantic streaming multilingual translation method according to claim 2, characterized in that: The collecting and arranging the user input text and various elements to be translated in the target interface to obtain text data to be translated includes: encapsulating the user input text and various elements to be translated in the target interface in JSON format to obtain text data to be translated in JSON format.
4. The AI-based semantic streaming multilingual translation method according to claim 1, characterized in that: The preset AI translation model includes a language recognition AI model and a large language model; The AI large model service layer calls a preset AI translation model to translate the received text material to be translated to obtain a translation result, including: The AI large model service layer first calls the language recognition AI model to determine the target language from the text material to be translated; The AI large model service layer then calls the large language model to perform text translation on the text material to be translated, and generates a translation result that matches the target language.
5. The AI-based semantic streaming multilingual translation method according to claim 4, characterized in that: The AI large model service layer first calls the language recognition AI model to determine the target language from the text material to be translated, including: The AI large model service layer calls the language recognition AI model; The language recognition AI model is based on a deep learning algorithm to analyze the character features, vocabulary patterns and / or grammatical structure information of the user input text in the text material to be translated to determine the target language.
6. The AI-based semantic streaming multilingual translation method according to claim 4, characterized in that: The AI large model service layer calls a preset AI translation model to translate the received text material to be translated to obtain a translation result, and further includes: The AI big model service layer interacts with the data storage layer at the same time, reads the historical translation data stored in the data storage layer for optimizing translation, and then combines the context to generate high-quality translation results that match the target language.
7. The AI-based semantic streaming multilingual translation method according to claim 1, characterized in that: The user interaction layer completes the target interface update display according to the translation result and realizes language switching, including: The user interaction layer updates and displays the target interface according to the translation result, in accordance with the original position and style of the target interface elements, and completes the language switch.
8. A semantic streaming multilingual translation system based on AI, characterized by: The AI-based semantic streaming multilingual translation method according to any one of claims 1 to 7 is applied to the AI-based semantic streaming multilingual translation system, comprising: a user interaction layer, an AI large model service layer, and a data storage layer, wherein: The user interaction layer is used to monitor the input of a specific input box in real time, collect the input of the specific input box and the content to be translated on the target interface, obtain the text data to be translated, and send it to the AI large model service layer; The AI large model service layer calls a preset AI translation model to translate the received text material to be translated to obtain a translation result, returns the translation result to the user interaction layer, and stores the translation result in the data storage layer; The user interaction layer is further used to update and display the target interface according to the translation result to achieve language switching.
9. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and running on the processor, wherein when the computer program is executed by the processor, the AI-based semantic streaming multilingual translation method according to any one of claims 1 to 7 is implemented.
10. A storage medium, characterized in that: The storage medium stores a program of an AI-based semantic streaming multilingual translation method, and when the program of the AI-based semantic streaming multilingual translation method is executed by a processor, the AI-based semantic streaming multilingual translation method according to any one of claims 1 to 7 is implemented.