Intelligent caching and switching method and system for offline speech synthesis

By employing an intelligent caching and switching method for offline speech synthesis, the response latency and network dependency issues of in-vehicle speech synthesis systems are resolved. This achieves efficient cache management and seamless switching, thereby improving the real-time performance and availability of speech synthesis in in-vehicle scenarios.

CN122120337APending Publication Date: 2026-05-29DONGFENG MOTOR GRP

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
DONGFENG MOTOR GRP
Filing Date
2026-02-06
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing in-vehicle speech synthesis systems rely on online TTS engines, resulting in high response latency, strong network dependence, and inefficient caching strategies, which cannot meet the real-time and continuous requirements of in-vehicle scenarios.

Method used

An intelligent caching and switching method based on offline speech synthesis is adopted, which achieves efficient caching and mode switching through high-frequency text recognition, priority queue management, multi-dimensional network quality switching and double buffer verification technology.

Benefits of technology

Significantly improved the real-time performance and availability of speech synthesis in in-vehicle scenarios, with cache hit rate increased to 91%, response time shortened to 200ms, enhanced network adaptability, and optimized user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122120337A_ABST
    Figure CN122120337A_ABST
Patent Text Reader

Abstract

The application provides an intelligent caching and switching method and system for offline speech synthesis, and relates to the technical field of vehicle-mounted voice interaction.The method obtains high-frequency request text through a high-frequency text recognition module combined with statistical analysis and LSTM prediction, an intelligent caching management module adopts a priority pre-synthesis and LRU-K partition caching strategy to realize efficient storage of audio, an online / offline switching control module dynamically switches the synthesis mode based on network quality multidimensional threshold and realizes smooth transition through double buffering, and a caching verification module ensures caching effectiveness through a double verification mechanism of timestamp, SHA-256 hash and version compatibility.The application solves the problems of traditional online TTS response delay, network failure and simple caching strategy, significantly improves the real-time performance, availability and caching reliability of speech synthesis in a vehicle-mounted scenario, and is suitable for efficient deployment of TTS services in a vehicle networking cloud platform.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of in-vehicle voice interaction technology, and in particular to an intelligent caching and switching method and system for offline voice synthesis. Background Technology

[0002] With the development of vehicle networking technology, voice interaction has become the core interaction method of in-vehicle systems. Text-to-speech (TTS) technology, as a key component of voice interaction, directly impacts user experience. Existing in-vehicle speech synthesis systems primarily rely on online TTS engines, requesting cloud servers to generate audio and then feeding it back to the user. However, this approach has the following significant drawbacks:

[0003] 1. The response latency issue is prominent: online synthesis requires multiple steps such as text uploading, cloud processing, and audio transmission, with an average response time of over 800ms. In the in-vehicle scenario, users have extremely high requirements for the real-time performance of voice feedback, and latency will cause interactive stuttering, which will seriously affect the user experience.

[0004] 2. Strong network dependence: When the vehicle is in a tunnel, mountainous area or other area without network or with weak network, the online TTS engine cannot work at all, causing the voice interaction function to be interrupted and unable to meet the continuous use requirements of in-vehicle scenarios.

[0005] 3. Inefficient and rudimentary caching strategies: Existing caching mechanisms mostly rely on exact text matching for caching, without considering the frequency of text access, timeliness, and consistency of synthesized content. This results in a cache hit rate of less than 50%, and a large number of invalid caches occupy storage resources. In some cases, cached content may even expire or not match the current request.

[0006] To address the aforementioned issues, existing technologies attempt to introduce offline TTS engines as a supplement. However, these technologies lack intelligence in switching between online and offline modes and lack effective verification mechanisms for cache management, resulting in problems such as switching stutters and cache invalidation. Therefore, there is an urgent need for an intelligent caching and switching method and system for offline speech synthesis to achieve low latency and high availability of speech synthesis in in-vehicle scenarios. Summary of the Invention

[0007] This invention aims to solve at least one of the technical problems existing in the prior art, and proposes an intelligent caching and switching method and system for offline speech synthesis.

[0008] In a first aspect, embodiments of the present invention provide an intelligent caching and switching method for offline speech synthesis, comprising:

[0009] Based on the frequency of historical voice and text requests, high-frequency text is identified. When the frequency of high-frequency text exceeds a preset threshold, a voice pre-synthesis instruction is sent.

