Comment information sorting method, device, electronic device and storage medium
By assigning sorting scores to comment information and using Redis's Zset or SortedSet data structure storage, the problems of complex logic of storing and reading, large memory usage and high maintenance costs are solved, and more efficient comment information reading and storage are achieved.
Patent Information
- Application Number
- CN202111100759.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-18
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2041-09-18
AI Technical Summary
In the prior art, the storage and reading logic of comment information is complex, the memory occupies a large amount of data maintenance costs, and the reading efficiency is low.
By assigning sorting scores to each comment information, determining the display order based on the sorting scores and storing the comment information, using Redis's Zset or SortedSet data structure for sorting and storing, reducing the reading of priority prefixes.
Simplifies reading logic, improves reading efficiency, and reduces memory usage and data maintenance costs.
Smart Images

Figure CN113849632B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of multimedia technology, and in particular to a comment information sorting method, device, electronic device, and storage medium. Background Art
[0002] After an author publishes a work on an app, user accounts can leave comments in the comment section to express their approval of the work. Replies to user accounts' comments in the comment section can provide positive incentives for the user accounts, encouraging them to post more comments and increasing engagement between the author and the user account. However, for authors with a large number of comments, how to more conveniently reply to comments has become a pressing technical challenge.
[0003] In related technologies, in order to help authors reply to comments more conveniently, the solution adopted is to display comment information sorted by importance level to the author. Specifically, when storing comment information, the storage location of each comment information is determined based on the comment information identifier, and the priority prefix of each comment information is stored to distinguish the priority levels of different comment information. When reading comment information, the comment information is first read according to the storage location of the comment information, and then the priority prefix of the comment information is read to determine the display order of the comment information. This storage method not only causes the comment information to occupy a large amount of memory and has high data maintenance costs due to the storage of the priority prefix, but also because it needs to be read multiple times, resulting in complex reading logic and low reading efficiency. Summary of the Invention
[0004] The present disclosure provides a review information sorting method, device, electronic device, and storage medium to at least address the problems of complex review data reading logic, large memory usage, and high data maintenance costs in related technologies. The technical solutions of the present disclosure are as follows:
[0005] According to a first aspect of an embodiment of the present disclosure, a comment information sorting method is provided, comprising: obtaining multiple comment information of a media resource; obtaining multiple comment information of a media resource; the media resource comprising a short video resource; determining a sorting score for each of the multiple comment information, the sorting score being used to characterize the importance level of each comment information among the multiple comment information; determining a display order of each comment information based on the sorting score, and storing each comment information according to the display order of each comment information.
[0006] In one possible implementation, determining the ranking score of each comment information among the multiple comment information includes: generating a ranking score for each comment information based on the priority value and comment information identifier of each comment information; the priority value is used to represent the importance level of the first user account that posted the comment information.
[0007] In another possible implementation, the ranking score of each comment information is generated based on the priority value and comment information identifier of each comment, including: determining a first ranking score of the comment information based on the priority value and a preset score coefficient; determining a second ranking score of the comment information based on the comment information identifier and the preset score coefficient; and determining the ranking score of the comment information based on the first ranking score and the second ranking score.
[0008] In another possible implementation, the ranking score of the comment information is determined based on the first ranking score and the second ranking score, including: performing a left shift operation on the sum of the first ranking score and the second ranking score to obtain a vacant position for the sum; the sum is binary data; writing the binary value corresponding to the interactive attribute of the comment information into the vacant position to obtain the ranking score; the interactive attribute is used to represent the interactive information between the first user account and the second user account, and the second user account represents other user accounts other than the first user account.
[0009] In another possible implementation, determining the first ranking score of the comment information according to the priority value and the preset score coefficient includes: determining the first ranking score according to the product of the priority value and the preset score coefficient.
[0010] In another possible implementation, determining a second ranking score of the comment information based on the comment information identifier and a preset score coefficient includes: determining the second ranking score based on a remainder obtained by dividing the comment information identifier by the preset score coefficient.
[0011] In another possible implementation, the method further includes: determining a priority value based on at least two priority information of the comment information; each priority information of the at least two priority information is determined based on the intimacy between the first user account and the third user account that publishes the media resource or at least one attribute information of the first user account.
[0012] In another possible implementation, each comment information is stored according to the display order of each comment information, including: based on the display order of each comment information, each comment information in the multiple comment information is stored in sequence; the storage information of the comment information includes the identifier of the media resource, the comment information identifier and the ranking score.
[0013] In another possible implementation, the comment information sorting method further includes: determining the identifier of the first media resource of the comment information to be displayed; determining the first comment information identifier and the first sorting score corresponding to the first media resource based on the correspondence between the identifier of the media resource and the comment information identifier; and based on the first sorting score, reading the comment information corresponding to the first comment information identifier to obtain the comment information to be displayed.
[0014] According to a second aspect of an embodiment of the present disclosure, a comment information sorting device is provided, comprising: an acquisition module configured to execute acquisition of multiple comment information of a media resource; the media resource comprises a short video resource; a determination module configured to execute determination of a ranking score for each of the multiple comment information, the ranking score being used to characterize the importance level of each comment information among the multiple comment information; a sorting module configured to execute determination of a display order of each comment information based on the ranking score, and store each comment information according to the display order of each comment information.
[0015] In one possible implementation, the determination module is specifically configured to execute: generating a ranking score for each comment information based on the priority value and comment information identifier of each comment information; the priority value is used to represent the importance level of the user account that posted the comment information.
[0016] In another possible implementation, the determination module is specifically configured to perform: determining the first ranking score of the comment information based on the priority value and the preset score coefficient; determining the second ranking score of the comment information based on the comment information identifier and the preset score coefficient; determining the ranking score of the comment information based on the first ranking score and the second ranking score.
[0017] In another possible implementation, the determination module is specifically configured to execute: performing a left shift operation on the sum of the first ranking score and the second ranking score to obtain a vacant position for the sum; the sum is binary data; writing the binary value corresponding to the interactive attribute of the comment information into the vacant position to obtain a ranking score; the interactive attribute is used to represent the interactive information between the first user account and the second user account, and the second user account represents other user accounts other than the first user account.
[0018] In another possible implementation, the determination module is specifically configured to execute: determining the first ranking score according to the product of the priority value and a preset score coefficient.
[0019] In another possible implementation, the determination module is specifically configured to execute: determining the second ranking score according to a remainder obtained by dividing the comment information identifier by a preset score coefficient.
[0020] In another possible embodiment, the device also includes a priority module configured to perform: determining a priority value based on at least two priority information of the comment information; each priority information of the at least two priority information is determined based on the intimacy between the first user account and the third user account that publishes the media resource or at least one attribute information of the first user account.
[0021] In another possible implementation, the ranking module is specifically configured to: sequentially store each of the plurality of comments based on the display order of each comment; the stored comment information includes the identifier of the media resource, the comment identifier, and the ranking score.
[0022] In another possible implementation, the device further includes a reading module configured to execute: determining an identifier of a first media resource of the comment information to be displayed; determining a first comment information identifier and a first ranking score corresponding to the first media resource based on a correspondence between the identifier of the media resource and the comment information identifier; and reading the comment information corresponding to the first comment information identifier based on the first ranking score to obtain the comment information to be displayed.
[0023] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute instructions to implement the comment information sorting method of the above-mentioned first aspect and any possible implementation method thereof.
[0024] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the comment information sorting method in the above-mentioned first aspect and any possible implementation method thereof.
[0025] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, which includes computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the comment information sorting method of the first aspect and any possible implementation method thereof.
[0026] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects: by determining the display order of comment information through a ranking score that can represent the level of importance of the comment information, and storing the comment information according to the display order, the comment information can be displayed according to the order in which the comment information is read, eliminating the need to read the priority prefix row to display the ranking after reading the comment information. This makes the reading logic simpler and the reading efficiency higher, solving the problem of the prior art that requires multiple readings, resulting in complex reading logic and low reading efficiency. In addition, it also solves the problem of the prior art that the need to store priority prefixes causes the comment information to occupy a large amount of memory and high data maintenance costs.
[0027] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute an improper limitation of the present disclosure.
[0029] Figure 1 is a flow chart showing a method for sorting comment information according to an exemplary embodiment;
[0030] Figure 2 is a flow chart showing another method for sorting comment information according to an exemplary embodiment;
[0031] Figure 3 is a flow chart showing another method for sorting comment information according to an exemplary embodiment;
[0032] Figure 4 is a flow chart showing another method for sorting comment information according to an exemplary embodiment;
[0033] Figure 5 This is a block diagram of a method and apparatus for sorting comment information according to an exemplary embodiment;
[0034] Figure 6 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0035] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0036] It should be noted that the terms "first," "second," and the like in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the numbers used in this manner are interchangeable where appropriate so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure as detailed in the appended claims.
[0037] Before introducing the information processing method provided by the present disclosure in detail, a brief introduction is first given to the application scenarios, implementation environment and related elements involved in the present disclosure.
[0038] First, a brief introduction to the application scenarios involved in this disclosure is given.
[0039] The comment section of a media resource reflects the community atmosphere of an application. It is an important scene for consolidating community culture and enhancing user stickiness. It is also the main place for group identity recognition and emotional reinforcement.
[0040] After an author publishes a work on an app, user accounts can leave comments in the comment section to express their approval of the work. Replies to user accounts' comments in the comment section can provide positive incentives for the user accounts, encouraging them to post more comments and increasing engagement between the author and the user account. However, for authors with a large number of comments, how to more conveniently reply to comments has become a pressing technical challenge.
[0041] In the prior art, in order to help authors reply to comments more conveniently, the solution adopted is to display comment information sorted by importance level to the author. Specifically, when storing comment information, the storage location of each comment information is determined based on the comment information identifier, and the priority prefix of each comment information is stored to distinguish the priority levels of different comment information. When reading comment information, the comment information is first read according to the storage location of the comment information, and then the priority prefix of the comment information is read to determine the display order of the comment information. This storage method not only causes the comment information to occupy a large amount of memory and high data maintenance costs due to the storage of the priority prefix, but also because it needs to be read multiple times, resulting in complex reading logic and low reading efficiency.
[0042] In response to the above problems, the present disclosure provides a comment information sorting method. The display order of the comment information is determined by a sorting score that can represent the level of importance of the comment information, and the comment information is stored according to the display order. Thus, the comment information can be displayed according to the order in which the comment information is read. There is no need to read the priority prefix line after reading the comment information to display the sorting. The reading logic is simpler and the reading efficiency is higher. This solves the problem of the existing technology that requires multiple readings, resulting in complex reading logic and low reading efficiency. In addition, it also solves the problem of the existing technology that requires storing priority prefixes, resulting in large memory usage and high data maintenance costs.
[0043] Next, the implementation environment (implementation architecture) involved in this disclosure is briefly introduced below.
[0044] The content search method provided in the embodiments of the present disclosure can be applied to electronic devices. The electronic device can be a terminal device or a server. The terminal device can be a smartphone, tablet computer, PDA, vehicle-mounted terminal, desktop computer, laptop computer, etc. The server can be any server or server cluster, which is not limited in this disclosure.
[0045] Again, in order to facilitate understanding of this application, the relevant elements involved in this application are described.
[0046] An Application Programming Interface (API) is a set of predefined interfaces (such as functions or HTTP interfaces) or conventions for connecting different components of a software system. It provides a set of routines that applications and developers can access based on a piece of software or hardware without requiring access to the source code or understanding the details of the internal workings.
[0047] Remote Dictionary Server (Redis) is an open-source, network-friendly, in-memory, and persistent log-based key-value database written in ANSI C. It also provides APIs in multiple languages.
[0048] A SortedSet is an ordered list with no duplicate members. Each member in a SortedSet is associated with a score, and Redis uses the score to sort the members in the list from largest to smallest.
[0049] A Zset is an ordered list with no duplicate members. Each member in a Zset has a score associated with it, and members cannot be duplicated. The Zset automatically sorts the members based on their scores.
[0050] In addition, it should be noted that the user information involved in this disclosure (including but not limited to user device information, user personal information, etc.) is all information authorized by the user or fully authorized by all parties.
[0051] For ease of understanding, the task processing method provided by the present disclosure is described in detail below with reference to the accompanying drawings.
[0052] Figure 1 FIG. 1 is a flow chart showing a method for sorting comment information according to an exemplary embodiment, wherein the method for sorting comment information is used in an electronic device. Figure 1 As shown, the comment information sorting method includes S101-S103.
[0053] In S101 , multiple comment information of a media resource is obtained.
[0054] Among them, media resources include short video resources.
[0055] Optionally, the media resource further includes only one of a text resource, an image resource, an audio resource, and a video resource.
[0056] Optionally, the client sends a display request carrying comment information to the electronic device, requesting that the comment information be displayed to the first user account identifier that posted the comment information on the media resource. The electronic device obtains multiple comment information on the media resource according to the display request.
[0057] In one embodiment, after a first user account viewing a media resource posts a comment, the client sends a display request to the server. The display request includes the comment posted by the first user account and requests that the comment be displayed to the first user account. After receiving the display request, the electronic device retrieves the comment information for the media resource. After receiving multiple display requests for the media resource, the electronic device retrieves multiple comments for the media resource.
[0058] Optionally, historical comment information of the media resource is stored in the database, and the electronic device obtains multiple comment information of the media resource from the database.
[0059] In one embodiment, a type of media resource has historical comment information stored in its database. This historical comment information was published before the application used the comment ranking method disclosed herein, making it impossible to retrieve the comment information when receiving a request to display the comment information. For this historical comment information, when using the comment ranking method disclosed herein, the electronic device retrieves the comment information from the database.
[0060] For example, when an author account that publishes a media resource clicks a comment control on the media resource to trigger the display of comment information for the media resource, the client sends a comment retrieval request to the electronic device. After receiving the comment retrieval request, the electronic device retrieves multiple historical comments for the media resource from a database, sorts the multiple historical comments, and sends the sorted comment information to the client, which then displays the sorted comment information to the author account.
[0061] For example, historical comment information for media resources of author accounts can be pre-obtained and sorted to improve the speed of comment information display. Specifically, author accounts can be determined based on their activity level. Author accounts with high activity levels are more likely to request comment information display. Pre-obtaining and sorting comment information corresponding to these author accounts can improve the real-time display of comment information.
[0062] In one embodiment, the media resource may be audio, video, picture, or text information, etc. This disclosure does not limit this.
[0063] In S102 , a ranking score of each review information among the plurality of review information is determined, where the ranking score is used to represent the importance level of each review information among the plurality of review information.
[0064] Optionally, after acquiring multiple review information, the electronic device determines a ranking score for each review information in the multiple review information.
[0065] In one embodiment, the ranking score of each comment information may be determined according to the importance level of each comment information to the third user account that published the media resource.
[0066] For example, the importance level of each comment to the third user account that posted the media resource can be determined based on information about the first user account that posted the comment. For example, the importance level can be determined based on the intimacy between the first user account and the third user account. Alternatively, the importance level can be determined based on at least one attribute of the first user account.
[0067] Optionally, the attribute information includes the number of fans, activity, number of comments posted, registration time, login time, and consumption time. The consumption time is the time spent watching the media resource.
[0068] Optionally, different review information has different ranking scores.
[0069] In S103 , the display order of each review information is determined based on the ranking score, and each review information is stored according to the display order of each review information.
[0070] Optionally, after obtaining the ranking scores of the comment information, the electronic device determines the display order of each comment information according to the ranking scores, obtains multiple comment information ranked according to the display order, and stores the ranked multiple comment information.
[0071] In one embodiment, comment information can be stored based on a Redis Zset or SortedSet data structure, with the comment information's ranking score representing the score, the media resource identifier representing the key, and the comment information identifier representing the field. When storing comment information, the database sorts the comments based on the score, consistent with the sorting parameters disclosed herein for displaying comment information based on ranking scores. This ensures that the database does not disrupt the display order of the comments during storage.
[0072] In the above embodiment, the display order of the comment information is determined by a ranking score that can represent the level of importance of the comment information, and the comment information is stored according to the display order. This allows the comment information to be displayed according to the order in which the comment information is read, eliminating the need to read the priority prefix row to display the ranking after reading the comment information. This simplifies the reading logic and improves the reading efficiency, solving the problem of the prior art that requires multiple readings, resulting in complex reading logic and low reading efficiency. In addition, it also solves the problem of the prior art that the need to store priority prefixes causes the comment information to occupy a large amount of memory and high data maintenance costs.
[0073] In one possible implementation, determining a ranking score for each comment information among a plurality of comment information includes: generating a ranking score for each comment information based on a priority value and a comment information identifier of each comment information; the priority value is used to represent the importance level of the first user account that posts the comment information.
[0074] Optionally, the priority value is used to represent the importance level of the first user account to the third user account.
[0075] Optionally, the electronic device generates a ranking score for each review based on the priority value and review identifier of each review. The ranking score obtained by combining the priority value and review identifier allows the ranking score to both represent the priority levels of different review information and distinguish between review information of the same priority level. The priority value portion of the ranking score represents the priority levels of different review information, while the review identifier of the ranking score is used to distinguish between review information of the same priority level.
[0076] In one embodiment, the priority value is used to generate the pre-order portion of the ranking score. The comment information identifier is used to generate the post-order portion of the ranking score. For example, the ranking score is 300007589, where 3 is for the pre-order portion and 7589 is for the post-order portion. The pre-order portion of 3 is determined by the priority value, and the post-order portion of 7589 is determined by the comment information identifier.
[0077] Optionally, the priority value is used to represent the importance level of the comment information to the third user account identifier.
[0078] In one embodiment, a larger priority value of a comment indicates a higher level of importance of the comment to the third user account identifier. For example, a first comment with a priority value of 5 is more important than a second comment with a priority value of 4.
[0079] In the above embodiment, a ranking score is generated by the priority value of the comment information and the comment information identifier, so that the ranking score can partially represent the priority level of different comment information through the priority value part, and distinguish the comment information of the same priority level through the comment information identifier, so that the ranking score can not only represent the importance level of each comment information among multiple comment information, but also enable different comment information to have different ranking scores, avoiding the inability to determine the display order between comment information of the same priority level.
[0080] In one possible embodiment, the comment information sorting method further includes: determining a priority value based on at least two priority information of the comment information; each priority information of the at least two priority information is determined based on the intimacy between the first user account and the third user account that publishes the media resource or at least one attribute information of the first user account.
[0081] Optionally, the priority value is determined according to the intimacy between the first user account identifier and the third user account identifier.
[0082] In one embodiment, based on the intimacy between the first user account identifier and the third user account identifier, the relationship between the first user account identifier and the third user account identifier can be determined as a friend relationship, a fan relationship, or a stranger relationship. The intimacy corresponding to a friend relationship is higher than the intimacy corresponding to a fan relationship, and the intimacy corresponding to a fan relationship is higher than the intimacy corresponding to a stranger relationship. Furthermore, the higher the intimacy, the greater the priority value. Specifically, the priority value of comment information corresponding to a friend relationship is higher than the priority value of comment information corresponding to a fan relationship, and the priority value of comment information corresponding to a fan relationship is higher than the priority value of comment information corresponding to a stranger relationship.
[0083] Exemplarily, the intimacy between the first user account identifier and the second user account identifier may be determined based on interaction information between the first user account identifier and the third user account identifier.
[0084] Exemplarily, the intimacy between the first user account identifier and the third user account identifier may be determined based on the remark information of the third user account identifier on the first user account identifier.
[0085] Optionally, the priority value is determined according to attribute information of the first user account identifier.
[0086] In one embodiment, the attribute information of the first user account identifier includes at least one of the following information: number of followers, activity level, number of comments posted, registration time, login time, and consumption time. The consumption time represents the length of time spent viewing the media resource.
[0087] In the above embodiment, the priority value is determined by at least two priority values, so that the ranking score of the comment information is determined according to multiple priority values, thereby realizing the sorting of the comment information according to multiple priorities, thereby improving data access efficiency and data storage efficiency.
[0088] In one possible embodiment, combining Figure 1 ,like Figure 2 As shown, S102 includes S102a-S102c.
[0089] In S102a, a first ranking score of the comment information is determined according to the priority value and the preset score coefficient.
[0090] Optionally, a preset score coefficient is used to determine the order of magnitude of the ranking score.
[0091] In one embodiment, the order of magnitude of the ranking score is the same as the order of magnitude of the preset score coefficient. That is, the order of magnitude of the ranking score is determined by the preset score coefficient so that the ranking scores of comments with the same priority level are at the same order of magnitude, thereby ensuring that comments with the same priority level can be sorted consecutively when sorting the comments, thereby ensuring the accuracy of the comment sorting. Comments with the same priority value are comments with the same priority level.
[0092] In a possible implementation, determining the first ranking score of the comment information according to the priority value and the preset score coefficient includes: determining the first ranking score according to the product of the priority value and the preset score coefficient.
[0093] In the above embodiment, the first ranking score is obtained by multiplying the priority value and the preset score coefficient, so that the first ranking score can represent the priority levels of different comment information.
[0094] In S102b, a second ranking score of the comment information is determined according to the comment information identifier and the preset score coefficient.
[0095] Optionally, the electronic device obtains a second ranking score based on the comment information identifier and a preset score coefficient. Because different comment information has different comment information identifiers, the second ranking score determined by the comment information identifier can distinguish between comment information of the same priority level, thereby enabling comment information of the same priority level to have different ranking scores. This enables comment information of the same priority level to have different ranking positions when sorting multiple comment information.
[0096] In one embodiment, the comment information identifier is determined according to the time when the comment information is published. The comment information identifier corresponding to the most recently published comment information has the largest value.
[0097] In a possible implementation, determining a second ranking score of the comment information according to the comment information identifier and a preset score coefficient includes: determining the second ranking score according to a remainder obtained by dividing the comment information identifier by the preset score coefficient.
[0098] In the above embodiment, the second ranking score is determined by the remainder obtained by dividing the comment information identifier by the preset score coefficient, so that different comment information has different second ranking scores, thereby distinguishing comment information of the same priority level through the second ranking score.
[0099] In S102c, the ranking score of the comment information is determined according to the first ranking score and the second ranking score.
[0100] Optionally, the electronic device determines the sum of the first ranking score and the second ranking score as the ranking score of the comment information, wherein the order of magnitude corresponding to the first ranking score is greater than the order of magnitude corresponding to the second ranking score.
[0101] In one embodiment, the magnitude of the preset score coefficient is greater than the magnitude of the comment information identifier. By making the magnitude of the preset score coefficient greater than the magnitude of the comment information identifier, the magnitude of the first ranking score is greater than the magnitude of the second ranking score.
[0102] Because the order of magnitude of the first ranking score is greater than the order of magnitude of the second ranking score, the ranking score derived from the sum of the first and second ranking scores can both represent the priority of different review information through the high-order bits and distinguish between reviews of the same priority level through the low-order bits. This ensures that reviews of the same priority level can be sorted consecutively when sorting, thereby ensuring the accuracy of the review ranking.
[0103] In the above embodiment, the first ranking score is used to represent the priority of different review information, and the second ranking score is used to distinguish review information with the same priority level, so that the ranking score determined according to the first ranking score and the second ranking score can not only represent the priority of different review information, but also distinguish review information with the same priority level. In one possible implementation, combined with Figure 2 ,like Figure 3 As shown, S102c includes S102c1-S102c2.
[0104] In S102c1, a left shift operation is performed on the sum of the first ranking score and the second ranking score to obtain a vacant position in the sum.
[0105] Here, the sum is binary data.
[0106] Optionally, the electronic device performs a left shift operation on the sum of the first ranking score and the second ranking score to reserve bits on the ranking score.
[0107] In one embodiment, the number of shifts is recorded as EXTRA_BITS. EXTRA_BITS is a reserved bit used to store some binary attributes of the entity (comment information). The binary attributes are represented by the binary values corresponding to the attributes of the comment information.
[0108] Exemplarily, before writing the binary attribute into the empty space, the empty space is filled with the value "0".
[0109] In S102c2, the binary value corresponding to the interactive attribute of the comment information is written into the empty position to obtain the ranking score.
[0110] The interactive attribute is used to represent the interactive information between the first user account and the second user account, and the second user account represents other user accounts other than the first user account.
[0111] Optionally, a binary value corresponding to the interactive attribute of the comment information is written into the empty position to obtain a ranking score, so that the ranking score can represent the interactive attribute of the comment information.
[0112] In one embodiment, the interactive attribute of the comment information may be whether the comment information has sub-comments, whether the comment information has likes, whether the comment information has been reported, whether the comment information has a reply from the author of the media resource, or whether the comment information is pinned.
[0113] For example, the binary value corresponding to having sub-comments, likes, reports, replies, and pinning is "1." The binary value corresponding to having no sub-comments, no likes, no reports, no replies, and no pinning is "0."
[0114] In one embodiment, the sum value includes multiple spaces. Different spaces are filled with binary values corresponding to different interactive attributes, so that when reading the sorting score, the interactive attributes corresponding to the binary values are determined based on the positions of the different binary values.
[0115] In the above embodiment, by performing a left shift operation on the sum of the first ranking score and the second ranking score, a vacant space for the sum is obtained, and the binary value corresponding to the interactive attribute of the comment information is written into the vacant space to obtain the ranking score, thereby realizing the expression of the attribute information of the comment information through the ranking score.
[0116] In a possible implementation, storing each comment information according to the display order of each comment information includes: storing each comment information of the multiple comment information in sequence based on the display order of each comment information; the storage information of the comment information includes the identifier of the media resource, the comment information identifier and the ranking score.
[0117] In one embodiment, a Zset or SortedSet is an ordered list. When storing comments based on a Redis Zset or SortedSet data structure, the stored comment information is configured with a key representing the identifier of the media resource, a field representing the identifier of the comment information, and a score representing the ranking score. The size of the score determines the ranking position of the field within the key; in other words, the ranking score determines the ranking position of multiple comments on the media resource.
[0118] In the above implementation, by configuring the storage information of the comment information to include a ranking score that can both represent the priority level of the comment information and distinguish the comment information with the same priority level, it is possible to store the comment information in the same database, reduce the complexity of the reading logic, and improve storage efficiency and reading performance.
[0119] In one possible implementation, Figure 4 As shown, the comment information sorting method further includes: S104-S106. S104-S106 are used in electronic devices.
[0120] In S104, the identifier of the first media resource for displaying comment information is determined.
[0121] Optionally, the electronic device determines the identifier of the first media resource whose comment information is to be displayed according to the display request sent by the client. The display request is used to request display of the comment information of the first media resource. The display request includes the identifier of the first media resource.
[0122] In one embodiment, a third user account identifier triggers a comment control for a first media resource, requesting the display of comment information for the first media resource. A client sends a display request to an electronic device, the display request carrying the identifier of the first media resource. The electronic device obtains the identifier of the first media resource carried in the display request and determines it as the identifier of the first media resource for which comment information is to be displayed.
[0123] In S105 , a first comment information identifier and a first ranking score corresponding to the first media resource are determined according to the correspondence between the identifiers of the media resources and the comment information identifiers.
[0124] Optionally, the storage information of each comment information includes the identifier of the media resource, the comment information identifier and the ranking score. After determining the identifier of the first media resource, the electronic device determines the first comment information identifier and the first ranking score corresponding to the first media resource based on the correspondence between the identifier of the media resource and the comment information identifier.
[0125] In one embodiment, based on the correspondence between the identifiers of the media resources and the comment information identifiers, multiple first comment information identifiers corresponding to the first media resource are determined, and each first comment information identifier corresponds to a different first ranking score.
[0126] In S106 , based on the first ranking score, the comment information corresponding to the first comment information identifier is read to obtain the comment information to be displayed.
[0127] Optionally, the electronic device flips through the pages to read the comments corresponding to the first comment information identifier based on the first ranking score. In one embodiment, the number of comments read each time is determined based on the preset number of displayed items on the display page corresponding to the third user account identifier. For example, if the preset number of displayed items on the display page is 20, then 20 comments are read each time.
[0128] In one embodiment, the electronic device reads the comment information in ascending order from the ordered list, or reads the comment information in descending order from the ordered list according to the first ranking score.
[0129] For example, the electronic device can read the comment information according to the API interface provided by Redis.
[0130] In the above embodiment, by reading the comment information according to the ranking score, the corresponding comment information can be obtained by reading it only once. The reading logic is simple and the reading efficiency is high. It is suitable for scenarios where online comment information is requested in real time, and the user experience is high.
[0131] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of method. In order to realize the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily appreciate that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in a hardware or computer software driven hardware manner depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0132] The disclosed embodiment also provides a comment information sorting device.
[0133] Figure 5 This is a block diagram of a comment information sorting device according to an exemplary embodiment. Figure 5 The device includes an acquisition module 501, a determination module 502 and a sorting module 503.
[0134] The acquisition module 501 is configured to execute the acquisition of multiple comment information of media resources; the media resources include short video resources; for example, Figure 1 , the acquisition module 501 can be used to execute S101.
[0135] The determination module 502 is configured to determine the ranking score of each comment information in the plurality of comment information, wherein the ranking score is used to represent the importance level of each comment information in the plurality of comment information. Figure 1, the determination module 502 can be used to execute S102.
[0136] The sorting module 503 is configured to determine the display order of each comment information based on the sorting score, and store each comment information according to the display order of each comment information. Figure 1 , the sorting module 503 can be used to execute S103.
[0137] In one possible implementation, the determination module is specifically configured to execute: generating a ranking score for each comment information based on the priority value and comment information identifier of each comment information; the priority value is used to represent the importance level of the user account that posted the comment information.
[0138] In another possible implementation, the determination module 502 is specifically configured to execute: determining a first ranking score of the comment information according to the priority value and the preset score coefficient; determining a second ranking score of the comment information according to the comment information identifier and the preset score coefficient; determining a ranking score of the comment information according to the first ranking score and the second ranking score. Figure 2 , the determination module 502 can be used to execute S102a-S102c.
[0139] In another possible implementation, the determination module 502 is specifically configured to execute: performing a left shift operation on the sum of the first ranking score and the second ranking score to obtain an empty space for the sum; the sum is binary data; writing the binary value corresponding to the interactive attribute of the comment information into the empty space to obtain the ranking score; the interactive attribute is used to represent the interactive information between the first user account and the second user account, and the second user account represents other user accounts other than the first user account. For example, combined with Figure 3 , the determination module 502 can be used to execute S102c1-S102c2.
[0140] In another possible implementation, the determination module 502 is specifically configured to execute: determining the first ranking score according to the product of the priority value and a preset score coefficient.
[0141] In another possible implementation, the determination module 502 is specifically configured to execute: determining the second ranking score according to a remainder obtained by dividing the comment information identifier by a preset score coefficient.
[0142] In another possible embodiment, the device also includes a priority module configured to perform: determining a priority value based on at least two priority information of the comment information; each priority information of the at least two priority information is determined based on the intimacy between the first user account and the third user account that publishes the media resource or at least one attribute information of the first user account.
[0143] In another possible implementation, the sorting module is specifically configured to perform: based on the display order of each comment information, sequentially store each of the multiple comment information; the storage information of the comment information includes the identifier of the media resource, the comment information identifier and the sorting score.
[0144] In another possible implementation, the device further includes a reading module configured to: determine the identifier of the first media resource of the comment information to be displayed; determine the first comment information identifier and the first ranking score corresponding to the first media resource based on the correspondence between the identifier of the media resource and the comment information identifier; and read the comment information corresponding to the first comment information identifier based on the first ranking score to obtain the comment information to be displayed. Figure 4 , the reading module can be used to execute S104-S106.
[0145] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0146] Figure 6 FIG. 1 is a block diagram of an electronic device according to an exemplary embodiment. Figure 6 As shown, the electronic device 600 includes but is not limited to: a processor 601 and a memory 602 .
[0147] The memory 602 is used to store the executable instructions of the processor 601. It is understood that the processor 601 is configured to execute instructions to implement the above embodiment. Figures 1 to 4 The comment information sorting method shown in any one of the items.
[0148] It should be noted that those skilled in the art can understand that Figure 6 The electronic device structure shown in the figure does not limit the electronic device, and the electronic device may include Figure 6 More or fewer components may be shown, or certain components may be combined, or the components may be arranged differently.
[0149] The processor 601 is the control center of the electronic device. It connects all parts of the electronic device using various interfaces and circuits. By running or executing software programs and / or modules stored in the memory 602 and accessing data stored in the memory 602, it performs various functions of the electronic device and processes data, thereby monitoring the entire electronic device. The processor 601 may include one or more processing units; optionally, the processor 601 may integrate an application processor and a modem processor. The application processor primarily handles the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into the processor 601.
[0150] The memory 602 can be used to store software programs and various data. The memory 602 may primarily include a program storage area and a data storage area. The program storage area may store an operating system and application programs required by at least one functional module (such as an image acquisition module, a positioning module, a latent variable acquisition module, or an image generation module). Furthermore, the memory 602 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0151] In an exemplary embodiment, the present disclosure further provides a computer-readable storage medium including instructions, such as a memory 602 including instructions, which can be executed by a processor 601 of an electronic device 600 to complete the above-mentioned Figures 1 to 4 The comment information sorting method shown in any one of the items.
[0152] In actual implementation, the processing functions of the acquisition module 501, the determination module 502 and the sorting module 503 can be Figure 6 The processor 601 shown calls the program code in the memory 602 to implement the process. Figures 1 to 4 The description of any of the comment information sorting methods shown will not be repeated here.
[0153] Optionally, the computer-readable storage medium may be a non-temporary computer-readable storage medium, for example, the non-temporary computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0154] In an exemplary embodiment, the present disclosure further provides a computer program product comprising one or more instructions, which can be executed by the processor 601 of the electronic device 600 to complete the above Figures 1 to 4The comment information sorting method shown in any one of the items.
[0155] It should be noted that when the instructions in the computer-readable storage medium or one or more instructions in the computer program product are executed by the processor 601 of the electronic device 600, each process of the above-mentioned problem recommendation method embodiment is implemented, and the above-mentioned problem recommendation method embodiment can be achieved. Figures 1 to 4 The technical effect of sorting the comment information shown in any of the items is the same, so to avoid repetition, it will not be repeated here.
[0156] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the following claims.
[0157] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for sorting comment information, characterized in that: include: In response to an operation of publishing comment information of a media resource, obtaining a plurality of comment information of the media resource; The media resources include short video resources; Determining a ranking score for each of the plurality of review information, wherein the ranking score is used to represent the importance level of each of the review information among the plurality of review information; wherein determining the ranking score for each of the plurality of review information includes: Determining a first ranking score of the comment information based on a priority value and a preset score coefficient; the priority value is used to represent the importance level of the first user account that posted the comment information; the priority value is determined based on at least two priority information of the comment information; each priority information of the at least two priority information is determined based on the intimacy between the first user account and a third user account that posted the media resource or at least one attribute information of the first user account; Determining a second ranking score of the comment information according to the comment information identifier and the preset score coefficient; Performing a left shift operation on the sum of the first sorting score and the second sorting score to obtain a vacant position of the sum; the sum is binary data; Writing a binary value corresponding to the interactive attribute of the comment information into the empty space to obtain a ranking score; the interactive attribute is used to represent the interactive information between the first user account and the second user account, and the second user account represents other user accounts besides the first user account; Based on the ranking score, a display order of each review information is determined, and each review information is stored according to the display order of each review information.
2. The comment information sorting method according to claim 1, characterized in that: Determining a first ranking score of the comment information according to the priority value and a preset score coefficient includes: The first ranking score is determined according to the product of the priority value and the preset score coefficient.
3. The comment information sorting method according to claim 2, characterized in that: Determining a second ranking score of the comment information according to the comment information identifier and the preset score coefficient includes: The second ranking score is determined according to the remainder obtained by dividing the comment information identifier by the preset score coefficient.
4. The comment information sorting method according to claim 1, characterized in that: Storing each comment information according to the display order of each comment information includes: Based on the display order of each comment information, each comment information in the plurality of comment information is stored in sequence; the storage information of each comment information includes the identifier of the media resource, the comment information identifier and the ranking score.
5. The comment information sorting method according to claim 4, characterized in that: The comment information sorting method further includes: Determining an identifier of a first media resource for displaying comment information; Determining a first comment information identifier and a first ranking score corresponding to the first media resource based on a correspondence between the media resource identifier and the comment information identifier; Based on the first ranking score, the comment information corresponding to the first comment information identifier is read to obtain the comment information to be displayed.
6. A comment information sorting device, characterized in that: include: an acquisition module, configured to, in response to an operation of publishing comment information of a media resource, execute acquisition of a plurality of comment information of the media resource; The media resources include short video resources; a determining module configured to determine a ranking score for each of the plurality of review information, the ranking score being used to represent the importance level of each of the review information among the plurality of review information; wherein determining the ranking score for each of the plurality of review information comprises: Determining a first ranking score of the comment information based on a priority value and a preset score coefficient; the priority value is used to represent the importance level of the first user account that posted the comment information; the priority value is determined based on at least two priority information of the comment information; each priority information of the at least two priority information is determined based on the intimacy between the first user account and a third user account that posted the media resource or at least one attribute information of the first user account; Determining a second ranking score of the comment information according to the comment information identifier and the preset score coefficient; Performing a left shift operation on the sum of the first sorting score and the second sorting score to obtain a vacant position of the sum; the sum is binary data; The binary value corresponding to the interactive attribute of the comment information is written into the empty space to obtain a sorting score; the interactive attribute is used to represent the interactive information between the first user account and the second user account, and the second user account represents other user accounts other than the first user account; the sorting module is configured to execute based on the sorting score, determine the display order of each comment information, and store each comment information according to the display order of each comment information.
7. The comment information sorting device according to claim 6, characterized in that: The determining module is specifically configured to execute: The first ranking score is determined according to the product of the priority value and the preset score coefficient.
8. The comment information sorting device according to claim 7, characterized in that: The determining module is specifically configured to execute: The second ranking score is determined according to the remainder obtained by dividing the comment information identifier by the preset score coefficient.
9. The comment information sorting device according to claim 6, characterized in that: The sorting module is specifically configured to perform: Based on the display order of each comment information, each comment information in the multiple comment information is stored in sequence; the storage information of the comment information includes the identifier of the media resource, the comment information identifier and the ranking score.
10. The comment information sorting device according to claim 9, characterized in that: The apparatus further comprises a reading module configured to execute: Determining an identifier of a first media resource for displaying comment information; Determining a first comment information identifier and a first ranking score corresponding to the first media resource based on a correspondence between the media resource identifier and the comment information identifier; Based on the first ranking score, the comment information corresponding to the first comment information identifier is read to obtain the comment information to be displayed.
11. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the comment information sorting method according to any one of claims 1 to 5.
12. A computer-readable storage medium, characterized in that When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the comment information ranking method according to any one of claims 1 to 5.
13. A computer program product, characterized in that The computer program product includes computer instructions, and when the computer instructions are executed on an electronic device, the electronic device executes the comment information ranking method according to any one of claims 1 to 5.
Citation Information
Patent Citations
User evaluation processing method and device, computer readable medium and electronic equipment
CN108960944A
Data storage method and device
CN113329078A