Social media post comment fusion search method and device based on DACF dynamic alternating content fusion model
By using the DACF dynamic alternating content fusion model, the problem of information fragmentation between post and comment data in social media is solved, enabling deep fusion and flexible search of posts and comments, and improving the accuracy of search results and user experience.
Patent Information
- Application Number
- CN202511277573.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-09
- Publication Date
- 2025-12-16
AI Technical Summary
Existing social media search methods fail to effectively integrate post and comment data, resulting in information fragmentation, poor user search experience, inaccurate search results, and low efficiency.
The system employs the DACF dynamic alternating content fusion model, which uses vector extraction and centroid calculation in conjunction with Elasticsearch indexes to achieve deep fusion of post and comment data. It also dynamically adjusts the search strategy based on the user's query type and provides paginated display of post and comment pairs.
It improves information integration and search flexibility, enhances the accuracy and efficiency of search results, and improves user experience.
Smart Images

Figure CN121144580A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method, apparatus, and electronic device for searching social media post comments based on the DACF dynamic alternating content fusion model. Background Technology
[0002] The booming development of social media has led to the generation of massive amounts of information across various platforms, including a wealth of post data and related comments. In the current field of information retrieval, traditional search methods face a series of challenges when processing social media data.
[0003] On the one hand, most traditional search technologies treat post and comment data as independent information sources, lacking in-depth exploration and utilization of their inherent connections. For example, in the design of storage and indexing structures, posts and comments are usually stored in different data tables or storage areas, making it difficult to effectively integrate and correlate the information from both during a search. This fragmented information prevents users from obtaining comprehensive and coherent information from both posts and comments simultaneously, and fails to fully leverage the correlation between them to improve the quality of search results.
[0004] On the other hand, existing search methods have significant limitations in terms of user search experience. They typically only support single-dimensional searches, limiting users to a relatively fixed mode of operation. Users cannot flexibly switch search scopes or adjust search priorities between posts and comments based on their specific needs. Furthermore, traditional search technologies often employ simple matching or shallow semantic analysis when processing user-input keywords. They fail to adequately understand the rich and diverse user expressions and semantic information in social media, resulting in inconsistent accuracy and relevance of search results.
[0005] Furthermore, traditional search systems face immense pressure in terms of data processing and retrieval efficiency when dealing with massive amounts of social media data. Due to a lack of efficient data organization and search algorithms, when a user initiates a search request, the system cannot quickly and accurately filter out posts and comments that match the user's needs, resulting in longer search times and increased time costs for users waiting for results, failing to meet users' demand for rapid information access.
[0006] The aforementioned issues have become technical problems that need to be solved. Summary of the Invention
[0007] In view of this, embodiments of the present invention provide a method, apparatus and electronic device for social media post and comment fusion search based on the DACF dynamic alternating content fusion model, which at least partially solves the problems existing in the prior art.
[0008] In a first aspect, embodiments of the present invention provide a social media post and comment fusion search method based on the DACF dynamic alternating content fusion model, including:
[0009] Social media data is collected from social media platforms. The social media data includes post data DT and comment data DP corresponding to the post data DT. Vector extraction is performed on the post data DT and the comment data DP to obtain the post centroid vector VT and the comment centroid vector VP. The post centroid vector VT and the comment centroid vector VP are stored in an Elasticsearch index, and the post data DT and the comment data DP are stored in the database corresponding to the Elasticsearch index.
[0010] The user interface receives a set of keywords K={K1,K2,…,Kp} and a query type QT selected by the user for the set of keywords K. The query type QT includes querying comments, querying the original post, and querying both the original post and comments simultaneously.
[0011] In the Elasticsearch index, the keyword set K={K1,K2,…,Kp} is vectorized to obtain the search vector SK. The offset values of the search vector SK from the post centroid vector VT and the comment centroid vector VP are calculated to obtain the first offset value DS1 and the second offset value DS2.
[0012] Based on the first offset value DS1, the second offset value DS2 and the query type QT, calculate the first query ratio QC1 for post data DT and the second query ratio QC2 for comment data DP;
[0013] The search vector SK, the first query ratio QC1, and the second query ratio QC2 are used as mixed query conditions. The post data DT and comment data DP are fused and searched in the database to obtain the search result SR. The search result SR is then displayed to the user in a paginated manner using post and comment pairs.
[0014] According to a specific implementation of the present invention, the step of extracting vectors from post data DT and comment data DP to obtain post centroid vector VT and comment centroid vector VP includes:
[0015] The post data (DT) and comment data (DP) are segmented into words. For the post data (DT), the words it contains are represented as follows: Each word is processed through a pre-trained word vector model. Convert to word vectors Then, the centroid vector VT of the post is calculated:
[0016]
[0017] Word vectors The j-th dimension, where d is the dimension of the word vector;
[0018] For comment data DP, the words it contains are represented as follows: Each word is processed through a pre-trained word vector model. Convert to word vectors Then, the centroid vector VP of the comment is calculated:
[0019]
[0020] Word vectors The i-th dimension, where d is the dimension of the word vector.
[0021] According to a specific implementation of an embodiment of the present invention, the vectorization processing of the keyword set K in the Elasticsearch index includes:
[0022] For each keyword Ki in the keyword set K={K1,K2,…,Kp}, convert it into a word vector using a pre-trained word vector model. ;
[0023] Calculate word vectors Importance weight , ;
[0024] The search vector SK is obtained by weighting and combining the word vectors:
[0025] .
[0026] According to a specific implementation of the present invention, the step of calculating the offset values between the search vector SK and the post centroid vector VT and the comment centroid vector VP, respectively, to obtain the first offset value DS1 and the second offset value DS2, includes:
[0027] Calculate the first offset value DS1:
[0028]
[0029] Calculate the second offset value DS2:
[0030]
[0031] Where e is the dimension of the vector, and These represent the values of the k-th dimension of the search vector SK and the post centroid vector VT, respectively.
[0032] According to a specific implementation of the present invention, the step of calculating a first query ratio QC1 for post data DT and a second query ratio QC2 for comment data DP based on a first offset value DS1, a second offset value DS2, and a query type QT includes:
[0033] The query type QT is normalized using the normalization function fg to obtain the normalized value Dg of the query type QT:
[0034]
[0035] Wherein, when the query type QT is to query comments, 0 < Dg ≤ τ1; when the query type QT is to query the original post, τ2 < Dg ≤ 1; when the query type QT is to query both the original post and comments, τ1 < Dg ≤ τ2; τ1 and τ2 are normalized segmentation parameters, 0 < τ1 < τ2 < 1.
[0036] Construct a calculation function fl to calculate the first query ratio QC1 and the second query ratio QC2:
[0037] ,
[0038] , .
[0039] According to a specific implementation of an embodiment of the present invention, the step of using the search vector SK, the first query ratio QC1, and the second query ratio QC2 as mixed query conditions to perform a fusion search on post data DT and comment data DP in the database includes:
[0040] The search vector SK, the first query ratio QC1, and the second query ratio QC2 are used as mixed query conditions to perform a fusion search on post data DT and comment data DP in the database;
[0041] Using probability density function and This represents the distribution of post data (DT) and comment data (DP) in the vector space;
[0042] Calculate the expected number of results E(SR) for the search result SR:
[0043]
[0044] g(SK,x) is the similarity function between the search vector SK and the position x in the vector space:
[0045]
[0046] It is the bandwidth parameter of the kernel function. This represents the distance between SK and x.
[0047] According to a specific implementation of an embodiment of the present invention, the step of paginating and displaying the search results (SR) to the user using post comment pairs includes:
[0048] The search results SR are paginated, with P representing the number of results displayed per page. Assuming the total number of search results SR is N, and the total number of pages is M = , Indicates rounding up;
[0049] For the sorted result SR, assuming the sorting score function is s(sr), entropy is used to evaluate the diversity of results on each page. The entropy of page i is... Represented as:
[0050]
[0051] in Let represent the probability distribution of each result sr in the i-th page. By adjusting the pagination method, we can make... Evenly distributed across pages, sr represents a specific search result element in the search result set SR. Let represent the set of results on page i of the search results SR. Specifically, after SR is divided into multiple pages according to certain pagination rules, page i contains all the search result elements. p(sr) is the probability distribution of each result sr on page i, and s(sr) is the ranking score function, assigning a score to each search result sr. This represents the sum of the ranking scores for all search results on page i.
[0052] According to a specific implementation of an embodiment of the present invention, the step of paginating and displaying the search results SR to the user using post comment pairs further includes:
[0053] For each search result This is broken down into post and comment sections, forming post-comment pairs. ,in For the post data related to this result, This refers to the comment data corresponding to this post;
[0054] Through quality assessment function Assess the relevance and quality of the pairs:
[0055]
[0056] and These are the relevance scores for posts and comments, respectively. It is the relevance score between posts and comments, where λ1, λ2, and λ3 are weight parameters;
[0057] according to The values are used to sort and filter the pairs, and the final results are displayed to the user.
[0058] Secondly, embodiments of the present invention also provide a social media post and comment fusion search device based on the DACF dynamic alternating content fusion model, comprising:
[0059] The extraction module collects social media data from social media platforms. The social media data includes post data DT and comment data DP corresponding to the post data DT. Vector extraction is performed on the post data DT and comment data DP to obtain post centroid vector VT and comment centroid vector VP. The post centroid vector VT and comment centroid vector VP are stored in an Elasticsearch index, and the post data DT and comment data DP are stored in the database corresponding to the Elasticsearch index.
[0060] The receiving module receives the keyword set K={K1,K2,…,Kp} input by the user on the user interface, as well as the query type QT selected by the user for the keyword set K. The query type QT includes querying comments, querying the original post, and querying both the original post and comments simultaneously.
[0061] The quantization module performs vectorization processing on the keyword set K={K1,K2,…,Kp} in the Elasticsearch index to obtain the search vector SK. It then calculates the offset values between the search vector SK and the post centroid vector VT and the comment centroid vector VP to obtain the first offset value DS1 and the second offset value DS2.
[0062] The calculation module calculates the first query ratio QC1 for post data DT and the second query ratio QC2 for comment data DP based on the first offset value DS1, the second offset value DS2 and the query type QT;
[0063] The display module uses the search vector SK, the first query ratio QC1, and the second query ratio QC2 as mixed query conditions to perform a fusion search on the post data DT and comment data DP in the database to obtain the search result SR. The search result SR is then displayed to the user in a paginated manner using post and comment pairs.
[0064] Thirdly, embodiments of the present invention also provide an electronic device, the electronic device comprising:
[0065] At least one processor; and,
[0066] The memory is communicatively connected to the at least one processor; wherein,
[0067] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method described in any of the first aspects or any implementations thereof.
[0068] Fourthly, embodiments of the present invention also provide a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the method described in the first aspect or any implementation thereof.
[0069] Fifthly, embodiments of the present invention also provide a computer program product, the computer program product including a computing program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, which, when executed by a computer, cause the computer to perform the method described in the first aspect or any implementation thereof.
[0070] The present invention has the following beneficial effects:
[0071] 1. Improve information integration
[0072] By extracting vectors from post data (DT) and comment data (DP), and calculating the centroid vectors VT (post) and VP (comment), the semantic information of posts and comments can be quantified, allowing them to be organically combined in vector space. Storing these vectors in an Elasticsearch index breaks the limitation of separating post and comment information in traditional search, thus achieving deeper information fusion. This fusion helps users view posts and related comments from a more comprehensive perspective during searches, avoiding information fragmentation, providing users with more comprehensive and valuable information, and enhancing the coherence and completeness of the information.
[0073] 2. Enhance search flexibility:
[0074] The system allows users to select different query types on the user interface, including querying comments only, querying the original post only, or querying both the original post and comments, fully respecting users' personalized search needs. Simultaneously, during the search process, the system can dynamically adjust its search strategy based on the user's selection and the first and second offset values DS1 and DS2 of the search vector SK and the centroid vectors VT and VP. This provides users with significant search flexibility, allowing them to switch and explore at different information levels (posts or comments) according to their actual needs, enhancing user autonomy and interactivity in social media information searching.
[0075] 3. Optimize search result accuracy
[0076] Based on the first offset value DS1, the second offset value DS2, and the query type QT, a first query ratio QC1 for post data DT and a second query ratio QC2 for comment data DP are calculated as mixed query conditions, which can accurately allocate weights to the search results. This allows for dynamic adjustment of the search focus and scope based on the user-input keyword set K and the inherent characteristics of post and comment information, making the search results more closely match the user's search intent, avoiding interference from irrelevant information, significantly improving the accuracy and relevance of search results, providing users with more expected search results, and enhancing the quality of search results.
[0077] 4. Improve search efficiency
[0078] By leveraging Elasticsearch indexes for data storage and processing, and combining vector operations and fusion search, this invention enables efficient processing and retrieval of massive amounts of social media data. Compared to traditional search methods, when processing large-scale data, this invention can more quickly locate data that meets user needs, reduce search time costs, improve the response speed of the search system, and provide users with a faster search experience. It is particularly suitable for handling the ever-increasing volume of data on social media platforms.
[0079] 5. Improve user experience
[0080] Finally, the search results (SR) are displayed to users in paginated form as post-comment pairs. This not only makes the search results clearer and more organized but also facilitates user viewing and filtering of information. This display method allows users to compare posts and their comments, helping them better understand the relationships between information, improving their understanding and efficiency in using search results, and enabling them to find the information they need more conveniently and quickly. This greatly improves the user experience when using social media search functions and increases user satisfaction with the search service. Attached Figure Description
[0081] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0082] Figure 1 This is a schematic diagram of a social media post and comment fusion search method based on the DACF dynamic alternating content fusion model, provided in an embodiment of the present invention.
[0083] Figure 2 A schematic diagram of another social media post comment fusion search method based on the DACF dynamic alternating content fusion model provided in this embodiment of the invention;
[0084] Figure 3 This is a schematic diagram of the structure of a social media post and comment fusion search device based on the DACF dynamic alternating content fusion model provided in an embodiment of the present invention;
[0085] Figure 4 A schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0086] The embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0087] See Figure 1 and Figure 2 This invention provides a social media post and comment fusion search method based on the DACF dynamic alternating content fusion model, including:
[0088] S101, collect social media data from the social media platform. The social media data includes post data DT and comment data DP corresponding to the post data DT. Perform vector extraction on the post data DT and comment data DP to obtain post centroid vector VT and comment centroid vector VP. Store the post centroid vector VT and comment centroid vector VP in an Elasticsearch index, and store the post data DT and comment data DP in the database corresponding to the Elasticsearch index.
[0089] Data is collected from numerous social media platforms using web scraping techniques or open application programming interfaces (APIs) provided by these platforms. This collected data includes information about user-posted posts (DT) and comment data (DP) closely related to these posts.
[0090] For the post data DT, Natural Language Processing (NLP) techniques are used for preprocessing. This process encompasses multiple aspects, such as removing potential noise, which may include special characters, emojis, and stop words, and segmenting the post content into meaningful words—this is word segmentation. Next, a pre-trained word vector model (such as Word2Vec, GloVe, or BERT) is used to convert the processed post words into word vectors. Then, these post word vectors are combined to calculate the post centroid vector VT. When calculating the post centroid vector VT, all post word vectors are averaged to obtain a vector that represents the overall semantic information of the post.
[0091] For comment data (DP), a similar processing flow is applied as for post data. First, noise removal and word segmentation are performed, converting the words in the comments into word vectors. Then, these comment word vectors are averaged to obtain the comment centroid vector (VP). This comment centroid vector (VP) represents the overall semantic information of the comment data.
[0092] The obtained post centroid vectors VT and VP are stored in a specific location within the Elasticsearch index for subsequent fast lookup and search operations. Simultaneously, the original post data DT and comment data DP are stored in the database corresponding to the Elasticsearch index. This ensures data integrity and allows for easy retrieval of the original data when needed, guaranteeing that the displayed search results are complete and evidence-based.
[0093] S102, receive the keyword set K={K1,K2,…,Kp} input by the user on the user interface, as well as the query type QT selected by the user for the keyword set K. The query type QT includes querying comments, querying the original post, and querying both the original post and comments at the same time.
[0094] On the user interface, a search input box is provided for users to enter a set of keywords K={K1,K2,…,Kp}, which are the core content of the information that users want to find.
[0095] In addition to keyword input, the user interface offers clear search type selection, including three main types: users can choose to view only comments (search for comments); they can choose to view only the original post (search for the original post); and they can choose to view both the original post and related comments (search for both the original post and comments). Intuitive interactive elements, such as radio buttons and drop-down menus, allow users to easily express their search intent. This design enables users to conduct targeted searches at different information levels based on their actual needs, improving user experience and search convenience.
[0096] S103, In the Elasticsearch index, the keyword set K={K1,K2,…,Kp} is vectorized to obtain the search vector SK. The offset values of the search vector SK from the post centroid vector VT and the comment centroid vector VP are calculated to obtain the first offset value DS1 and the second offset value DS2.
[0097] For the set of keywords K={K1,K2,…,Kp} input by the user, the same pre-trained word vector model as when processing post and comment data is used to convert each keyword Ki into a word vector.
[0098] Next, the word vectors of these keywords are combined to obtain the search vector SK. During the combination process, the keyword word vectors may undergo some kind of comprehensive processing, such as averaging, to obtain a search vector SK that reflects the user's search intent.
[0099] Next, the offset value DS1 between the search vector SK and the post centroid vector VT is calculated. The offset value DS1 represents the degree of difference between the search vector SK and the post centroid vector VT. This is calculated using a vector difference metric that reflects the distance between the user's search intent and the overall semantic information of the post data.
[0100] Similarly, the offset DS2 between the search vector SK and the comment centroid vector VP is calculated to measure the degree of difference between the search vector SK and the comment centroid vector VP. This offset DS2 reflects the distance between the user's search intent and the overall semantic information of the comment data.
[0101] S104, based on the first offset value DS1, the second offset value DS2 and the query type QT, calculate the first query ratio QC1 for post data DT and the second query ratio QC2 for comment data DP.
[0102] In this process, a normalization function fg is introduced to process the query type QT. The purpose is to map different query types QT to a unified range [0, 1] to obtain a normalized value Dg.
[0103] There are three types of query types in QT:
[0104] When a user selects "reviews" as the query type in QT, the normalized value Dg obtained after processing by the normalization function fg will fall within a range, namely 0 < Dg ≤ τ1. This means that for the case of querying reviews, the normalized value Dg is relatively small, falling within the relatively small range of [0, τ1]. This is because, under this query type, the system may be more inclined to focus on the review data.
[0105] When the query type (QT) is querying original posts, the normalized Dg falls into another range, i.e., τ2 < Dg ≤ 1. Conversely, when querying comments, the value of Dg is relatively large in this case, indicating that when the user primarily wants to query original posts, the system will assign it to a higher range of normalized values. This may mean that subsequent calculations will tend to consider original post data more.
[0106] When the query type QT is to query both the original post and comments, the range of Dg is τ1 < Dg ≤ τ2. This range lies between the normalized values of querying comments and querying the original post, indicating that when a user chooses to query both simultaneously, their normalized value Dg will be in the middle range. This means that the original post and comments will be considered comprehensively in subsequent searches, and the weights will be relatively balanced.
[0107] Next, a calculation function fl was constructed, which takes either offset value DS1 or DS2 as input. The expression for this function is: and The exponential function is used here. The purpose is to incorporate the offset values DS1 and DS2 into the calculation in a non-linear manner.
[0108] The following formula was used to calculate the first query ratio QC1 and the second query ratio QC2:
[0109]
[0110] This section calculates the first query ratio QC1 by dividing the result of DS1 calculated using the fl function by the sum of the results of DS1 and DS2 calculated using the fl function. This ratio reflects the search weight allocation for post data DT, taking into account both the query type normalization value Dg and DS1. Because it is the proportion of the result of DS1 calculated using the fl function to the sum of the results of DS1 and DS2 calculated using the fl function, its value is affected by DS1 and indirectly by the query type normalization value Dg.
[0111] Similarly, It calculates the second query ratio QC2, which reflects the search weight allocation of the comment data DP after comprehensively considering the query type normalization value Dg and DS2.
[0112] In summary, this calculation method normalizes the query type QT to obtain Dg, and then combines the offset values DS1 and DS2 using the calculation function fl to finally obtain the first query ratio QC1 and the second query ratio QC2. This achieves a dynamic weight allocation mechanism that comprehensively considers the user's query type and the offset values between the search vector and the centroid vector. This allows for more flexible and reasonable adjustment of the search weights for post data DT and comment data DP based on different user query needs and the actual data situation. This makes the search results more aligned with user expectations and the inherent characteristics of the data, providing a relatively reasonable search focus in different query scenarios and improving the quality and relevance of search results.
[0113] S105, the search vector SK, the first query ratio QC1, and the second query ratio QC2 are used as mixed query conditions to perform a fusion search on the post data DT and comment data DP in the database to obtain the search result SR. The search result SR is then displayed to the user in a paginated manner using post and comment pairs.
[0114] Leveraging Elasticsearch's powerful search capabilities, the search vector SK, the first query ratio QC1, and the second query ratio QC2 are used as combined query conditions to perform a search operation in the database. This process comprehensively considers the relationship between the user's search intent and the post and comment data, treating them as a whole for a fusion search.
[0115] After completing the search, you will receive the search result SR, which contains posts and comments that meet the user's needs.
[0116] Search results (SRs) are paginated, with the number of results displayed per page determined based on user habits or system default settings. Each piece of information in the search results (SRs) is organized into a post / comment tuple, combining the post information of each search result with its related comment information to form a tuple. These tuples are then displayed to the user in a paginated manner, allowing for convenient browsing of information on different pages. Additionally, users will be provided with extra features, such as sorting by relevance, time sequence, or filtering information based on specific criteria, to help them find the information they need and enhance their information retrieval experience.
[0117] According to a specific implementation of the present invention, the step of extracting vectors from post data DT and comment data DP to obtain post centroid vector VT and comment centroid vector VP includes:
[0118] The post data (DT) and comment data (DP) are segmented into words. For the post data (DT), the words it contains are represented as follows: Each word is processed through a pre-trained word vector model. Convert to word vectors Then, the centroid vector VT of the post is calculated:
[0119]
[0120] Word vectors The j-th dimension, where d is the dimension of the word vector;
[0121] For comment data DP, the words it contains are represented as follows: Each word is processed through a pre-trained word vector model. Convert to word vectors Then, the centroid vector VP of the comment is calculated:
[0122]
[0123] Word vectors The i-th dimension, where d is the dimension of the word vector.
[0124] According to a specific implementation of an embodiment of the present invention, the vectorization processing of the keyword set K in the Elasticsearch index includes:
[0125] For each keyword Ki in the keyword set K={K1,K2,…,Kp}, convert it into a word vector using a pre-trained word vector model. ;
[0126] Calculate word vectors Importance weight , ;
[0127] The search vector SK is obtained by weighting and combining the word vectors:
[0128] .
[0129] According to a specific implementation of the present invention, the step of calculating the offset values between the search vector SK and the post centroid vector VT and the comment centroid vector VP, respectively, to obtain the first offset value DS1 and the second offset value DS2, includes:
[0130] Calculate the first offset value DS1:
[0131]
[0132] Calculate the second offset value DS2:
[0133]
[0134] Where e is the dimension of the vector, and These represent the values of the k-th dimension of the search vector SK and the post centroid vector VT, respectively.
[0135] According to a specific implementation of the present invention, the step of calculating a first query ratio QC1 for post data DT and a second query ratio QC2 for comment data DP based on a first offset value DS1, a second offset value DS2, and a query type QT includes:
[0136] The query type QT is normalized using the normalization function fg to obtain the normalized value Dg of the query type QT:
[0137]
[0138] Wherein, when the query type QT is to query comments, 0 < Dg ≤ τ1; when the query type QT is to query the original post, τ2 < Dg ≤ 1; when the query type QT is to query both the original post and comments, τ1 < Dg ≤ τ2; τ1 and τ2 are normalized segmentation parameters, 0 < τ1 < τ2 < 1.
[0139] Construct a calculation function fl to calculate the first query ratio QC1 and the second query ratio QC2:
[0140] ,
[0141] , .
[0142] According to a specific implementation of an embodiment of the present invention, the step of using the search vector SK, the first query ratio QC1, and the second query ratio QC2 as mixed query conditions to perform a fusion search on post data DT and comment data DP in the database includes:
[0143] The search vector SK, the first query ratio QC1, and the second query ratio QC2 are used as mixed query conditions to perform a fusion search on post data DT and comment data DP in the database;
[0144] Using probability density function and This represents the distribution of post data (DT) and comment data (DP) in the vector space;
[0145] Calculate the expected number of results E(SR) for the search result SR:
[0146]
[0147] g(SK,x) is the similarity function between the search vector SK and the position x in the vector space:
[0148]
[0149] It is the bandwidth parameter of the kernel function. This represents the distance between SK and x.
[0150] According to a specific implementation of an embodiment of the present invention, the step of paginating and displaying the search results (SR) to the user using post comment pairs includes:
[0151] The search results SR are paginated, with P representing the number of results displayed per page. Assuming the total number of search results SR is N, and the total number of pages is M = , Indicates rounding up;
[0152] For the sorted result SR, assuming the sorting score function is s(sr), entropy is used to evaluate the diversity of results on each page. The entropy of page i is... Represented as:
[0153]
[0154] in Let represent the probability distribution of each result sr in the i-th page. By adjusting the pagination method, we can make... Evenly distributed across pages, sr represents a specific search result element in the search result set SR. Let represent the set of results on page i of the search results SR. Specifically, after SR is divided into multiple pages according to certain pagination rules, page i contains all the search result elements. p(sr) is the probability distribution of each result sr on page i, and s(sr) is the ranking score function, assigning a score to each search result sr. This represents the sum of the ranking scores for all search results on page i.
[0155] According to a specific implementation of an embodiment of the present invention, the step of paginating and displaying the search results SR to the user using post comment pairs further includes:
[0156] For each search result This is broken down into post and comment sections, forming post-comment pairs. ,in For the post data related to this result, This refers to the comment data corresponding to this post;
[0157] Through quality assessment function Assess the relevance and quality of the pairs:
[0158]
[0159] and These are the relevance scores for posts and comments, respectively. It is the relevance score between posts and comments, where λ1, λ2, and λ3 are weight parameters;
[0160] according to The values are used to sort and filter the pairs, and the final results are displayed to the user.
[0161] For a corresponding method embodiment, see [link to relevant documentation]. Figure 3 This invention also discloses a social media post and comment fusion search device 30 based on the DACF dynamic alternating content fusion model, comprising:
[0162] Extraction module 301 collects social media data from social media platforms. The social media data includes post data DT and comment data DP corresponding to the post data DT. Vector extraction is performed on the post data DT and comment data DP to obtain post centroid vector VT and comment centroid vector VP. The post centroid vector VT and comment centroid vector VP are stored in an Elasticsearch index, and the post data DT and comment data DP are stored in the database corresponding to the Elasticsearch index.
[0163] The receiving module 302 receives the keyword set K={K1,K2,…,Kp} input by the user on the user interface, as well as the query type QT selected by the user for the keyword set K. The query type QT includes querying comments, querying the original post, and querying both the original post and comments simultaneously.
[0164] The quantization module 303 performs vectorization processing on the keyword set K={K1,K2,…,Kp} in the Elasticsearch index to obtain the search vector SK. It calculates the offset values between the search vector SK and the post centroid vector VT and the comment centroid vector VP respectively to obtain the first offset value DS1 and the second offset value DS2.
[0165] Calculation module 304 calculates a first query ratio QC1 for post data DT and a second query ratio QC2 for comment data DP based on the first offset value DS1, the second offset value DS2 and the query type QT;
[0166] The display module 305 uses the search vector SK, the first query ratio QC1, and the second query ratio QC2 as mixed query conditions to perform a fusion search on the post data DT and comment data DP in the database to obtain the search result SR. The search result SR is then displayed to the user in a paginated manner using post and comment pairs.
[0167] See Figure 4 This invention also provides an electronic device 60, which includes:
[0168] At least one processor; and,
[0169] The memory is communicatively connected to the at least one processor; wherein,
[0170] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the social media post comment fusion search method based on the DACF dynamic alternating content fusion model in the foregoing method embodiments.
[0171] This invention also provides a non-transitory computer-readable storage medium that stores computer instructions for causing the computer to perform the aforementioned method embodiments.
[0172] This invention also provides a computer program product, which includes a computing program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions that, when executed by a computer, cause the computer to perform the social media post and comment fusion search method based on the DACF dynamic alternating content fusion model in the foregoing method embodiments.
[0173] like Figure 4 As shown, electronic device 60 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from storage device 608 into random access memory (RAM) 603. RAM 603 also stores various programs and data required for the operation of electronic device 60. Processing device 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.
[0174] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic device 60 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 4 An electronic device 60 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0175] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, it performs the functions defined in the methods of the embodiments of the present invention.
[0176] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A social media post and comment fusion search method based on the DACF dynamic alternating content fusion model, characterized in that, include: Social media data is collected from social media platforms. The social media data includes post data DT and comment data DP corresponding to the post data DT. Vector extraction is performed on the post data DT and the comment data DP to obtain the post centroid vector VT and the comment centroid vector VP. The post centroid vector VT and the comment centroid vector VP are stored in an Elasticsearch index, and the post data DT and the comment data DP are stored in the database corresponding to the Elasticsearch index. The user interface receives a set of keywords K={K1,K2,…,Kp} and a query type QT selected by the user for the set of keywords K. The query type QT includes querying comments, querying the original post, and querying both the original post and comments simultaneously. In the Elasticsearch index, the keyword set K={K1,K2,…,Kp} is vectorized to obtain the search vector SK. The offset values of the search vector SK from the post centroid vector VT and the comment centroid vector VP are calculated to obtain the first offset value DS1 and the second offset value DS2. Based on the first offset value DS1, the second offset value DS2 and the query type QT, calculate the first query ratio QC1 for post data DT and the second query ratio QC2 for comment data DP; The search vector SK, the first query ratio QC1, and the second query ratio QC2 are used as mixed query conditions. The post data DT and comment data DP are fused and searched in the database to obtain the search result SR. The search result SR is then displayed to the user in a paginated manner using post and comment pairs.
2. The method according to claim 1, characterized in that, The step of extracting vectors from post data DT and comment data DP to obtain post centroid vector VT and comment centroid vector VP includes: The post data (DT) and comment data (DP) are segmented into words. For the post data (DT), the words it contains are represented as follows: Each word is processed through a pre-trained word vector model. Convert to word vectors Then, the centroid vector VT of the post is calculated: Word vectors The j-th dimension, where d is the dimension of the word vector; For comment data DP, the words it contains are represented as follows: Each word is processed through a pre-trained word vector model. Convert to word vectors Then, the centroid vector VP of the comment is calculated: Word vectors The i-th dimension, where d is the dimension of the word vector.
3. The method according to claim 2, characterized in that, The vectorization of the keyword set K in the Elasticsearch index includes: For each keyword Ki in the keyword set K={K1,K2,…,Kp}, convert it into a word vector using a pre-trained word vector model. ; Calculate word vectors Importance weight , ; The search vector SK is obtained by weighting and combining the word vectors: 。 4. The method according to claim 3, characterized in that, The step of calculating the offset values between the search vector SK and the post centroid vector VT and the comment centroid vector VP, respectively, to obtain the first offset value DS1 and the second offset value DS2, includes: Calculate the first offset value DS1: Calculate the second offset value DS2: Where e is the dimension of the vector, and These represent the values of the k-th dimension of the search vector SK and the post centroid vector VT, respectively.
5. The method according to claim 4, characterized in that, The calculation of the first query ratio QC1 for post data DT and the second query ratio QC2 for comment data DP based on the first offset value DS1, the second offset value DS2, and the query type QT includes: The query type QT is normalized using the normalization function fg to obtain the normalized value Dg of the query type QT: Wherein, when the query type QT is to query comments, 0 < Dg ≤ τ1; when the query type QT is to query the original post, τ2 < Dg ≤ 1; when the query type QT is to query both the original post and comments, τ1 < Dg ≤ τ2; τ1 and τ2 are normalized segmentation parameters, 0 < τ1 < τ2 < 1. Construct a calculation function fl to calculate the first query ratio QC1 and the second query ratio QC2: , , 。 6. The method according to claim 5, characterized in that, The step of using the search vector SK, the first query ratio QC1, and the second query ratio QC2 as mixed query conditions to perform a fusion search on post data DT and comment data DP in the database includes: The search vector SK, the first query ratio QC1, and the second query ratio QC2 are used as mixed query conditions to perform a fusion search on post data DT and comment data DP in the database; Using probability density function and This represents the distribution of post data (DT) and comment data (DP) in the vector space; Calculate the expected number of results E(SR) for the search result SR: g(SK,x) is the similarity function between the search vector SK and the position x in the vector space: It is the bandwidth parameter of the kernel function. This represents the distance between SK and x.
7. The method according to claim 6, characterized in that, The step of displaying search results (SR) to users in paginated form using post comment pairs includes: The search results SR are paginated, with P representing the number of results displayed per page. Assuming the total number of search results SR is N, and the total number of pages is M = , Indicates rounding up; For the sorted result SR, assuming the sorting score function is s(sr), entropy is used to evaluate the diversity of results on each page. The entropy of page i is... Represented as: in Let represent the probability distribution of each result sr in the i-th page. By adjusting the pagination method, we can make... Evenly distributed across pages, sr represents a specific search result element in the search results set SR. Let represent the set of results on page i of the search results SR. Specifically, after SR is divided into multiple pages according to certain pagination rules, the set of all search result elements contained on page i is the final page. p(sr) is the probability distribution of each result sr on page i, and s(sr) is the ranking score function, assigning a score to each search result sr. This represents the sum of the ranking scores for all search results on page i.
8. The method according to claim 7, characterized in that, The method of paginating and displaying search results (SR) to users using post comment pairs also includes: For each search result This is broken down into post and comment sections, forming post-comment pairs. ,in For the post data related to this result, This refers to the comment data corresponding to this post; Through quality assessment function Assess the relevance and quality of the pairs: and These are the relevance scores for posts and comments, respectively. It is the relevance score between posts and comments, where λ1, λ2, and λ3 are weight parameters; according to The values are used to sort and filter the pairs, and the final results are displayed to the user.
9. A social media post and comment fusion search device based on the DACF dynamic alternating content fusion model, characterized in that, include: The extraction module collects social media data from social media platforms. The social media data includes post data DT and comment data DP corresponding to the post data DT. Vector extraction is performed on the post data DT and comment data DP to obtain post centroid vector VT and comment centroid vector VP. The post centroid vector VT and comment centroid vector VP are stored in an Elasticsearch index, and the post data DT and comment data DP are stored in the database corresponding to the Elasticsearch index. The receiving module receives the keyword set K={K1,K2,…,Kp} input by the user on the user interface, as well as the query type QT selected by the user for the keyword set K. The query type QT includes querying comments, querying the original post, and querying both the original post and comments simultaneously. The quantization module performs vectorization processing on the keyword set K={K1,K2,…,Kp} in the Elasticsearch index to obtain the search vector SK. It then calculates the offset values between the search vector SK and the post centroid vector VT and the comment centroid vector VP to obtain the first offset value DS1 and the second offset value DS2. The calculation module calculates the first query ratio QC1 for post data DT and the second query ratio QC2 for comment data DP based on the first offset value DS1, the second offset value DS2 and the query type QT; The display module uses the search vector SK, the first query ratio QC1, and the second query ratio QC2 as mixed query conditions to perform a fusion search on the post data DT and comment data DP in the database to obtain the search result SR. The search result SR is then displayed to the user in a paginated manner using post and comment pairs.
10. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the social media post comment fusion search method based on the DACF dynamic alternating content fusion model as described in any one of claims 1 to 8.