Method for optimizing memory occupied by word stock

By using time decay algorithm, prediction mechanism, priority control model and multi-threaded processing technology in the font library management system, the symbol priority is dynamically adjusted and the loading strategy is optimized, and the memory waste and response speed caused by improper symbol management in the existing technology is solved. Problems, efficient symbol management and rapid response are achieved.

CN119440845APending Publication Date: 2025-02-14深圳市云希谷科技有限公司
View PDF 15 Cites 0 Cited by

Patent Information

Application Number
CN202411566725.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-05
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

The existing technology is difficult to intelligently manage and load optimized symbols based on real-time situations, resulting in waste of memory resources and reduced response speed, especially in the case of limited memory, which is difficult to achieve efficient management of symbols.

Method used

By using a frequency algorithm based on time decay to calculate the initial priority of the symbol, and dynamically adjust the final priority of the symbol in combination with the prediction mechanism and priority regulation model, a multi-threaded parallel processing mechanism is used to manage the loading and compression of the symbols, and a dynamic time regularization algorithm is used. Perform symbol matching.

Benefits of technology

It realizes dynamic adjustment and gradual loading of symbol priorities, optimizes memory usage, improves the system's response speed and symbol matching accuracy, and enhances the system's response ability to user needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440845A_ABST
    Figure CN119440845A_ABST
Patent Text Reader

Abstract

The invention provides a method for optimizing memory occupied by a word stock, which realizes adaptive optimization of symbol loading through dynamic adjustment of symbol priorities and a progressive loading mechanism. The method comprises the following steps: calculating an initial priority of each symbol based on a time decay use frequency algorithm, and gradually loading the symbols; dynamically adjusting the final priority of the symbols based on the prediction model, and ensuring that common symbols are preferentially loaded; managing loading, compression and decompression tasks of symbols by adopting a multi-thread parallel processing mechanism; and matching user input fonts with stored symbols in a symbol library through a dynamic time warping (DTW) algorithm. According to the method, memory occupation is effectively reduced, the system response speed is increased, and the symbol matching accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of digital technology, and in particular to a method for optimizing the memory occupied by a font library. Background Art

[0002] With the popularization of computing devices and mobile devices, the demand for the use of fonts is growing, especially in scenarios with multi-language support, special symbols, and complex fonts. The loading and memory management of fonts has become an important technical challenge. Most of the existing font management methods use static loading, which results in common symbols and uncommon symbols occupying a large amount of memory resources, causing system resource waste, reduced response speed, and other problems. In addition, due to the characteristics of user input symbols such as frequency changes and different usage trends, it is difficult for existing technologies to intelligently manage and load optimization symbols according to real-time situations, especially when memory resources are limited. It is difficult to achieve efficient management of symbols. Therefore, there is an urgent need for an optimization method that can adaptively adjust symbol priority and loading strategies to solve technical problems such as excessive memory usage and symbol loading delays. Summary of the invention

[0003] The present invention provides a method for optimizing the memory occupied by a font library to solve the above technical problem.

[0004] The present invention provides a method for optimizing the memory occupied by a character library, comprising the following steps:

[0005] Step 1: Calculate the initial priority of each symbol based on the time-decayed usage frequency algorithm and perform progressive loading;

[0006] Step 2: Use a prediction mechanism to predict the usage probability of symbols based on their initial priority and perform progressive loading;

[0007] Step 3: Dynamically adjust the final priority of the symbol based on the priority regulation model;

[0008] Step 4: After the symbol library reaches the call cycle, the content of the symbol library is adjusted based on the priority control model;

[0009] Step 5: Manage the symbol loading, compression and decompression tasks through multi-threaded parallel processing mechanism;

[0010] Step 6: Use a dynamic time warping algorithm to match the user input glyph with the basic symbols stored in the symbol library.

[0011] Specifically, step 6 includes the following sub-steps:

[0012] (1) Extracting the curve features of the font input by the user;

[0013] (2) using the dynamic time warping (DTW) algorithm, the curve data of the input glyph is compared with the basic symbol curve stored in the symbol library;

[0014] (3) Calculate the similarity score between the input glyph and the basic symbol, and select the symbol with the highest similarity as the matching result.

[0015] Specifically, the calling cycle in step 4 is 5000 times.

[0016] Specifically, step 1 uses the following formula to calculate the symbol priority: priority P = α·Freq-β·Decay+γ·Cost+δ·Assoc+ε·Trend; where: Freq represents the frequency of use of the symbol; Decay represents the time interval since the symbol was last used; Cost represents the complexity of symbol loading; Assoc represents the correlation between the symbol and other symbols; Trend represents the usage trend of the symbol; α,

[0017] β, γ, δ and ε are coefficients that control the influence weight of each parameter;

[0018] Specifically, the value range of α is 0.1-1.0; the value range of β is 0.01-0.5; the value range of γ is 0.1-0.7; the value range of δ is 0.2-1.0; and the value range of ε is 0.1-0.9.

[0019] Specifically, the prediction mechanism uses the following formula to predict the usage probability of a symbol:

[0020] P next (t+1)=σ(W1·LSTM(h t ,x t )+W2·(α·Freq(t)+β·△T(t)+γ·Assoc(t)+∈·Trend(t))+b), where, P next (t+1): predict the probability that the symbol will be used at the future time point (t+1);

[0021] LSTM: Long Short-Term Memory Network;

[0022] σ: An activation function used to limit the output value to a reasonable range;

[0023] W1, W2: weight matrix to control the contribution of different features to prediction;

[0024] LSTM(h t , x t ): Based on the history of hidden state h t and the current input x t ;

