A session database recovery method and device and a storage medium

By combining encoding and feature extraction models in a big data environment, the problems of persistent session storage and dialogue content reminders are solved, achieving efficient session recovery and user prompts.

CN116756274BActive Publication Date: 2026-11-27INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202310822404.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-05
Publication Date
2026-11-27
Estimated Expiration
2043-07-05

Smart Images

  • Figure CN116756274B_ABST
    Figure CN116756274B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of big data, and can be used in the financial field, and in particular to a session storage recovery method and device and a storage medium. The method comprises the following steps: receiving all sessions in the communication window of all users in a first time period, encoding the sessions and time stamps, and saving the encoded sessions and time stamps; in response to a transfer condition, importing the last at least one session in the communication window in the first time period into a feature extraction model according to the time stamp, obtaining the keyword corresponding to the session, and transferring all sessions in the first time period to a database; when a user recovers the communication window in a second time period, the keyword corresponding to the last at least one session in the communication window is sent to the communication window, so that the basic content of the last session can be flexibly reminded while the persistent storage is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of big data technology and can be used in the financial sector, particularly a method, apparatus, and storage medium for recovering session data. Background Technology

[0002] When instant messaging is used on a large scale, the number of sessions per hour exceeds one million. Due to the instability of the sessions, such as dialog boxes suddenly closing or opening, the dialog box needs to instantly restore all the content of the previous conversation. Therefore, when a large number of users open the chat simultaneously, it puts enormous pressure on the database performance.

[0003] The common practice is to store the session only in a cache queue. Once the queue exceeds a certain size, sessions that entered the queue first will be discarded. This means that when a user opens the dialog box again, all conversation content will not be restored, and the session will not be persistently stored in the database, thus avoiding the database performance pressure it would cause. This first-in-first-out queue, combined with the session list stored locally on the client, perfectly matches the user's usage habits, namely, the existence of the earliest communication session is often not of great concern to the user.

[0004] However, in certain special scenarios, it is required that the conversation not only be persistently stored, but also that the user be reminded of the basic content of the last conversation, which is something that existing technology cannot achieve. Summary of the Invention

[0005] In view of the above-mentioned problems in the prior art, the purpose of this specification is to provide a method, apparatus and storage medium for session data recovery, so as to solve the problems that the prior art cannot perform persistent storage and cannot remind users of the basic content of the last conversation.

[0006] To solve the above-mentioned technical problems, the specific technical solution in this specification is as follows:

[0007] On the one hand, this specification provides a session-based database recovery method applied to caching, including:

[0008] Receive all user communication windows within the first time period, encode the sessions with timestamps, and save them.

[0009] In response to the transfer condition, the last at least one session of the communication window in the first time period is imported into the feature extraction model according to the timestamp to obtain the keyword corresponding to the session, and all sessions in the first time period are transferred to the database.

[0010] When the user resumes the communication window within the second time period, the keyword corresponding to the last at least one session in that communication window will be sent to the communication window.

[0011] As one embodiment of this specification, after the user restores the communication window within the second time period, sending the keyword corresponding to at least one last session in the communication window to the communication window includes:

[0012] The system receives a user's instruction to retrieve detailed information for at least the last session, retrieves the session from the database based on the mapping relationship between the encoding and the session, and sends it to the communication window.

[0013] As an embodiment of this specification, the step of receiving all user communication windows within a first time period and encoding and saving the sessions with timestamps further includes:

[0014] Record the user's first account and the second account of the user's communication partner, and concatenate the first account and the second account to obtain the window number of the user's communication window;

[0015] The window number is encoded with the timestamp of the session occurrence and then saved as the session number.

[0016] As one embodiment of this specification, the feature extraction method of the feature extraction model includes:

[0017] Use Jieba word segmentation technology to divide the conversation into several words and obtain the total number of words in the current conversation;

[0018] Calculate the number of times each word appears in the conversation;

[0019] The word frequency of each word is determined based on the total number of words in the conversation and the number of times each word appears.

[0020] Determine the number of preset conversations in the corpus, and the number of preset conversations containing each word in that conversation;

[0021] The inverse document frequency of each word in a session is determined based on the number of preset sessions and the number of preset sessions containing each word.

[0022] The criticality value of each word is determined based on the word frequency and the inverse document frequency;

[0023] The top few words with the highest degree of importance will be used as the keywords for this conversation.

