Searching method, electronic equipment and storage medium

By determining the target position of the target string and obtaining the key character set in the character search process, the method of generating the target search content is solved, and the problem of high difficulty and low efficiency of character search processing in the prior art is solved, and a more efficient search process is achieved.

CN120196705APending Publication Date: 2025-06-24ZTE CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311764654.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-20
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

In the prior art, character search processing has problems such as high difficulty and low efficiency. Especially for users with weak technical skills, using regular expressions to match characters requires certain technical thresholds.

Method used

By determining the target position of the target string, a set of keywords with a predetermined position relationship with the location is obtained, and a target search content corresponding to the target string is generated based on the characters in the key character set, thereby realizing the search based on location information.

Benefits of technology

It reduces the difficulty of character search processing, improves search efficiency, and allows users with weak technical skills to easily perform text or character processing-related search operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120196705A_ABST
    Figure CN120196705A_ABST
Patent Text Reader

Abstract

The invention provides a searching method, electronic equipment and a storage medium. The method comprises the following steps: determining a target position of a target character string; acquiring a key character set having a predetermined position relationship with the target position; and generating target search content corresponding to the target character string according to the character at the specified position in the key character set. Through the method, the searching difficulty can be reduced, and the searching efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of text processing, and particularly to a search method, an electronic device, and a storage medium. Background Art

[0002] Character search technology is a technology for performing character search in text information, which is usually used for fast search and comparison of strings, thereby helping users to efficiently search and process information in massive data, and improving information processing efficiency and performance.

[0003] In related technologies, regular expressions are usually used to perform character matching in text information, and character search is performed according to the matching results. However, the use of regular expressions requires a certain technical threshold, and it is difficult for users with weak technical skills to perform the above search processing alone, resulting in a relatively high search difficulty. Summary of the Invention

[0004] This application provides a search method, an electronic device, and a storage medium, which are used to reduce the processing difficulty and improve the search efficiency.

[0005] An embodiment of this application provides a search method, including: determining a target position of a target string; obtaining a set of key characters having a predetermined positional relationship with the target position; and generating target search content corresponding to the target string according to the characters at a specified position in the set of key characters.

[0006] An embodiment of this application provides an electronic device, including: one or more processors; a memory storing one or more programs, which when executed by the one or more processors, cause the one or more processors to implement any one of the search methods in the embodiments of this application.

[0007] An embodiment of this application provides a storage medium storing a computer program, which when executed by a processor, implements any one of the search methods in the embodiments of this application.

[0008] According to the search method of the embodiment of this application, after determining the target position of the target string, a set of key characters having a predetermined positional relationship with the target position can be obtained, and then the target search content corresponding to the target string is generated according to the characters in the set of key characters. According to this method, the target search content corresponding to the target string can be obtained based on the position information, which is beneficial to solving the problem that the search function in related technologies of text or character processing is too mechanical, thereby facilitating reducing the processing difficulty and improving the search efficiency.

[0009] More descriptions about the above embodiments and other aspects of this application and their implementation manners are provided in the accompanying drawings, the specific implementation manners, and the claims. Brief Description of the Drawings

[0010] Figure 1 It is a flowchart of a search method provided by an embodiment of the present application.

[0011] Figure 2a It is a schematic diagram showing the target position of the target string provided by an embodiment of the present application.

[0012] Figure 2b It is a schematic diagram of the length of the target string provided by an embodiment of the present application.

[0013] Figure 2c It is a schematic diagram of the key character set provided by an embodiment of the present application.

[0014] Figure 2d It is a schematic diagram of the target search content provided by an embodiment of the present application.

[0015] Figure 3 It is a flowchart of the search method for an exemplary embodiment of the present application.

[0016] Figure 4 It is a block diagram of a search device provided by an embodiment of the present application.

[0017] Figure 5 It is a structural diagram showing an exemplary hardware architecture of an electronic device capable of implementing the methods and devices according to the embodiments of the present invention. Detailed implementation manners