[0010] Online pre-synthesis of high-frequency text is performed based on a priority queue. The cache space is managed. When the cache occupancy rate is greater than a preset threshold, an eviction mechanism is triggered. Independent cache partitions are divided according to the text features of high-frequency text. When the cache is not hit, offline TTS engine synthesis is triggered.

[0011] The round-trip time and packet loss rate indicators during voice network transmission are obtained. Based on the round-trip time and packet loss rate indicators, an online-to-offline switching strategy, an offline-to-online switching strategy, and a weak network transition strategy are used to synthesize offline voice.

[0012] The synthesized speech is verified for time, content, and version compatibility. If the verification is successful, the speech is cached.

[0013] Furthermore, based on the frequency of historical speech text requests, high-frequency texts are identified. When the number of high-frequency texts exceeds a preset threshold, a speech pre-synthesis instruction is sent. The specific method includes: using a sliding window mechanism to count the frequency of text requests within the window period, setting a quantization threshold for high-frequency texts, predicting high-frequency texts within a preset time period using an LSTM time-series prediction model, extracting text features from the high-frequency texts, and sending a pre-synthesis trigger instruction when the number of high-frequency text candidate sets exceeds a preset threshold.

[0014] Furthermore, the priority calculation formula is priority = α1 × text frequency + α2 × semantic complexity; α1 + α2 = 1; wherein the semantic complexity is calculated based on the text length and the number of slots, and the cache partition includes navigation partition, vehicle control partition, entertainment partition and semantic domain partition, and each partition is managed independently.

[0015] Furthermore, when a cache miss occurs, the offline TTS engine is triggered for synthesis. Specifically, when a cache miss occurs, a synthesis request is sent to the offline TTS engine, which then loads the local speech library.

[0016] Furthermore, based on the round-trip time and packet loss rate metrics, an online-to-offline switching strategy is employed to synthesize offline speech. Specific methods include:

[0017] When the number of consecutive online requests times out or the network quality fails to meet the standard for a preset duration, the online mode will be switched to offline mode. The timeout threshold is 500ms, and the standard for network quality failure is a round-trip time greater than 500ms or a packet loss rate greater than 10%.

[0018] Furthermore, based on the round-trip time and packet loss rate indicators, an offline-to-online strategy is adopted to synthesize offline speech. The specific method includes: when the network is restored, if the online requests meet the success condition of a round-trip time of less than 300ms for a preset number of consecutive times, the offline mode is switched back to the online mode.

[0019] Furthermore, based on the round-trip time and packet loss rate metrics, a weak network transition strategy is employed to synthesize offline speech. Specific methods include:

[0020] When the network is in a weak state with a round-trip time of 300ms to 500ms and a packet loss rate of 5% to 10%, a parallel online synthesis and cache query method is adopted, prioritizing the use of cached audio to ensure seamless interaction.

[0021] Furthermore, the synthesized speech is verified for time, content, and version compatibility. Specific methods include:

[0022] Add a timestamp generated by a monotonic clock to each cached audio file, set a cache expiration period, and automatically mark it as invalid and trigger re-synthesis when it expires; perform SHA-256 hash calculation on the pre-synthesized text and the user's current request text, compare the two hash values, and if they are inconsistent, it is determined that the content does not match and triggers re-synthesis; when the TTS engine version is updated, automatically batch check the compatibility of existing cached audio with the new engine, and incompatible cached items will be marked and batch re-synthesized.

[0023] Secondly, this invention also discloses an intelligent caching and switching system for offline speech synthesis, comprising: a high-frequency text recognition module, an intelligent cache management module, an online and offline state switching module, and a cache verification module; wherein:

[0024] The high-frequency text recognition module is used to recognize high-frequency text based on the frequency of historical voice text requests. When the frequency of high-frequency text exceeds a preset threshold, a voice pre-synthesis instruction is sent.

[0025] The intelligent cache management module is used to perform online pre-synthesis of high-frequency text based on a priority queue, manage the cache space, trigger an eviction mechanism when the cache occupancy rate exceeds a preset threshold, divide the high-frequency text into independent cache partitions according to the text features, and trigger offline TTS engine synthesis when the cache is not hit.

[0026] The online and offline state switching module is used to obtain round-trip time and packet loss rate indicators during voice network transmission, and synthesize offline voice based on the round-trip time and packet loss rate indicators, using online-to-offline switching strategy, offline-to-online switching strategy and weak network transition strategy;