[0024] As an embodiment of this specification, the step of determining the word frequency of each word based on the total number of words in the conversation and the number of times each word appears further includes:

[0025] The word frequency of each word is obtained according to the formula.

[0026]

[0027] Where T i Let M be the word frequency of the i-th word.i Let N be the number of times the i-th word appears in the session, and N be the total number of words.

[0028] As an embodiment of this specification, determining the inverse document frequency of each word in a session based on the number of preset sessions and the number of preset sessions containing each word further includes:

[0029] The inverse document frequency of each word is obtained according to the formula.

[0030]

[0031] Where F i K is the inverse document frequency of the i-th word. i Let P be the number of preset documents containing the i-th word, and let P be the total number of preset documents in the corpus.

[0032] As an embodiment of this specification, the step of determining the criticality value of each word based on the word frequency and the inverse document frequency further includes:

[0033] The keyness value of each word is obtained according to the formula.

[0034] I i =T i ×(1-F i (i = 1, 2, 3...)

[0035] Where T i Let F be the frequency of the i-th word. i Let I be the inverse document frequency of the i-th word. i The importance value of the i-th word.

[0036] As an embodiment of this specification, the step of sending keywords corresponding to at least one last session in the communication window to the communication window according to the encoding when the user restores the communication window within the second time period further includes:

[0037] The window number corresponding to the communication window between the user and the user's chat partner, sent when the user restores the window;

[0038] Keywords are obtained by matching window numbers and sent to the communication window, where they are displayed.

[0039] As one embodiment of this specification, after receiving all sessions within the user communication window during the first time period, the sessions are encoded with timestamps and saved, followed by:

[0040] In response to the transition condition, the last at least one session of the communication window between the user and multiple session objects in the first time period is imported into the feature extraction model according to the timestamp to obtain the keywords between the user and multiple session objects.

[0041] If there are duplicate keywords, the session corresponding to the duplicate keyword will be mapped to a single keyword, and only one keyword will be retained.

[0042] As an embodiment of this specification, the step of restoring the communication window within the second time period further includes:

[0043] If the keyword is stored for longer than the cache time, the keyword will be deleted.

[0044] When the user restores the communication window, the session is retrieved from the database based on the window number and timestamp, and then restored to the communication window.

[0045] On the other hand, this specification also provides a session write-to-database recovery device for use in caching, including:

[0046] The receiving unit is used to receive all user communication windows within the first time period, encode the sessions with timestamps, and save them.

[0047] A transfer unit is used to, in response to a transfer condition, import at least one last session of the communication window in the first time period into the feature extraction model according to the timestamp, obtain the keyword corresponding to the session, and transfer all sessions in the response period to the database.

[0048] The recovery unit is used to send the keyword corresponding to at least one last session in the communication window to the communication window according to the encoding when the user recovers the communication window within the second time period.

[0049] On the other hand, this specification also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement any of the session data recovery methods described above.

[0050] On the other hand, this specification also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements any of the session write-to-database recovery methods described above.

[0051] By adopting the above technical solution, by receiving all conversations in the user communication window within the first time period, encoding and saving the conversations with timestamps, it is possible to encode and save all conversations within the first time period, and each conversation's encoding includes its unique corresponding timestamp. Responding to the transfer condition, based on the timestamp, at least one of the last conversations in the communication window within the first time period is imported into the feature extraction model to obtain the keywords corresponding to that conversation. All conversations within the first time period are then transferred to the database. This allows all conversations in the first time period to be transferred to the database when the transfer condition is triggered, and the last at least one conversation within the first time period can be imported into the feature extraction model to obtain the keywords corresponding to the last at least one conversation, which are then cached. When the user restores the communication window within the second time period, the keywords corresponding to the last at least one conversation in that communication window are sent back to the communication window. This means that when the communication window is restored within the second time period, it is not necessary to directly display all the content of the last at least one conversation; only the keywords corresponding to the last at least one conversation need to be displayed to prompt the user with the basic dialogue content of the conversation in the first time period.

[0052] To make the above and other objects, features and advantages of this specification more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0053] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0054] Figure 1 This specification illustrates an overall system diagram of a session data recovery method according to an embodiment of the present invention.

[0055] Figure 2 This specification illustrates a step-by-step diagram of a session data recovery method according to an embodiment of the present invention.

[0056] Figure 3 This specification illustrates a schematic diagram of the session saving process in an embodiment.

[0057] Figure 4 A schematic diagram of the feature extraction method of the embodiment of this specification is shown;