[0018] To make the objectives, technical solutions and advantages of the present application clearer and more understandable, the embodiments of the present application will be described in detail below with reference to the accompanying drawings. It should be noted that, without conflict, the embodiments and features in the embodiments of the present application can be combined with each other arbitrarily.

[0019] In actual scenarios, character search technology involves different algorithms, data structures, and application scenarios. For example, a common character search technology is to use string matching algorithms, such as the string matching algorithm (Knuth-Morris-Pratt, KMP), the string search algorithm (Boyer-Moore, BM) algorithm, and the regular expression matching algorithm to find a specified character sequence in the text. In addition, there are some other advanced character search technologies, such as index-based full-text search, fuzzy search, and semantic search. When users or software developers use regular matching to match keywords with shell statements, there are usually fewer engineers who master regular expressions and shell statements. The technology of performing string matching based on the search statements of computer languages (such as JAVA language or Python language) usually searches for the line where the field is located, and then obtains the specified information by using methods such as cutting functions or replacement methods. The information processing method is too mechanical and requires a certain technical threshold, making it difficult for users with weak technical skills to perform the above search processing alone, resulting in high search processing difficulty and low processing efficiency.

[0020] The search method according to the embodiments of the present application can be executed by an electronic device such as a terminal device or a server. The terminal device can be a vehicle-mounted device, a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. The method can be implemented by the processor calling computer-readable program instructions stored in the memory. The server can include an independent physical server, a server cluster composed of multiple servers, or a cloud server capable of performing cloud computing.

[0021] In a first aspect, an embodiment of the present application provides a search method. Figure 1 The flowchart of a search method provided by an embodiment of the present application is shown. Refer to Figure 1 The method may include the following steps.

[0022] S110, determine the target position of the target string.

[0023] In this step, the target string can be a string in any text information. As an example, this step may specifically include: determining the target position of the target string in the text information.

[0024] As an example, the target string can be: the string corresponding to the attribute field in the text information (i.e., the target string constitutes the attribute field), or the string corresponding to other interesting information or the search term (i.e., the target string constitutes the interesting information or the search term).

[0025] In this step, the target position is used to indicate the position information of the first character of the target string in the text information.

[0026] It should be understood that the types of text information in the embodiments of the present application may include but are not limited to: text attribute information, dialogue information, database configuration information, etc.; the information sources of text information may include but are not limited to: portal websites, social media, text files pre-configured and generated in electronic devices, etc., and the embodiments of the present application do not make specific limitations.

[0027] In this embodiment, according to the general interface software system program standard, the text information can be accessed through a preset interface to obtain a target string (such as a search term) from the text information to determine its position information within the text information.

[0028] S120. Obtain a set of key characters having a predetermined positional relationship with the target position.

[0029] As an example, this step may specifically include: obtaining a set of key characters having a predetermined positional relationship with the target position from the text information.

[0030] As an example, the predetermined positional relationship is used to indicate: the relative positional relationship between the set of key characters and the target string in the text information. For example, in the text information, the set of key characters is located before or after the target string, and there are K characters between the set of key characters and the target string, where K is an integer greater than or equal to 1. According to the target position of the target string in the text information and this relative positional relationship, the position of the set of key characters in the text information can be determined.

[0031] S130. Generate a target search content corresponding to the target string according to the characters at the specified position in the set of key characters.

[0032] As an example, the target search content is included in the set of key characters, and the target search content is located at the specified position in the set of key characters. Specifically, the specified position may consist of at least one character position, and the characters at the specified position may include some or all of the characters in the set of key characters.

[0033] In this step, at the specified position of the target search content in the set of key characters, after obtaining the set of key characters, the characters located at the specified position or at a fixed position can be obtained from the set of key characters to obtain the target search content corresponding to the target string.

[0034] According to the search method of the embodiments of the present application, after determining the target position of the target string, a set of key characters having a predetermined positional relationship with the target position can be obtained, and then according to the characters in the set of key characters, target search content corresponding to the target string can be generated. According to this method, the target search content corresponding to the target string can be obtained based on the position information, which is beneficial to solving the problem that the search function in related technologies of text or character processing is too mechanical, thereby facilitating reducing the processing difficulty and improving the search efficiency.