[0025] b: A bias term that adjusts the output of the prediction model.

[0026] Specifically, the activation function includes the following two functions:

[0027] (1) Sigmoid activation function;

[0028] (2) ReLU activation function.

[0029] Specifically, the value range of the bias term b is [-1, 1].

[0030] Specifically, the Sigmoid activation function is used to limit the output value of the symbol usage probability to the range of [0,1];

[0031] The ReLU activation function is used to limit the output value of the symbol usage probability to the range of [0,∞).

[0032] The present invention provides a method for optimizing the memory occupied by a font library, which has the following beneficial effects:

[0033] 1. Dynamic adjustment of symbol priority: The initial priority of the symbol is calculated by using a frequency of use algorithm based on time decay, and the final priority of the symbol is dynamically adjusted in combination with a prediction model, thus realizing progressive loading and optimized management of symbols. This mechanism effectively reduces system response delays and ensures that high-frequency symbols are loaded first, thus improving the overall performance of the system.

[0034] 2. Memory occupancy optimization: The present invention reduces the memory occupancy of low-frequency symbols through a multi-threaded parallel processing mechanism and a progressive loading strategy, compresses or moves infrequently used symbols to secondary storage, thereby optimizing the use of memory resources and effectively reducing the memory burden of the system.

[0035] 3. Improved symbol matching efficiency: The Dynamic Time Warping (DTW) algorithm solves the problem of glyph changes caused by handwriting, input device differences, etc. The DTW algorithm can adaptively match the glyphs input by the user with the symbols in the symbol library, improving the accuracy and response speed of symbol matching.

[0036] 4. Predicting symbol usage needs: The symbol usage probability prediction based on the long short-term memory network (LSTM) model can load symbols that users will frequently use in advance, effectively improving the system's responsiveness to user needs and reducing delays in symbol loading.

[0037] 5. Flexible adaptation to scenario changes: The present invention combines multi-dimensional factors such as symbol usage frequency, time interval, relevance, usage trend, etc. to adjust priorities, ensuring the flexibility and adaptability of the symbol library in different usage scenarios, and further optimizing symbol management and loading strategies.

[0038] Through the above optimization strategy, the present invention significantly improves the efficiency of character library management, reduces memory usage, and enhances the accuracy of symbol matching and system response speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0040] Figure 1 A structural diagram of a method for optimizing the memory occupied by a font library provided by the present invention

[0041] Figure 2 This is a structural diagram of Embodiment 7 of the present invention. DETAILED DESCRIPTION

[0042] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Preferred embodiments of the present invention are provided in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive.

[0043] It should be noted that when an element is referred to as being "fixed to" another element, it may be directly on the other element or there may be a central element. When an element is considered to be "connected to" another element, it may be directly connected to the other element or there may be a central element at the same time. The terms "vertical", "horizontal", "left", "right" and similar expressions used herein are for illustrative purposes only.

[0044] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more related listed items.

[0045] In a specific implementation, the "system" mentioned specifically refers to a symbol library management architecture implemented by software logic. The architecture dynamically adjusts the priority, loading order and memory allocation of symbols to achieve the effect of optimizing the memory occupied by the font library. The system can dynamically adjust the size and content of the symbol library according to the usage of the symbols and the memory pressure. Therefore, the concept of "system" in the present invention is completely based on a logical architecture implemented by software, and does not involve any specific hardware device or hardware system. The functions of the system can be performed by conventional computing devices, such as computers, servers, smart terminals, etc. The entire "system" completes various functions by executing algorithms and logics for optimizing font library management, aiming to solve the problem of efficient use of memory resources in the font library management process.

[0046] Embodiment 1

[0047] See also Figure 1 This embodiment provides a method for optimizing the memory occupied by a font library, comprising the following steps:

[0048] Step 1: Calculate the initial priority of each symbol based on the time-decay frequency algorithm and perform progressive loading. The symbol priority calculation formula is: Priority P = α·Freq-β·Decay+γ·Cost+δ·Assoc+ε·Trend; where: Freq represents the frequency of symbol usage; Decay represents the time interval since the symbol was last used; Cost represents the complexity of symbol loading; Assoc represents the correlation between the symbol and other symbols; Trend represents the usage trend of the symbol; α, β, γ, δ and ε are coefficients that control the weight of each parameter;

[0049] Step 2: Use a prediction mechanism to predict the usage probability of symbols based on their initial priority and perform progressive loading;

[0050] Step 3: Dynamically adjust the final priority of the symbol based on the priority regulation model;

[0051] Step 4: After the symbol library reaches the preset 5000 call cycles, the content of the symbol library is adjusted based on the priority control model;

[0052] Step 5: Manage the symbol loading, compression and decompression tasks through multi-threaded parallel processing mechanism;

[0053] Step 6: Use a dynamic time warping algorithm to match the user input glyph with the basic symbols stored in the symbol library.

[0054] This embodiment can optimize memory usage and ensure that commonly used symbols are loaded first, thereby improving the system's response speed through dynamic adjustment of symbol priority and progressive loading mechanism. In addition, the efficiency of symbol loading and decompression is further improved by multi-threaded parallel processing of symbol loading tasks. The introduction of the dynamic time warping (DTW) algorithm enhances the accuracy of symbol matching. Even if the font entered by the user changes irregularly, it can accurately match the symbols in the symbol library, thereby improving the overall system performance.

[0055] Embodiment 2

[0056] This embodiment combines the dynamic adjustment of symbol priority with the progressive loading mechanism to achieve adaptive optimization of symbol loading, thereby ensuring efficient management of the symbol library and minimization of memory usage.