[0058] Figure 5 A schematic diagram of a session recovery device according to an embodiment of this specification is shown;

[0059] Figure 6 A schematic diagram of a computer device according to an embodiment of this specification is shown.

[0060] Explanation of symbols in the attached drawings:

[0061] 101. Communication terminal;

[0062] 102. Cache;

[0063] 103. Database;

[0064] 501. Receiving Unit;

[0065] 502. Transfer Unit;

[0066] 503. Recovery Unit;

[0067] 602. Computer equipment;

[0068] 604, Processor;

[0069] 606. Memory;

[0070] 608. Drive mechanism;

[0071] 610. Input / output module;

[0072] 612. Input devices;

[0073] 614. Output devices;

[0074] 616. Presentation equipment;

[0075] 618. Graphical User Interface;

[0076] 620. Network interface;

[0077] 622. Communication link;

[0078] 624. Communication bus. Detailed Implementation

[0079] The technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this specification.

[0080] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, apparatus, product, or device that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.

[0081] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0082] like Figure 1 The overall system diagram of a session data recovery method shown includes: a communication terminal 101, a cache 102, and a database 103.

[0083] The communication terminal 101 includes multiple terminals, and in one embodiment, each user has its own corresponding communication terminal 101. The communication terminal 101 is used to display at least one communication window, which can receive the user's session content. In some embodiments, the communication window can acquire and display all the content of the session between users. In some cases, if a user is having a session with several users at the same time, the communication terminal 101 can run multiple communication windows simultaneously.

[0084] It should be noted that, in the embodiments of this specification, under certain high-security requirements, the sessions in the communication window will not be temporarily stored on the communication terminal 101, but will be directly transferred to the cache 102 or the database 103 for storage.

[0085] Cache 102 is connected to each communication terminal 101 and is connected to database 103. It is used to save all user communication window sessions within the first time period and to transfer the sessions to database 103 for storage after the first time period expires. If a user needs to reply to a session in the communication window within the first time period, they need to communicate with cache 102 and retrieve the session within the first time period from cache 102.

[0086] Database 103, connected to cache 102, is used to persistently store session data. It should be noted that in the embodiments of this specification, database 103 can save all sessions in cache 102 after the first time period has expired, and the storage time of database 103 can be long enough, such as one month, two months or three months.

[0087] In existing technologies, it is not possible to achieve both persistent storage of conversations and reminders of the previous basic conversation content to the user in certain special scenarios.

[0088] To address the aforementioned issues, this specification provides a method for session recovery by persisting the data in a database and reminding the user of the basic content of the previous conversation. Figure 2 This diagram illustrates the steps of a session data recovery method provided in an embodiment of this specification. While this specification provides the operational steps described in the embodiments or flowcharts, more or fewer steps may be included based on conventional or non-inventive methods. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only possible order. In actual system or device products, the methods shown in the embodiments or accompanying drawings can be executed sequentially or in parallel. Specifically, as shown... Figure 2 As shown, the method may include:

[0089] Step 201: Receive all user communication windows within the first time period, encode the sessions with timestamps, and save them;

[0090] Step 202: In response to the transfer condition, import at least one last session of the communication window in the first time period into the feature extraction model according to the timestamp to obtain the keyword corresponding to the session, and transfer all sessions in the first time period to the database.

[0091] Step 203: When the user restores the communication window within the second time period, send the keyword corresponding to at least the last session in the communication window to the communication window.

[0092] By adopting the above technical solution, by receiving all conversations in the user communication window within the first time period, encoding and saving the conversations with timestamps, it is possible to encode and save all conversations within the first time period, and each conversation's encoding includes its unique corresponding timestamp. Responding to the transfer condition, the last conversation in the communication window within the first time period is imported into the feature extraction model based on the timestamp to obtain the keyword corresponding to that conversation. All conversations within the first time period are then transferred to the database. This allows all conversations in the first time period to be transferred to the database when the transfer condition is triggered. Furthermore, the last conversation in the first time period is imported into the feature extraction model to obtain the keyword corresponding to the last conversation, and the keyword is saved in the cache. When the user resumes the communication window in the second time period, the keyword corresponding to the last conversation in that communication window is sent back to the communication window. This means that when the communication window is resumed in the second time period, it is not necessary to directly display all the content of the last conversation; only the keyword corresponding to the last conversation needs to be displayed to prompt the user with the basic dialogue content of the conversation in the first time period.