[0035] In some embodiments, the target string is any string pre-stored in a data container; step S110 may specifically include: sequentially obtaining strings from a predetermined data container, and respectively using each obtained string as the target string; determining the target position of the target string.

[0036] As an example, a data container can be understood as: a storage space for accommodating data. Each data accommodated in the data container can be called an element, and the element can be any type of data, such as a string, a number, etc.

[0037] As an example, the type of the data container can be one or more of an array, a list, a tuple, a set, and a dictionary.

[0038] As a specific example, assume that the text information (denoted as line) includes the following information:

[0039] package:name='com.hello' versionCode='236' versionName='4.0.7'

[0040] package:name='com.ludashi.benchmark' versionCode='174' versionName='10.0.4'

[0041] package:name='org.benchmark.demo' versionCode='6' versionName='2.1.2' platformBuildVersionName='2.1.2',

[0042] For example, when the data container is a list, multiple strings are pre-stored in the list, including: package:name, versionCode, versionName. Each string can be a property field name. If the target string is the property field name packa:gename, according to the method of the embodiments of the present application, the target search content to be obtained from the text information is each property value corresponding to the property field name package:name: com.hello, com.ludashi.benchmark, and org.benchmark.demo.

[0043] In this embodiment, a preset data container can be used to store and hold multiple strings. Each string is obtained from the data container one by one, and each obtained string is used as the target string to search for the target string in the text information, obtaining the target position of the target string in the text information. There is no need to manually input the target string during the search and processing, improving the data acquisition efficiency.

[0044] In some embodiments, the number of target positions of the target string is multiple; the above step S110 includes: S11, searching for the target string in the text information; S12, when the target string at any target position is found, determining the character offset of the first character of the currently found target string relative to the starting position of the text information; S13, determining the character offset as the target position of the currently found target string; S14, generating multiple target positions of the target character according to the target positions of each found target string.

[0045] Exemplarily, multiple target positions of the target string in the text information can be generated through the function offset = line.find(property), where property represents the target string, and line.find(property) represents searching for the target string in the text information line and returning the target positions of each found target string in the text information.

[0046] As an example, from the specific content of the above text information, it can be seen that there are three package:name in the text information. Therefore, the target string (property field name package:name) can correspond to multiple target positions in this text information.

[0047] Figure 2a A schematic diagram showing the target positions of the target string provided by the embodiments of the present application.

[0048] Such as Figure 2aAs shown, the starting position of the text information (i.e., the predetermined reference position) is position 0. Assume that the target string property is "package:name=" (the string within the double quotes, excluding the double quotes). Starting from position 0, search for "package:name". When the current "package:name" is found, obtain the first character "p" in "package:name", and assign the position information value of p (position 0) to the variable offset to obtain the target position of the current "package:name" in the text information.

[0049] In the embodiment of the present application, search for the target string from the text information, obtain the character offset of the first character of the target string relative to the starting position of the text information, and assign the character offset to offset to obtain the target position of the currently found target string in the text information.

[0050] In some embodiments, step S120 may specifically include: S21, determining the length value of the target string; S22, obtaining the set of key characters after the target string; wherein, the number of characters between the set of key characters and the target position is equal to the length value.

[0051] In step S21, the length value of the target string can be represented by len(property).

[0052] Figure 2b It is a schematic diagram of the length of the target string provided by the embodiment of the present application. As Figure 2b shown, when the target string is "package:name=", since "package:name=" includes 13 characters, so len(property) is equal to 13. In Figure 2b , len(property) is equal to 13, corresponding to positions 0 to 12 in the text information.

[0053] Exemplarily, the predetermined positional relationship between the set of key characters and the target string is: the set of key characters is located after the target string, and there are several characters between the set of key characters and the target string, and the number of characters between them is equal to the length value of the target string.