[0027] The cache verification module is used to verify the synthesized speech based on time, content, and version compatibility. If the verification is successful, the speech is cached.

[0028] Thirdly, the present invention also discloses an electronic device, comprising:

[0029] One or more processors;

[0030] Memory, used to store one or more programs;

[0031] When the one or more programs are executed by the one or more processors, the one or more processors implement the intelligent caching and switching method.

[0032] This invention provides an intelligent caching and switching method for offline speech synthesis. This method uses a high-frequency text recognition module combined with statistical analysis and LSTM prediction to obtain high-frequency request text. An intelligent cache management module employs a priority pre-synthesis and LRU-K partitioned caching strategy to achieve efficient audio storage. An online / offline switching control module dynamically switches the synthesis mode based on multi-dimensional network quality thresholds and achieves a smooth transition through double buffering. A cache verification module ensures cache validity through a dual verification mechanism using timestamps, SHA-256 hashes, and version compatibility. This invention solves the problems of traditional online TTS response latency, network outage failure, and rudimentary caching strategies, significantly improving the real-time performance, availability, and cache reliability of speech synthesis in in-vehicle scenarios. It is suitable for the efficient deployment of TTS services in vehicle-to-everything (V2X) cloud platforms.

[0033] Compared with the prior art, the present invention has the following beneficial effects:

[0034] 1. Significantly improved real-time performance: Through high-frequency text pre-synthesis and cached calls, the online response time is reduced from 800ms to 200ms, and the response time in offline mode is further reduced, fully meeting the real-time interaction requirements of in-vehicle scenarios;

[0035] 2. Enhanced network adaptability: Based on a dynamic switching mechanism with multi-dimensional network quality thresholds, seamless integration of online / offline modes is achieved. The availability of high-frequency text synthesis reaches 85% in offline states, completely solving the network dependency problem.

[0036] 3. Cache reliability optimization: Improve the accuracy of high-frequency text recognition through LSTM prediction, and combine it with the LRU-K partition caching strategy to increase the cache hit rate to 91%. The dual verification mechanism controls the invalid cache rate to within 5%, ensuring the timeliness and accuracy of cached content.

[0037] 4. User experience optimization: The dual-buffering smooth transition technology avoids audio stuttering or interruption during mode switching. The implementation variants of hardware acceleration and adaptive caching strategies can be adapted to vehicle hardware with different performance levels, and have wide applicability. Attached Figure Description

[0038] Figure 1 A flowchart illustrating an intelligent caching and switching method for offline speech synthesis provided in an embodiment of the present invention;

[0039] Figure 2This is a schematic diagram illustrating the dynamic switching of synthesis modes based on network status in the method provided in this embodiment of the invention;

[0040] Figure 3 This is a structural block diagram of an intelligent caching and switching system for offline speech synthesis provided in an embodiment of the present invention;

[0041] Figure 4 This is a structural block diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0042] To enable those skilled in the art to better understand the technical solutions of the present invention, exemplary embodiments of the present invention are described below in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0043] Where there is no conflict, the various embodiments of the present invention and the features thereof may be combined with each other.

[0044] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.

[0045] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used herein, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof is not excluded. Terms such as “connected” or “linked” are not limited to physical or mechanical connections but can include electrical connections, whether direct or indirect.

[0046] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having the meaning consistent with their meaning in the context of the relevant art and the invention, and will not be interpreted as having an idealized or overly formal meaning unless expressly so defined herein.

[0047] In the technical solution of this invention, the collection, storage, use, processing, transmission, provision, and disclosure of user personal information all comply with relevant laws and regulations and do not violate public order and good morals. The use of user data in this technical solution follows relevant national laws and regulations (e.g., the "Information Security Technology - Personal Information Security Specification"). For example: appropriate measures are taken for personal information access control; restrictions are imposed on the display of personal information; the purpose of using personal information does not exceed the scope of direct or reasonable association; and explicit identity targeting is eliminated when using personal information to avoid precisely locating a specific individual.

[0048] To address at least one of the technical problems existing in the aforementioned related technologies, this embodiment provides an intelligent caching and switching method and system for offline speech synthesis.

[0049] This implementation discloses an intelligent caching and switching method for offline speech synthesis, such as... Figure 1 ,include:

[0050] S100. Based on the historical frequency of voice text requests, high-frequency text is identified. When the frequency of high-frequency text exceeds a preset threshold, a speech pre-synthesis instruction is sent. Specifically, in this embodiment, based on the historical frequency of voice text requests, high-frequency text is identified. When the frequency of high-frequency text exceeds a preset threshold, a speech pre-synthesis instruction is sent. The specific method includes: using a sliding window mechanism to count the frequency of text requests within the window period, setting a quantization threshold for high-frequency text, predicting high-frequency text within a preset time period using an LSTM time-series prediction model, extracting text features of high-frequency text, and sending a pre-synthesis trigger instruction when the number of high-frequency text candidate sets exceeds a preset threshold.

[0051] Specifically, the first step is to count the frequency of text requests: a sliding window mechanism is preferred, with a window period of 7 days to count the frequency of text requests, and a threshold of ≥100 times per month is set as the quantification threshold for high-frequency text.

[0052] Then, LSTM prediction modeling is performed: an LSTM time series prediction model is constructed, with input parameters including historical request time series (such as the distribution of users' daily usage time periods) and contextual semantic features (such as the semantic association of commands such as "navigate to the company" and "adjust the temperature" in the in-vehicle scenario). The model prediction accuracy is ≥92%, achieving accurate prediction of high-frequency text in the next 24 hours.

[0053] Next, text feature extraction is performed: the TF-IDF algorithm is used to extract keywords from high-frequency text, such as "navigation", "air conditioning", and "music", to provide a classification basis for subsequent cache partitioning;

[0054] Finally, the instruction triggering mechanism is as follows: when the number of high-frequency text candidate sets reaches 50 or more, a pre-synthesis triggering instruction is sent to the intelligent cache management module.

[0055] Through step S100 of this embodiment, accurate identification of frequently requested texts from users is achieved, providing a basis for pre-synthesis.

[0056] S200. Online pre-synthesis of high-frequency text is performed based on priority queues. The cache space is managed. When the cache occupancy rate is greater than the preset threshold, an eviction mechanism is triggered. Independent cache partitions are divided according to the text features of high-frequency texts. When the cache is not hit, offline TTS engine synthesis is triggered.

[0057] In this embodiment, the priority calculation formula is priority = α1 × text frequency + α2 × semantic complexity; α1 + α2 = 1; wherein the semantic complexity is calculated based on text length and number of slots, and the cache partition includes navigation partition, vehicle control partition, entertainment partition and semantic domain partition, and each partition is managed independently.

[0058] Specifically, this implementation adopts a pre-synthesis scheduling strategy. First, the pre-synthesis priority is calculated based on text frequency and semantic complexity. The priority calculation formula is priority = 0.6 × text frequency + 0.4 × semantic complexity. The semantic complexity is comprehensively evaluated based on text length and number of slots to ensure that high-value texts are pre-synthesized first. To avoid occupying network and system resources during user interaction periods, the pre-synthesis operation is performed after the vehicle is turned off or during periods of network idle time, and is completed through background tasks.

[0059] This embodiment employs the LRU-K (K=2) cache eviction algorithm, retaining only the text and audio that have been accessed twice most recently, ensuring that cache resources are tilted towards frequently accessed content. This embodiment divides the cache into independent cache partitions according to the semantic domain of the text, such as navigation partitions, vehicle control partitions, entertainment partitions, etc., and each partition is managed independently, which greatly improves cache retrieval efficiency. This embodiment sets a cache occupancy rate of ≥80% as the eviction trigger threshold, and automatically evicts low-value cache items that meet the LRU-K rule when the cache space is insufficient.

[0060] In this embodiment, when a user initiates a text request and the cache is not hit, a synthesis request is immediately sent to the offline TTS engine, and the offline engine loads the local pre-built speech library to complete the audio synthesis.

[0061] In step S200 of this embodiment, online pre-synthesis and offline caching resources are coordinated to achieve efficient audio storage and scheduling.

[0062] S300. Obtain round-trip time and packet loss rate indicators during voice network transmission, and synthesize offline voice based on the round-trip time and packet loss rate indicators using an online-to-offline switching strategy, an offline-to-online switching strategy, and a weak network transition strategy;

[0063] Specifically, such as Figure 2, monitor the network quality, collect network performance metrics in real time, including round-trip time (RTT) and packet loss rate, as the basis for determining mode switching; when the online request times out continuously for 3 times (the timeout threshold is set to 500ms), or the network quality fails to meet the standard for 10s continuously (RTT>500ms or packet loss rate>10%), the system automatically switches from online to offline mode; when the network recovers and the online requests are successfully satisfied with RTT<300ms for 2 consecutive times, the system switches back to online mode; when the network is in a weak network state where 300ms<RTT≤500ms and 5%≤packet loss rate≤10%, adopt the method of parallel online synthesis and cache query, and preferentially use cached audio to ensure that the interaction is imperceptible. During the switching process, the double-buffer queue technology is adopted to achieve 50ms cross-fading processing of the audio stream, avoiding problems such as audio stuttering, breaking, or abrupt switching.

[0064] The S300 step disclosed in this embodiment dynamically adjusts the synthesis mode based on the real-time network quality to ensure seamless connection between the online and offline modes.

[0065] S400. Verify the synthesized speech for time, content, and version compatibility, and cache the speech after successful verification.

[0066] In this embodiment, the method of time verification includes: verifying the synthesized speech for time, content, and version compatibility. The specific method includes: adding a timestamp generated by a monotonic clock to each cached audio, setting the cache validity period, and automatically marking it as invalid and triggering re-synthesis when it times out; the method of content verification includes: performing SHA-256 hash calculation on the pre-synthesized text and the user's current request text, comparing the two hash values, and if they are inconsistent, it is determined that the content does not match and re-synthesis is triggered; the method of version compatibility verification includes: when the TTS engine version is updated, automatically batch verify the compatibility of the existing cached audio with the new engine, and the incompatible cache items will be marked and batch re-synthesized.

[0067] In this embodiment, for high-frequency access texts (≥10 accesses per day), a high-frequency verification cycle of once every 30 minutes is set, and for low-frequency texts, a verification cycle of once every 2 hours is set to balance the system resource consumption while ensuring the cache validity.

[0068] The S400 step disclosed in this embodiment ensures the timeliness, accuracy, and compatibility of the cached audio through a multiple verification mechanism.

[0069] To better understand this embodiment, this embodiment takes the in-vehicle navigation scenario as an example to detail the specific implementation process of the present invention:

[0070] For high-frequency text recognition: The system uses the text frequency statistics unit to find that the monthly access frequency of texts such as "navigate to the company", "avoid congestion" and "navigate to the route home" all exceed 100 times. Combined with the LSTM model, it predicts that the request probability of these texts is high during the morning rush hour. The TF-IDF algorithm is used to extract keywords such as "navigation" and "congestion" to form a high-frequency text list and trigger the pre-synthesis instruction.

[0071] Pre-synthesis and caching: When the vehicle is turned off at night and the network is idle, the intelligent cache management module performs online pre-synthesis of high-frequency text based on priority. Among them, "navigation to the company" has the highest combined score in terms of text frequency and semantic complexity, and is prioritized for synthesis. The synthesized audio is stored in the "navigation partition" cache according to semantic classification and is managed using the LRU-K algorithm.

[0072] User interaction trigger: During the morning rush hour, a user initiates a "navigate to the company" request. The network quality monitoring unit detects in real time that the current network RTT=600ms and packet loss rate=12%, which meets the switching conditions for online to offline.

[0073] Mode switching and cache retrieval: The online / offline switching control module triggers offline mode and simultaneously queries the cache partition. The cache verification module quickly completes time verification (generation time is 1 hour away from the current time, not timed out) and content verification (SHA-256 hash value is consistent) to confirm that the cache is valid.

[0074] Audio playback: The cached audio is output to the in-vehicle player through a double-buffered queue, achieving voice playback without delay or stuttering.

[0075] This embodiment provides an intelligent caching and switching method for offline speech synthesis. This method uses a high-frequency text recognition module combined with statistical analysis and LSTM prediction to obtain high-frequency request text. An intelligent cache management module employs a priority pre-synthesis and LRU-K partitioned caching strategy to achieve efficient audio storage. An online / offline switching control module dynamically switches the synthesis mode based on multi-dimensional network quality thresholds and achieves a smooth transition through double buffering. A cache verification module ensures cache validity through a dual verification mechanism using timestamps, SHA-256 hashes, and version compatibility. This invention solves the problems of traditional online TTS response latency, network outage failure, and rudimentary caching strategies, significantly improving the real-time performance, availability, and cache reliability of speech synthesis in in-vehicle scenarios. It is suitable for the efficient deployment of TTS services in vehicle-to-everything (V2X) cloud platforms.

[0076] Based on the same inventive concept, embodiments of the present invention also provide an intelligent caching and switching system for offline speech synthesis, such as... Figure 3 It includes: a high-frequency text recognition module, an intelligent cache management module, an online and offline status switching module, and a cache verification module; among which:

[0077] The high-frequency text recognition module is used to recognize high-frequency text based on the frequency of historical voice text requests. When the frequency of high-frequency text exceeds a preset threshold, a voice pre-synthesis instruction is sent.

[0078] The intelligent cache management module is used to perform online pre-synthesis of high-frequency text based on a priority queue, manage the cache space, trigger an eviction mechanism when the cache occupancy rate exceeds a preset threshold, divide the high-frequency text into independent cache partitions according to the text features, and trigger offline TTS engine synthesis when the cache is not hit.

[0079] The online and offline state switching module is used to obtain round-trip time and packet loss rate indicators during voice network transmission, and synthesize offline voice based on the round-trip time and packet loss rate indicators, using online-to-offline switching strategy, offline-to-online switching strategy and weak network transition strategy;

[0080] The cache verification module is used to verify the synthesized speech based on time, content, and version compatibility. If the verification is successful, the speech is cached.

[0081] The specific working methods of the high-frequency text recognition module, intelligent cache management module, online and offline state switching module, and cache verification module have been described in detail in the above methods, and will not be repeated here in this embodiment.

[0082] Based on the same inventive concept, embodiments of the present invention also provide an electronic device. Figure 4 This is a structural block diagram of an electronic device provided in an embodiment of the present invention. Figure 4 As shown, an embodiment of the present invention provides an electronic device including: one or more processors 101, a memory 102, and one or more I / O interfaces 103. The memory 102 stores one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement any of the intelligent caching and switching methods described in the above embodiments to achieve information interaction between the processor and the memory.

[0083] The processor 101 is a device with data processing capabilities, including but not limited to a central processing unit (CPU); the memory 102 is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), and flash memory (FLASH); the I / O interface (read / write interface) 103 is connected between the processor 101 and the memory 102, and can realize information interaction between the processor 101 and the memory 102, including but not limited to a data bus (Bus).