[0093] like Figure 3 The diagram illustrating the session saving process, as an embodiment of this specification, further includes step 201, which involves receiving all sessions within the first time period, encoding the sessions with timestamps, and saving them:

[0094] Step 301: Record the user's first account and the user's communication object's second account, and concatenate the first account and the second account as the window number of the user's communication window;

[0095] In this step, the user logs in to the communication terminal using their first account and corresponding password, while the communication partner logs in using their second account and corresponding password. When the user engages in a conversation with another communication partner (another user), the communication window number can be the first account + second account, while the communication partner's communication window can be the second account + first account. This instruction manual is based on the user, and the specific number of each user's conversation can be the first account + second account + timestamp.

[0096] For example:

[0097] Message to: Today's work progress. (June 5, 10:15:45)

[0098] User: Developing ABC scripts. (June 5, 10:18:41)

[0099] Message received. (June 5, 10:19:15)

[0100] For ease of explanation, we can set the first account as 007 and the second account as 008. Then, the corresponding number for the "Today's Work Status" session in the user's communication window can be 007-008-6.5.10.15.45.

[0101] Similarly, the number corresponding to the conversation "Develop ABC scripts" can be 007-008-6.5.10.18.41.

[0102] Similarly, the number corresponding to the "received" message could be 007-008-6.5.10.19.15.

[0103] Step 302: Encode the window number and the timestamp when the session occurred as the session number and save it.

[0104] After numbering, the data can be saved to the cache in timestamp order. Specifically, to ensure a smoother caching process, this manual uses zset buckets for caching, further including:

[0105] The cache includes several zset buckets;

[0106] The sessions are randomly assigned to zset buckets using a hash algorithm;

[0107] The zset bucket removes duplicate feature information that is entered repeatedly.

[0108] Specifically, if a session occurs repeatedly within the first time period, the cache can store only one instance. For example, if the session "received" appears several times, the cache can assign multiple numbers to "received". For example, the number corresponding to "received" can be 007-008-6.5.11.20.17, 007-008-6.5.13.18.15, or 007-008-6.5.15.45.46.

[0109] As an embodiment of this specification, step 202 involves importing the last session of the communication window in the first time period into the feature extraction model according to the timestamp, obtaining the keyword corresponding to the session, and transferring all sessions in the first time period to the database.

[0110] In this manual, the transition conditions can be preset with specific time parameters. For example, the transition can be triggered when the number of sessions is at its lowest. In this manual, the time parameter could be 2-5 AM. When 2 AM is reached, at least one session from each time window will be imported into the feature extraction model to extract the features corresponding to each session. For example, the feature for the session "User: Develop ABC script (June 5th, 10:18:41)" could be "Develop script". This method allows for the extraction of a summary of lengthy content, enabling users to quickly recall the content of their previous session and providing inspiration for their work.

[0111] After obtaining the keywords corresponding to the session, all data in the cache is transferred to the database so that the database can persistently save the session. It should be noted that the database cannot interact directly with the communication terminal; it needs to send data to the communication terminal through the cache. In this way, the database has strong security and can be protected from data theft.

[0112] like Figure 4 The diagram illustrates the feature extraction method of the feature extraction model. In this specification, the feature extraction method of the feature extraction model includes:

[0113] Step 401: Use Jieba word segmentation technology to divide the conversation into several words and obtain the total number of words in the current conversation;

[0114] In this step, the Jieba word segmentation technology can be used to divide a continuous paragraph into several words, for example: "How is the weather today? Is it still cloudy like yesterday? Yes, it is still cloudy like yesterday."

[0115] The sentence can be divided into: today, weather, how, still like, yesterday, cloudy, yes, still like, yesterday, cloudy. Therefore, the current sentence has a total of 14 words.

[0116] Step 402: Calculate the number of times each word appears in the conversation;

[0117] Among them, it appears once today, once in the weather, once in some way, or twice like yesterday, twice in the same way, twice in the cloudy weather, once in some way, or once in some other way.

[0118] Step 403: Determine the word frequency of each word based on the total number of words in the conversation and the number of times each word appears;

[0119] In this step, the word frequency of each word is obtained according to the formula.

[0120]

[0121] Where T iLet M be the word frequency of the i-th word. i Let N be the number of times the i-th word appears in the session, and N be the total number of words.