[0054] Exemplarily, the obtained set of key characters can be represented by s = line[offset + len(property):]. Here, offset is the target position of the currently obtained target string, len(property) is the length value (L) of the target string, line is the text information, and s represents the following set of strings in the text information: the set of strings after the first position, where the first position is the position obtained by shifting the target position of the currently obtained target string backward by the length value of the target string.

[0055] In this embodiment, according to the target position of the string of the target string in the text information and the predetermined positional relationship between the set of key characters and this target position, the position information of the set of key characters in the text information can be quickly determined, so that the set of key characters can be quickly obtained according to this position information.

[0056] Figure 2c This is a schematic diagram of the set of key characters provided by the embodiment of the present application. As Figure 2c shown, exemplarily, the target position of the currently obtained target string is position 0, and len(property) is equal to 13, then s represents the set of strings composed of all characters after position 13 in the text information.

[0057] In some embodiments, step S130 may specifically include: S31, searching for the starting character and the ending character in the set of key characters to obtain the character starting position and the character ending position; S32, determining a predetermined position range according to the character starting position and the character ending position; S33, obtaining the characters within the predetermined position range as the target search content corresponding to the target string.

[0058] Among them, the starting character and the ending character can be delimiters or any characters with a delimiting function.

[0059] In this embodiment, the character starting position is the character offset of the starting character relative to the starting position of the text information; the character ending position is the character offset of the ending character relative to the starting position of the text information; a position range is determined through the character starting position and the character ending position, and the characters within this position range are determined as the target search content corresponding to the target string.

[0060] In some embodiments, the start character and the end character are a pair of a first delimiter and a second delimiter; step S31 may specifically include: starting from the first key character in the key character set, searching for the first delimiter closest to the first key character; taking the position of the found first delimiter as the character start position; starting from the position immediately after the first delimiter, searching for the second delimiter closest to the first delimiter; taking the position of the found second delimiter as the character end position.

[0061] Exemplarily, the pair of the first delimiter and the second delimiter may be different delimiters. For example, they may be any one of: left double quotation mark (“) and right double quotation mark (“), left single quotation mark (‘) and right single quotation mark (‘), left parenthesis and right parenthesis, and the parenthesis type may be any one of small parentheses, square brackets, and curly brackets; the pair of the first delimiter and the second delimiter may also be the same delimiter. For example, they may be any one of: space, predetermined punctuation marks (comma, semicolon, comma-like punctuation mark, etc.), single dash, double dash, etc. The specific symbols of the first delimiter and the second delimiter may be custom-set according to actual needs, as long as they can serve as delimiters and can be distinguished from each key character in the target string and the key character set. The embodiments of the present application do not make specific limitations.

[0062] Figure 2d It is a schematic diagram of the target search content provided by the embodiments of the present application.

[0063] In some embodiments, the position of the first delimiter may be obtained by start = s.find(seperator), and the position of the second delimiter may be obtained by end = s.find(separator, start + 1), where s represents the key character set, s.find(seperator) represents searching for the first delimiter in the key character set, and s.find(separator, start + 1) represents searching for the second delimiter starting from the next position after the position where the found first delimiter is located.

[0064] As Figure 2d shown, the position of the first delimiter obtained by start = s.find(seperator) is position 13, the position of the second delimiter obtained by end = s.find(separator, start + 1) is position 23. By searching for the positions of these two delimiters in the key character set and assigning them to start and end respectively, then all the characters between start and end, that is, all the characters between position 13 and position 23 (excluding these two delimiters) are used as the target search content.

[0065] In this embodiment, by obtaining the positions of the paired delimiter symbols, the set of intervening characters between the two delimiter symbols is the target search content to be extracted.

[0066] In some embodiments, the number of sets of key character sets is multiple, and each key character set has a different predetermined positional relationship with the corresponding target position; step S130 may specifically include:

[0067] S21. For each key character set, use the characters in each key character set as the search content in the corresponding key character set; S22. Generate the target search content corresponding to the target string according to the search content in each key character set.