[0057] 1. The system uses a time-decay-based frequency-of-use algorithm to calculate the initial priority of each symbol. The priority calculation formula is as follows:

[0058] Priority P = α·Freq-β·Decay+γ·Cost+δ·Assoc+ε·Trend, where the meanings of the coefficients are as follows:

[0059] (1) Frequency of use (Freq)

[0060] Definition: Indicates the number of times a symbol is called in the system. The more frequently used a symbol is, the higher its priority will be. The symbol will be loaded into the cache first to ensure fast response when users call it frequently.

[0061] The value range of α is: 0.1-1.0; a smaller α value indicates that the symbol is rarely used and has a very low priority; a larger α value indicates that the symbol is a commonly used symbol in the system and has a very high priority.

[0062] (2) Time decay coefficient (Decay): Indicates the time interval since the symbol was last used. As the time that a symbol has not been called increases, the Decay value increases and the symbol priority gradually decreases to prevent it from occupying memory resources for a long time.

[0063] The value range of β is: 0.01-0.5; a smaller β value indicates that the symbol is used for a short time interval and the priority will not drop rapidly; a larger β value indicates that the symbol has not been used for a long time and the priority drops rapidly.

[0064] (3) Loading cost (Cost): Indicates the complexity of symbol loading, such as rendering time, memory usage, etc. Symbols with high loading costs usually require more system resources, so the priority will be adjusted dynamically according to the scene. The plus sign before Cost indicates that this parameter has a positive impact on the symbol priority, but this does not mean that high-cost symbols will definitely be loaded first. On the contrary, the role of the plus sign combined with the coefficient is to handle high-cost symbols more flexibly in the system to avoid excessive resource occupation.

[0065] The value range of γ is 0.1-0.7. A smaller γ value means that the system is more inclined to decide whether to load the symbol first based on the frequency, relevance or usage trend of the symbol, rather than focusing on its loading cost. When the γ value is larger, it means that the system pays more attention to the loading cost of the symbol. For complex symbols, even if the loading cost is higher, the system will still allocate more resources to ensure that it is loaded, rather than ignoring it.

[0066] (4) Symbol Assoc: The degree of association between a symbol and other symbols. Some symbols have a strong co-occurrence relationship with commonly used symbols and have a higher priority. Symbols with high association will be loaded together when related symbols are called.

[0067] δ value range: 0.2-1.0; a smaller δ means that the symbol has almost no correlation with other symbols and has a lower priority.

[0068] A larger δ indicates that the symbol is strongly correlated with other high-frequency symbols and has a very high priority.

[0069] (5) Usage Trend: reflects the recent usage frequency changes of symbols. When the usage frequency of a symbol increases in a short period of time, its priority can be increased and it can be loaded into the cache in advance to ensure that the symbol can respond in time.

[0070] A smaller ε value indicates that the frequency of symbol usage does not change much and the trend is weak; a larger ε value indicates that the frequency of symbol usage increases rapidly in a short period of time and needs to be loaded first.

[0071] This embodiment realizes adaptive optimization of symbol loading by combining dynamic adjustment of symbol priority with progressive loading mechanism, ensuring efficient management of symbol library and minimization of memory usage. This method enables the system to dynamically adjust the priority of symbols according to the usage of symbols, ensuring that high-frequency symbols are loaded first, while reducing the long-term memory usage of low-frequency symbols.

[0072] Specifically, by multiplying the coefficients (such as α, β, γ, δ, ε) with the parameters, fine control of symbol priority in different dimensions is achieved:

[0073] 1. Enhanced correlation between frequency of use (Freq) and priority: The α coefficient is used to control the impact of the frequency of use of symbols on priority. Symbols with high frequency of use (i.e., higher Freq values) will be multiplied by a larger α value, which greatly increases the priority and ensures that these symbols are loaded into the cache first, shortening the response time of user calls. On the contrary, the priority of low-frequency symbols is reduced accordingly, reducing the occupation of memory resources.

[0074] 2. Time decay (Decay) optimizes memory usage: The β coefficient controls the impact of the time interval since the symbol was last used on the priority. Symbols that have not been used for a long time will have a gradually increasing Decay value. After multiplying by the β coefficient, the symbol priority will be greatly reduced, preventing these symbols from occupying cache resources for a long time and optimizing memory usage.

[0075] 3. Loading cost (Cost) balances resource allocation: By adjusting the impact of loading cost through the γ coefficient, the system can dynamically adjust the symbol priority according to the complexity of symbol loading. Although high loading cost symbols are more complex in the system, in appropriate scenarios, Cost is multiplied by a larger γ value to ensure that more resources are allocated to load important symbols first when necessary. This design can prevent complex symbols from consuming too many system resources while not ignoring their importance.

[0076] 4. Symbol Associativity (Assoc) improves the efficiency of symbol linkage loading: By regulating the symbol association through the δ coefficient, the system can load other high-frequency symbols related to it when the symbol is called. The stronger the symbol association, the larger the δ value and the higher the priority, thereby accelerating the loading of linkage symbols and improving the overall system efficiency.

[0077] 5. Use Trend to respond to changes in market demand: The ε coefficient is used to capture the recent usage trend of symbols, and the priority of symbols can be quickly adjusted according to changes in usage frequency. Symbols with an increasing frequency of use in the recent period (i.e., higher Trend values) are multiplied by a larger ε value, and their priority is significantly increased, ensuring that the system loads these symbols into the cache in advance to meet dynamically changing usage needs. Symbol priority can be flexibly adjusted to ensure that high-frequency, complex, highly correlated symbols and symbols with an increasing usage trend can be loaded in a timely manner, while low-frequency, unused symbols are compressed and stored first. This design can significantly improve system response speed, optimize memory usage, and achieve reasonable allocation of resources.