[0122] In this manual, for ease of explanation, the words (today, weather, how, still like, yesterday, same, cloudy, yes, what) can be sorted and designated as T1, T2, T3, T4, T5, T6, T7, T8, and T9 respectively.

[0123] Then T1 = 1 / 14, and similarly T2 = 1 / 14, T3 = 1 / 14, T4 = 1 / 7, T5 = 1 / 7, T6 = 2 / 14 = 1 / 7, T7 = 1 / 7, T8 = 1 / 14, T9 = 1 / 14.

[0124] Step 404: Determine the number of preset conversations in the corpus, and the number of preset conversations containing each word in the conversation;

[0125] In this step, the preset sessions in the forecast library can be adjusted manually. For example, in some situations, there are templates for conversations between users. For instance, in a department with a feedback mechanism, users need to report their work plan in the morning and their work completion status at the end of the day. Therefore, the preset sessions could be for today's work plan, etc., or for work completion status, etc. In other situations, such as when a department recently received a group project, the preset sessions could also be templates for the project's progress or project terminology. Or, when a department needs to monitor the weather closely, the preset sessions could be for today's weather, tomorrow's weather, etc.

[0126] Of course, the preset conversations can also be segmented using Jieba segmentation technology. In some embodiments, if the preset conversations are ten in number, including today's weather and tomorrow's weather, then the number of preset conversations containing the above "How is the weather today? Is it still cloudy like yesterday? Yes, it's still cloudy like yesterday" is two.

[0127] Step 405: Determine the inverse document frequency of each word in the session based on the number of preset sessions and the number of preset sessions containing each word;

[0128] In this step, the inverse document frequency of each word is obtained according to the formula.

[0129]

[0130] Where F i K is the inverse document frequency of the i-th word. i Let P be the number of preset documents containing the i-th word, and let P be the total number of preset documents in the corpus.

[0131] In this instruction manual, for example, the words (today, weather, how, still like, yesterday, same, cloudy, yes, what) are sorted and set as T1, T2, T3, T4, T5, T6, T7, T8, and T9 respectively.

[0132] For ease of explanation, K1 corresponds to T1, K2 corresponds to T2, K3 corresponds to T3, and so on.

[0133] When there are 10 preset documents, including today's weather and tomorrow's weather, the preset session is layered to get today, weather, tomorrow, and situation.

[0134] The inverse document frequencies are: F1 = log(10 / 2) = 0.7, F2 = log(10 / 3) = 0.5, F3 = log(10 / 1) = 1, F4 = log(10 / 1) = 1, F5 = log(10 / 1) = 1, F6 = log(10 / 1) = 1, F7 = log(10 / 1) = 1, F8 = log(10 / 1) = 1, and F9 = log(10 / 1) = 1.

[0135] Step 406: Determine the criticality value of each word based on the word frequency and the inverse document frequency;

[0136] The keyness value of each word is obtained according to the formula.