[0068] Exemplarily, in the text information of the above embodiment, when the target string is package:name, the number of positions of the target position of the target string is 3. For example, the first target position is the position of the first package:name in the text information, the second target position is the position of the second package:name in the text information, and the third target position is the position of the third package:name in the text information.

[0069] In this example, the number of sets of key character sets is 3. The first key character set has a predetermined positional relationship with the first target position; the second key character set has a predetermined positional relationship with the second target position; the third key character set has a predetermined positional relationship with the third target position. Therefore, when the target positions of the target string are multiple, based on the different target positions of the target string in the text information, respectively obtain the key character sets having a predetermined positional relationship with each target position, and obtain multiple key character sets.

[0070] In this embodiment, for multiple target positions of the target string in the text information, respectively obtain the key character sets having a predetermined positional relationship with each target position, and in each obtained key character set, generate the target search content corresponding to the target string according to the characters in the key character set, to obtain the search result corresponding to the target string.

[0071] In some embodiments, the target string includes characters in a predetermined text attribute field; the target search content is the attribute value of the attribute field.

[0072] As an example, the predetermined text attribute field is used to describe the attribute information of the text, including but not limited to at least one of the following text attribute fields: text name, version number, version name, publication time, author name, text storage path, text capacity (Size), etc.

[0073] Exemplarily, when the target string is a character in a predetermined text attribute field, that is, the target string is used to indicate any text attribute field, the text attribute field is used as the target attribute field. The search method of the embodiments of the present application may include the following steps: determining the target position of the target attribute field; obtaining a set of key characters having a predetermined positional relationship with the target position; and generating target search content corresponding to the target attribute field according to the characters at the specified position in the set of key characters.

[0074] It should be understood that the specific processing method of each step can refer to the description of the above embodiments, and the embodiments of the present application will not be elaborated herein.

[0075] In this embodiment, if the target string includes characters in a predetermined text attribute field, at least one attribute value corresponding to the attribute field can be found from the text information to which the target string belongs.

[0076] According to an embodiment of the present application, after determining the target position of the target string, a set of key characters having a predetermined positional relationship with the target position can be obtained, and then target search content corresponding to the target string can be generated according to the characters in the set of key characters. According to this method, the target search content corresponding to the target string can be obtained based on the position information, which is beneficial to solving the problem that the search function in related technologies of text or character processing is too mechanical, thereby facilitating reducing the processing difficulty and improving the search efficiency.

[0077] In the embodiments of the present application, general fields or index information can be searched without using cross-languages. Cross-language search refers to information written in a language different from the user's query. In the search method of the embodiments of the present application, since cross-languages do not need to be used and the above search method can be performed based on position information, it is beneficial to solving the problem that the search function in related technologies of text or character processing is too mechanical, thereby facilitating improving the processing efficiency of text information and the information search efficiency.

[0078] It should be clear that the present invention is not limited to the specific configurations and processes described in the above embodiments and shown in the figures. For the convenience and brevity of description, the detailed description of known methods is omitted here, and the specific working processes of the systems, modules, and units described above can refer to the corresponding processes in the foregoing method embodiments, which will not be elaborated herein.

[0079] Figure 3 This is the flowchart of the search method of the exemplary embodiments of the present application. As Figure 3 shown, in some embodiments, the search method may include the following steps.

[0080] S301, determine the search term.

[0081] In this step, the pre-acquired target string can be determined as the search term.

