Combined fragment retrieval method and apparatus

CN122432361BActive Publication Date: 2026-10-23APUTURE IMAGING IND CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610893851.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-06-22
Publication Date
2026-10-23
Estimated Expiration
2046-06-22

AI Technical Summary

Technical Problem

此类组合检索任务面临的核心问题在于:素材片段之间的组合方式数量随片段数量呈指数级增长,检索空间极为庞大

Benefits of technology

[0022]本申请实施例的第五方面提供了一种计算机程序产品,当计算机程序产品在电子设备上运行时,使得电子设备执行上述第一方面的组合片段检索方法。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122432361B_ABST
    Figure CN122432361B_ABST
Patent Text Reader

Abstract

The application provides a combined segment retrieval method and device, wherein the method records the minimum value and the maximum value of all combined duration scores in the corresponding sub-tree of each node of a base prefix tree in the node, and compares the upper and lower bounds of the sub-tree score recorded by the node with a target duration interval during the traversal retrieval process, and when the duration range of the entire sub-tree has no intersection with the target duration interval, the sub-tree branch is directly skipped, so that the one-by-one access to irrelevant branches is avoided, the invalid traversal calculation in the retrieval process is reduced, and the response efficiency of the combined segment retrieval is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of retrieval technology, and in particular relates to a method and apparatus for retrieving combined fragments. Background Technology

[0002] With the large-scale development of multimedia content production, quickly retrieving sequences of combined segments that meet specific duration requirements from a large number of material clips has become a common need in the field of intelligent content production. For example, in short video generation scenarios, it is necessary to select several clips from a material library and splice them together to form a finished sequence that meets the target duration. The core problem facing this type of combined retrieval task is that the number of ways to combine material clips grows exponentially with the number of clips, resulting in an extremely large retrieval space.

[0003] In related technologies, for the task of retrieving combined segments, a traversal method based on an index structure is typically used to find and match candidate combinations. During the retrieval process, each node branch in the index structure needs to be visited sequentially, and it needs to be determined whether a combination that meets the duration condition exists under each branch.

[0004] However, since the retrieval process requires accessing a large number of branches in the index structure one by one, and a considerable number of these branches do not actually contain combinations that meet the target duration requirements, a large amount of invalid calculations are generated during the retrieval process, resulting in a long overall retrieval time and a response efficiency that is difficult to meet real-time requirements. Summary of the Invention

[0005] This application provides a combined fragment retrieval method and apparatus, which can reduce invalid traversal calculations during the retrieval process and improve the response efficiency of combined fragment retrieval.

[0006] The first aspect of this application provides a method for retrieving combined segments, comprising: acquiring a pre-constructed cardinal prefix tree, wherein the edge labels of the cardinal prefix tree store the prefix segments of the combined segment sequence, each node of the cardinal prefix tree corresponds to a subtree, and each node records the minimum and maximum values ​​of all combined duration scores within the corresponding subtree, which are respectively used as the lower and upper bounds of the subtree scores; receiving a retrieval request carrying a target duration lower bound and a target duration upper bound; traversing the nodes in the cardinal prefix tree starting from the root node, wherein, for any currently accessed node, if the upper bound of the subtree score of the currently accessed node is less than the target duration lower bound, or the lower bound of the subtree score of the currently accessed node is greater than the target duration upper bound, then traversing the subtree branch rooted at the currently accessed node is terminated; when a node marked as a word ending is detected, at least one combined segment sequence associated with the word ending node is acquired as a candidate result.

[0007] In the technical solution of this application, the minimum and maximum values ​​of all combined duration scores in the subtree corresponding to each node of the cardinality prefix tree are recorded. During the traversal retrieval process, the upper and lower bounds of the subtree scores recorded by the node are compared with the target duration interval. When the duration range of the entire subtree does not intersect with the target duration interval, the subtree branch is skipped directly, thereby avoiding the visit of irrelevant branches one by one, reducing invalid traversal calculations in the retrieval process, and improving the response efficiency of combined fragment retrieval.

[0008] Optionally, in one possible implementation of the first aspect, the aforementioned radix prefix tree is constructed through the following steps: creating an initial radix prefix tree containing a root node; receiving the combined fragment sequence to be inserted and the combined duration score corresponding to the combined fragment sequence; determining the insertion position corresponding to the combined fragment sequence in the initial radix prefix tree, marking the end node of the combined fragment sequence as a word end node, and storing the combined duration score in the candidate value priority queue associated with the word end node; starting from the word end node, backtracking layer by layer along the ancestor link, updating the lower and upper bounds of the subtree score of each node on the backtracking path based on the newly inserted combined duration score; when all combined fragment sequences to be inserted have been inserted, the radix prefix tree is obtained. Thus, by backtracking layer by layer along the ancestor link for the newly inserted combined fragment sequence and updating the upper and lower bounds of the subtree score of each ancestor node based on the newly inserted combined duration score during the construction of the radix prefix tree, it is ensured that the subtree score boundary recorded by each node always reflects the duration distribution range of the actual combinations within the current subtree, providing a tight boundary basis for retrieval pruning.

[0009] Optionally, in another possible implementation of the first aspect, determining the insertion position corresponding to the combined fragment sequence in the initial radix prefix tree includes: performing longest common prefix matching between the combined fragment sequence and the existing edge labels in the current radix prefix tree to obtain the shared prefix length; when the shared prefix length is zero, determining the insertion position corresponding to the combined fragment sequence as the new edge position under the root node, and creating a new edge with the combined fragment sequence as the edge label; when the shared prefix length is greater than zero and less than the existing edge label length, splitting the existing edge label into a shared prefix edge and a remaining suffix edge at the shared prefix length, and determining the insertion position of the remaining part of the combined fragment sequence as the new branch position under the child node corresponding to the shared prefix edge; when the shared prefix length is equal to the existing edge label length, continuing to match downwards along the child nodes corresponding to the existing edge label until the insertion position of the remaining part of the combined fragment sequence is determined. Therefore, by performing the longest common prefix matching between the combined fragment sequence and the existing edge labels in the current radix prefix tree when determining the insertion position of the combined fragment sequence, and processing the creation, splitting and continuing downward matching of the edge according to the matching length, the combined fragment sequence can be compactly stored in the radix prefix tree, reducing the redundant creation of edges and nodes.

[0010] Optionally, in another possible implementation of the first aspect, the above-mentioned method of obtaining at least one combination fragment sequence associated with the word ending node as a candidate result when traversing to a node marked as a word ending is detected includes: when traversing to a node marked as a word ending is detected, at least one candidate combination is popped from the candidate value priority queue associated with the word ending node, wherein the candidate combination includes a combination fragment sequence and a combination duration score corresponding to the combination fragment sequence; the popped candidate combinations are filtered according to a preset value filtering condition, and the candidate combinations that pass the filtering are added to a temporary candidate set; when the number of combinations in the temporary candidate set reaches a preset number threshold, a target number of candidate combinations are determined from the temporary candidate set as candidate results output; and the candidate combinations in the temporary candidate set that are not determined as candidate results output are backfilled into the candidate value priority queue associated with the corresponding word ending node. Therefore, by filtering the candidate combinations popped from the word tail node with preset value filtering conditions and adding them to the temporary candidate set, and after determining the target number of candidate results, the unselected candidate combinations are backfilled into the candidate value priority queue of the corresponding word tail node, thereby maintaining the integrity of the candidate combinations in the candidate value priority queue, so that the same candidate combination can continue to participate in the filtering in subsequent searches.

[0011] Optionally, in another possible implementation of the first aspect, the above-mentioned filtering of the popped-up candidate combinations based on preset filtering conditions includes: obtaining the starting fragment identifier of the candidate combination; when the starting fragment identifier is not recorded as used, recording the starting fragment identifier as used and determining that the candidate combination passes the filtering; when the starting fragment identifier has been recorded as used, comparing the number of fragments in the candidate combination with the number of fragments in the recorded combination corresponding to the same starting fragment identifier; if the number of fragments in the candidate combination is greater than the number of fragments in the recorded combination, then replacing the recorded combination with the candidate combination and passing the filtering; otherwise, determining that the candidate combination fails the filtering. Thus, by recording the used starting fragment identifier when filtering candidate combinations and comparing and selecting the best candidate combinations with different numbers of fragments under the same starting fragment identifier, deduplication filtering based on the starting fragment identifier is completed during the retrieval process, avoiding separate deduplication processing after the candidate results are generated.

[0012] Optionally, in another possible implementation of the first aspect, determining the target number of candidate combinations as candidate results output from the temporary candidate set includes: grouping the candidate combinations in the temporary candidate set according to the starting segment identifier to obtain at least one candidate group; sorting the candidate combinations within each candidate group in descending order of combination duration score, and determining the score of the first candidate combination in each candidate group as the representative score of the corresponding candidate group; determining the processing priority of each candidate group in descending order of the representative score; and repeatedly executing the following steps until the number of output candidate results reaches the target number: taking the highest priority candidate group from the currently schedulable candidate groups according to the processing priority, extracting the first candidate combination in the highest priority candidate group as the candidate result output, and moving the remaining candidate combinations in the highest priority candidate group into the standby set; when there are no schedulable candidate groups and the standby set is not empty, restoring all candidate groups in the standby set to the schedulable state, and re-determining the processing priority based on the representative score of each restored candidate group. Therefore, by grouping the candidate combinations in the temporary candidate set according to the starting segment identifier, and alternately extracting candidate combinations from different groups according to the priority determined by the score represented by each group, the candidate results of adjacent outputs are avoided from being concentrated in the same starting segment identifier, thus improving the uniformity of the distribution of candidate results.