[0137] I i =T i ×(1-F i (i = 1, 2, 3...)

[0138] Where T i Let F be the frequency of the i-th word. i Let I be the inverse document frequency of the i-th word. i The importance value of the i-th word.

[0139] Therefore, I1 = 1 / 14 × 0.3 = 0.02, I2 = 1 / 14 × 0.5 = 0.03, I3 = 1 / 14 × 0 = 0, I4 = 1 / 7 × 0 = 0, I5 = 1 / 7 × 0 = 0.2, I6 = 1 / 7 × 0 = 0, I7 = 1 / 7 × 0 = 0, I8 = 1 / 14 × 0 = 0, I9 = 1 / 14 × 0 = 0.

[0140] Step 407: Select the top few words with the highest degree of importance as the keywords for this conversation.

[0141] Based on the above calculations, "today" and "weather" can be exported as keywords for the conversation.

[0142] As an embodiment of this specification, step 303: when the user restores the communication window within the second time period, the keyword corresponding to the last at least one session in the communication window is sent to the communication window.

[0143] In this specification, the first time period can be from 5:00 to 24:00 on the first day, and the second time period can be from 5:00 to 24:00 on the second day.

[0144] When a user resumes the communication window between 5:00 AM and 12:00 AM the following day, the communication window number is the user account minus the communication target account, for example, 007-008. The communication terminal sends 007-008 to the cache, which uses 007-008 to iterate through the keyword numbers corresponding to the session and then returns them to the communication window. The system displays "Today's Weather" to the user.

[0145] The cache can send today's information and weather to the communication window. Of course, those skilled in the art can adjust the preset template according to the above technical inspiration to send more detailed keywords to the communication window. This specification does not limit this.

[0146] As an embodiment of this specification, in response to a transition condition, the last at least one session of the communication window between the user and multiple session objects in the first time period is imported into the feature extraction model according to the timestamp to obtain the keywords between the user and multiple session objects.

[0147] If there are duplicate keywords, the session corresponding to the duplicate keyword will be mapped to a single keyword, and only one keyword will be retained.

[0148] For example, if multiple identical sessions exist within the communication window between a user and a communication partner, only one session can be stored in the cache to reduce storage pressure. When retrieving a session, it can be extracted separately through a one-to-many mapping relationship to be displayed to the user.

[0149] For example, if the "Received" message appears three times in the same communication window (window numbers 007-008) at times 6.6.11.17.18, 6.6.10.15.48, and 6.6.18.48.48, then the "Received" message can be saved once and three numbers can be created: 007-008-6.6.11.17.18, 007-008-6.6.10.15.48, and 007-008-6.6.18.48.48.

[0150] As an embodiment of this specification, the step of restoring the communication window within the second time period further includes:

[0151] If the keyword is stored for longer than the cache time, the keyword will be deleted.

[0152] When the user restores the communication window, the session is retrieved from the database based on the window number and timestamp, and then restored to the communication window.

[0153] In this manual, the first time period can be from 5:00 to 24:00 on the first day, and the second time period can be from 5:00 to 24:00 on the second day. However, in special cases, if a user opens a communication window within the first time period, and then opens it again one, two, or three months later, to ensure effective use of the cached space, a keyword can be deleted if its storage time exceeds the cache time and the user has not opened the window to view it during this period. Since human memory is short-term, if a keyword is reminded after a long time, the user may not be able to recall the conversation content, thus requiring the full content to be returned to the user.

[0154] So when the user opens the communication window again after a long time, the cache can retrieve the entire session content from the database and display it to the user.

[0155] It should be noted that, in this manual, "reopening the communication window" means opening a window with the same window number. For example, if the window number opened the first time is 007-008, then the window number opened again must also be 007-008.

[0156] like Figure 5 The diagram shown illustrates a session write-to-database recovery device applied to a cache, comprising:

[0157] The receiving unit 501 is used to receive all sessions in the user communication window within the first time period, and save the sessions after encoding them with timestamps.

[0158] The transfer unit 502 is used to, in response to the transfer condition, import at least one last session of the communication window in the first time period into the feature extraction model according to the timestamp, obtain the keyword corresponding to the session, and transfer all sessions in the response period to the database.

[0159] The recovery unit 503 is used to send the keyword corresponding to the last at least one session in the communication window to the communication window according to the encoding when the user recovers the communication window in the second time period.

[0160] By adopting the above technical solution, by receiving all conversations in the user communication window within the first time period, encoding and saving the conversations with timestamps, it is possible to encode and save all conversations within the first time period, and each conversation's encoding includes its unique corresponding timestamp. Responding to the transfer condition, based on the timestamp, at least one of the last conversations in the communication window within the first time period is imported into the feature extraction model to obtain the keywords corresponding to that conversation. All conversations within the first time period are then transferred to the database. This allows all conversations in the first time period to be transferred to the database when the transfer condition is triggered, and the last at least one conversation within the first time period can be imported into the feature extraction model to obtain the keywords corresponding to the last at least one conversation, which are then cached. When the user restores the communication window within the second time period, the keywords corresponding to the last at least one conversation in that communication window are sent back to the communication window. This means that when the communication window is restored within the second time period, it is not necessary to directly display all the content of the last at least one conversation; only the keywords corresponding to the last at least one conversation need to be displayed to prompt the user with the basic dialogue content of the conversation in the first time period.

[0161] like Figure 6 The illustration shows a computer device provided in an embodiment of this specification, used to run a session recovery method described herein. The computer device 602 may include one or more processors 604, such as one or more central processing units (CPUs), each of which may implement one or more hardware threads. The computer device 602 may also include any memory 606 for storing information of any kind, such as code, settings, data, etc. Without limitation, for example, memory 606 may include any type of RAM, any type of ROM, flash memory, hard disk, optical disk, etc. More generally, any memory can use any technology to store information. Further, any memory can provide volatile or non-volatile retention of information. Further, any memory may represent a fixed or removable component of the computer device 602. In one case, when processor 604 executes associated instructions stored in any memory or combination of memories, the computer device 602 can perform any operation of the associated instructions. The computer device 602 also includes one or more drive mechanisms 608 for interacting with any memory, such as hard disk drive mechanisms, optical disk drive mechanisms, etc.

[0162] Computer device 602 may also include an input / output module 610 (I / O) for receiving various inputs (via input device 612) and providing various outputs (via output device 614). A specific output mechanism may include a presentation device 616 and an associated graphical user interface (GUI) 618. In other embodiments, the input / output module 610 (I / O), input device 612, and output device 614 may be omitted, and the device may function solely as a computer device within a network. Computer device 602 may also include one or more network interfaces 620 for exchanging data with other devices via one or more communication links 622. One or more communication buses 624 couple the components described above together.

[0163] Communication link 622 can be implemented in any way, such as via a local area network, a wide area network (e.g., the Internet), a point-to-point connection, or any combination thereof. Communication link 622 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc., governed by any protocol or combination of protocols.

[0164] Corresponding to Figures 2 to 4 In addition to the methods described above, embodiments of this specification also provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the methods described above.

[0165] This specification also provides computer-readable instructions, wherein when a processor executes the instructions, the program therein causes the processor to perform the following... Figures 2 to 4 The method shown.

[0166] It should be understood that in the various embodiments of this specification, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this specification.

[0167] It should also be understood that, in the embodiments of this specification, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this specification generally indicates that the preceding and following related objects have an "or" relationship.

[0168] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this specification can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this specification.

[0169] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0170] In the several embodiments provided in this specification, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the couplings or direct couplings or communication connections shown or discussed may be indirect couplings or communication connections through some interfaces, devices, or units, or they may be electrical, mechanical, or other forms of connection.