[0078] Embodiment 3

[0079] The prediction mechanism of this embodiment uses a long short-term memory network (LSTM) to perform time series prediction on the usage of symbols. By analyzing the user's historical input data, the model can predict the symbols that may be frequently used in the future. The prediction mechanism uses the following formula to predict the probability of symbol usage:

[0080] P next (t+1)=σ(W1·LSTM(h t ,x t )+W2·(α·Freq(t)+β·△T(t)+γ·Assoc(t)+∈·Trend(t))+b)

[0081] P next (t+1): predicts the probability that the symbol will be used at the future time point (t+1).

[0082] σ: The activation function is used to limit the value of the LSTM network output to a reasonable range, ensuring that the prediction result of the symbol usage probability remains within the valid range. By nonlinearly transforming the output, the activation function can ensure that the output value adapts to the complex fluctuations of the symbol usage frequency. Sigmoid: The output range is [0,1], ReLU: The output range is [0,∞)

[0083] W1, W2: Weight matrices W1 and W2 control the impact of different features of symbols (such as frequency of use, time interval, relevance, etc.) on the prediction results. Through the weighted operation of the weight matrix, the LSTM network can adjust the contribution of each feature to the final prediction symbol priority according to the historical usage of the symbol. Different symbols have different usage patterns, and the weight matrix will help the model dynamically balance the importance of each feature, thereby improving the prediction accuracy.

[0084] LSTM(h t , x t ): LSTM (Long Short-Term Memory Network) combines the input data of the current symbol (x t ) and the past hidden state (h t ), which can capture both short-term and long-term usage patterns of symbols.

[0085] h t (Hidden state): Stores the usage of symbols in the past time period, helping the network to keep a memory of the historical usage frequency of symbols, thereby accurately reflecting the long-term usage trend of symbols.

[0086] x t (Current input): represents the current usage data of the symbol, including the symbol’s recent usage frequency, relevance, and other features. By combining with the hidden state, LSTM can make accurate predictions when the symbol’s usage frequency changes.

[0087] b is a bias term, which aims to adjust the output of the prediction model to ensure that the model can still reasonably predict the probability of symbol use when the historical data or eigenvalue of the symbol is small. By introducing the bias term b, the flexibility of the model can be improved, so that it can still accurately predict the future use of symbols when parameters such as symbol usage frequency, time interval, correlation and trend change. This bias term effectively compensates for the possible underfitting of the model and improves the stability and accuracy of the prediction results. The value range is [-1,1].

[0088] In this formula, the LSTM network (Long Short-Term Memory Network) processes the historical input data and characteristic parameters of the symbol (such as usage frequency Freq, time interval ΔT(t), symbol relevance Assoc and usage trend Trend), and adjusts different coefficients (α, β, γ, ∈) to flexibly adjust the symbol priority according to different scenarios. For example, if the usage frequency of a symbol is very high Freq(t) and the future trend is strong Trend(t), then the priority of the symbol will be significantly improved and loaded in advance. The LSTM network can capture the long-term usage pattern of symbols, thereby generating dynamic symbol priority adjustment suggestions and optimizing the management of the symbol library.

[0089] For example, for commonly used symbols (such as the letter "A"), the LSTM network retains its importance in long-term memory due to its high historical usage frequency. Therefore, even if it has not been frequently called recently, it can still maintain its high priority, ensuring that the symbol is loaded first in regular scenarios.

[0090] The LSTM network processes the time interval information of symbols through short-term memory units. ΔT(t) reflects the time interval since the symbol was last called, and can capture the changes in the frequency of use and "heat" of the symbol. The short-term memory unit of LSTM is used to identify the short-term call frequency of symbols and adjust their priority according to the length of time the symbol has not been used.

[0091] Example: If the symbol ΔT(t) shows that the symbol has not been called for a period of time, the LSTM network will gradually reduce its priority to free up cache space. However, if the symbol is frequently used again within a short period of time, the system will quickly increase its priority to avoid frequent loading delays.

[0092] The LSTM network can process the relevance of symbols through multi-step dependency modeling, helping to identify the co-occurrence relationship between symbols and other commonly used symbols. The relevance between symbols is dynamically generated by historical input data and the dependency modeling module of the LSTM network, ensuring that when a symbol is called, the symbols associated with it can be loaded in advance.

[0093] Example: In an input method application, if users frequently enter specific letters or phrases, such as "car" and "rent", the LSTM network can recognize the high correlation between these symbols and load related symbols first, thereby improving the response speed of subsequent input.

[0094] In addition, the trend prediction of the LSTM network can efficiently capture the usage trend of symbols. By processing the recent usage changes of symbols, the LSTM network can identify the short-term usage trend Trend(t) of symbols and predict the future usage demand of symbols. By gradually accumulating the usage patterns of symbols, the LSTM network can timely identify symbols with increasing usage frequency and increase their priority.

[0095] Example: When the recent usage frequency of a symbol increases significantly (for example, common phrases during holidays), the LSTM network will automatically increase the priority of the symbol and load the symbol into the cache in advance through a progressive loading mechanism to avoid loading delays when users input.

[0096] Combining the prediction results of the prediction mechanism with the progressive loading mechanism, the system will prioritize the predicted high-frequency symbols to be loaded into the cache. Through the prediction mechanism's prejudgment, the symbols can be loaded in advance before the user actually inputs, reducing delays and improving system response speed.

