Local fuzzy search method for three-level catalog of energy and chemical products

Through the local fuzzy search method for the three-level catalog of energy-chemical products, the problem of efficient traversal and matching of specific numbers or keywords in commodity search is solved, efficient and accurate search results are achieved, and user experience is improved.

CN119739762APending Publication Date: 2025-04-01SHANDONG LONGZHONG INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411820069.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

The prior art has shortcomings in efficient traversal and matching of specific numbers or keywords in commodity search, especially in structured commodity data, especially in three-level directory searches for commodities, where the search efficiency is low.

Method used

A local fuzzy search method for the three-level catalog of energy-chemical products is adopted. By pre-processing the product list, the model is converted and the full spelling and first letter information is stored; the catalog mapping relationship is established, and the three-level price product model is quickly obtained using a hash table; the search result collection is initialized, and the NSMutableOrderedSet is used to ensure that the results are free of duplicates; compound predicates are constructed to filter products that meet multiple conditions; numbers in keywords are grouped, and matching products are traversed using efficient algorithms.

Benefits of technology

Improves search efficiency and user experience, ensures accuracy and consistency of results, reduces calculation volume and improves search speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119739762A_ABST
    Figure CN119739762A_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of search algorithms, and in particular to a local fuzzy search method for a three-level directory of energy and chemical products. The present invention includes the following steps: S1, preprocessing a list of products of interest: completing the conversion, name conversion and storage of the list of products of interest at one time; S2, establishing a directory mapping relationship: using a hash table to quickly map the first-level directory to the second-level directory, and then obtaining a three-level price product model; S3, initializing a set of retrieval results; S4, composite predicate screening products: constructing a composite predicate to screen three-level price products that meet multiple conditions at one time; S5, digital grouping and efficient traversal: grouping the numbers in the keywords, and using an efficient algorithm to traverse the matching products; S6, converting and displaying the model. The present invention implements a local fuzzy search for a three-level directory of energy and chemical products, improving search efficiency and user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of search algorithms, and in particular to a local fuzzy search method for a three-level directory of energy and chemical products. Background Art

[0002] With the development of technical means such as data structure, artificial intelligence, and algorithm optimization, the current development status of commodity search shows a trend of diversification and intelligence. On the one hand, the existing technology focuses on data preprocessing and organization, and quickly locates the target product by establishing an effective data structure and mapping relationship, such as a hash table, so as to improve the search efficiency. This is similar to the method of using a hash table to establish a directory mapping relationship in this application. On the other hand, the existing technology also actively explores the application of artificial intelligence technology to improve the accuracy and fuzziness of the search. For example, some systems use deep learning language models to understand the user's search intent, so that products with high semantic similarity to the target can be retrieved. For example, the Chinese patent publication number is CN110990538A, which discloses a method of semantic fuzzy search based on a sentence-level deep learning language model, which integrates mechanisms such as semantic understanding, fuzzy query, and accurate information positioning, and then encapsulates the entire algorithm module into an interface for user call. However, this solution does not fully consider the efficient traversal and matching of specific numbers or keywords in commodity search. It may not be fully applicable to structured commodity data, especially the three-level directory search of commodities, and the search efficiency is relatively low. Summary of the invention

[0003] The technical problem to be solved by the present invention is to overcome the deficiencies of the prior art and provide a local fuzzy search method for a three-level directory of energy and chemical products.

[0004] The technical solution adopted by the present invention is as follows: A local fuzzy search method for a three-level directory of energy and chemical products includes the following steps: S1. Preprocessing the list of products to be followed: Complete the conversion, name conversion and storage of the list of products to be followed at one time, including the following steps: S11. After obtaining the product list that the user is interested in, directly perform the transformation operation, and use the CFStringTransform method to obtain the full spelling and initials of the third-level product name; S12, storing the full spelling and initials information in a dictionary, with the product ID as the key and the full spelling and initials as the value; this is used to avoid repeated mold conversion and conversion operations in subsequent processing, thereby improving overall efficiency; S2. Establish directory mapping relationship: Use hash table to quickly map the first-level directory to the second-level directory, and then obtain the third-level price product model, including the following steps: S21, storing the mapping relationship between the first-level directory and the second-level directory by constructing a hash table; S22. Rapidly obtain the third-level price product model under the second-level directory through hash search to reduce unnecessary traversal and search operations; S3. Initialize the search result set: Use NSMutableOrderedSet to store the deduplicated search results, including the following steps: S31. Before starting the search, initialize the NSMutableOrderedSet object; S32. Use NSMutableOrderedSet to perform automatic deduplication and unordered storage operations to ensure that there are no duplicate items in the result set; S4. Compound predicate screening products: Construct compound predicates to screen three-level price products that meet multiple conditions at one time, including the following steps: S41, construct a compound predicate based on the search conditions of price product name, full spelling and initials; S42. Use the composite predicate to filter out the three-level price product objects of multiple conditions at one time, and store them directly in NSMutableOrderedSet to avoid multiple loops and condition judgments and improve the screening efficiency; S5, digital grouping and efficient traversal: Group the numbers in the keywords and use an efficient algorithm to traverse the matching products, including the following steps: S51, grouping the numbers in the key words, and then traversing the third-level product objects containing the corresponding numbers using a hash-based search method; S52. During the traversal process, the qualified objects are added to NSMutableOrderedSet, and the number grouping and traversal algorithms are optimized to reduce the amount of calculation and improve the retrieval speed. S6. Convert and display the model: traverse the NSMutableOrderedSet, directly convert the model and display the model, including the following steps: S61. Traverse the three-level price product objects in NSMutableOrderedSet and convert them directly into models for display; S62, directly convert the model and display it, and store the search results directly into the display class Model to avoid additional processing steps.