[0013] Optionally, in another possible implementation of the first aspect, before grouping the candidate combinations in the temporary candidate set according to the starting fragment identifier, the method further includes: obtaining the ending attribute identifier of each candidate combination; dividing the candidate combinations in the temporary candidate set into a first attribute group and a second attribute group according to the ending attribute identifier; and grouping the candidate combinations in the temporary candidate set according to the starting fragment identifier, including: grouping the candidate combinations in the first attribute group and the second attribute group according to the starting fragment identifier respectively. Thus, by first dividing the candidate combinations in the temporary candidate set into two attribute groups according to the ending attribute identifier before grouping by the starting fragment identifier, and then performing starting fragment identifier grouping and alternating extraction on the candidate combinations in each attribute group respectively, the method ensures the uniformity of the distribution of starting fragment identifiers while also taking into account the balanced output of candidate combinations with different ending attribute identifiers.

[0014] Optionally, in another possible implementation of the first aspect, each word ending node of the aforementioned cardinal prefix tree also records at least one of the following: ending attribute identifier, starting segment identifier information, and combined segment quantity information. This provides the necessary basic attribute data for filtering and result sorting during the retrieval process.

[0015] Optionally, in another possible implementation of the first aspect, the method further includes: traversing each word-tail node in the cardinality prefix tree to obtain the combination duration score of the candidate combinations associated with each word-tail node; aggregating and statistically analyzing the obtained combination duration scores according to a preset duration interval to generate interval histogram distribution data with duration as the horizontal axis and the number of candidate combinations as the vertical axis; and outputting the interval histogram distribution data. Thus, by traversing each word-tail node in the cardinality prefix tree to obtain the combination duration score of the candidate combinations and aggregating and statistically analyzing it according to a preset duration interval to generate and output interval histogram distribution data, the distribution density of candidate combinations in the duration dimension is presented intuitively, providing statistical basis for the evaluation and adjustment of the retrieval strategy.

[0016] A second aspect of this application provides a combined fragment retrieval device, comprising: The tree acquisition module is used to acquire a pre-constructed radix prefix tree. The edge labels of the radix prefix tree store the prefix segments of the combined fragment sequence. Each node of the radix prefix tree corresponds to a subtree, and each node records the minimum and maximum values ​​of the combined duration scores within the corresponding subtree, which serve as the lower and upper bounds of the subtree scores, respectively.

[0017] The request receiving module is used to receive retrieval requests carrying the lower limit and upper limit of the target duration.

[0018] The node traversal module is used to traverse the nodes in the radix prefix tree starting from the root node. For any currently visited node, if the upper bound of the subtree score of the currently visited node is less than the lower bound of the target duration, or the lower bound of the subtree score of the currently visited node is greater than the upper bound of the target duration, then the traversal of the subtree branch rooted at the currently visited node is terminated.

[0019] The result determination module is used to obtain at least one combined segment sequence associated with the word ending node as a candidate result when a node marked as the word ending is detected during traversal.

[0020] A third aspect of this application provides an electronic device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the combined fragment retrieval method of the first aspect described above.

[0021] A fourth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the combined fragment retrieval method of the first aspect described above.

[0022] The fifth aspect of this application provides a computer program product that, when run on an electronic device, causes the electronic device to execute the combined fragment retrieval method of the first aspect described above.

[0023] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description

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

[0025] Figure 1 This is a flowchart illustrating a combined fragment retrieval method provided in an embodiment of this application; Figure 2 This is a structural example diagram of some nodes in the cardinality prefix tree provided in the embodiments of this application; Figure 3 This is a schematic diagram of the query pruning process provided in the embodiments of this application; Figure 4 This is a schematic diagram of the interval histogram distribution data provided in the embodiments of this application; Figure 5 This is a schematic diagram of the structure of a combined fragment retrieval device provided in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0026] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0027] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0028] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0029] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."

[0030] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0031] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

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

[0033] In related technologies, for the retrieval task of combined segments, a traversal method based on an index structure is typically used to find and match candidate combinations. During the retrieval process, each branch in the index structure needs to be visited sequentially, and each branch needs to be checked to determine if a combination meeting the duration requirement exists. However, because the retrieval process requires visiting a large number of branches in the index structure, and a significant portion of these branches do not actually contain combinations meeting the target duration requirement, a large amount of invalid computation is generated during the retrieval process, resulting in a long overall retrieval time and making it difficult to meet real-time requirements.

[0034] In view of this, embodiments of this application provide a method and apparatus for retrieving combined fragments. The method first obtains a pre-constructed cardinal prefix tree. The edge labels of the cardinal prefix tree store the prefix segments of the combined fragment sequence. Each node of the cardinal prefix tree corresponds to a subtree, and each node records the minimum and maximum values ​​of all combined duration scores within the corresponding subtree, serving as the lower and upper bounds of the subtree scores, respectively. Then, it receives a retrieval request carrying a target duration lower bound and a target duration upper bound. Next, starting from the root node of the cardinal prefix tree, it traverses the nodes in the cardinal prefix tree. For any currently accessed node, if the upper bound of the subtree score of the currently accessed node is less than the target duration lower bound, or the lower bound of the subtree score of the currently accessed node is greater than the target duration upper bound, then the traversal of the subtree branch rooted at the currently accessed node is terminated. Finally, when a node marked as a word ending is detected, at least one combined fragment sequence associated with the word ending node is obtained as a candidate result. Therefore, by recording the minimum and maximum values ​​of all combined duration scores in the subtree corresponding to each node in the cardinality prefix tree, and comparing the upper and lower bounds of the subtree scores recorded by the node with the target duration interval during the traversal retrieval process, the subtree branch is skipped directly when the duration range of the entire subtree does not intersect with the target duration interval, thereby avoiding the visit of irrelevant branches one by one, reducing invalid traversal calculations in the retrieval process, and improving the response efficiency of combined fragment retrieval.

[0035] The following example illustrates the application scenario of the combined segment retrieval method provided in this application. In the intelligent production scenario of short drama series, users need to quickly retrieve several candidate segment combinations whose total duration falls within a specified range (e.g., 5 minutes to 5 minutes and 30 seconds) from a material library containing hundreds of episode segments for subsequent editing and synthesis. Since the combination methods between segments grow exponentially with the scale of the material, traditional retrieval methods require traversing and judging a large number of branches in the index structure one by one. In most of these branches, the total duration of the combination does not intersect with the target range, resulting in a slow retrieval response. After adopting the solution of this application, each node of the cardinality prefix tree pre-records the minimum and maximum values ​​of the duration scores of all combinations in its subtree. During retrieval, it is only necessary to compare the duration range recorded by the node with the target duration range. This allows for the identification and skipping of subtrees with completely mismatched duration ranges at the branch entry point, thereby significantly reducing the number of branches that actually need to be accessed. This enables the rapid location of candidate segment sequences that meet the duration requirements in the vast combination space, satisfying the real-time retrieval requirements of short drama series production tasks.

[0036] To illustrate the technical solution of this application, specific embodiments are described below.

[0037] Reference Figure 1 The diagram illustrates a flowchart of a combined fragment retrieval method provided in an embodiment of this application. Figure 1As shown, the combined fragment retrieval method may include the following steps: Step 101: Obtain the pre-built radix prefix tree.

[0038] In this embodiment, the radix prefix tree is a compressed prefix tree structure used for indexing and storing combined segment sequences. A combined segment sequence refers to a sequence formed by splicing multiple multimedia segments in a specific order, such as a candidate combination composed of several episode segments in a short drama production task. Each combined segment sequence corresponds to a combined duration score, which is the cumulative value of the duration of each segment in the combined segment sequence, used to characterize the total duration of the combination.

[0039] In this system, each node (TreeNode) of the radix prefix tree corresponds to a subtree, and each node records the minimum value of the duration score of all combinations within the corresponding subtree as the lower bound of the subtree score (min_score_children), and records the maximum value of the duration score of all combinations within the corresponding subtree as the upper bound of the subtree score (max_score_children).

[0040] It should be noted that each node in the radix prefix tree corresponds to a subtree. A subtree is a tree-like branching structure rooted at that node, containing that node and all its descendant nodes. Each node records two boundary information items: the minimum value of the duration score of all combinations within the corresponding subtree, serving as the lower bound of the subtree score; and the maximum value of the duration score of all combinations within the corresponding subtree, serving as the upper bound of the subtree score. The lower and upper bounds of the subtree score together define the distribution range of the combined fragment sequences covered by the subtree in the duration dimension. When a new combined fragment sequence is inserted into the radix prefix tree, the lower and upper bounds of the subtree score of each ancestor node are updated from bottom to top along the insertion path to ensure the compactness of the boundary information.

[0041] In this system, the edges of the radix prefix tree are used to store compact prefix segments, rather than individual characters. Edge labels consist of a connection symbol between adjacent segment identifiers in the combined segment sequence (e.g., the segment connection identifier "→") and the segment identifier itself. Once a combined segment sequence is fully inserted, its end node is marked as a term end node. This term end node is associated with a priority queue (PQ) to store at least one candidate combination that matches the combined prefix. Each element in the priority queue contains the identifier of the combined segment sequence (i.e., the starting segment identifier and segment connection path of the candidate combination) and the corresponding combination duration score. The queue is internally sorted by combination duration score to quickly retrieve candidate combinations with higher scores during retrieval.