[0084] In some embodiments, the processor 101, memory 102, and I / O interface 103 are interconnected via bus 104, and thus connected to other components of the computing device.

[0085] In some embodiments, the one or more processors 101 include a field-programmable gate array.

[0086] This invention also provides a computer-readable medium. The computer-readable medium stores a computer program, which, when executed by a processor, implements the steps of any of the intelligent caching and switching methods described in the above embodiments. The computer-readable storage medium can be volatile or non-volatile.

[0087] This invention also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code. When the computer-readable code is run in the processor of an electronic device, the processor in the electronic device executes the above-described intelligent caching and switching method.

[0088] Those skilled in the art will understand that all or some of the steps, systems, and apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software can be distributed on a computer-readable storage medium, which may include computer storage media (or non-transitory media) and communication media (or transient media).

[0089] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable program instructions, data structures, program modules, or other data. Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is known to those skilled in the art that communication media typically contain computer-readable program instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

[0090] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.

[0091] The computer program instructions used to perform the operations of this invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing state information from the computer-readable program instructions. This electronic circuitry can execute the computer-readable program instructions to implement various aspects of the invention.

[0092] The computer program product described herein can be implemented specifically through hardware, software, or a combination thereof. In one alternative embodiment, the computer program product is specifically embodied in a computer storage medium; in another alternative embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.