[0082] As an example, the search method of this embodiment can be expressed as GetValue(line, property, separator = '\”), which means: obtaining the full text information of the parameter in the predetermined text, assigning the full text information of the parameter to line, inputting the full text information of the parameter, setting the property field name (property), and using the string corresponding to the property field name as the target string, that is, as a search term; setting the delimiter property (separator), that is, setting the specific delimiter that appears in pairs, which can be customized according to actual needs; that is to say, line represents the text information, property represents the text property to be retrieved, separator represents the parameter value with the delimiter property, and GetValue() represents obtaining at least one text property value of the specified text property according to line, property, and separator.

[0083] S302. Obtain the target position where the search term is located.

[0084] In this step, the position information of the specified text property in the text information is obtained through offset = line.find(Property), and offset is used as the starting mark of the characters in the text information, that is, the starting mark of the text information. In this step, the starting position of the text property is obtained by searching for the position of the search term (specified text property) in line, and it is assigned to the variable offset.

[0085] In this step, it can be first determined whether the key character set is obtained, and the key character set is represented as s.

[0086] Among them, s = line[offset + len(Property):]. In this step, it can be determined whether s is obtained through “if offset == -1”. If s is not obtained, the above GetValue() returns a null value. If s is obtained, the key character set is assigned to s. s can be used to represent the remaining text starting from the end position of the text property.

[0087] S303. Obtain the position of the starting mark in the nearest keyword set.

[0088] In this step, the position of the first delimiter in s can be searched and assigned to the variable start, where the first delimiter can be used as the starting mark of the keyword set.

[0089] S304. Obtain the position of the end marker in the set of keywords closest to the distance.

[0090] In this step, the position of the second delimiter in s can be found and assigned to the variable end, where the second delimiter can be used as the end marker in the set of keywords.

[0091] S305. Return the character information between the position of the start marker and the position of the end marker.

[0092] In this step, obtain the value value = s[start + 1, end]. In this step, according to the position of the start marker and the position of the end marker, obtain the character information in s between these two positions and assign it (the character information) to the variable value.

[0093] In this embodiment, after obtaining the value value, value can be printed (#print value).

[0094] In some embodiments, for the i-th string among the n strings in the corresponding data container (for i in n), where n is an integer greater than or equal to 1 and i is an integer greater than or equal to 1 and less than or equal to n; sequentially obtain each of the n strings (for i in n; Property = property[n]), and obtain the paired delimiter Serparator = charr[n], and then execute the search method of this application according to the text information, the currently obtained string, and the paired delimiter. According to this search method, the target search content obtained is GetValue(line, property, separator = '\”). The meaning of each symbol in GetValue in this embodiment can be referred to the description of the above embodiment and will not be elaborated here.

[0095] Through the above steps S301 - S305, the target position corresponding to the search term can be obtained from the text information, the set of keywords can be obtained according to the positional relationship between the search term and the set of keywords, and then each character can be obtained from the predetermined positions (each position between the character start position and the character end position) in the set of keywords to generate one or more target search contents corresponding to the search term. When the search term is the name of an attribute field, the target search content is the attribute content of the same attribute field name, so as to support the attribute information search function of the same attribute field according to this search method.

[0096] In the embodiments of the present application, the position information can be obtained by detecting the position parameters inside the module. For example, determining the position of the target string (such as the attribute field name) in the text information, and determining the positions of the first delimiter and the second delimiter in the key character set (matching the delimiter symbols from the character set and determining their positions in the character set).

[0097] It should be noted that the text information includes but is not limited to the above-mentioned target string (which can also be called the search term, attribute field name). In addition to the package name (i.e., the text packaging name), version number, and version name, the target string can also include one or more other types of information with different characteristics, such as the platform internal build version name, etc. Specifically, it can be determined according to the actual situation of the application to which the text belongs, and the embodiments of the present application do not make specific limitations.

[0098] It can be understood that, without violating the principle logic, the above-mentioned method embodiments mentioned in the present application can be combined with each other to form combined embodiments. Due to space limitations, the present application will not elaborate further. Those skilled in the art can understand that in the above methods of the specific implementation manner, the specific execution order of each step should be determined according to its function and possible internal logic.

[0099] In addition, the present application also provides a search device, an electronic device, and a computer-readable storage medium, all of which can be used to implement any one of the search methods provided by the present application. For the corresponding technical solutions and descriptions, please refer to the corresponding records in the method part, and details will not be repeated here.

[0100] In a second aspect, an embodiment of the present application provides a search device.

[0101] Figure 4 It is a block diagram of a search device provided by an embodiment of the present application. Referring to Figure 4 , an embodiment of the present application provides a search device, and the search device 400 may include the following modules.

[0102] A determination module 410, configured to determine the target position of the target string;

[0103] An acquisition module 420, configured to acquire a key character set having a predetermined position relationship with the target position;

[0104] A generation module 430, configured to generate a target search content corresponding to the target string according to the characters at the specified positions in the key character set.

[0105] In some embodiments, the target string is any string pre-stored in a data container; the determining module 410 is specifically configured to: sequentially obtain strings from a predetermined data container, and use each obtained string as the target string; and determine the target position of the target string.

[0106] In some embodiments, the number of target positions of the target string is multiple; the determining module 410 is specifically configured to: search for the target string in the text information; in the case of finding the target string at any target position, determine the character offset of the first character of the currently found target string relative to the starting position of the text information; determine the character offset as the target position of the currently found target string; and generate multiple target positions of the target character according to the target positions of each found target string.

[0107] In some embodiments, the number of sets of the key character set is multiple, and each key character set has a predetermined positional relationship with the corresponding target position; the generating module 430 is specifically configured to: for each key character set, use the characters in each key character set as the search content in the corresponding key character set; and generate the target search content corresponding to the target string according to the search content in each key character set.

[0108] In some embodiments, the obtaining module 420 is specifically configured to: determine the length value of the target string; and obtain the key character set after the target string; wherein, the number of characters between the key character set and the target position is equal to the length value.

[0109] In some embodiments, the generating module 430 is specifically configured to: search for the starting character and the ending character in the key character set to obtain the character starting position and the character ending position; determine a predetermined position range according to the character starting position and the character ending position; and obtain the characters within the predetermined position range as the target search content corresponding to the target string.

[0110] In some embodiments, the starting character and the ending character are a pair of first delimiters and second delimiters that appear in pairs; when the generating module 430 is configured to search for the starting character and the ending character in the key character set to obtain the character starting position and the character ending position, it is specifically configured to: start from the first key character of the key character set, search for the first delimiter closest to the first key character; use the position of the found first delimiter as the character starting position; start from the position after the first delimiter, search for the second delimiter closest to the first delimiter; and use the position of the found second delimiter as the character ending position.

[0111] In some embodiments, the target string includes characters in a predetermined text attribute field; the target search content is the attribute value of the attribute field.

[0112] According to the search device in the embodiments of the present application, after determining the target position of the target string, a set of key characters having a predetermined positional relationship with the target position can be obtained, and then, according to the characters in the set of key characters, target search content corresponding to the target string is generated. According to this method, the target search content corresponding to the target string can be obtained based on the position information, which is beneficial to solving the problem that the search function in related technologies of text or character processing is too mechanical, thereby facilitating reducing the processing difficulty and improving the search efficiency.

[0113] Each module in the above search device can be implemented in whole or in part by software, hardware, and their combination. Each of the above modules can be embedded in the processor in the computer device in the form of hardware or be independent of the processor, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0114] In a third aspect, the embodiments of the present application further provide an electronic device.

[0115] Referring to Figure 5 , the electronic device includes: at least one processor 501; at least one memory 502, and one or more I / O interfaces 503; wherein, the memory 502 stores one or more computer programs executable by at least one processor 501, and the one or more computer programs are executed by at least one processor 501 so that at least one processor 501 can execute the above search method.

[0116] Wherein, the processor is a device with data processing capabilities, which includes but is not limited to a central processing unit (CPU), etc.; the memory is a device with data storage capabilities, which includes but is not limited to a random access memory (RAM, more specifically such as SDRAM, DDR, etc.), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory (FLASH); the I / O interface (read / write interface) is connected between the processor and the memory and can realize the information interaction between the memory and the processor, which includes but is not limited to a data bus (Bus), etc.

[0117] The embodiments of the present application further provide a computer-readable storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor / processing core, implements the above search method. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.

[0118] Those of ordinary skill in the art can understand that all or some of the steps, systems, and functional modules / units in the devices disclosed above can be implemented as software, firmware, hardware, and their appropriate combinations.

[0119] In a hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be executed by the cooperation of several physical components.

[0120] Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit (CPU), a digital signal processor, or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or transitory medium). As is well known to those of ordinary skill in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable instructions, data structures, program modules, or other data. Computer storage media includes, but is not limited to, random access memory (RAM, more specifically SDRAM, DDR, etc.), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), flash memory (FLASH), or other magnetic disk storage; compact disc read only memory (CD-ROM), digital versatile disc (DVD), or other optical disc storage; magnetic cassettes, tapes, magnetic disk storage, or other magnetic storage; and any other medium that can be used to store the desired information and that can be accessed by a computer. In addition, as is well known to those of ordinary skill in the art, communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and may include any information delivery medium.