[0005] This technical solution pre-processes the list of products of interest, converts the product names into models and stores the full spelling and initials information to improve the efficiency of subsequent processing; by establishing a directory mapping relationship, a hash table is used to quickly obtain the three-level price product model to reduce traversal and search operations; the search result set is initialized and NSMutableOrderedSet is used to ensure that there are no duplicates in the results; a composite predicate is constructed to filter products that meet multiple conditions at one time to improve the screening efficiency; the numbers in the keywords are grouped and an efficient algorithm is used to traverse the matching products to reduce the amount of calculation and increase the search speed; finally, the result set is traversed, the model is directly converted and displayed to avoid additional processing steps, so as to realize local fuzzy search for the three-level directory of energy and chemical products and improve search efficiency and user experience.

[0006] In addition, the local fuzzy search method for the three-level directory of energy and chemical products proposed above according to the present invention also has the following additional technical features: According to one embodiment of the present invention, in step S1, the list of products of interest is preprocessed, and the targeted product objects are bulk product data, including natural gas, iron ore, crude oil, pulp, rubber, cotton, and fertilizer; the list of products of interest includes price fluctuations, profit fluctuations, price amplitude, and price percentile.

[0007] This technical solution focuses on the product list through preprocessing, especially for bulk product data such as natural gas, iron ore, crude oil, pulp, rubber, cotton, fertilizer, etc., to achieve one-time conversion, name conversion and storage operations, which not only simplifies the subsequent processing flow, but also improves the overall efficiency. At the same time, it pays attention to key information such as price fluctuations, profit fluctuations, price amplitude, price quantiles, etc. in the product list, providing necessary data support for subsequent search, screening and display, so as to ensure that users can quickly obtain the required product information and market dynamics.

[0008] According to an embodiment of the present invention, in step S11, after obtaining the product list that the user is interested in, the mold conversion operation is directly performed, including the following steps: S111, data acquisition and conversion: use the API to obtain product data from the list of products to be followed, and perform conversion operations on the obtained product data to convert it into a format suitable for subsequent processing; S112. Name conversion: Implement a function based on the CFStringTransform method to obtain the full spelling and initials of the third-level product name, apply the function to the converted product name to obtain the full spelling and initials; In the step S12, the full spelling and initials information are stored in the dictionary, including the following steps: S121. Data storage: Use NSDictionary in Objective-C as a data structure to store the converted information; S122. Use product ID as key, and store the full spelling and initials information as value in the dictionary.

[0009] This technical solution realizes the data acquisition and preprocessing of the user's product list and builds an efficient data storage mechanism. Specifically, after obtaining product data through the API interface, the conversion operation is directly performed to convert the original data into the format required for subsequent processing; the CFStringTransform method is used to implement the name conversion function to obtain the full spelling and initial information of the third-level product name. This step helps to improve the accuracy and efficiency of subsequent search and screening; the dictionary (NSDictionary) in Objective-C is used as the data structure, the product ID is used as the key, and the full spelling and initial information are stored in the dictionary as the value, which is not only convenient for quick search and access, but also effectively avoids data redundancy and duplication, and improves the efficiency and accuracy of data processing.

[0010] According to an embodiment of the present invention, in step S21, a mapping relationship between the first-level directory and the second-level directory is stored by constructing a hash table, which includes the following steps: S211. Create an empty hash table HashMap; S212, traverse all first-level directories and corresponding second-level directory data; S213, for each first-level directory, use it as a key and the corresponding second-level directory as a value, and store them in the hash table; S22. Quickly obtain the third-level price product model under the second-level directory through hash search, including the following steps: S221, when it is necessary to search for a third-level price product model under a second-level directory, first search in the hash table according to the first-level directory; S222. If the mapping relationship of the first-level directory exists in the hash table, directly obtain the corresponding second-level directory; S223. According to the obtained second-level catalog, locate the corresponding third-level price product model.