[0042] In one embodiment, the term ending node of the cardinality prefix tree also records at least one of the following: an ending attribute identifier (has_ending), a starting fragment identifier (start_uuid_info), and a combination fragment quantity information (combo_size_info). Additionally, the node may also record prefix fragment identifier information (prefix_uuid_info). The ending attribute identifier indicates whether the combination fragment sequence ends with a suspenseful ending; the starting fragment identifier identifies the starting fragment of the combination for deduplication and diversity control during retrieval; the combination fragment quantity information records the number of fragments contained in the combination, providing a basis for selective retention under the same starting fragment identifier; and the prefix fragment identifier identifies the prefix characteristics of the combination fragment sequence, which can be used as an auxiliary judgment condition in specific retrieval or deduplication strategies. These attribute information are stored along with the combination fragment sequence when the node is created or inserted and are read and used in subsequent filtering and sorting steps.

[0043] In one possible implementation, see, for example... Figure 2 The diagram shows an example of the structure of some nodes in a radix prefix tree. Figure 2 Taking a tree node as an example, this node maintains a lower bound and an upper bound [min, max] for its subtree score. This node radiates two edges, labeled A and B, each representing a prefix segment in the combined fragment sequence. The child node pointed to by edge A also maintains its subtree score's upper and lower bounds. This child node further branches into two edges, labeled A1 and A2, each pointing to a word end node (is_comb_end, indicating the end position of a complete combined fragment sequence). This means that when reaching this node from the root node along the path "A→A1" or "A→A2", a complete candidate combination has been matched. Each word end node is associated with a candidate value priority queue, which stores specific candidate combination instances belonging to the combination prefix and their corresponding combination duration scores. Similarly, the child node pointed to by edge B also maintains its subtree score's upper and lower bounds and radiates two edges labeled B1 and B2, each pointing to its respective word end node. Each word end node is also associated with a candidate value priority queue.

[0044] It should be understood that the above structural example illustrates the core way that cardinality prefix trees organize combination fragment sequences: each path from the root node to the word tail node in the tree corresponds to a prefix code of a combination fragment sequence (for example, "A→A1" represents a combination starting with fragment A and followed by fragment A1); edge labels are stored in a compact prefix form rather than character-by-character to reduce the number of edges and storage overhead; each node maintains the upper and lower bounds of the duration scores of all combinations within its subtree, providing a basis for branch pruning (Pruning, which will be explained in detail below) based on the overall duration range during the retrieval phase; the word tail node manages multiple candidate combinations belonging to the same prefix through a priority queue, enabling the rapid acquisition of candidate results with higher scores when a retrieval hits.

[0045] In one embodiment, the radix prefix tree can be pre-constructed before retrieval execution. Specifically, the radix prefix tree can be constructed through the following steps: creating an initial radix prefix tree containing a root node; receiving the combined fragment sequence to be inserted and the corresponding combined duration score; determining the insertion position corresponding to the combined fragment sequence in the initial radix prefix tree, marking the end node of the combined fragment sequence as a term end node, and storing the combined duration score in the candidate value priority queue associated with the term end node; starting from the term end node, backtracking layer by layer along the ancestor link, updating the lower and upper bounds of the subtree score of each node on the backtracking path based on the newly inserted combined duration score; when all combined fragment sequences to be inserted have been inserted, the radix prefix tree is obtained. Thus, by backtracking layer by layer along the ancestor link for the newly inserted combined fragment sequence and updating the upper and lower bounds of the subtree score of each ancestor node based on the newly inserted combined duration score during the construction of the radix prefix tree, it is ensured that the subtree score boundary recorded by each node always reflects the actual duration distribution range of the combinations within the current subtree, providing a tight boundary basis for retrieval pruning.

[0046] It should be noted that the radix prefix tree starts as an empty tree structure containing only a root node, which does not store any segment identification information. When a new combined segment sequence needs to be included in the index, it receives the combined segment sequence to be inserted and the corresponding combined duration score. The combined segment sequence consists of ordered segment identifiers, such as "segment A → segment B → segment C".

[0047] The insertion process begins by locating the insertion position in the radix prefix tree that matches the combined fragment sequence. Starting from the root node, the first part of the combined fragment sequence is matched with the longest common prefix of the child edge labels of the current node. Based on the matching result, edge creation or splitting operations are performed, and the combined fragment sequence is inserted into the tree layer by layer until all fragment identifiers in the sequence have been processed. At this point, the node corresponding to the last character of the combined fragment sequence (i.e., the end of the sequence) is marked as the word end node. Subsequently, candidate elements containing the combined fragment sequence identifier and the combined duration score are added to the candidate value priority queue associated with the word end node. The candidate value priority queue can be sorted according to the combined duration score, so that each pop operation can prioritize the candidate combination with the highest score.

[0048] Furthermore, after storing the data for the word ending nodes, a backtracking update of the boundary information is performed. Specifically, starting from the newly inserted word ending node, the process backtracks layer by layer along the ancestor link towards the root node. For each ancestor node traversed on the backtracking path, the newly inserted combination duration score is compared with the lower bound of the subtree score currently recorded by that ancestor node: if the new score is less than the lower bound of the subtree score currently recorded, the lower bound is updated with the new score; similarly, if the new score is greater than the upper bound of the subtree score currently recorded, the upper bound is updated with the new score. In the specific implementation, the above backtracking update operation can be completed by calling the functions __update_max_scores and __update_min_scores, respectively. In this way, the subtree score boundary information maintained by the ancestor nodes can be dynamically tightened as new data is added, ensuring that the boundary information always accurately reflects the actual duration distribution range of all combinations within the current subtree.

[0049] It should be understood that the above process of receiving and backtracking updates is repeated for each combination fragment sequence to be inserted. Once all combination fragment sequences to be included in the index have completed the insertion operation, the initial radix prefix tree containing only the root node grows into a pre-built radix prefix tree containing complete candidate combination information and whose subtree score boundaries have been maintained. This tree structure can then be directly obtained and used in subsequent retrieval steps.

[0050] In one specific implementation, the insertion process may include: first, comparing the new combined fragment sequence with the existing edge labels in the current cardinality prefix tree to calculate the longest common prefix. Then, processing is performed according to three different matching cases: congruence, prefix, or bifurcation. Next, intermediate nodes are created or existing subtrees are reused based on the matching results. Furthermore, elements containing the combined identifier and combined duration score are added to the candidate value priority queue of the word tail node. Finally, backtracking from the word tail node to the root node, the lower bound and upper bound of the subtree score of the ancestor nodes are updated layer by layer.

[0051] In one embodiment, the specific steps for determining the insertion position may include: performing longest common prefix matching between the combined fragment sequence and existing edge labels in the current radix prefix tree to obtain the shared prefix length; when the shared prefix length is zero, determining the insertion position corresponding to the combined fragment sequence as the new edge position under the root node, and creating a new edge with the combined fragment sequence as the edge label; when the shared prefix length is greater than zero and less than the existing edge label length, splitting the existing edge label into a shared prefix edge and a remaining suffix edge at the shared prefix length, and determining the insertion position of the remaining part of the combined fragment sequence as the new branch position under the child node corresponding to the shared prefix edge; when the shared prefix length is equal to the existing edge label length, continuing to match downwards along the child nodes corresponding to the existing edge label until the insertion position of the remaining part of the combined fragment sequence is determined. Thus, by performing longest common prefix matching between the combined fragment sequence and existing edge labels in the current radix prefix tree when determining the insertion position of the combined fragment sequence, and processing the creation, splitting, and continuing downward matching of edges according to the matching length, compact storage of the combined fragment sequence in the radix prefix tree is achieved, reducing redundant creation of edges and nodes.

[0052] It's important to note that determining the insertion position of a combined fragment sequence in a radix prefix tree involves core operations such as longest common prefix matching and dynamic edge splitting. When inserting a new combined fragment sequence, starting from the root node, the first part of the sequence is compared with each child edge label of the current node to calculate the shared prefix length. The shared prefix length refers to the number of consecutive characters that are identical in the combined fragment sequence and the edge label, starting from the first character.

[0053] Depending on the different values ​​of the shared prefix length, there are three processing scenarios: Scenario 1: Shared prefix length is zero. This indicates that the combined fragment sequence has no common starting character with any of the existing child edges of the current node. In this case, the insertion position of the combined fragment sequence is determined as a new edge position under the root node (or the current node). A new edge can be directly created with the complete combined fragment sequence as its edge label, pointing to a newly created child node.

[0054] Scenario 2: Shared prefix length is greater than zero and less than the length of the existing edge label. This indicates that the combined fragment sequence partially overlaps with an existing edge label, but they do not match perfectly. For example, the existing edge label is "fragment A → fragment B", and the sequence to be inserted is "fragment A → fragment C". They share a prefix "fragment A →", and the length of the shared prefix is ​​greater than zero but less than the full length of the existing edge label. In this case, the existing edge label needs to be split at the shared prefix length. The splitting operation divides the original edge label into two segments: the shared prefix edge (i.e., "fragment A →") and the remaining suffix edge (i.e., "fragment B"). The child node relationships corresponding to the original edge label are reconstructed: the shared prefix edge becomes a new edge of the current node, pointing to a newly created intermediate node; this intermediate node then leads to an edge labeled with the remaining suffix edge, pointing to the original child node. For the combined fragment sequence to be inserted, the insertion position of its remaining part (i.e., "fragment C") is determined as the new branch position under this intermediate node, creating a new edge labeled with this remaining part, pointing to a new word ending node. In the actual implementation, the above-mentioned edge splitting and replacement operations can be completed by calling the function replace_child.