[0171] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments described in this specification, depending on actual needs.

[0172] Furthermore, the functional units in the various embodiments of this specification can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0173] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this specification, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this specification. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0174] This specification uses specific embodiments to illustrate the principles and implementation methods of this specification. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this specification. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this specification. Therefore, the content of this specification should not be construed as a limitation of this specification.

Claims

1. A method for recovering sessions stored in a database, characterized in that, Applied to caching, including: Receive all user communication windows within the first time period, encode the sessions with timestamps, and save them. In response to the transfer condition, at least one last session of the communication window in the first time period is imported into the feature extraction model according to the timestamp to obtain the keyword corresponding to the session, and all sessions in the first time period are transferred to the database; wherein, the transfer condition is triggered when the time reaches the minimum number of sessions; When a user restores the communication window within the second time period, the keyword corresponding to the last at least one session in that communication window will be sent to the communication window. The feature extraction model includes the following extraction methods: Use Jieba word segmentation technology to divide the conversation into several words and obtain the total number of words in the current conversation; Calculate the number of times each word appears in the conversation; The word frequency of each word is determined based on the total number of words in the conversation and the number of times each word appears. Determine the number of preset conversations in the corpus, and the number of preset conversations containing each word in that conversation; The inverse document frequency of each word in a session is determined based on the number of preset sessions and the number of preset sessions containing each word. The criticality value of each word is determined based on the word frequency and the inverse document frequency; Select the top few words with the highest degree of importance as the keywords for this conversation; Within the first time period, all user communication windows are received, and the sessions are encoded and saved with timestamps. This process then includes: In response to the transition condition, the last at least one session of the communication window between the user and multiple session objects in the first time period is imported into the feature extraction model according to the timestamp to obtain the keywords between the user and multiple session objects. If there are duplicate keywords, the session corresponding to the duplicate keyword will be mapped to a single keyword, and only one keyword will be retained. The step of determining the criticality value of each word based on the word frequency and the inverse document frequency further includes: The keyness value of each word is obtained according to the formula. in Let be the word frequency of the i-th word. Let i be the inverse document frequency of the i-th word. The importance value of the i-th word; When the user restores the communication window within the second time period, it further includes: If the keyword is stored for longer than the cache time, the keyword will be deleted. When the user restores the communication window again, the session is retrieved from the database based on the window number and timestamp, and restored to the communication window; wherein, the session restored to the communication window includes all sessions cached from the database; The step of receiving all user communication windows within the first time period, encoding and saving the sessions with timestamps, further includes: Record the user's first account and the second account of the user's communication partner, and concatenate the first account and the second account to obtain the window number of the user's communication window; The window number and the timestamp when the session occurred are encoded and saved as the session number; wherein, the saving is performed in the order of the timestamps and stored in the cache, the cache including several zset buckets; the session is randomly assigned to the zset bucket using a hash algorithm; the zset buckets remove duplicate feature information for repeated entries.