[0011] This technical solution achieves fast indexing and access to the directory structure by building a hash table to store the mapping relationship between the first-level directory and the second-level directory. Specifically, first create an empty hash table, then traverse all the first-level directories and the corresponding second-level directory data, store the first-level directory as the key and the second-level directory as the value in the hash table; when you need to find a third-level price product model under a second-level directory, you only need to use hash search to quickly locate the corresponding second-level directory based on the first-level directory, and then locate the corresponding third-level price product model, avoiding unnecessary traversal and search operations, and significantly improving the efficiency of directory structure retrieval.

[0012] According to one embodiment of the present invention, the composite predicate is constructed in step S4 using the NSPredicate class, and the predicate syntax provided by NSPredicate includes logical operators and comparison operators; the filteredArrayUsingPredicate method of NSArray is used to filter the third-level price product objects, and the filteredArrayUsingPredicate method returns a new array containing all elements that meet the predicate conditions; the filtered product objects are directly added to NSMutableOrderedSet; NSMutableOrderedSet automatically deduplicates and maintains the insertion order, so no additional processing is required.

[0013] This technical solution achieves accurate screening of three-level price product objects by constructing a composite predicate. Specifically, the powerful predicate syntax provided by the NSPredicate class, including logical operators and comparison operators, is used to construct a composite predicate, so that qualified product objects can be screened out at one time according to multiple conditions; it is implemented through the filteredArrayUsingPredicate method of NSArray, and the new array returned contains only elements that meet the predicate conditions; the screened product objects are then directly added to NSMutableOrderedSet. Since NSMutableOrderedSet has the characteristics of automatic deduplication and maintaining the insertion order, there is no need for additional deduplication or sorting, which not only improves the screening efficiency, but also ensures the accuracy and consistency of the results.

[0014] According to an embodiment of the present invention, the digital grouping and efficient traversal in step S5, the grouping processing strategy is formulated according to specific needs, including grouping by digital size, grouping by digital digits; the key is the grouped number or digital combination, and the value is a set of three-level product objects containing the corresponding number; the number in the keyword is used as the key to find the corresponding value in the hash table, that is, the product object set; after using the hash-based search method to find the product object set containing the corresponding number, traverse the set to check whether each product object meets the screening requirements of other non-digital conditions; for the product object that meets all the screening conditions, it is added to the NSMutableOrderedSet; The following optimization steps are also included: S53, optimize digital grouping: select appropriate grouping strategy according to the digital distribution characteristics of the product and the query requirements to reduce the number of groups and the complexity of the hash table; S54, Preprocessing and Indexing: When loading product data, pre-index and sort the numbers to locate products containing specific numbers more quickly; S55. Cache mechanism: For frequently queried number combinations, the query results are cached to avoid repeated calculations and improve retrieval speed.

[0015] This technical solution achieves efficient retrieval of keywords containing numbers through digital grouping and efficient traversal strategies. Specifically, the strategy first formulates grouping processing rules according to specific needs, such as grouping by digital size or digits, using the grouped numbers or digital combinations as keys, and the corresponding third-level product object sets containing the numbers as values, which are stored in a hash table. When searching, the numbers in the keywords are used as keys to search in the hash table to quickly locate the product object sets containing these numbers; traverse these sets to check whether each product object meets the screening requirements of other non-digital conditions; for product objects that meet all conditions, add them to NSMutableOrderedSet to ensure the uniqueness and orderliness of the results. In addition, to further optimize the retrieval efficiency, the following strategies are also adopted: First, optimize the number grouping, select the appropriate grouping strategy according to the number distribution characteristics of the product and the query requirements, and reduce the number of groups and the complexity of the hash table; second, preprocessing and indexing, pre-index and sort the numbers when loading the product data, so as to locate the products containing specific numbers more quickly; third, introduce a cache mechanism, cache the query results for frequently queried number combinations, avoid repeated calculations, and further improve the retrieval speed; the optimization measures jointly improve the accuracy and efficiency of retrieval and meet the needs of users to quickly obtain relevant products.

[0016] According to one embodiment of the present invention, the conversion and display model in step S6 uses a for loop to traverse the elements in NSMutableOrderedSet, and for each element, i.e., the third-level price product object, creates a conversion function to convert it into a display model; the conversion function convertPriceProductToDisplayModel creates a new DisplayModel object according to the properties of the PriceProduct object, and copies the corresponding data to the new model; each time a PriceProduct object is converted to DisplayModel, the DisplayModel object is displayed on the UI, or stored in an array for subsequent batch display.