[0055] Scenario 3: The length of the shared prefix equals the length of the existing edge label. This indicates that the combined fragment sequence completely contains the existing edge label as a prefix. For example, the existing edge label is "fragment A→", and the sequence to be inserted is "fragment A→fragment B". In this case, the matched portion of the combined fragment sequence completely covers the edge label, and there is no need to split the existing edge. Continuing downwards along the child nodes corresponding to the edge label, the remaining part of the combined fragment sequence (i.e., "fragment B") is matched with the edge labels of the child nodes in the next round of longest common prefix matching. This process continues until all fragment identifiers of the combined fragment sequence have been processed, and the insertion position of the remaining part is finally determined (which may involve subsequent splitting or creation operations).

[0056] Through the insertion position determination mechanism based on longest common prefix matching and dynamic edge splitting, the radix prefix tree can store a large number of combined fragment sequences of shared prefixes in a compact manner, significantly reducing the number of edges and nodes in the tree, reducing storage overhead, and providing a structural foundation for efficient retrieval based on edge matching.

[0057] Step 102: Receive a retrieval request carrying the lower limit and upper limit of the target duration.

[0058] In this embodiment, after obtaining the pre-constructed cardinality prefix tree, a retrieval request is received from a user or an upper-layer application. The retrieval request carries a lower limit and an upper limit of the target duration, which together define a target duration range to constrain the total duration range of the combined segment sequence returned by the retrieval. For example, in a short drama production scenario, a user may need to retrieve a combination of candidate segments with a total duration between 5 minutes and 5 minutes and 30 seconds. In this case, the lower limit of the target duration is 5 minutes, and the upper limit of the target duration is 5 minutes and 30 seconds.

[0059] The lower and upper limits of the target duration can be values ​​directly entered by the user through the interactive interface, or they can be time window parameters automatically generated according to preset business rules. Receiving this search request marks the formal start of a combined fragment search task. Subsequent steps will filter candidate combinations in the cardinality prefix tree based on this target duration interval.

[0060] It should be noted that the target duration interval will serve as the core reference for pruning decisions during the retrieval process. Specifically, during the traversal of each node in the cardinality prefix tree, the duration range of the subtree defined by the lower and upper bounds of the subtree score maintained by each node is compared with the target duration interval carried in the retrieval request to determine whether there are candidate combinations within that subtree that meet the duration condition. The setting of the lower and upper limits of the target duration directly determines the scope of the pruning operation and the recall scale of the retrieval results: the wider the interval, the more subtree branches are filtered through pruning, and the larger the number of recalled candidate combinations; the narrower the interval, the more significant the pruning effect and the more obvious the improvement in retrieval efficiency.

[0061] Step 103: Starting from the root node of the radix prefix tree, traverse the nodes in the radix prefix tree. For any currently visited node, if the upper bound of the subtree score of the currently visited node is less than the lower bound of the target duration, or the lower bound of the subtree score of the currently visited node is greater than the upper bound of the target duration, then terminate the traversal of the subtree branch rooted at the currently visited node.

[0062] In this embodiment, upon receiving a retrieval request carrying the lower and upper limits of the target duration, a depth-first search (DFS) strategy can be used to traverse the nodes in the pre-constructed cardinality prefix tree, starting from the root node. The traversal process aims to locate and collect all combined segment sequences that satisfy the target duration interval constraints.

[0063] It should be noted that during the traversal, for any currently visited node, the lower and upper bounds of the subtree score, which were maintained during the node's construction phase, are first read. Then, the subtree score range of the currently visited node is compared with the target duration interval carried in the retrieval request. If the upper bound of the subtree score of the currently visited node is less than the lower limit of the target duration interval, it indicates that the duration score of all combined segment sequences within that subtree is lower than the lower limit of the target duration interval, and there are no candidate combinations that meet the duration requirements. If the lower bound of the subtree score of the currently visited node is greater than the upper limit of the target duration interval, it indicates that the duration score of all combined segment sequences within that subtree is higher than the upper limit of the target duration interval, and there are also no candidate combinations that meet the requirements. When either of the above conditions is met, it can be determined that the entire subtree branch corresponding to the currently visited node has no intersection with the target duration interval, thereby terminating the depth-first traversal of that subtree branch and directly backtracking to the previous level node to continue processing other branches. This is the pruning operation based on subtree boundary information.

[0064] In one possible implementation, the pruning decision logic can be encapsulated as a separate decision function, such as the `_skip_all_children` function. This function receives parameters such as the current node, the collected result set, the target duration interval, and the expected number of returns. By comparing the node's `max_score_children` with the target duration lower limit and `min_score_children` with the target duration upper limit, it returns a boolean value indicating whether all child nodes of the current node should be skipped.

[0065] Specifically, if the upper bound of the subtree score of the currently visited node is greater than or equal to the lower bound of the target duration, and the lower bound of the subtree score is less than or equal to the upper bound of the target duration, it indicates that there may be candidate combinations in the subtree that satisfy the duration condition. In this case, continue traversing downwards along the current branch, recursively visiting the child nodes of the node, until the node marked as the word ending is reached.

[0066] It should be noted that when a node marked as a word suffix is ​​encountered during traversal, it indicates that the combined prefix corresponding to the current path has matched one or more complete candidate combinations. The candidate value priority queue associated with the word suffix node stores specific candidate combination instances belonging to that prefix. At this point, the candidate combination fragment sequence is retrieved from this priority queue as the candidate result. The specific processing flow for retrieving candidate results from the word suffix node will be described in detail in subsequent steps.

[0067] In one possible implementation, see, for example... Figure 3 The diagram shown illustrates the query pruning process. Figure 3Starting from the initial node (start), the process enters the first decision node. This node compares the subtree score of the current child node with the target duration interval (child [min,max] vs [L,U]). If the duration range of the subtree does not intersect with the target interval, the process proceeds along the right path to the prune branch node, indicating termination of traversal of that subtree branch. If the duration range of the subtree intersects with the target interval, the process proceeds along the left path to the visit child node (visitchild), indicating continued visit to that child node. The process then proceeds to the second decision node, which determines whether the currently visited node is a word end node (is_word_end?). If it is a word end node, the process proceeds to the pop-priority queue and filter node (popPQ→filter), indicating entry into the candidate result acquisition and filtering stage (the specific implementation of this stage will be detailed in subsequent embodiments). Subsequently, the process proceeds sequentially to the select-top-K node and the unused result refill priority queue node (unused→refill PQ). This process illustrates the complete retrieval path from root node traversal, pruning judgment, word tail node identification to the candidate result processing entry point.

[0068] Step 104: When a node marked as the end of a word is detected during traversal, at least one combined segment sequence associated with the end-of-word node is obtained as a candidate result.

[0069] In this embodiment, during the traversal in step 103, when the depth-first search reaches a node marked as a word suffix, it indicates that the combined prefix corresponding to the path from the root node to the current node has matched one or more complete combined fragment sequences. At this point, it is necessary to obtain specific candidate combinations from the candidate value priority queue associated with the word suffix node, and after filtering, screening, and sorting, finally determine the candidate fragment sequence as the retrieval result output. The following will describe in detail the process of obtaining and processing candidate results.

[0070] In one embodiment, firstly, when a node marked as a word ending is detected during traversal, at least one candidate combination is popped from the candidate value priority queue associated with the word ending node. The candidate combination includes a combination fragment sequence and the combination duration score corresponding to the combination fragment sequence. Then, the popped candidate combinations are filtered according to a preset value filtering condition, and the candidate combinations that pass the filtering are added to a temporary candidate set. Next, when the number of combinations in the temporary candidate set reaches a preset number threshold, a target number of candidate combinations are determined from the temporary candidate set as candidate results output. Finally, the candidate combinations in the temporary candidate set that are not determined as candidate results output are backfilled into the candidate value priority queue associated with the corresponding word ending node.

[0071] It should be noted that when traversing to the word ending node, the candidate value priority queue associated with that node will be accessed. The candidate value priority queue stores all candidate combination instances belonging to the prefix of that combination. Each element in the queue contains two pieces of information: the identifier of the combination fragment sequence (usually represented as a fragment connection path, such as "fragment A → fragment B → fragment C") and the combination duration score corresponding to that combination. The candidate value priority queue is internally sorted by combination duration score. In a specific implementation, a max-heap structure can be used, ensuring that each pop operation prioritizes the candidate combination with the highest score.

[0072] The process involves sequentially popping candidate combinations from a priority queue of candidate values. For each popped candidate combination, it can be filtered according to preset filtering conditions. The filtered candidate combinations are then added to a temporary candidate set, which is used to temporarily store candidate combinations that meet the filtering conditions collected from each term end node during this round of retrieval.

[0073] The process of popping, filtering, and adding combinations continues until either of the following conditions is met: the number of combinations in the temporary candidate set has reached a preset threshold; or the candidate value priority queue of the current word end node has no more candidate combinations to pop and no other word end nodes are pending processing. The preset threshold can be set based on the expected number of combinations returned in the search request (i.e., the target number). Typically, the threshold can be set to a multiple of the target number (e.g., two or three times the target number) to provide a sufficient candidate pool for subsequent diversity ranking. When the number of combinations in the temporary candidate set reaches the preset threshold, the target number of candidate combinations can be selected from the temporary candidate set as candidate results for output.