[0093] Various aspects of the present invention are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.

[0094] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

[0095] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.

[0096] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction, which contains one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0097] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for illustrative purposes only and should be construed as such, and is not intended to be limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in conjunction with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in conjunction with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of the invention as set forth in the appended claims.

Claims

1. A method for intelligent caching and switching in offline speech synthesis, characterized in that, include: Based on the frequency of historical voice and text requests, high-frequency text is identified. When the frequency of high-frequency text exceeds a preset threshold, a voice pre-synthesis instruction is sent. Online pre-synthesis of high-frequency text is performed based on a priority queue. The cache space is managed. When the cache occupancy rate is greater than a preset threshold, an eviction mechanism is triggered. Independent cache partitions are divided according to the text features of high-frequency text. When the cache is not hit, offline TTS engine synthesis is triggered. The round-trip time and packet loss rate indicators during voice network transmission are obtained. Based on the round-trip time and packet loss rate indicators, an online-to-offline switching strategy, an offline-to-online switching strategy, and a weak network transition strategy are used to synthesize offline voice. The synthesized speech is verified for time, content, and version compatibility. If the verification is successful, the speech is cached.

2. The intelligent caching and switching method according to claim 1, characterized in that, Based on the historical frequency of voice and text requests, high-frequency text is identified. When the number of high-frequency texts exceeds a preset threshold, a voice pre-synthesis instruction is sent. The specific method includes: using a sliding window mechanism to count the frequency of text requests within the window period, setting a quantization threshold for high-frequency texts, predicting high-frequency texts within a preset time period using an LSTM time-series prediction model, extracting text features from high-frequency texts, and sending a pre-synthesis trigger instruction when the number of high-frequency text candidate sets exceeds a preset threshold.