[0017] This technical solution realizes the conversion of the filtered and processed three-level price product objects into a model suitable for display or storage. Specifically, a for loop is used to traverse each element in NSMutableOrderedSet, that is, the three-level price product objects; for each object, the conversion function convertPriceProductToDisplayModel is called, which creates a new DisplayModel object according to the properties of the PriceProduct object and copies the necessary data to the new model to ensure that the displayed or stored data is consistent with the original data and meets the specific requirements of display or storage; whenever a PriceProduct object is successfully converted to a DisplayModel object, the object is immediately displayed on the user interface or stored in an array for subsequent batch display, which not only improves the readability and availability of the data, but also optimizes the user experience, allowing users to view and process the screening results more intuitively.

[0018] According to an embodiment of the present invention, the conversion and display model in step S6 is performed by defining the search result model as SearchResultModel, and SearchResultModel includes a searchField attribute for storing the value of the search field; The ordered set NSMutableOrderedSet contains the data objects that need to be converted, and uses the traversal algorithm for loop to access the elements in the collection one by one; during the traversal process, each element is converted into a search result model, and the search result model is added to a mutable array searchResults.

[0019] This technical solution achieves the standardized representation of search results by defining the search result model SearchResultModel; the searchField attribute in SearchResultModel is specifically used to store the value of the search field, thereby ensuring the accuracy of the search results; the ordered set NSMutableOrderedSet is used to store the data objects that need to be converted, and the program accesses the elements in the set one by one through the traversal algorithm for loop; during the traversal process, each element is converted into a search result model and added to a variable array searchResults. It not only improves the organization and readability of the data, but also facilitates the subsequent processing and display of the search results; by building a unified search result model, the program can more flexibly respond to different search needs and improve the versatility and scalability of the search function.

[0020] Compared with the prior art, the present invention has the following beneficial effects: (1) Preprocess the list of products of interest, convert the product names into templates and store the full spelling and initials information to improve the efficiency of subsequent processing; (2) By establishing a directory mapping relationship, the hash table is used to quickly obtain the three-level price product model, reducing traversal and search operations; (3) Initialize the search result set and use NSMutableOrderedSet to ensure that there are no duplicate results; construct a composite predicate to filter products that meet multiple conditions at one time to improve the screening efficiency; (4) Group the numbers in the keywords and use efficient algorithms to traverse the matching products, reducing the amount of calculation and improving the retrieval speed; (5) Finally, the result set is traversed, and the model is directly converted and displayed to avoid additional processing steps. This is used to implement local fuzzy search for the three-level directory of energy and chemical products, thereby improving search efficiency and user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 It is a flow diagram of the method of the present invention.

[0022] Figure 2 It is a program example diagram of step S1 of the present invention.

[0023] Figure 3 It is a program example diagram of step S2 of the present invention.

[0024] Figure 4 It is a program example diagram of step S3 of the present invention.

[0025] Figure 5 It is a program example diagram of step S6 of the present invention. DETAILED DESCRIPTION

[0026] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0027] Example 1 like Figure 1 As shown, this embodiment provides a local fuzzy search method for a three-level directory of energy and chemical products, comprising the following steps: S1. Preprocessing the list of concerned products: completing the conversion, name conversion and storage of the list of concerned products at one time, such as Figure 2 As shown, it includes the following steps: S11. After obtaining the product list that the user is interested in, directly perform the transformation operation, and use the CFStringTransform method to obtain the full spelling and initials of the third-level product name; S12, storing the full spelling and initials information in a dictionary, with the product ID as the key and the full spelling and initials as the value; this is used to avoid repeated mold conversion and conversion operations in subsequent processing, thereby improving overall efficiency; S2. Establish directory mapping relationship: Use hash table to quickly map the first-level directory to the second-level directory, and then obtain the third-level price product model, such as Figure 3 As shown, it includes the following steps: S21, storing the mapping relationship between the first-level directory and the second-level directory by constructing a hash table; S22. Rapidly obtain the third-level price product model under the second-level directory through hash search to reduce unnecessary traversal and search operations; S3. Initialize the search result set: Use NSMutableOrderedSet to store the deduplicated search results, such as Figure 4 As shown, it includes the following steps: S31. Before starting the search, initialize the NSMutableOrderedSet object; S32. Use NSMutableOrderedSet to perform automatic deduplication and unordered storage operations to ensure that there are no duplicate items in the result set; S4. Compound predicate screening products: Construct compound predicates to screen three-level price products that meet multiple conditions at one time, including the following steps: S41, construct a compound predicate based on the search conditions of price product name, full spelling and initials; S42. Use the composite predicate to filter out the three-level price product objects of multiple conditions at one time, and store them directly in NSMutableOrderedSet to avoid multiple loops and condition judgments and improve the screening efficiency; S5, digital grouping and efficient traversal: Group the numbers in the keywords and use an efficient algorithm to traverse the matching products, including the following steps: S51, grouping the numbers in the key words, and then traversing the third-level product objects containing the corresponding numbers using a hash-based search method; S52. During the traversal process, the qualified objects are added to NSMutableOrderedSet, and the number grouping and traversal algorithms are optimized to reduce the amount of calculation and improve the retrieval speed. S6. Convert and display the model: traverse the NSMutableOrderedSet, directly convert the model and display the Model, such as Figure 5 As shown, it includes the following steps: S61. Traverse the three-level price product objects in NSMutableOrderedSet and convert them directly into models for display; S62, directly convert the model and display it, and store the search results directly into the display class Model to avoid additional processing steps.