[0097] This embodiment uses a long short-term memory network (LSTM) to perform time series prediction of symbol usage, which can effectively improve the dynamic adjustment capability of symbol priority and ensure the intelligent and efficient symbol loading process. Specifically, by analyzing historical input data, the LSTM network can accurately predict symbols that may be frequently used in the future, and flexibly adjust symbol priority based on multi-dimensional features such as symbol usage frequency, time interval, correlation, and usage trend.

[0098] 1. Dynamic adjustment of symbol priority: The LSTM network can combine short-term and long-term symbol usage patterns to accurately predict the future usage of symbols, so that commonly used symbols or high-frequency trend symbols can be loaded first, reducing loading delays and thus improving response speed.

[0099] 2. Symbol relevance optimization: By identifying the relationship between symbols, the LSTM network can load highly correlated symbols in advance, improving the efficiency of symbol linkage loading. For example, phrases that users frequently input will automatically match related symbols to avoid loading one by one, improving the overall smoothness of the operation.

[0100] 3. Trend Capture and Prediction: By capturing the usage trend of symbols, the LSTM network can adjust the symbol priority in a timely manner to ensure that symbols that are frequently used recently are loaded in advance in future usage. This trend prediction greatly improves the usability of symbols and avoids freezes or delays in user operations.

[0101] 4. Reasonable allocation of memory resources: LSTM network can not only increase the priority of high-frequency symbols, but also reduce the priority of unused symbols to release cache space. This mechanism effectively optimizes resource utilization, ensures that memory is not occupied by low-frequency symbols, and improves overall resource management efficiency.

[0102] 5. Improve the accuracy of symbol usage prediction: The LSTM network combines different features (such as usage frequency, time interval, symbol relevance, etc.) and uses weight matrices and bias items to balance the impact of various factors on symbol priority. This can significantly improve the accuracy of symbol usage prediction and avoid underfitting of the model, thereby ensuring the stability and accuracy of symbol management.

[0103] In general, this embodiment realizes the optimization of symbol usage prediction, dynamic priority adjustment and symbol linkage loading through the LSTM network, which significantly improves the efficiency of symbol loading, reduces response delay, and effectively optimizes the utilization of memory resources.

[0104] Embodiment 4

[0105] The priority control model of this embodiment dynamically adjusts the final priority of the symbol. The model includes a final symbol priority calculation formula as follows:

[0106] P final =η·P next (t+1)+α·Freq(t)-β·Decay(t)+γ·Cost(t)+δ·Assoc(t)+∈·Trend(t)

[0107] η: This coefficient represents the weight of the predicted probability of future symbol usage on the final priority of the symbol. When the η value is large, the prediction of the symbol's future usage has a greater impact on the priority, that is, the system will rely more on the prediction results to adjust the loading order of the symbols in advance. Conversely, if the η value is small, the system has less dependence on future usage and relies more on current or past data to determine the priority of the symbol. The value range is [0,1].

[0108] This embodiment can optimize the order of symbol loading by dynamically adjusting the final priority of the symbols of the priority control model. The Freq parameter (frequency of use) combined with the Assoc parameter (symbol association) can ensure that commonly used symbols and their related symbols can be loaded into the cache first. For example, when the commonly used place name "Beijing" appears frequently, its Freq value is high, and it has a strong association with other related symbols (such as "city", etc.) (high Assoc value). The priority control model predicts that these symbols will continue to be used frequently, so they can be loaded into the cache in advance to ensure a quick response when called subsequently.

[0109] The Decay parameter (time decay) and the Cost parameter (loading cost) have a negative impact on the priority of symbols. When a symbol has not been used for a long time, its Decay value gradually increases, resulting in a lower priority. At the same time, the complexity of the symbol (such as Chinese characters with many strokes) leads to a higher Cost value, and the system delays the loading or compresses the storage of such symbols to avoid occupying too much memory resources.

[0110] Example: Suppose the symbol "龘" (complex glyph, high loading cost) has a low usage frequency and has not been called for a long time. In the symbol priority formula, the Cost is high and the Decay increases, ultimately resulting in a final low P value. Therefore, by delaying the loading of this symbol through the progressive loading mechanism, symbols that are commonly used and frequently called can be processed first.

[0111] In this embodiment, through the dynamic adjustment of the priority control model, the refined management of symbol loading is achieved, significantly improving the resource utilization rate. The priority control model combines the usage frequency (Freq) and symbol association (Assoc), enabling commonly used symbols and their related symbols to be loaded in advance before actual demand, reducing the delay when symbols are called, and ensuring the efficient call of frequently used symbols. In addition, the time decay (Decay) coefficient gradually reduces the priority of symbols that have not been used for a long time, effectively releasing memory resources and avoiding long-term occupation. At the same time, the loading cost (Cost) parameter weighs complex symbols, ensuring dynamic resource allocation according to the scenario during the loading process to avoid excessive memory consumption. This mechanism optimizes the symbol loading order by flexibly adjusting the priority of symbols, improving the response speed of symbol management and the memory utilization efficiency.

[0112] Embodiment Five

[0113] Symbol library self-adaptive optimization: The symbol library will be automatically updated after 5000 call cycles. Based on the prediction results of the priority control model and the final priority formula, the content of the symbol library is further optimized. Specifically, commonly used symbols are kept in the cache to ensure fast response; while low-frequency symbols are compressed or moved to secondary storage according to the decreasing priority. Through this dynamic adjustment mechanism of the symbol library, the loading order of symbols can be efficiently managed under limited memory.