[0121] This application has disclosed example embodiments, and although specific terms have been used, they are used only and should be construed only as having a general illustrative meaning and not for purposes of limitation. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly stated, features, characteristics, and / or elements described in connection with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in connection with other embodiments. Accordingly, those skilled in the art will understand that various forms and details may be changed without departing from the scope of this application as set forth in the appended claims.

Claims

1. A search method, wherein, The method includes: Determine the target position of the target string; Obtain a set of key characters having a predetermined positional relationship with the target position; Generate target search content corresponding to the target string according to the characters at the specified positions in the set of key characters.

2. The method according to claim 1, wherein, The target string is any string pre-stored in the data container; The determining the target position of the target string includes: Sequentially obtain strings from a predetermined data container, and use each obtained string as the target string; Determine the target position of the target string.

3. The method according to claim 1, wherein, The number of target positions of the target string is multiple; the determining the target position of the target string includes: Search for the target string in the text information; When the target string at any target position is found, determine the character offset of the first character of the currently found target string relative to the starting position of the text information; Determine the character offset as the target position of the currently found target string; Generate multiple target positions of the target character according to the target positions of each found target string.

4. The method according to claim 3, wherein, The number of sets in the set of key characters is multiple, and each set of key characters has a predetermined positional relationship with the corresponding target position; The generating the target search content corresponding to the target string according to the characters at the specified positions in the set of key characters includes: For each set of key characters, use the characters in each set of key characters as the search content in the corresponding set of key characters; Generate target search content corresponding to the target string according to the search content in each set of key characters.