[0028] like Figure 1 As shown, this technical solution pre-processes the list of products of interest, converts the product names into models and stores the full spelling and initials information to improve the efficiency of subsequent processing; by establishing a directory mapping relationship, a hash table is used to quickly obtain the three-level price product model to reduce traversal and search operations; the search result set is initialized, and NSMutableOrderedSet is used to ensure that there are no duplicates in the results; a composite predicate is constructed to filter products that meet multiple conditions at one time to improve the screening efficiency; the numbers in the keywords are grouped, and an efficient algorithm is used to traverse the matching products to reduce the amount of calculation and increase the retrieval speed; finally, the result set is traversed, the model is directly converted and displayed, and additional processing steps are avoided, so as to realize local fuzzy search for the three-level directory of energy and chemical products, thereby improving search efficiency and user experience.

[0029] In addition, the local fuzzy search method for the three-level directory of energy and chemical products proposed above according to the present invention also has the following additional technical features: According to one embodiment of the present invention, in step S1, the list of products of interest is preprocessed, and the targeted product objects are bulk product data, including natural gas, iron ore, crude oil, pulp, rubber, cotton, and fertilizer; the list of products of interest includes price fluctuations, profit fluctuations, price amplitude, and price percentile.

[0030] This technical solution focuses on the product list through preprocessing, especially for bulk product data such as natural gas, iron ore, crude oil, pulp, rubber, cotton, fertilizer, etc., to achieve one-time conversion, name conversion and storage operations, which not only simplifies the subsequent processing flow, but also improves the overall efficiency. At the same time, it pays attention to key information such as price fluctuations, profit fluctuations, price amplitude, price quantiles, etc. in the product list, providing necessary data support for subsequent search, screening and display, so as to ensure that users can quickly obtain the required product information and market dynamics.

[0031] like Figure 2 As shown, in step S11, after obtaining the product list that the user is interested in, the mold conversion operation is directly performed, including the following steps: S111, data acquisition and conversion: use the API to obtain product data from the list of products to be followed, and perform conversion operations on the obtained product data to convert it into a format suitable for subsequent processing; S112. Name conversion: Implement a function based on the CFStringTransform method to obtain the full spelling and initials of the third-level product name, apply the function to the converted product name to obtain the full spelling and initials; In the step S12, the full spelling and initials information are stored in the dictionary, including the following steps: S121. Data storage: Use NSDictionary in Objective-C as a data structure to store the converted information; S122. Use product ID as key, and store the full spelling and initials information as value in the dictionary.

[0032] This technical solution realizes the data acquisition and preprocessing of the user's product list and builds an efficient data storage mechanism. Specifically, after obtaining product data through the API interface, the conversion operation is directly performed to convert the original data into the format required for subsequent processing; the CFStringTransform method is used to implement the name conversion function to obtain the full spelling and initial information of the third-level product name. This step helps to improve the accuracy and efficiency of subsequent search and screening; the dictionary (NSDictionary) in Objective-C is used as the data structure, the product ID is used as the key, and the full spelling and initial information are stored in the dictionary as the value, which is not only convenient for quick search and access, but also effectively avoids data redundancy and duplication, and improves the efficiency and accuracy of data processing.

[0033] like Figure 3 As shown, in step S21, a mapping relationship between the first-level directory and the second-level directory is stored by constructing a hash table, which includes the following steps: S211. Create an empty hash table HashMap; S212, traverse all first-level directories and corresponding second-level directory data; S213, for each first-level directory, use it as a key and the corresponding second-level directory as a value, and store them in the hash table; S22. Quickly obtain the third-level price product model under the second-level directory through hash search, including the following steps: S221, when it is necessary to search for a third-level price product model under a second-level directory, first search in the hash table according to the first-level directory; S222. If the mapping relationship of the first-level directory exists in the hash table, directly obtain the corresponding second-level directory; S223. According to the obtained second-level catalog, locate the corresponding third-level price product model.