[0114] When the symbol library is updated, combined with the final priority of the symbols, the symbols are gradually loaded through the progressive loading mechanism to ensure that high-priority symbols can be loaded into the cache in advance during the peak demand for symbol usage. This reduces the loading delay during user input. Especially when the priority control model predicts an increase in the usage frequency of symbols, these symbols can be actively loaded to avoid a slowdown in system response.

[0115] Embodiment Six

[0116] This embodiment improves the efficiency of symbol loading and memory management through a multi-threaded parallel processing mechanism. In high-load and high-concurrency scenarios, by dynamically allocating thread resources, symbol loading, compression, and decompression tasks are effectively managed to ensure fast response and efficient operation under limited resources.

[0117] In this embodiment, a multi-thread mechanism is used to allocate symbol loading tasks according to the final symbol priority calculation formula. Each thread independently processes a group of symbol loading tasks, and the dynamic allocation of tasks is achieved through the following formula:

[0118]

[0119] Formula Description:

[0120] T load : Symbol loading tasks assigned to each thread.

[0121] N threads : The number of currently available threads, indicating how many threads the symbol loading and decompression tasks will be assigned to process.

[0122] L system : The current load status of the system, indicating the usage of system resources. When the load is high, the thread allocation can be adjusted appropriately to give priority to the loading of high-priority symbols.

[0123] C decomp : The decompression complexity of the symbol. For compressed symbols, symbols with higher decompression complexity require more thread resources to reduce decompression latency.

[0124] According to the priority of the symbol, the loading tasks are assigned to the available threads according to the priority:

[0125] Frequently used symbols (higher Freq) and symbols with an increasing usage trend (higher Trend) are preferentially assigned to resource-rich threads, ensuring that these symbols can be quickly loaded into the cache when users input.

[0126] Low-priority symbols (larger Decay and higher Cost) are assigned to threads with lighter loads and processed later to ensure that commonly used symbols receive priority responses.

[0127] The task scheduler calculates the current load according to the current load condition L system , dynamically adjust the symbol loading order and thread resource allocation to ensure that resources are used reasonably.

[0128] In this embodiment, low-priority symbols in the symbol library are compressed and stored when they have not been used for a long time. When these symbols are needed, a multi-threading mechanism is used to perform parallel processing of their decompression tasks:

[0129] When a compressed symbol needs to be loaded, the task scheduler selects the symbol based on its decompression complexity (C decomp ) Dynamically allocate multiple threads to handle decompression tasks simultaneously. Symbols with higher decompression complexity will be assigned more threads to reduce the delay of decompression and loading. It should be noted that even in the decompression scenario, the symbol priority is dynamically adjusted through the formula to give priority to those symbols with higher frequency of use and stronger usage trend, ensuring that these symbols can be quickly loaded and entered into the cache after decompression.

[0130] Embodiment 7

[0131] See also Figure 2 In this embodiment, the dynamic time warping (DTW) algorithm is used to achieve efficient matching between the user-input glyph and the basic symbols stored in the symbol library. The main function of the DTW algorithm is to dynamically compare the time series, so that the optimal match can still be found even when the shapes of the user-input glyph and the symbols in the symbol library change irregularly in the time dimension. This flexibility can effectively handle the glyph changes caused by handwriting, individual differences or input devices during the input process, ensuring efficient matching and calling of the symbol library.

[0132] 1. Dynamic comparison of glyph features

[0133] First, the curve features of the glyphs input by the user are extracted and dynamically compared with the basic symbol curves stored in the symbol library. The DTW algorithm processes the curve data of the input glyphs as a time series, identifies the key points on the curve, and matches them one by one with the curve points of the basic symbols in the symbol library. Through this dynamic comparison, the DTW algorithm can identify the shape similarity between the input glyphs and the symbols in the symbol library, and can still ensure matching accuracy even when the input glyphs have some deformations or irregular changes.