5. The method according to claim 1, wherein The obtaining the set of key characters having a predetermined positional relationship with the target position includes: Determine the length value of the target string; Obtain the set of key characters after the target string; wherein, the number of characters separated between the set of key characters and the target position is equal to the length value.

6. The method according to claim 1, wherein, The generating the target search content corresponding to the target string according to the characters at the specified positions in the set of key characters includes: Search for the starting character and the ending character in the set of key characters to obtain the character starting position and the character ending position; Determine a predetermined position range according to the character starting position and the character ending position; Obtain the characters within the predetermined position range as the target search content corresponding to the target string.

7. The method according to claim 6, wherein The starting character and the ending character are a pair of first delimiter and second delimiter that appear in pairs; the searching for the starting character and the ending character in the set of key characters to obtain the character starting position and the character ending position includes: Start from the first key character in the set of key characters and search for the first delimiter closest to the first key character; Take the position of the found first delimiter as the character starting position; Start from the position after the first delimiter and search for the second delimiter closest to the first delimiter; Take the position of the found second delimiter as the character ending position.

8. According to the method of claim 1, wherein, The target string includes characters in a predetermined text attribute field; the target search content is the attribute value of the attribute field.

9. An electronic device, comprising: At least one processor; A memory having stored thereon at least one program, which when executed by the at least one processor causes the at least one processor to implement the method according to any one of claims 1-7.

10. A storage medium, wherein, The storage medium stores a computer program, which when executed by a processor implements the method according to any one of claims 1-7.