[0034] This technical solution achieves fast indexing and access to the directory structure by building a hash table to store the mapping relationship between the first-level directory and the second-level directory. Specifically, first create an empty hash table, then traverse all the first-level directories and the corresponding second-level directory data, store the first-level directory as the key and the second-level directory as the value in the hash table; when you need to find a third-level price product model under a second-level directory, you only need to use hash search to quickly locate the corresponding second-level directory based on the first-level directory, and then locate the corresponding third-level price product model, avoiding unnecessary traversal and search operations, and significantly improving the efficiency of directory structure retrieval.

[0035] According to one embodiment of the present invention, the composite predicate is constructed in step S4 using the NSPredicate class, and the predicate syntax provided by NSPredicate includes logical operators and comparison operators; the filteredArrayUsingPredicate method of NSArray is used to filter the third-level price product objects, and the filteredArrayUsingPredicate method returns a new array containing all elements that meet the predicate conditions; the filtered product objects are directly added to NSMutableOrderedSet; NSMutableOrderedSet automatically deduplicates and maintains the insertion order, so no additional processing is required.

[0036] This technical solution achieves accurate screening of three-level price product objects by constructing a composite predicate. Specifically, the powerful predicate syntax provided by the NSPredicate class, including logical operators and comparison operators, is used to construct a composite predicate, so that qualified product objects can be screened out at one time according to multiple conditions; it is implemented through the filteredArrayUsingPredicate method of NSArray, and the new array returned contains only elements that meet the predicate conditions; the screened product objects are then directly added to NSMutableOrderedSet. Since NSMutableOrderedSet has the characteristics of automatic deduplication and maintaining the insertion order, there is no need for additional deduplication or sorting, which not only improves the screening efficiency, but also ensures the accuracy and consistency of the results.

[0037] According to an embodiment of the present invention, the digital grouping and efficient traversal in step S5, the grouping processing strategy is formulated according to specific needs, including grouping by digital size, grouping by digital digits; the key is the grouped number or digital combination, and the value is a set of three-level product objects containing the corresponding number; the number in the keyword is used as the key to find the corresponding value in the hash table, that is, the product object set; after using the hash-based search method to find the product object set containing the corresponding number, traverse the set to check whether each product object meets the screening requirements of other non-digital conditions; for the product object that meets all the screening conditions, it is added to the NSMutableOrderedSet; The following optimization steps are also included: S53, optimize digital grouping: select appropriate grouping strategy according to the digital distribution characteristics of the product and the query requirements to reduce the number of groups and the complexity of the hash table; S54, Preprocessing and Indexing: When loading product data, pre-index and sort the numbers to locate products containing specific numbers more quickly; S55. Cache mechanism: For frequently queried number combinations, the query results are cached to avoid repeated calculations and improve retrieval speed.

[0038] This technical solution achieves efficient retrieval of keywords containing numbers through digital grouping and efficient traversal strategies. Specifically, the strategy first formulates grouping processing rules according to specific needs, such as grouping by digital size or digits, using the grouped numbers or digital combinations as keys, and the corresponding third-level product object sets containing the numbers as values, which are stored in a hash table. When searching, the numbers in the keywords are used as keys to search in the hash table to quickly locate the product object sets containing these numbers; traverse these sets to check whether each product object meets the screening requirements of other non-digital conditions; for product objects that meet all conditions, add them to NSMutableOrderedSet to ensure the uniqueness and orderliness of the results. In addition, to further optimize the retrieval efficiency, the following strategies are also adopted: First, optimize the number grouping, select the appropriate grouping strategy according to the number distribution characteristics of the product and the query requirements, and reduce the number of groups and the complexity of the hash table; second, preprocessing and indexing, pre-index and sort the numbers when loading the product data, so as to locate the products containing specific numbers more quickly; third, introduce a cache mechanism, cache the query results for frequently queried number combinations, avoid repeated calculations, and further improve the retrieval speed; the optimization measures jointly improve the accuracy and efficiency of retrieval and meet the needs of users to quickly obtain relevant products.

[0039] like Figure 5As shown, the conversion and display model in step S6 uses a for loop to traverse the elements in NSMutableOrderedSet, and for each element, that is, the third-level price product object, a conversion function is created to convert it into a display model; the conversion function convertPriceProductToDisplayModel creates a new DisplayModel object according to the properties of the PriceProduct object, and copies the corresponding data to the new model; whenever a PriceProduct object is converted to DisplayModel, the DisplayModel object is displayed on the UI, or stored in an array for subsequent batch display.