[0074] For the remaining candidate combinations in the temporary candidate set that were not determined as candidate results, they can be backfilled into the candidate value priority queue associated with the corresponding term end node. The backfilling operation ensures the integrity of candidate combinations in the candidate value priority queue, allowing the same candidate combination to continue participating in the filtering process in subsequent search requests or other branches of the same search request, avoiding the loss and duplication of candidate combinations, and maintaining the reusability of index data.

[0075] In one specific implementation, the complete process of candidate value popping, filtering, selection, and backfilling can include: traversing each element in the candidate value priority queue of the word end node, adding the score and the corresponding candidate combination identifier to a temporary list; filtering and sorting the elements in the temporary list; if the total number of elements exceeds the target number, selecting the first target number of elements as candidate results and outputting the remaining elements back into the candidate value priority queue of the word end node. Specifically, the iterator of elements in the priority queue can be obtained by calling the get_values() method, processed item by item in the loop, and finally the unselected candidates can be backfilled into the priority queue by the add_to_value() method.

[0076] Therefore, by filtering the candidate combinations popped from the word tail node with preset value filtering conditions and adding them to the temporary candidate set, and after determining the target number of candidate results, the unselected candidate combinations are backfilled into the candidate value priority queue of the corresponding word tail node, thereby maintaining the integrity of the candidate combinations in the candidate value priority queue, so that the same candidate combination can continue to participate in the filtering in subsequent searches.

[0077] Furthermore, the process of filtering the pop-up candidate combinations based on preset filtering conditions may specifically include: obtaining the starting segment identifier of the candidate combination; when the starting segment identifier is not recorded as used, recording the starting segment identifier as used and determining that the candidate combination passes the filtering; when the starting segment identifier has been recorded as used, comparing the number of segments of the candidate combination with the number of segments of the recorded combination corresponding to the same starting segment identifier; if the number of segments of the candidate combination is greater than the number of segments of the recorded combination, then replacing the recorded combination with the candidate combination and passing the filtering; otherwise, determining that the candidate combination fails the filtering.

[0078] It should be noted that the preset filtering condition is used to perform deduplication and selection before candidate combinations enter the temporary candidate set. The core basis of this filtering condition is the starting segment identifier of the candidate combination. The starting segment identifier is used to uniquely identify the starting segment of a combination segment sequence, such as the identifier of the first episode segment in a short drama production task. During the retrieval process, in order to ensure the diversity of the final output candidate results in terms of episode source and to avoid multiple candidate results starting from the same episode segment, it is necessary to control the deduplication of candidate combinations with the same starting segment identifier.

[0079] Specifically, when a candidate combination is popped from the candidate value priority queue, the starting segment identifier of that candidate combination is first obtained. This starting segment identifier can be stored in the starting segment identifier information (start_uuid_info) of the word end node, or it can be parsed from the identifier of the combination segment sequence. Then, it can be queried whether the starting segment identifier has been recorded as used. If the starting segment identifier has not been recorded as used, it means that no candidate combination starting with this starting segment has passed the screening in the current retrieval process. At this time, the starting segment identifier can be recorded as used, and the candidate combination can be determined to have passed the screening, allowing it to enter the temporary candidate set.

[0080] If the aforementioned starting segment identifier has already been recorded as used, it indicates that at least one candidate combination starting with that starting segment has passed the screening process. In this case, the number of segments in the current candidate combination can be further obtained and compared with the number of segments in the already recorded combinations corresponding to the same starting segment identifier. The number of segments refers to the number of segments contained in the combination segment sequence, which can be obtained from the combination segment count information (combo_size_info) in the word end node. If the number of segments in the current candidate combination is greater than the number of segments in the already recorded combinations, the current candidate combination replaces the already recorded combinations, and the current candidate combination is determined to have passed the screening; if the number of segments in the current candidate combination is less than or equal to the number of segments in the already recorded combinations, the current candidate combination is determined to have failed the screening and is discarded or ignored.

[0081] It should be understood that the filtering mechanism described above prioritizes combinations with a larger number of segments when multiple candidate combinations with the same starting segment identifier are encountered. Since combinations with a larger number of segments in a short drama production typically imply richer plot content or a more complete narrative structure, prioritizing such combinations helps improve the quality of the candidate results.

[0082] In one specific implementation, the deduplication filtering logic described above may include: querying whether the starting fragment identifier has been used by using the get_clip_manager().check_start_uuid_stats() method; recording the used starting fragment identifier by using the update_start_uuid_stats() method; and determining whether to retain the current candidate combination by comparing the combo_size with the number of fragments in the existing combination.

[0083] Therefore, by recording the used starting fragment identifiers when filtering candidate combinations, and comparing and selecting the best candidate combinations with different numbers of fragments under the same starting fragment identifier, the deduplication screening based on the starting fragment identifier is completed during the retrieval process, avoiding the need to perform deduplication processing separately after the candidate results are generated.

[0084] In one embodiment, the process of determining a target number of candidate combinations as candidate results output from a temporary candidate set may specifically include: grouping the candidate combinations in the temporary candidate set according to the starting segment identifier to obtain at least one candidate group; sorting the candidate combinations within each candidate group in descending order of combination duration score, and determining the score of the first candidate combination in each candidate group as the representative score of the corresponding candidate group; determining the processing priority of each candidate group in descending order of the representative scores; and repeatedly executing the following steps until the number of output candidate results reaches the target number: taking the highest priority candidate group from the currently schedulable candidate groups according to the processing priority, extracting the first candidate combination in the highest priority candidate group as the candidate result output, and moving the remaining candidate combinations in the highest priority candidate group into a waiting set; when there are no schedulable candidate groups and the waiting set is not empty, restoring all candidate groups in the waiting set to a schedulable state, and re-determining the processing priority based on the representative scores of each restored candidate group.

[0085] It should be noted that when the number of candidate combinations in the temporary candidate set reaches a preset threshold, a target number of candidate combinations need to be selected as the final candidate output. To ensure sufficient diversity in the source of the output episodes and to avoid adjacent output candidate results being concentrated in the same starting segment, this embodiment of the application adopts a strategy of grouping and alternating extraction according to the starting segment identifier.

[0086] Specifically, firstly, all candidate combinations in the temporary candidate set are grouped according to their starting segment identifiers, with combinations sharing the same identifier grouped into the same candidate group. The temporary candidate set is divided into at least one candidate group, each corresponding to a specific starting segment. Then, for each candidate group, the candidate combinations within that group are sorted in descending order of their combination duration score, placing higher-scoring combinations at the beginning of the group. After sorting, the score of the first-ranked candidate combination in each group is determined as the representative score for that group. The representative score characterizes the duration score level of the current best candidate combination within that group. Next, the processing priority of each candidate group is determined in descending order of its representative score. Candidate groups with higher representative scores have higher processing priority and will be processed first in subsequent extraction processes. After completing the grouping and priority determination, a cyclical extraction phase begins. This cycle continues until the number of output candidate results reaches the target number.

[0087] Each iteration of the loop performs the following operations: First, the highest-priority candidate group is selected from the currently schedulable candidate groups according to processing priority. A schedulable candidate group refers to a candidate group that is currently active and has not yet been temporarily removed. The top-ranked candidate combination within this highest-priority candidate group is extracted and output as the candidate result. After output, the remaining candidate combinations (if any) in this candidate group are moved to a waiting set and temporarily removed from the current extraction round. When it is found that there are no currently schedulable candidate groups (i.e., all candidate groups have been moved to the waiting set), and the waiting set is not empty, all candidate groups in the waiting set are restored to a schedulable state, and their processing priorities are re-determined based on the representative scores of each restored candidate group. After this, the next iteration can continue to extract candidate combinations from the restored candidate groups according to priority.

[0088] It should be understood that through the above-mentioned alternating extraction mechanism, candidate combinations in candidate groups with high representative scores are output first. At the same time, after each output, the group is moved to the waiting set and then extracted from other candidate groups in the next round of the cycle. This effectively avoids the situation where multiple consecutive output results come from the same starting segment and improves the uniformity of the distribution of candidate results in terms of the source of the series.

[0089] In one specific implementation, the above-mentioned alternating extraction logic can be implemented using the `interleave_group` function. This function manages the processing priority of each candidate group by maintaining a max-heap (implemented by using a min-heap to take negative scores) and implements a temporary storage and restoration mechanism for the standby set through a cooling queue (`cool_down_queue`).

[0090] Therefore, by grouping the candidate combinations in the temporary candidate set according to the starting segment identifier, and alternately extracting candidate combinations from different groups according to the priority determined by the score represented by each group, the candidate results of adjacent outputs are avoided from being concentrated in the same starting segment identifier, thus improving the uniformity of the distribution of candidate results.

[0091] In one embodiment, before grouping the candidate combinations in the temporary candidate set according to the start fragment identifier, a dual grouping method of ending attribute grouping can be introduced. Specifically, it can include: obtaining the ending attribute identifier of each candidate combination; dividing the candidate combinations in the temporary candidate set into a first attribute group and a second attribute group according to the ending attribute identifier; and grouping the candidate combinations in the first attribute group and the second attribute group according to the start fragment identifier.