2. The session recovery method according to claim 1, characterized in that, When the user restores the communication window within the second time period, after sending the keyword corresponding to at least one of the last sessions in the communication window to the communication window, the process includes: The system receives a user's instruction to retrieve detailed information for at least the last session, retrieves the session from the database based on the mapping relationship between the encoding and the session, and sends it to the communication window.

3. The session recovery method according to claim 1, characterized in that, The determination of word frequency based on the total number of words in the conversation and the number of times each word appears further includes: The word frequency of each word is obtained according to the formula. in Let be the word frequency of the i-th word. Let i be the number of times the i-th word appears in this session. This represents the total number of words.

4. The session recovery method according to claim 1, characterized in that, The step of determining the inverse document frequency of each word in a session based on the number of preset sessions and the number of preset sessions containing each word further includes: The inverse document frequency of each word is obtained according to the formula. in Let i be the inverse document frequency of the i-th word. The preset number of documents containing the i-th word. The preset total number of documents in the corpus.

5. The session recovery method according to claim 3, characterized in that, When the user restores the communication window within the second time period, sending the keyword corresponding to at least one last session in the communication window to the communication window according to the encoding further includes: The window number corresponding to the communication window between the user and the user's chat partner, sent when the user restores the window; Keywords are obtained by matching window numbers and sent to the communication window, where they are displayed.

6. A session data recovery device, characterized in that, Applied to caching, including: The receiving unit is used to receive all user communication windows within the first time period, encode the sessions with timestamps, and save them. A transfer unit is configured to, in response to a transfer condition, import at least one last session of the communication window in the first time period into the feature extraction model based on the timestamp, obtain the keyword corresponding to that session, and transfer all sessions in the first time period to the database; wherein, the transfer condition is triggered when the time reaches the minimum number of sessions; The recovery unit is used to send the keyword corresponding to the last at least one session in the communication window to the communication window according to the encoding when the user recovers the communication window in the second time period. The extraction method of the feature extraction model in the transfer unit includes: Use Jieba word segmentation technology to divide the conversation into several words and obtain the total number of words in the current conversation; Calculate the number of times each word appears in the conversation; The word frequency of each word is determined based on the total number of words in the conversation and the number of times each word appears. Determine the number of preset conversations in the corpus, and the number of preset conversations containing each word in that conversation; The inverse document frequency of each word in a session is determined based on the number of preset sessions and the number of preset sessions containing each word. The criticality value of each word is determined based on the word frequency and the inverse document frequency; Select the top few words with the highest degree of importance as the keywords for this conversation; The transfer unit is further configured to: In response to the transition condition, the last at least one session of the communication window between the user and multiple session objects in the first time period is imported into the feature extraction model according to the timestamp to obtain the keywords between the user and multiple session objects. If there are duplicate keywords, the session corresponding to the duplicate keyword will be mapped to a single keyword, and only one keyword will be retained. The step of determining the criticality value of each word based on the word frequency and the inverse document frequency further includes: The keyness value of each word is obtained according to the formula. in Let be the word frequency of the i-th word. Let i be the inverse document frequency of the i-th word. The importance value of the i-th word; When the user restores the communication window within the second time period, it further includes: If the keyword is stored for longer than the cache time, the keyword will be deleted. When the user restores the communication window again, the session is retrieved from the database based on the window number and timestamp, and restored to the communication window; wherein, the session restored to the communication window includes all sessions cached from the database; The receiving unit is specifically used for: Record the user's first account and the second account of the user's communication partner, and concatenate the first account and the second account to obtain the window number of the user's communication window; The window number and the timestamp when the session occurred are encoded and saved as the session number; wherein, the saving is performed in the order of the timestamps and stored in the cache, the cache including several zset buckets; the session is randomly assigned to the zset bucket using a hash algorithm; the zset buckets remove duplicate feature information for repeated entries.

7. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the session data recovery method as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the session data recovery method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Session reservation method and system in instant communication tool

    CN101483620A

  • Information interactive method and apparatus, and user equipment

    CN106919321A

  • Chat message display method and device

    CN110166346A

  • Chat record keyword extraction method and device, computer equipment and storage medium

    CN110750619A