[0134] 2. Generation of the optimal matching path: The DTW algorithm calculates the optimal matching path between the input glyph and each basic symbol in the symbol library to calculate the optimal matching symbol for the input glyph. The dynamic comparison capability of the DTW algorithm allows the shape of the input glyph to change in the time dimension (for example, the speed or order of the user's input strokes is different), but the basic symbol with the highest similarity in the symbol library can still be found by calculating the shortest path.

[0135] 3. Calculation of similarity score: During the comparison process of the DTW algorithm, a similarity score is generated based on the similarity between the input glyph and the basic symbols in the symbol library. This score is used to determine the degree of match between the symbols stored in the symbol library and the glyphs input by the user. Based on these similarity scores, the closest basic symbol combination is selected to generate the complete glyph required by the user. This combination of symbols based on similarity scores avoids the need to fully load complex glyphs, thereby improving the storage efficiency and response speed of the symbol library.

[0136] After the DTW algorithm completes the glyph matching, the glyphs generated by the matching are decomposed into basic symbols and stored in the symbol library for subsequent reuse. When the user enters a similar glyph next time, the previously stored basic symbol combination can be directly called without the need to perform complex fuzzy matching calculations again. This closed-loop mechanism of symbol reuse further reduces the usage of computing resources and improves the storage efficiency of the symbol library.

[0137] Embodiment 8

[0138] This embodiment introduces the adaptive loading and dynamic matching optimization of complex landmark symbols (such as the "Eiffel Tower") in the vehicle navigation system, combining the symbol priority dynamic adjustment formula, dynamic time warping (DTW) algorithm, long short-term memory network (LSTM) and multi-threaded task processing technology to ensure efficient memory management and fast response when processing complex symbols.

[0139] In a car navigation system, a user may navigate to a globally famous complex landmark (such as the Eiffel Tower). Such symbols not only contain detailed geographic information, but also involve complex graphics rendering, resulting in high loading costs (such as rendering time and memory usage). To ensure timely response in such complex situations, this embodiment combines multiple optimization techniques to achieve efficient management of complex landmark symbols.

[0140] First, the symbols are dynamically managed through the symbol priority formula, especially in the scenario of complex landmark symbols. The specific formula is:

[0141] P final =η·P next (t+1)+α·Freq(t)-β·△T(t)+γ·Cost(t)+δ·Assoc(t)+∈·Trend(t)

[0142] α=0.8:The symbols with higher usage frequency are loaded first.

[0143] β=0.5:Time interval. The priority of symbols that have not been used for a long time will be gradually reduced.

[0144] γ = 0.7: Complex symbols with higher loading costs still maintain higher priority, ensuring that they are not ignored when processing key complex symbols (such as "Eiffel Tower").

[0145] δ = 0.9: symbol relevance. When the symbol has a high relevance to commonly used symbols, it is loaded first to improve navigation efficiency.

[0146] ∈=0.6:When the symbol usage trend increases, it is loaded first.

[0147] When a user navigates to Paris and approaches the Eiffel Tower, although the Eiffel Tower symbol has a higher loading cost, it is still loaded first due to its high relevance in the current scene. This ensures that complex landmark symbols are not overlooked due to their complexity. At the same time, AI predicts its future usage to ensure that the symbol is ready when the user approaches the landmark.

[0148] Then, the navigation information input by the user is dynamically matched with the complex symbol "Eiffel Tower" in the symbol library through the Dynamic Time Warping (DTW) algorithm. The DTW algorithm allows the characters or geographic location information input by the user to be matched with the basic symbols in the symbol library. In particular, when there are deformations or irregularities in the input, DTW can find the best matching path. The similarity is calculated by comparing the shape features of the user input with the "Eiffel Tower" symbol curve in the symbol library. Example: When the user inputs the "Eiffel Tower" navigation by voice or handwriting, the DTW algorithm compares the curve of the input glyph with the complex symbols stored in the symbol library, and calculates the similarity between the two. Even if the user input is slightly deformed or the pronunciation is not standard, the DTW algorithm can flexibly adjust the comparison, quickly find the "Eiffel Tower" symbol, and ensure the rapid display of the landmark symbol.

[0149] In addition, the user's historical navigation records in Paris are analyzed through the long short-term memory network (LSTM), capturing the user's frequent navigation to famous landmarks (such as the "Eiffel Tower"). The LSTM network predicts that the symbol will be used in the user's next navigation, so the symbol is loaded into the cache in advance. Even if the user has not yet approached the landmark, the symbol is loaded first based on the prediction result to avoid subsequent delays.

[0150] When the user quickly zooms in and out of the map or switches views during navigation, symbol loading tasks are processed in parallel through multiple threads. Since the complexity cost of the "Eiffel Tower" symbol is high, more thread resources can be allocated to decompress and render it. Lower priority symbols (such as other less commonly used landmarks) are assigned to secondary threads for processing, ensuring that high priority symbols such as the "Eiffel Tower" can be loaded and displayed in time.

[0151] This embodiment realizes adaptive loading and matching optimization of the complex landmark symbol "Eiffel Tower" through the combination of symbol priority dynamic adjustment formula, DTW algorithm matching, LSTM network prediction and multi-threaded processing technology. It can also flexibly adjust the loading order of symbols according to the user's navigation scenario, predict the use requirements of symbols in advance, and optimize the loading and rendering process of complex symbols through multi-threading, ensuring that users get timely and accurate symbol display and response when navigating to complex landmarks.

[0152] Embodiment 9

[0153] This embodiment is applied to the voice assistant in the smart home system, which improves the response speed of voice commands and reduces the memory usage of symbol loading through symbol usage probability prediction, dynamic time warping algorithm (DTW) and symbol library optimization management. In this application scenario, the voice assistant needs to quickly load relevant symbols according to the user's instructions, such as lighting, temperature control and home appliance icons.

[0154] 1. Symbol usage probability prediction and symbol library optimization

[0155] In the smart home system, users control home appliances through voice. In order to improve the efficiency of symbol loading, the system analyzes the user's historical input and symbol usage patterns through the LSTM model to predict the future usage probability of the symbol. For symbols that users frequently use (such as lighting and air conditioning control), the system prioritizes loading them into the cache. For example, when the user controls the lights every night, the system predicts the priority of the symbol by the frequency of use and loads the light control symbol into the cache to ensure a fast response.

[0156] At the same time, the time decay mechanism (gradually reducing the priority of symbols according to the time they have not been used) will process symbols that have not been used for a long time (such as curtain control) by reducing their priority and compressing their storage, thereby freeing up system memory. This predictive mechanism allows the system to flexibly respond to different scenarios, ensuring fast loading of high-priority symbols and memory optimization of low-priority symbols.

[0157] 2. Application of Dynamic Time Warping (DTW) in Symbol Matching

[0158] The system not only relies on the frequency of symbol usage, but also combines the Dynamic Time Warping (DTW) algorithm to handle irregular changes in user voice input. The DTW algorithm allows the system to accurately identify and match symbols when there are slight changes in the user's voice command (such as changes in the user's speaking speed or pronunciation).