[0040] This technical solution realizes the conversion of the filtered and processed three-level price product objects into a model suitable for display or storage. Specifically, a for loop is used to traverse each element in NSMutableOrderedSet, that is, the three-level price product objects; for each object, the conversion function convertPriceProductToDisplayModel is called, which creates a new DisplayModel object according to the properties of the PriceProduct object and copies the necessary data to the new model to ensure that the displayed or stored data is consistent with the original data and meets the specific requirements of display or storage; whenever a PriceProduct object is successfully converted to a DisplayModel object, the object is immediately displayed on the user interface or stored in an array for subsequent batch display, which not only improves the readability and availability of the data, but also optimizes the user experience, allowing users to view and process the screening results more intuitively.

[0041] like Figure 5 As shown, the conversion and display model in step S6 is defined by defining the search result model as SearchResultModel, and SearchResultModel includes a searchField attribute for storing the value of the search field; The ordered set NSMutableOrderedSet contains the data objects that need to be converted, and uses the traversal algorithm for loop to access the elements in the collection one by one; during the traversal process, each element is converted into a search result model, and the search result model is added to a mutable array searchResults.

[0042] This technical solution achieves the standardized representation of search results by defining the search result model SearchResultModel; the searchField attribute in SearchResultModel is specifically used to store the value of the search field, thereby ensuring the accuracy of the search results; the ordered set NSMutableOrderedSet is used to store the data objects that need to be converted, and the program accesses the elements in the set one by one through the traversal algorithm for loop; during the traversal process, each element is converted into a search result model and added to a variable array searchResults. It not only improves the organization and readability of the data, but also facilitates the subsequent processing and display of the search results; by building a unified search result model, the program can more flexibly respond to different search needs and improve the versatility and scalability of the search function.

[0043] Although the present invention is described in detail by referring to the accompanying drawings and in combination with the preferred embodiments, the present invention is not limited thereto. Without departing from the spirit and essence of the present invention, a person of ordinary skill in the art may make various equivalent modifications or substitutions to the embodiments of the present invention, and these modifications or substitutions shall be within the scope of the present invention. Any person of ordinary skill in the art may easily think of changes or substitutions within the technical scope disclosed by the present invention, and these shall be within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope of protection of the claims.

Claims

1. A local fuzzy search method for a three-level directory of energy and chemical products, characterized in that: The steps include: S1. Preprocessing the list of products to be followed: Complete the conversion, name conversion and storage of the list of products to be followed at one time, including the following steps: S11. After obtaining the product list that the user is interested in, directly perform the transformation operation, and use the CFStringTransform method to obtain the full spelling and initials of the third-level product name; S12, storing the full spelling and initials information in a dictionary, with the product ID as the key and the full spelling and initials as the value; this is used to avoid repeated mold conversion and conversion operations in subsequent processing, thereby improving overall efficiency; S2. Establish directory mapping relationship: Use hash table to quickly map the first-level directory to the second-level directory, and then obtain the third-level price product model, including the following steps: S21, storing the mapping relationship between the first-level directory and the second-level directory by constructing a hash table; S22. Rapidly obtain the third-level price product model under the second-level directory through hash search to reduce unnecessary traversal and search operations; S3. Initialize the search result set: Use NSMutableOrderedSet to store the deduplicated search results, including the following steps: S31. Before starting the search, initialize the NSMutableOrderedSet object; S32. Use NSMutableOrderedSet to perform automatic deduplication and unordered storage operations to ensure that there are no duplicate items in the result set; S4. Compound predicate screening products: Construct compound predicates to screen three-level price products that meet multiple conditions at one time, including the following steps: S41, construct a compound predicate based on the search conditions of price product name, full spelling and initials; S42. Use the composite predicate to filter out the three-level price product objects of multiple conditions at one time, and store them directly in NSMutableOrderedSet to avoid multiple loops and condition judgments and improve the screening efficiency; S5, digital grouping and efficient traversal: Group the numbers in the keywords and use an efficient algorithm to traverse the matching products, including the following steps: S51, grouping the numbers in the key words, and then traversing the third-level product objects containing the corresponding numbers using a hash-based search method; S52. During the traversal process, the qualified objects are added to NSMutableOrderedSet, and the number grouping and traversal algorithms are optimized to reduce the amount of calculation and improve the retrieval speed. S6. Convert and display the model: traverse the NSMutableOrderedSet, directly convert the model and display the model, including the following steps: S61. Traverse the three-level price product objects in NSMutableOrderedSet and convert them directly into models for display; S62, directly convert the model and display it, and store the search results directly into the display class Model to avoid additional processing steps.