[0092] It should be noted that in application scenarios such as short drama production, whether the ending of the combined segment sequence has a suspense attribute is one of the important dimensions for measuring the quality of candidate combinations. In order to ensure the diversity of the starting segments while taking into account the balanced output of candidate combinations with suspenseful endings and non-suspenseful endings, the embodiments of this application first divide the candidate combinations in the temporary candidate set according to the ending attribute identifier before grouping them by the starting segment identifier.

[0093] Specifically, the ending attribute identifier of each candidate combination is first obtained. This identifier is stored in the `has_ending` field of the word ending node and indicates whether the combination segment sequence ends with suspense. For example, a `has_ending` value of "true" or "1" indicates a suspenseful ending, while a value of "false" or "0" indicates no suspenseful ending. Then, all candidate combinations in the temporary candidate set are divided into a first attribute group and a second attribute group based on their ending attribute identifiers. The first attribute group corresponds to candidate combinations with suspenseful endings, and the second attribute group corresponds to candidate combinations without suspenseful endings. The two groups are independent of each other. Based on this, the grouping operation based on the starting segment identifier described in the previous embodiment can be performed on the candidate combinations within the first and second attribute groups respectively. That is, within the first attribute group, the candidate combinations are further divided into several subgroups based on the starting segment identifier, and operations such as descending order within the group, determining representative scores, and alternating extraction are performed; within the second attribute group, the same subgrouping and subsequent sorting and extraction operations are performed based on the starting segment identifier.

[0094] The dual grouping strategy, which first groups by ending attribute and then by starting segment, ensures that both suspenseful and non-suspenseful ending candidate combinations have a reasonable chance of being displayed in the final output candidate results. At the same time, the diversity principle of alternating extraction of starting segments is still followed within each group to avoid the absolute dominance of candidate combinations with one type of ending attribute in the results.

[0095] In one specific implementation, the above-mentioned dual grouping logic can split the input data according to the has_ending field before executing the interleave_group function, then call the interleave function on the two parts of the data respectively, and finally merge the output results.

[0096] Therefore, by dividing the candidate combinations in the temporary candidate set into two attribute groups based on the end attribute identifier before grouping by the start fragment identifier, and then performing start fragment identifier grouping and alternating extraction on the candidate combinations in each attribute group, the balanced output of candidate combinations with different end attribute identifiers can be ensured while maintaining the uniformity of the distribution of start fragment identifiers.

[0097] In one embodiment, after completing the construction and retrieval of the cardinality prefix tree, to facilitate users' intuitive evaluation of the distribution density and coverage of candidate combinations in the time dimension, this application embodiment also provides a function for visually statistically outputting the candidate data in the cardinality prefix tree. This function can be executed independently of the retrieval process, or it can be invoked during system operation and maintenance or strategy tuning phases.

[0098] Specifically, the visualization and statistical output steps may include the following: Traverse each word suffix node in the cardinality prefix tree to obtain the combination duration score of the candidate combinations associated with each word suffix node; aggregate and statistically analyze the obtained combination duration scores according to a preset duration interval to generate interval histogram distribution data with duration as the horizontal axis and the number of candidate combinations as the vertical axis; output the interval histogram distribution data.

[0099] It should be noted that, firstly, the process iterates through each word-tail node in the pre-constructed cardinal prefix tree, obtaining the combined duration score of all candidate combinations stored in the candidate value priority queue associated with each word-tail node. Since each word-tail node corresponds to one or more candidate combinations, the traversal process needs to cover all word-tail nodes in the cardinal prefix tree to ensure the integrity of the statistical data. Then, the obtained combined duration scores are aggregated and statistically analyzed according to preset duration intervals. A preset duration interval refers to dividing the duration score range into several continuous sub-intervals at equal intervals or according to business needs. For example, using 30 seconds as an interval unit, the duration score range from 0 seconds to 10 minutes is divided into twenty intervals. For each combined duration score, it is determined which preset duration interval it falls into, and the candidate combination count for that interval is incremented by one. Next, based on the candidate combination counts for each preset duration interval, interval histogram data can be generated, with duration as the horizontal axis and the number of candidate combinations as the vertical axis. This interval histogram data can be output in various forms, such as numerical arrays, graphically rendered data, or image files. Finally, the interval histogram data is output. Output methods may include rendering it as a bar chart on the user interface, exporting it as a data report, or providing it to external systems for display and analysis.

[0100] In one possible implementation, see, for example... Figure 4 The diagram shows an interval histogram distribution of data. Figure 4 The distribution of candidate combinations is displayed in the form of a bar chart. The height of each bar represents the number of candidate combinations falling within the corresponding time interval, visually presenting the degree of clustering and sparse areas of candidate combinations in different time segments. By observing this histogram, users can quickly determine the richness of candidate combinations for each time segment in the current media library, thereby providing a basis for setting target time intervals in search requests, making media supplementation decisions, or adjusting search strategies.

[0101] The aforementioned visualization and statistical functions can be implemented using the `visualize` function. This function takes inputs such as drama ID (`drama_id`), number of videos (`num_of_videos`), and interval partitioning parameter (`interval`), traverses the cardinality prefix tree, aggregates and counts the number of candidates for each duration interval, and finally outputs a histogram distribution describing the data. This function can transform abstract tree-structured data into intuitively understandable statistical charts.

[0102] Therefore, by traversing each word tail node in the cardinality prefix tree to obtain the combination duration score of the candidate combination, and aggregating and statistically generating interval histogram distribution data according to the preset duration interval, the distribution density of the candidate combination in the duration dimension is presented intuitively, providing statistical basis for the evaluation and adjustment of the retrieval strategy.

[0103] The combined fragment retrieval method disclosed in the above embodiments of this application first obtains a pre-constructed radix prefix tree. The edge labels of the radix prefix tree store the prefix segments of the combined fragment sequence. Each node of the radix prefix tree corresponds to a subtree, and each node records the minimum and maximum values ​​of the combined duration scores of all combinations within the corresponding subtree, which are respectively used as the lower and upper bounds of the subtree scores. Then, a retrieval request carrying the target duration lower limit and the target duration upper limit is received. Next, starting from the root node of the radix prefix tree, the nodes in the radix prefix tree are traversed. For any currently accessed node, if the upper bound of the subtree score of the currently accessed node is less than the target duration lower limit, or the lower bound of the subtree score of the currently accessed node is greater than the target duration upper limit, the traversal of the subtree branch rooted at the currently accessed node is terminated. Finally, when a node marked as a word ending is detected, at least one combined fragment sequence associated with the word ending node is obtained as a candidate result. Therefore, by recording the minimum and maximum values ​​of all combined duration scores in the subtree corresponding to each node in the cardinality prefix tree, and comparing the upper and lower bounds of the subtree scores recorded by the node with the target duration interval during the traversal retrieval process, the subtree branch is skipped directly when the duration range of the entire subtree does not intersect with the target duration interval, thereby avoiding the visit of irrelevant branches one by one, reducing invalid traversal calculations in the retrieval process, and improving the response efficiency of combined fragment retrieval.

[0104] In addition, through the multi-level processing flow of pop-up filtering, deduplication filtering, alternating sorting and attribute grouping, after traversing to the end node, it is possible to efficiently obtain candidate combination fragment sequences that meet the time constraints, have content diversity and conform to business preferences from the candidate value priority queue, and return them to the user as search results.

[0105] See Figure 5 The diagram shows a structural schematic of a combined fragment retrieval device provided in an embodiment of this application. For ease of explanation, only the parts related to the embodiment of this application are shown.

[0106] The combined fragment retrieval device may specifically include the following modules: The tree acquisition module 501 is used to acquire a pre-constructed radix prefix tree. The edge labels of the radix prefix tree store the prefix segments of the combined fragment sequence. Each node of the radix prefix tree corresponds to a subtree, and each node records the minimum and maximum values ​​of the combined duration scores in the corresponding subtree, which serve as the lower and upper bounds of the subtree scores, respectively.

[0107] The request receiving module 502 is used to receive a retrieval request carrying the lower limit value and the upper limit value of the target duration.

[0108] The node traversal module 503 is used to traverse the nodes in the radix prefix tree starting from the root node. For any currently visited node, if the upper bound of the subtree score of the currently visited node is less than the lower bound of the target duration, or the lower bound of the subtree score of the currently visited node is greater than the upper bound of the target duration, then the traversal of the subtree branch rooted at the currently visited node is terminated.

[0109] The result determination module 504 is used to obtain at least one combined segment sequence associated with the word ending node as a candidate result when a node marked as the word ending is detected during traversal.

[0110] The combined segment retrieval device disclosed in the above embodiments of this application first obtains a pre-constructed radix prefix tree. The edge labels of the radix prefix tree store the prefix segments of the combined segment sequence. Each node of the radix prefix tree corresponds to a subtree, and each node records the minimum and maximum values ​​of all combined duration scores in the corresponding subtree, which are respectively used as the lower and upper bounds of the subtree scores. Then, it receives a retrieval request carrying the target duration lower limit and the target duration upper limit. Next, it traverses the nodes in the radix prefix tree starting from the root node. For any currently accessed node, if the upper bound of the subtree score of the currently accessed node is less than the target duration lower limit, or the lower bound of the subtree score of the currently accessed node is greater than the target duration upper limit, then the traversal of the subtree branch rooted at the currently accessed node is terminated. Finally, when a node marked as a word ending is detected, at least one combined segment sequence associated with the word ending node is obtained as a candidate result. Therefore, by recording the minimum and maximum values ​​of all combined duration scores in the subtree corresponding to each node in the cardinality prefix tree, and comparing the upper and lower bounds of the subtree scores recorded by the node with the target duration interval during the traversal retrieval process, the subtree branch is skipped directly when the duration range of the entire subtree does not intersect with the target duration interval, thereby avoiding the visit of irrelevant branches one by one, reducing invalid traversal calculations in the retrieval process, and improving the response efficiency of combined fragment retrieval.