[0159] For example, when a user issues a command such as "turn off the light" or "turn off the light", although the voice details are different, the DTW algorithm can dynamically adjust the matching path to ensure that the system can correctly match the "light control" symbol. Similarly, if a user controls a smart device through handwriting input commands, the system will use the DTW algorithm to compare the handwriting curve features to ensure that even if there are slight changes in the input symbols, the system can still quickly match the correct device control symbol.

[0160] 3. Scene optimization and symbol loading

[0161] In actual operation, when a user issues a voice command such as "turn off the lights and increase the air conditioning temperature", the system will use the LSTM model to predict the probability of using the light control symbol and the air conditioning temperature control symbol. The system prioritizes loading these high-frequency symbols to ensure that the symbols can respond quickly. In addition, the DTW algorithm can correctly identify the relevant symbols when there are slight changes in the voice command, thereby avoiding delays caused by irregular user commands.

[0162] Combined with the relevance of symbol usage (such as the high relevance between light control and curtain control), the system will also preload symbols that are highly associated with the current symbol to ensure that subsequent operations can respond quickly. Even if users occasionally use some less-used symbols (such as "garden light control"), by adjusting the bias term in the LSTM model, the system can identify the potential needs of symbol usage and flexibly adjust the symbol loading order.

[0163] 4. Dynamic symbol priority adjustment and memory management

[0164] In the management of the symbol library, the system will dynamically adjust the symbol priority according to the frequency of use, relevance and time decay of the symbol. For frequently used symbols, the system will prioritize loading them into the cache to ensure fast response when users operate them. For symbols that are used less frequently or have not been called for a long time (such as some seasonal symbols), the system will move them to secondary storage through a memory compression mechanism to reduce unnecessary memory usage.

[0165] Through this symbol usage prediction and symbol library dynamic management mechanism, the smart home system can achieve efficient loading of symbols in different scenarios, ensure the voice assistant's quick response to user commands, and optimize the utilization of memory resources.

[0166] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0167] The above-mentioned embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

Claims

1. A method for optimizing the memory occupied by a font library, characterized in that: The following steps are involved: Step 1: Calculate the initial priority of each symbol based on the time-decayed usage frequency algorithm and perform progressive loading; Step 2: Use a prediction mechanism to predict the usage probability of symbols based on their initial priority and perform progressive loading; Step 3: Dynamically adjust the final priority of the symbol based on the priority regulation model; Step 4: After the symbol library reaches the call cycle, the content of the symbol library is adjusted based on the priority control model; Step 5: Manage the symbol loading, compression and decompression tasks through multi-threaded parallel processing mechanism; Step 6: Use a dynamic time warping algorithm to match the user input glyph with the basic symbols stored in the symbol library.

2. The method for optimizing the memory occupied by a font library according to claim 1, characterized in that: The step 6 comprises the following sub-steps: (1) Extracting the curve features of the font input by the user; (2) using the dynamic time warping (DTW) algorithm, the curve data of the input glyph is compared with the basic symbol curve stored in the symbol library; (3) Calculate the similarity score between the input glyph and the basic symbol, and select the symbol with the highest similarity as the matching result.

3. The method for optimizing the memory occupied by a font library according to claim 1, characterized in that: The calling cycle in step 4 is 5000 times.

4. The method for optimizing the memory occupied by a font library according to claim 1, characterized in that: Step 1 uses the following formula to calculate the symbol priority: Priority P = α·Freq-β·Decay+γ·Cost+δ·Assoc+ε·Trend; where: Freq represents the frequency of use of the symbol; Decay represents the time interval since the symbol was last used; Cost represents the complexity of symbol loading; Assoc represents the correlation between the symbol and other symbols; Trend represents the usage trend of the symbol; α, β, γ, δ and ε are coefficients that control the influence weight of each parameter.

5. The method for optimizing the memory occupied by a font library according to claim 1, characterized in that: The value range of α is 0.1-1.0; the value range of β is 0.01-0.5; the value range of γ is 0.1-0.7; the value range of δ is 0.2-1.0; and the value range of ε is 0.1-0.

9.

6. The method for optimizing the memory occupied by a font library according to claim 1, characterized in that: The prediction mechanism uses the following formula to predict the probability of a symbol being used: P next (t+1)=σ(W1·LSTM(h t , x t )+W2·(α·Freq(t)+β·ΔT(t)+γ·Assoc(t)+∈·Trend(t))+b), where, P next( t+1): predict the probability of a symbol being used at a future time point (t+1); LSTM: Long Short-Term Memory Network; σ: An activation function used to limit the output value to a reasonable range; W1, W2: weight matrix to control the contribution of different features to prediction; LSTM(h t , x t ): Based on the history of hidden state h t and the current input x t; b: Bias term that adjusts the output of the prediction model.

7. The method for optimizing the memory occupied by a font library according to claim 6, characterized in that: The activation function includes the following two functions: (1) Sigmoid activation function; (2) ReLU activation function.

8. The method for optimizing the memory occupied by a font library according to claim 6, characterized in that: The value range of the bias term b is [-1, 1].

9. The method for optimizing the memory occupied by a font library according to claim 7, characterized in that: The Sigmoid activation function is used to limit the output value of the symbol usage probability to the range of [0,1]; The ReLU activation function is used to limit the output value of the symbol usage probability to the range of [0,∞).

Citation Information

Patent Citations

  • Cache optimization method for mobile rich media player

    CN101963953A

  • Method and system for managing word stock of embedded browser

    CN102231150A

  • Handwriting input recognition method and system

    CN105117054A

  • Method and device for pre-loading media files

    CN105677381A

  • Data compression engine and method used for big data storage system

    CN107463606A