2. The local fuzzy search method for the three-level directory of energy and chemical products according to claim 1 is characterized in that: In the step S1, the list of products of interest is preprocessed, and the product objects targeted are bulk product data, including natural gas, iron ore, crude oil, pulp, rubber, cotton, and fertilizer; the list of products of interest includes price fluctuations, profit fluctuations, price amplitude, and price percentile.

3. The local fuzzy search method for the three-level directory of energy and chemical products according to claim 1 is characterized in that: In the step S11, after obtaining the product list that the user is interested in, the mold conversion operation is directly performed, including the following steps: S111, data acquisition and conversion: use the API to obtain product data from the list of products to be followed, and perform conversion operations on the obtained product data to convert it into a format suitable for subsequent processing; S112. Name conversion: Implement a function based on the CFStringTransform method to obtain the full spelling and initials of the third-level product name, apply the function to the converted product name to obtain the full spelling and initials; In the step S12, the full spelling and initials information are stored in the dictionary, including the following steps: S121. Data storage: Use NSDictionary in Objective-C as a data structure to store the converted information; S122. Use product ID as key, and store the full spelling and initials information as value in the dictionary.

4. The local fuzzy search method for the three-level directory of energy and chemical products according to claim 1 or 2, characterized in that: In step S21, a hash table is constructed to store the mapping relationship between the first-level directory and the second-level directory, including the following steps: S211. Create an empty hash table HashMap; S212, traverse all first-level directories and corresponding second-level directory data; S213, for each first-level directory, use it as a key and the corresponding second-level directory as a value, and store them in the hash table; S22. Quickly obtain the third-level price product model under the second-level directory through hash search, including the following steps: S221, when it is necessary to search for a third-level price product model under a second-level directory, first search in the hash table according to the first-level directory; S222. If the mapping relationship of the first-level directory exists in the hash table, directly obtain the corresponding second-level directory; S223. According to the obtained second-level catalog, locate the corresponding third-level price product model.

5. The local fuzzy search method for the three-level directory of energy and chemical products as claimed in claim 4 is characterized in that: The composite predicate in step S4 is constructed by using the NSPredicate class to construct the composite predicate, using the predicate syntax provided by NSPredicate, including logical operators and comparison operators; using the filteredArrayUsingPredicate method of NSArray to filter the third-level price product objects, the filteredArrayUsingPredicate method returns a new array containing all elements that meet the predicate conditions; the filtered product objects are directly added to NSMutableOrderedSet; NSMutableOrderedSet automatically removes duplicates and maintains the insertion order, so no additional processing is required.

6. The local fuzzy search method for the three-level directory of energy and chemical products as claimed in claim 5 is characterized in that: The digital grouping and efficient traversal in step S5, the grouping processing strategy is formulated according to specific needs, including grouping by digital size, grouping by digital digits; the key is the grouped number or digital combination, and the value is the set of three-level product objects containing the corresponding number; the number in the keyword is used as the key to find the corresponding value in the hash table, that is, the product object set; after using the hash-based search method to find the product object set containing the corresponding number, traverse the set to check whether each product object meets the screening requirements of other non-digital conditions; for the product object that meets all the screening conditions, it is added to the NSMutableOrderedSet; The following optimization steps are also included: S53, optimize digital grouping: select appropriate grouping strategy according to the digital distribution characteristics of the product and the query requirements to reduce the number of groups and the complexity of the hash table; S54, Preprocessing and Indexing: When loading product data, pre-index and sort the numbers to locate products containing specific numbers more quickly; S55. Cache mechanism: For frequently queried number combinations, the query results are cached to avoid repeated calculations and improve retrieval speed.

7. The local fuzzy search method for the three-level directory of energy and chemical products according to claim 1 or 6, characterized in that: The conversion and display model in step S6 uses a for loop to traverse the elements in NSMutableOrderedSet, and for each element, i.e., the third-level price product object, creates a conversion function to convert it into a display model; the conversion function convertPriceProductToDisplayModel creates a new DisplayModel object according to the properties of the PriceProduct object, and copies the corresponding data to the new model; Whenever a PriceProduct object is converted to a DisplayModel, the DisplayModel object is displayed on the UI or stored in an array for subsequent batch display.

8. The local fuzzy search method for the three-level directory of energy and chemical products according to claim 7 is characterized in that: The conversion and display model in step S6 is performed by defining the search result model as SearchResultModel, and SearchResultModel includes a searchField attribute for storing the value of the search field; The ordered set NSMutableOrderedSet contains the data objects that need to be converted, and uses the traversal algorithm for loop to access the elements in the collection one by one; during the traversal process, each element is converted into a search result model, and the search result model is added to a mutable array searchResults.

Citation Information

Patent Citations

  • Semantic fuzzy search method based on sentence-level deep learning language model

    CN110990538A