[0111] Furthermore, in one possible implementation of this application embodiment, the above-mentioned combined fragment retrieval device may further include the following modules: The tree construction module is used to create an initial radix prefix tree containing a root node; it receives the combined fragment sequence to be inserted and the combined duration score corresponding to the combined fragment sequence; it determines the insertion position corresponding to the combined fragment sequence in the initial radix prefix tree, marks the end node of the combined fragment sequence as the word end node, and stores the combined duration score in the candidate value priority queue associated with the word end node; starting from the word end node, it backtracks layer by layer along the ancestor link, and updates the lower bound and upper bound of the subtree score of each node on the backtracking path based on the newly inserted combined duration score; when all the combined fragment sequences to be inserted have been inserted, the radix prefix tree is obtained.

[0112] Therefore, by backtracking the newly inserted combination fragment sequence along the ancestor link layer by layer during the construction of the cardinality prefix tree and updating the upper and lower bounds of the subtree scores of each ancestor node based on the duration score of the newly inserted combination, it is ensured that the subtree score boundary recorded by each node always reflects the duration distribution range of the actual combination in the current subtree, providing a tight boundary basis for retrieval pruning.

[0113] Furthermore, in another possible implementation of this application embodiment, the tree construction module may specifically include the following units: The first matching unit is used to perform the longest common prefix matching between the combined fragment sequence and the existing edge labels in the current cardinality prefix tree to obtain the shared prefix length.

[0114] The first determining unit is used to determine the insertion position corresponding to the combined fragment sequence as the new edge position under the root node when the shared prefix length is zero, and to create a new edge with the combined fragment sequence as the edge label.

[0115] The first processing unit is used to split the existing edge label into a shared prefix edge and a remaining suffix edge at the shared prefix length when the shared prefix length is greater than zero and less than the existing edge label length, and to determine the insertion position of the remaining part of the combined fragment sequence as the new branch position under the child node corresponding to the shared prefix edge.

[0116] The second processing unit is used to continue matching downwards along the child nodes corresponding to the existing edge labels when the length of the shared prefix is ​​equal to the length of the existing edge labels, until the insertion position of the remaining part of the combined fragment sequence is determined.

[0117] Therefore, by performing the longest common prefix matching between the combined fragment sequence and the existing edge labels in the current radix prefix tree when determining the insertion position of the combined fragment sequence, and processing the creation, splitting and continuing downward matching of the edge according to the matching length, the combined fragment sequence can be compactly stored in the radix prefix tree, reducing the redundant creation of edges and nodes.

[0118] Furthermore, in another possible implementation of this application embodiment, the above result determination module 504 may specifically include the following units: The third processing unit is used to pop at least one candidate combination from the candidate value priority queue associated with the word tail node when it is detected that the node marked as the word tail is traversed. The candidate combination includes a combination fragment sequence and the combination duration score corresponding to the combination fragment sequence.

[0119] The first filtering unit is used to filter the pop-up candidate combinations according to preset filtering conditions, and add the filtered candidate combinations to a temporary candidate set.

[0120] The second determining unit is used to determine a target number of candidate combinations from the temporary candidate set as candidate results output when the number of combinations in the temporary candidate set reaches a preset number threshold.

[0121] The fourth processing unit is used to backfill the candidate combinations in the temporary candidate set that have not been determined as candidate results into the candidate value priority queue associated with the corresponding word end node.

[0122] Therefore, by filtering the candidate combinations popped from the word tail node with preset value filtering conditions and adding them to the temporary candidate set, and after determining the target number of candidate results, the unselected candidate combinations are backfilled into the candidate value priority queue of the corresponding word tail node, thereby maintaining the integrity of the candidate combinations in the candidate value priority queue, so that the same candidate combination can continue to participate in the filtering in subsequent searches.

[0123] Furthermore, in another possible implementation of this application embodiment, the first screening unit can be specifically used to: obtain the starting fragment identifier of the candidate combination; when the starting fragment identifier is not recorded as used, record the starting fragment identifier as used and determine that the candidate combination passes the screening; when the starting fragment identifier has been recorded as used, compare the number of fragments of the candidate combination with the number of fragments of the recorded combination corresponding to the same starting fragment identifier; if the number of fragments of the candidate combination is greater than the number of fragments of the recorded combination, replace the recorded combination with the candidate combination and pass the screening; otherwise, determine that the candidate combination has not passed the screening.

[0124] Therefore, by recording the used starting fragment identifiers when filtering candidate combinations, and comparing and selecting the best candidate combinations with different numbers of fragments under the same starting fragment identifier, the deduplication screening based on the starting fragment identifier is completed during the retrieval process, avoiding the need to perform deduplication processing separately after the candidate results are generated.

[0125] Furthermore, in another possible implementation of this application embodiment, the second determining unit can be specifically used to: group the candidate combinations in the temporary candidate set according to the starting segment identifier to obtain at least one candidate group; sort the candidate combinations in each candidate group in descending order according to the combination duration score, and determine the score of the candidate combination ranked first in each candidate group as the representative score of the corresponding candidate group; determine the processing priority of each candidate group in descending order according to the representative score of each candidate group; and repeatedly execute the following steps until the number of output candidate results reaches the target number: take the highest priority candidate group from the currently schedulable candidate groups according to the processing priority, extract the candidate combination ranked first in the highest priority candidate group as the candidate result output, and move the remaining candidate combinations in the highest priority candidate group into the waiting set. When there are no schedulable candidate groups and the waiting set is not empty, restore all candidate groups in the waiting set to the schedulable state, and redetermine the processing priority based on the representative score of each restored candidate group.

[0126] Therefore, by grouping the candidate combinations in the temporary candidate set according to the starting segment identifier, and alternately extracting candidate combinations from different groups according to the priority determined by the score represented by each group, the candidate results of adjacent outputs are avoided from being concentrated in the same starting segment identifier, thus improving the uniformity of the distribution of candidate results.

[0127] Furthermore, in another possible implementation of this application embodiment, the second determining unit may be further used to: obtain the ending attribute identifier of each candidate combination before grouping the candidate combinations in the temporary candidate set according to the starting fragment identifier; divide the candidate combinations in the temporary candidate set into a first attribute group and a second attribute group according to the ending attribute identifier; group the candidate combinations in the temporary candidate set according to the starting fragment identifier, including: grouping the candidate combinations in the first attribute group and the second attribute group according to the starting fragment identifier respectively.

[0128] Therefore, by dividing the candidate combinations in the temporary candidate set into two attribute groups based on the end attribute identifier before grouping by the start fragment identifier, and then performing start fragment identifier grouping and alternating extraction on the candidate combinations in each attribute group, the balanced output of candidate combinations with different end attribute identifiers can be ensured while maintaining the uniformity of the distribution of start fragment identifiers.

[0129] Furthermore, in another possible implementation of this application embodiment, each word ending node of the cardinality prefix tree also records at least one of the following: ending attribute identifier, starting segment identifier information, and combined segment quantity information. This provides the necessary basic attribute data for filtering and result sorting during the retrieval process.

[0130] Furthermore, in another possible implementation of the embodiments of this application, the above-mentioned combined fragment retrieval device may further include the following modules: The visualization module is used to traverse each word suffix node in the cardinality prefix tree, obtain the combination duration score of the candidate combinations associated with each word suffix node, aggregate and statistically analyze the obtained combination duration scores according to the preset duration interval, generate interval histogram distribution data with duration as the horizontal axis and the number of candidate combinations as the vertical axis, and output the interval histogram distribution data.

[0131] Therefore, by traversing each word tail node in the cardinality prefix tree to obtain the combination duration score of the candidate combination, and aggregating and statistically generating interval histogram distribution data according to the preset duration interval, the distribution density of the candidate combination in the duration dimension is presented intuitively, providing statistical basis for the evaluation and adjustment of the retrieval strategy.

[0132] The combined fragment retrieval device disclosed in the above embodiments of this application, through the multi-level processing flow of pop-up filtering, deduplication filtering, alternating sorting and attribute grouping, can efficiently obtain candidate combined fragment sequences that meet the time constraints, have content diversity and conform to business preferences from the candidate value priority queue after traversing to the end node, and return them to the user as retrieval results.

[0133] The combined fragment retrieval device provided in this application embodiment can be applied in the foregoing method embodiment. For details, please refer to the description of the above method embodiment, which will not be repeated here.

[0134] Figure 6 This is a schematic diagram of the structure of the electronic device provided in an embodiment of this application. For example... Figure 6 As shown, the electronic device 600 of this embodiment includes: at least one processor 610 ( Figure 6 The diagram shows only one processor, memory 620, and computer program 621 stored in memory 620 and executable on at least one processor 610. When processor 610 executes computer program 621, it implements the steps in the above-described combined fragment retrieval method embodiment.

[0135] Electronic device 600 can be a computing device such as a desktop computer, laptop, handheld computer, or cloud server. This electronic device may include, but is not limited to, a processor 610 and a memory 620. Those skilled in the art will understand that... Figure 6 This is merely an example of electronic device 600 and does not constitute a limitation on electronic device 600. It may include more or fewer components than shown, or combine certain components, or different components, such as input / output devices, network access devices, etc.

[0136] The processor 610 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0137] In some embodiments, memory 620 may be an internal storage unit of electronic device 600, such as a hard disk or memory of electronic device 600. In other embodiments, memory 620 may be an external storage device of electronic device 600, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on electronic device 600. Furthermore, memory 620 may include both internal and external storage units of electronic device 600. Memory 620 is used to store operating system, applications, boot loader, data, and other programs, such as program code for computer programs. Memory 620 may also be used to temporarily store data that has been output or will be output.