3. The intelligent caching and switching method according to claim 1, characterized in that, The priority calculation formula is: priority = α1 × text frequency + α2 × semantic complexity; α1 + α2 = 1; where the semantic complexity is calculated based on the text length and the number of slots. The cache partitions include navigation partition, vehicle control partition, entertainment partition, and semantic domain partition, and each partition is managed independently.

4. The intelligent caching and switching method according to claim 1, characterized in that, When a cache miss occurs, the offline TTS engine is triggered to synthesize the text. The specific methods include: when a cache miss occurs, a synthesis request is sent to the offline TTS engine, and the offline engine loads the local speech library.

5. The intelligent caching and switching method according to claim 1, characterized in that, Based on the round-trip time and packet loss rate metrics, an online-to-offline switching strategy is employed to synthesize offline speech. The specific method includes: When the number of consecutive online requests times out or the network quality fails to meet the standard for a preset duration, the online mode will be switched to offline mode. The timeout threshold is 500ms, and the standard for network quality failure is a round-trip time greater than 500ms or a packet loss rate greater than 10%.

6. The intelligent caching and switching method according to claim 1, characterized in that, Based on the round-trip time and packet loss rate indicators, an offline-to-online strategy is adopted to synthesize offline speech. The specific method includes: when the network is restored, if the online requests meet the success condition of a round-trip time of less than 300ms for a preset number of consecutive times, the offline mode is switched back to the online mode.

7. The intelligent caching and switching method according to claim 1, characterized in that, Based on the round-trip time and packet loss rate metrics, a weak network transition strategy is employed to synthesize offline speech. Specific methods include: When the network is in a weak state with a round-trip time of 300ms to 500ms and a packet loss rate of 5% to 10%, a parallel online synthesis and cache query method is adopted, prioritizing the use of cached audio to ensure seamless interaction.

8. The intelligent caching and switching method according to claim 1, characterized in that, The synthesized speech is verified for time, content, and version compatibility. Specific methods include: Add a timestamp generated by a monotonic clock to each cached audio file, set a cache expiration period, and automatically mark it as invalid and trigger re-synthesis when it expires; perform SHA-256 hash calculation on the pre-synthesized text and the user's current request text, compare the two hash values, and if they are inconsistent, it is determined that the content does not match and triggers re-synthesis; when the TTS engine version is updated, automatically batch check the compatibility of existing cached audio with the new engine, and incompatible cached items will be marked and batch re-synthesized.

9. An intelligent caching and switching system for offline speech synthesis, characterized in that, include: The module includes a high-frequency text recognition module, an intelligent cache management module, an online / offline status switching module, and a cache verification module; among which: The high-frequency text recognition module is used to recognize high-frequency text based on the frequency of historical voice text requests. When the frequency of high-frequency text exceeds a preset threshold, a voice pre-synthesis instruction is sent. The intelligent cache management module is used to perform online pre-synthesis of high-frequency text based on a priority queue, manage the cache space, trigger an eviction mechanism when the cache occupancy rate exceeds a preset threshold, divide the high-frequency text into independent cache partitions according to the text features, and trigger offline TTS engine synthesis when the cache is not hit. The online and offline state switching module is used to obtain round-trip time and packet loss rate indicators during voice network transmission, and synthesize offline voice based on the round-trip time and packet loss rate indicators, using online-to-offline switching strategy, offline-to-online switching strategy and weak network transition strategy; The cache verification module is used to verify the synthesized speech based on time, content, and version compatibility. If the verification is successful, the speech is cached.

10. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the intelligent caching and switching method as described in any one of claims 1 to 8.