[0138] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0139] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0140] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0141] In the embodiments provided in this application, it should be understood that the disclosed devices / electronic devices and methods can be implemented in other ways. For example, the device / electronic device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

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

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

[0144] If an integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0145] The implementation of all or part of the processes in the methods of the above embodiments can also be accomplished by a computer program product. When the computer program product is run on an electronic device, the electronic device can implement the steps in the various method embodiments described above.

[0146] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A method for retrieving combined fragments, characterized in that, include: A pre-constructed radix prefix tree is obtained, wherein the radix prefix tree is used to index and store the combined segment sequence, which is a sequence formed by splicing multiple multimedia segments in a preset order, and each combined segment sequence corresponds to a combined duration score; the combined duration score is the cumulative value of the duration of each segment in the combined segment sequence, used to represent the total duration of the combined segment sequence; the edge labels of the radix prefix tree store the prefix segments of the combined segment sequence, each node of the radix prefix tree corresponds to a subtree, and each node records the minimum and maximum values ​​of all combined duration scores in the corresponding subtree, which serve as the lower and upper bounds of the subtree score, respectively; the word tail nodes of the radix prefix tree are associated with a candidate value priority queue, which stores the combined segment sequence corresponding to the word tail node and the combined duration score corresponding to the combined segment sequence, and the candidate value priority queue is implemented using a max-heap data structure; Receive a retrieval request carrying the lower limit and upper limit of the target duration; Starting from the root node of the radix prefix tree, traversal is performed on the nodes in the radix prefix tree. For any currently visited node, if the upper bound of the subtree score of the currently visited node is less than the lower limit of the target duration, or the lower bound of the subtree score of the currently visited node is greater than the upper limit of the target duration, then the traversal of the subtree branch rooted at the currently visited node is terminated. When a node marked as the end of a word is detected during traversal, at least one candidate combination is popped from the candidate value priority queue associated with the end of the word node, wherein the candidate combination includes a combination fragment sequence and the combination duration score corresponding to the combination fragment sequence; The candidate combinations that pop up are filtered according to preset filtering conditions, and the candidate combinations that pass the filtering are added to a temporary candidate set. When the number of combinations in the temporary candidate set reaches a preset threshold, a target number of candidate combinations are determined from the temporary candidate set and output as candidate results. Candidate combinations that were not determined as candidate results in the temporary candidate set are backfilled into the candidate value priority queue associated with the corresponding word ending node.

2. The method according to claim 1, characterized in that, The radix prefix tree is constructed through the following steps: Create an initial radix prefix tree containing the root node; Receive the combined segment sequence to be inserted and the combined duration score corresponding to the combined segment sequence; In the initial cardinality prefix tree, determine the insertion position corresponding to the combined fragment sequence, mark the end node of the combined fragment sequence as the word end node, and store the combined duration score in the candidate value priority queue associated with the word end node; Starting from the term end node, backtrack layer by layer along the ancestor link, and update the lower bound and upper bound of the subtree score of each node on the backtracking path based on the newly inserted combined duration score; When all the combined fragment sequences to be inserted have been inserted, the cardinality prefix tree is obtained.

3. The method according to claim 2, characterized in that, Determining the insertion position corresponding to the combined fragment sequence in the initial cardinality prefix tree includes: The combined fragment sequence is matched with the existing edge labels in the current radix prefix tree using the longest common prefix to obtain the shared prefix length; When the length of the shared prefix is ​​zero, the insertion position corresponding to the combined fragment sequence is determined as the position of the new edge under the root node, and a new edge with the combined fragment sequence as the edge label is created; When the length of the shared prefix is ​​greater than zero and less than the length of the existing edge label, the existing edge label is split into a shared prefix edge and a remaining suffix edge at the length of the shared prefix, and the insertion position of the remaining part of the combined fragment sequence is determined as the new branch position under the child node corresponding to the shared prefix edge. When the length of the shared prefix is ​​equal to the length of the existing edge label, the matching continues downward along the child nodes corresponding to the existing edge label until the insertion position of the remaining part of the combined segment sequence is determined.

4. The method according to claim 1, characterized in that, The step of filtering the pop-up candidate combinations based on preset filtering conditions includes: Obtain the starting segment identifier of the candidate combination; When the starting fragment identifier is not recorded as used, the starting fragment identifier is recorded as used, and the candidate combination is determined to pass the screening. When the starting segment identifier has been recorded as used, the number of segments in the candidate combination is compared with the number of segments in the recorded combination corresponding to the same starting segment identifier. If the number of segments in the candidate combination is greater than the number of segments in the recorded combination, the candidate combination replaces the recorded combination and passes the screening; otherwise, the candidate combination is determined to have failed the screening.

5. The method according to claim 1, characterized in that, The step of determining a target number of candidate combinations from the temporary candidate set as candidate results output includes: The candidate combinations in the temporary candidate set are grouped according to the starting fragment identifier to obtain at least one candidate group; The candidate combinations within each candidate group are sorted in descending order of their combination duration scores, and the score of the first-ranked candidate combination in each candidate group is determined as the representative score of the corresponding candidate group. The processing priority of each candidate group is determined by descending the representative scores of each candidate group; The following steps are executed repeatedly until the number of output candidate results reaches the target number: the highest priority candidate group is taken from the currently schedulable candidate group according to the processing priority; the first candidate combination in the highest priority candidate group is extracted as the candidate result output; and the remaining candidate combinations in the highest priority candidate group are moved into the waiting set; when there are no schedulable candidate groups and the waiting set is not empty, all candidate groups in the waiting set are restored to the schedulable state, and the processing priority is re-determined based on the representative score of each restored candidate group.

6. The method according to claim 5, characterized in that, Before grouping the candidate combinations in the temporary candidate set according to the starting fragment identifier, the method further includes: Obtain the ending attribute identifier for each candidate combination; The candidate combinations in the temporary candidate set are divided into a first attribute group and a second attribute group according to the ending attribute identifier; The step of grouping the candidate combinations in the temporary candidate set according to the starting fragment identifier includes: Candidate combinations within the first attribute group and the second attribute group are grouped according to the starting fragment identifier.

7. The method according to claim 1, characterized in that, Each word ending node of the cardinality prefix tree also records at least one of the following: ending attribute identifier, starting segment identifier information, and combined segment quantity information.

8. The method according to claim 1, characterized in that, The method further includes: Traverse each word tail node in the cardinality prefix tree to obtain the combination duration score of the candidate combinations associated with each word tail node; The obtained duration scores of each combination are aggregated and statistically analyzed according to the preset duration intervals to generate interval histogram distribution data with duration as the horizontal axis and the number of candidate combinations as the vertical axis. Output the interval histogram distribution data.

9. A combined fragment retrieval device, characterized in that, include: A tree acquisition module is used to acquire a pre-constructed radix prefix tree. The radix prefix tree is used to index and store combined segment sequences, which are sequences formed by splicing multiple multimedia segments in a preset order. Each combined segment sequence corresponds to a combined duration score. The combined duration score is the cumulative value of the duration of each segment in the combined segment sequence, representing the total duration of the combined segment sequence. The edge labels of the radix prefix tree store the prefix segments of the combined segment sequences. Each node of the radix prefix tree corresponds to a subtree, and each node records the minimum and maximum values ​​of all combined duration scores within the corresponding subtree, serving as the lower and upper bounds of the subtree score, respectively. The word tail nodes of the radix prefix tree are associated with a candidate value priority queue, which stores the combined segment sequences corresponding to the word tail nodes and the combined duration scores corresponding to the combined segment sequences. The candidate value priority queue is implemented using a max-heap data structure. The request receiving module is used to receive retrieval requests carrying the lower limit and upper limit of the target duration. The node traversal module is used to traverse the nodes in the radix prefix tree starting from the root node. For any currently visited node, if the upper bound of the subtree score of the currently visited node is less than the lower bound of the target duration, or the lower bound of the subtree score of the currently visited node is greater than the upper bound of the target duration, then the traversal of the subtree branch rooted at the currently visited node is terminated. The third processing unit is used to pop at least one candidate combination from the candidate value priority queue associated with the word tail node when it is detected that the node marked as the end of the word is traversed. The candidate combination includes a combination fragment sequence and a combination duration score corresponding to the combination fragment sequence. The first filtering unit is used to filter the pop-up candidate combinations according to preset filtering conditions, and add the filtered candidate combinations to a temporary candidate set. The second determining unit is used to determine a target number of candidate combinations from the temporary candidate set as candidate results output when the number of combinations in the temporary candidate set reaches a preset number threshold. The fourth processing unit is used to backfill the candidate combinations in the temporary candidate set that have not been determined as candidate results into the candidate value priority queue associated with the corresponding word end node.

Citation Information

Patent Citations

  • Information search method and device, terminal equipment and computer readable storage medium

    CN113342848A

  • Video generation method and device, storage medium and electronic equipment

    CN116095422A