Information acquisition method and device, computer storage medium, and electronic device

By traversing the regular expression to update the execution expression, the resource overhead problem caused by too long statements or complex target words in the existing technology is solved, and efficient and accurate information acquisition is achieved.

CN111753548BActive Publication Date: 2024-09-20BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010144301.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-03-04
Publication Date
2024-09-20
Estimated Expiration
2040-03-04

AI Technical Summary

Technical Problem

When the existing technology determines whether a target word exists in a sentence input by a user, the system resource overhead increases and the efficiency and accuracy are low because the sentence is too long or the target word is too complex.

Method used

By obtaining the regular expression, obtain the current characters in sequence, create the initial keyword and initial execution expression, update the expression when the character types are different, until the update execution expression corresponding to the last character is obtained, and obtain the target based on this expression information, reduce the number of cycle detections, and improve efficiency and accuracy.

Benefits of technology

It optimizes system performance, supports complex environments, saves system resources, and improves the efficiency and accuracy of information acquisition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111753548B
    Figure CN111753548B
Patent Text Reader

Abstract

The present disclosure relates to the field of computer technology, and provides an information acquisition method, device, storage medium and electronic device, the information acquisition method comprising: obtaining a regular expression, obtaining the current character from the regular expression in sequence; creating an initial keyword and an initial execution expression; when the current character is a non-special character, determining a target keyword according to the current character and the initial keyword; when the current character is a special character, updating the initial execution expression according to the current character and the target keyword to obtain an updated execution expression, and using the updated execution expression as a new initial execution expression; repeating the above steps until an updated execution expression corresponding to the last character in the regular expression is obtained, using the updated execution expression corresponding to the last character as a target execution expression, and obtaining target information based on the target execution expression. The present disclosure improves the efficiency and accuracy of information acquisition through regular expressions and simple matching algorithms.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] With the development of computer technology, people often use computer technology to obtain useful information. For example, in the field of risk control or hot word statistics, it is often necessary to determine whether the user has entered certain specific words, and obtain the user's attention to a certain event through statistical judgment results.

[0003] In the prior art, a method of looping through the sentences to be detected word by word is adopted to determine whether the target word exists. However, due to the fact that the sentences are too long or the target words are too complex, the system resource overhead is increased in the process of obtaining information.

[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0005] The purpose of the present disclosure is to provide an information acquisition method, an information acquisition device, a computer-readable storage medium and an electronic device, thereby improving the efficiency and accuracy of information acquisition at least to a certain extent.

[0006] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.

[0007] According to one aspect of the present disclosure, there is provided an information acquisition method, the method comprising: acquiring a regular expression, and acquiring current characters from the regular expression in sequence; creating an initial keyword and an initial execution expression; when the current character is a non-special character, determining a target keyword based on the current character and the initial keyword; when the current character is a special character, updating the initial execution expression based on the current character and the target keyword to obtain an updated execution expression, and using the updated execution expression as a new initial execution expression; repeating the above steps until an updated execution expression corresponding to the last character in the regular expression is obtained, using the updated execution expression corresponding to the last character as a target execution expression, and acquiring target information based on the target execution expression.

[0008] In some exemplary embodiments of the present disclosure, the method further includes: generating the label when the current character is the non-special character.

[0009] In some exemplary embodiments of the present disclosure, a target keyword is determined based on the current character and the initial keyword, including: merging the current character with the initial keyword to form an updated keyword; using the updated keyword as the new initial keyword, repeating the previous step until the acquired character is a special character, and using the updated keyword finally acquired as the target keyword.

[0010] In some exemplary embodiments of the present disclosure, when the current character is a special character, the initial execution expression is updated according to the current character and the target keyword to obtain the updated execution expression, including: when the current character is a special character, determining whether there is a tag; if so, matching the target keyword with the text to be detected, and updating the initial execution expression according to the matching result and the current character to obtain the updated execution expression; if not, adding the current character to the initial execution expression to obtain the updated execution expression.

[0011] In some exemplary embodiments of the present disclosure, updating the initial execution expression according to the matching result and the current character to obtain the updated execution expression includes: determining identification information according to the matching result, and updating the initial execution expression according to the identification information and the current character to obtain the updated execution expression.

[0012] In some exemplary embodiments of the present disclosure, the identification information includes a first identification and a second identification; the initial execution expression is updated according to the identification information and the current character to obtain the updated execution expression, including: if the target keyword exists in the text to be detected, the current character and the first identification are added to the initial execution expression to obtain the updated execution expression; if the target keyword does not exist in the text to be detected, the current character and the second identification are added to the initial execution expression to obtain the updated execution expression.

[0013] In some exemplary embodiments of the present disclosure, after taking the updated execution expression as a new initial execution expression, the method further includes: clearing the target keyword and deleting the tag.

[0014] In some exemplary embodiments of the present disclosure, obtaining an update execution expression corresponding to the last character in the regular expression includes: when the last character is the non-special character, using the update keyword corresponding to the last character as the target keyword; matching the target keyword with the text to be detected, and obtaining the update execution expression corresponding to the last character based on the matching result.

[0015] In some exemplary embodiments of the present disclosure, an updated execution expression corresponding to the last character is obtained based on the matching result, including: if the target keyword corresponding to the last character exists in the text to be detected, a third identifier is added to the initial execution expression to obtain an updated execution expression corresponding to the last character; if the target keyword corresponding to the last character does not exist in the text to be detected, a fourth identifier is added to the initial execution expression to obtain an updated execution expression corresponding to the last character.

[0016] In some exemplary embodiments of the present disclosure, obtaining target information based on the target execution expression includes: performing statistics and / or evaluation according to the target execution expression to determine statistical information and / or evaluation information.

[0017] According to one aspect of the present disclosure, there is provided an information acquisition device, which includes: an acquisition expression module, which is used to acquire a regular expression and sequentially acquire the current character from the regular expression; an initial word creation module, which is used to create an initial keyword and an initial execution expression; an update keyword module, which is used to determine a target keyword based on the current character and the initial keyword when the current character is a non-special character; a determination expression module, which is used to update the initial execution expression based on the current character and the target keyword when the current character is a special character to obtain the updated execution expression, and use the updated execution expression as a new initial execution expression; and an acquisition target information module, which is used to repeat the above steps until the updated execution expression corresponding to the last character in the regular expression is acquired, use the updated execution expression corresponding to the last character as the target execution expression, and acquire target information based on the target execution expression.

[0018] According to one aspect of the present disclosure, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the information acquisition method as described in the above embodiments is implemented.

[0019] According to one aspect of the present disclosure, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the information acquisition method as described in the above embodiments.

[0020] It can be seen from the above technical solutions that the information acquisition method and device, computer-readable storage medium, and electronic device in the exemplary embodiments of the present disclosure have at least the following advantages and positive effects:

[0021] The information acquisition method of the exemplary embodiment of the present disclosure obtains the regular expression, obtains the current character from the regular expression in turn, and creates an initial keyword and an initial execution expression; when the current character is a non-special character, the target keyword is determined according to the current character and the initial keyword; when the current character is a special character, the initial execution expression is updated according to the current character and the target keyword to obtain an updated execution expression, and the updated execution expression is used as a new initial execution expression; the above steps are repeated until the updated execution expression corresponding to the last character in the regular expression is obtained, the updated execution expression corresponding to the last character is used as the target execution expression, and the target information is obtained based on the target execution expression. On the one hand, the information acquisition method in the present disclosure creates the target keyword by traversing the regular expression, and the creation process is simple, can support a more complex environment, and optimizes the system performance; on the other hand, the update execution expression is determined by the target keyword, so as to obtain the final target execution expression, which reduces the number of loop detections and improves the efficiency and accuracy of obtaining information; on the other hand, the loop is realized by judging the character type, and the implementation process is simple, the performance is good, and system resources are saved.

[0022] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0024] Figure 1 The following is a schematic diagram showing a flow chart of an information acquisition method according to an embodiment of the present disclosure;

[0025] Figure 2 The following schematically shows a flow chart of determining target keywords according to an embodiment of the present disclosure;

[0026] Figure 3 A schematic diagram of a process of obtaining an update execution expression according to an embodiment of the present disclosure is shown;

[0027] Figure 4 A schematic diagram of a structure for obtaining target information according to an embodiment of the present disclosure is shown;

[0028] Figure 5 A block diagram of an information acquisition device according to an embodiment of the present disclosure is schematically shown;

[0029] Figure 6 The module diagram of the electronic device according to an embodiment of the present disclosure is schematically shown;

[0030] Figure 7 A schematic diagram of a program product according to an embodiment of the present disclosure is shown schematically. DETAILED DESCRIPTION

[0031] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be more comprehensive and complete and will fully convey the concept of the example embodiments to those skilled in the art.

[0032] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure.

[0033] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0034] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0035] With the development of computer technology, it is often necessary to use computer technology to identify user needs, usually by detecting and counting the user's recent search records or browsing records through specific expressions. In the prior art, a word-by-word loop is adopted from the sentence to be detected to determine whether the target word exists. However, due to the fact that the sentence is too long or the target word is too complex, the recognition efficiency is too low in the process of identifying the target information, and the system resource overhead is increased.

[0036] Based on the problems existing in the related art, an information acquisition method is proposed in one embodiment of the present disclosure. The information acquisition method can be applied to but not limited to the following scenarios: hot word statistics, risk monitoring, business monitoring, user demand identification, etc. The present disclosure does not specifically limit the specific application scenarios of the information acquisition method, and changes in specific application scenarios should be understood as belonging to the protection scope of the present disclosure. Figure 1 A flow chart of the information acquisition method is shown, as shown in Figure 1 As shown, the information acquisition method at least includes the following steps:

[0037] Step S110: obtaining a regular expression, and obtaining the current characters from the regular expression in sequence;

[0038] Step S120: creating initial keywords and initial execution expressions;

[0039] Step S130: when the current character is a non-special character, determining a target keyword according to the current character and the initial keyword;

[0040] Step S140: when the current character is a special character, the initial execution expression is updated according to the current character and the target keyword to obtain an updated execution expression, and the updated execution expression is used as a new initial execution expression;

[0041] Step S150: Repeat the above steps until an update execution expression corresponding to the last character in the regular expression is obtained, the update execution expression corresponding to the last character is used as a target execution expression, and target information is obtained based on the target execution expression.

[0042] On the one hand, the information acquisition method in the disclosed embodiment creates the target keyword by traversing the regular expression, and the creation process is simple, can support more complex environments, and optimizes system performance; on the other hand, the update execution expression is determined by the target keyword to obtain the final target execution expression, which reduces the number of loop detections and improves the efficiency and accuracy of obtaining information; on the other hand, the loop is realized by judging the character type, which has a simple idea, good performance, and saves system resources.

[0043] It should be noted that the information acquisition method provided in the embodiments of the present disclosure is generally executed by a processor with computing functions, wherein the processor may include a terminal device, may include a server, or may be a processor with computing functions composed of a terminal device and a server. The present disclosure does not make specific limitations on this.

[0044] In order to make the technical solution of the present disclosure clearer, the information acquisition method in this exemplary embodiment is described in detail below with examples.

[0045] In step S110, a regular expression is obtained, and current characters are obtained from the regular expression in sequence.

[0046] In an exemplary embodiment of the present disclosure, a regular expression is composed of special characters and non-special characters. Special characters include metacharacters such as "&", "(", ")", "!", and non-special characters include letters, numbers, Chinese characters, etc. The present disclosure does not specifically limit the specific categories of special characters and non-special characters.

[0047] In step S120, initial keywords and initial execution expressions are created.

[0048] In an exemplary embodiment of the present disclosure, an initial keyword and an initial execution expression are created so that the initial keyword and the initial execution expression are updated in the following steps, wherein the initial keyword and the initial execution expression may be empty.

[0049] In step S130, when the current character is a non-special character, a target keyword is determined according to the current character and the initial keyword.

[0050] In an exemplary embodiment of the present disclosure, Figure 2 The schematic diagram of the process of determining the target keyword is shown as follows: Figure 2 As shown, by judging the type of the current character, when the current character is a non-special character, the process of determining the target keyword according to the current character and the initial keyword includes the following steps:

[0051] In step S210, the current character is combined with the initial keyword to form an updated keyword.

[0052] In an exemplary embodiment of the present disclosure, the initial keyword is empty, and the current characters are sequentially obtained from the regular expression. When the current characters are non-special characters, the current characters are merged with the initial keyword to form an updated keyword.

[0053] In step S220, the updated keyword is used as a new initial keyword, and the previous step is repeated until the acquired character is a special character, and the updated keyword finally acquired is used as the target keyword.

[0054] In an exemplary embodiment of the present disclosure, the update keyword corresponding to the current character is used as a new initial keyword. When the next character adjacent to the current character is obtained, the type of the next character is determined. If the next character is still a non-special character, the next character is merged with the new initial keyword to form an update keyword, and the update keyword is used as the new initial keyword. The above steps are repeated to obtain characters from the regular expression in turn, and the type and update keyword are determined until the current character obtained is a special character, and the finally obtained update keyword is used as the target keyword.

[0055] For example, the process of determining target keywords is as follows:

[0056] Get the regular expression "(mobile phone&explosion)", get the current character from the regular expression in turn, at this time the current character is "("; then, determine that the current character is a special character, continue to get the next character "hand" from the regular expression as the current character, determine that the current character is a non-special character, merge the current character "hand" with the initial keyword to form an update keyword, since the initial keyword is empty, the update keyword at this time is "hand", and the update keyword "hand" is used as the initial keyword for the next cycle; then, get the next character "machine" from the regular expression as the current character, determine that the current character is a non-special character, merge the current character "machine" with the initial keyword "hand" to form the update keyword "mobile phone", and use mobile phone as the initial keyword for the next cycle; continue to get the next character "&" from the regular expression as the current character, determine that the current character is a special character, and use the update keyword obtained in the previous cycle as the target keyword.

[0057] In an exemplary embodiment of the present disclosure, when the current character is a non-special character, a tag is generated. The step of generating a tag may be performed before determining the target keyword or after determining the target keyword, and the present disclosure does not specifically limit this.

[0058] In an exemplary embodiment of the present disclosure, when the current character is a non-special character, it is determined whether a tag exists, and if no tag exists, a tag is generated. Specifically, generating a tag may be storing the tag in a database, or marking the target keyword corresponding to the current character, which is not specifically limited in the present disclosure.

[0059] Continue to refer to Figure 1 As shown, in step S140, when the current character is a special character, the initial execution expression is updated according to the current character and the target keyword to obtain an updated execution expression, and the updated execution expression is used as a new initial execution expression.

[0060] In an exemplary embodiment of the present disclosure, Figure 3 The schematic diagram of the process of obtaining the update execution expression is shown as follows: Figure 3 As shown, the following steps are included:

[0061] In step S310, when the current character is a special character, it is determined whether there is a tag.

[0062] In an exemplary embodiment of the present disclosure, when the current character is a special character, it is determined whether there is a label in the database. If there is no label, there are two situations. One is that the label has been deleted during the execution of the previous cycle, or the previous character corresponding to the current character is a special character and no label is generated.

[0063] In step S320, if there is a tag, the target keyword is matched with the text to be detected, and the initial execution expression is updated according to the matching result and the current character to obtain an updated execution expression.

[0064] In an exemplary embodiment of the present disclosure, a target keyword is matched with a text to be detected. If the target keyword exists in the text to be detected, the identification information is determined to be a first identification, and the current character and the first identification are added to the initial execution expression to obtain an updated execution expression; if the target keyword does not exist in the text to be detected, the identification information is determined to be a second identification, and the current character and the second identification are added to the initial execution expression to obtain an updated execution expression. The first identification and the second identification are different, and respectively represent two opposite meanings. For example, the first identification can be true, and the second identification is false; the first identification is false, and the second identification is true. The first identification can also be 0, and the second identification is 1; the first identification is 1, and the second identification is 0. Of course, the first identification and the second identification can also be represented by other characters, and the present disclosure does not make specific limitations on this.

[0065] In step S330, if there is no tag, the current character is added to the initial execution expression to obtain an updated execution expression.

[0066] In an exemplary embodiment of the present disclosure, when there is no tag, the special character is directly added to the initial execution expression corresponding to the current character to obtain an updated execution expression.

[0067] In an exemplary embodiment of the present disclosure, after the updated execution expression is used as a new initial execution expression, the target keyword is cleared and the tag is deleted. Of course, after the initial execution expression is updated according to the matching result and the current character, the target keyword is cleared and the tag is deleted, and the next cycle is started, and the next character corresponding to the current character is continuously obtained from the regular expression as the current character, and the above operation is performed on the next character to form the final updated execution expression.

[0068] Continue to refer to Figure 1 As shown, in step S150, the above steps are repeated until an update execution expression corresponding to the last character in the regular expression is obtained, the update execution expression corresponding to the last character is used as a target execution expression, and target information is obtained based on the target execution expression.

[0069] In an exemplary embodiment of the present disclosure, the current character is sequentially obtained from the regular expression, and step S130 or step S140 is repeatedly executed according to the type of the current character until the updated execution expression corresponding to the last character in the regular expression is obtained.

[0070] In an exemplary embodiment of the present disclosure, when the last character of the regular expression is a special character, step S140 is executed to obtain an update execution expression corresponding to the last character, and the update execution expression corresponding to the last character is used as a target execution expression.

[0071] In an exemplary embodiment of the present disclosure, when the last character of the regular expression is a non-special character, the target keyword corresponding to the last character is matched with the text to be detected. If the target keyword corresponding to the last character exists in the text to be detected, the third identifier is added to the initial execution expression to obtain an updated execution expression corresponding to the last character; if the target keyword corresponding to the last character does not exist in the text to be detected, the fourth identifier is added to the initial execution expression to obtain an updated execution expression corresponding to the last character. The third identifier is the same as the first identifier, and the fourth identifier is the same as the second identifier.

[0072] In an exemplary embodiment of the present disclosure, acquiring target information based on a target execution expression includes: performing statistics and / or evaluation according to the target execution expression to determine statistical information and / or evaluation information.

[0073] In an exemplary embodiment of the present disclosure, Figure 4 The schematic diagram of the process of obtaining target information is shown as follows: Figure 4As shown, in step S401, a regular expression is obtained, and the current character is obtained from the regular expression in turn; in step S402, an initial keyword and an initial execution expression are created; wherein, the initial keyword is empty, and the initial execution expression is empty, and in step S403, it is determined whether the current character is a special character; in step S404, if the current character is a non-special character, the current character is added to the initial keyword to obtain an update keyword, and a tag is generated, and steps S402 to S404 are repeated until the current character obtained is a special character; in step S405, if the current character is a special character, the update keyword corresponding to the previous non-special character is used as the target keyword; in step S406, if the current character is a special character, it is determined whether there is a tag; in step S407, if there is no tag, the current character is added to the initial execution expression to obtain an update execution expression and a new initial execution expression; in step S408, if there is a tag, it is determined whether the character to be detected Whether the text contains the target keyword; in step S409, if the text to be detected contains the target keyword, add the first identifier to the initial execution expression to obtain an updated execution expression and a new initial execution expression; in step S410, if the text to be detected does not include the target keyword, add the second identifier to the initial execution expression to obtain an updated execution expression and a new initial execution expression; in step S411, clear the target keyword, delete the label, and execute step S407; It should be noted that the above steps S401 to S411 are looped until all characters in the regular expression are obtained in the loop. In step S412, if the last character of the regular expression is a non-special character, the updated keyword corresponding to the last character is used as the target keyword, and steps S408 to S410 are executed again; in step S413, the updated execution expression corresponding to the last character is used as the target execution expression, and the target information is obtained based on the target execution expression.

[0074] For example, taking the regular expression "(mobile phone & explosion)" and the text to be detected as "My mobile phone exploded on October 10th, can you help me deal with it?" as an example, the process of obtaining information disclosed in the present invention is explained in detail, and the process of obtaining target information is as follows:

[0075] In the first loop, take the first character "(" in the regular expression. The first character is a special character, but there is no label. Add the first character to the initial execution expression to obtain the updated execution expression. The updated execution expression is "(", and the new initial execution expression is "(".

[0076] The second loop: Take the second character '手' in the regular expression. Since the second character is a non-special character, add the second character to the initial keyword to obtain an updated keyword. The updated keyword is '手', and the new initial keyword is also '手'. Generate a label.

[0077] The third loop: Take the third character '机' in the regular expression. Since the third character is a non-special character, add the third character to the initial keyword to obtain an updated keyword. The updated keyword is '手机', and the new initial keyword is also '手机'. Generate a label.

[0078] The fourth loop: First, take the fourth character '&' in the regular expression. Since the fourth character is a special character, use the updated keyword obtained in the previous loop as the target keyword. The target keyword is '手机', and there is a label. Then, determine that the target keyword '手机' exists in the text to be detected. Add the first flag 'true' and the fourth character '&' to the initial execution expression to obtain an updated execution expression and a new initial execution expression of '(true&'. Finally, clear the target keyword and delete the label.

[0079] The fifth loop: Take the fifth character '爆' in the regular expression. Since the fifth character is a non-special character, add the fifth character to the initial keyword to obtain an updated keyword and a new initial keyword of '爆'. Generate a label.

[0080] The sixth loop: Take the sixth character '炸' in the regular expression. Since the sixth character is a non-special character, add the sixth character to the initial keyword to obtain an updated keyword and a new initial keyword of '爆炸'. Generate a label.

[0081] The seventh loop: First, take the seventh character ')' in the regular expression. Since the seventh character is a special character, use the updated keyword obtained in the previous loop as the target keyword. The target keyword is '爆炸', and there is a label. Then, determine that the target keyword '爆炸' exists in the text to be detected. Add the first flag 'true' and the seventh character ')' to the initial execution expression to obtain an updated execution expression and a new execution expression of '(true&true)'. Finally, clear the target keyword and delete the label.

[0082] When the loop ends and the last character of the regular expression is a special character, the updated execution expression corresponding to the last character is used as the target execution expression, and the target execution expression is obtained as "(true & true)". Calculate the target execution expression "(true & true) = true". The regular expression matches the text to be detected successfully. Detect multiple texts to be detected according to the above method, and count the detection results to finally obtain the statistical information.

[0083] In addition, when the regular expression is "mobile phone & explosion", the result of executing according to the above method of obtaining information is as follows:

[0084] In the first loop, the current character is 'hand', the updated keyword is 'hand', and the updated execution expression is empty.

[0085] In the second loop, the current character is'machine', the updated keyword is'mobile phone', and the updated execution expression is empty.

[0086] In the third loop, the current character is '&', the target keyword is'mobile phone', the updated execution expression is 'true &', and the target keyword is cleared.

[0087] In the fourth loop, the current character is 'explosion', the updated keyword is 'explosion', and the updated execution expression is 'true &'.

[0088] In the fifth loop, the current character is 'blast', the updated keyword is 'explosion', and the updated execution expression is 'true &'.

[0089] When the loop ends and the last character of the regular expression is a non - special character, the updated keyword corresponding to the last character is used as the target keyword. At this time, the target keyword is 'explosion'. Determine whether the target keyword 'explosion' exists in the text to be detected. If the target keyword exists in the text to be detected, the updated execution expression is 'true & true', and the finally obtained target execution expression is 'true & true'.

[0090] It should be noted that the above scenario is only an exemplary illustration and does not limit the protection scope of the exemplary embodiments of the present disclosure in any way.

[0091] The following introduces the device embodiments of the present disclosure, which can be used to execute the above - mentioned information acquisition method of the present disclosure. For the details not disclosed in the device embodiments of the present disclosure, please refer to the embodiments of the above - mentioned information acquisition method of the present disclosure.

[0092] Figure 5 The block diagram of the information acquisition device according to an embodiment of the present disclosure is schematically shown.

[0093] Refer to Figure 5 As shown, according to an embodiment of the present disclosure, the information acquisition device 500 includes: an expression acquisition module 501, an initial word creation module 502, a keyword update module 503, an expression determination module 504, and a target information acquisition module 505. Specifically:

[0094] The expression acquisition module 501 is used to acquire a regular expression and sequentially acquire the current characters from the regular expression.

[0095] The initial word creation module 502 is used to create initial keywords and initial execution expressions.

[0096] The keyword updating module 503 is used to determine the target keyword according to the current character and the initial keyword when the current character is a non-special character.

[0097] The expression determination module 504 is used to update the initial execution expression according to the current character and the target keyword when the current character is a special character to obtain an updated execution expression, and use the updated execution expression as a new initial execution expression.

[0098] The target information acquisition module 505 is used to repeat the above steps until the update execution expression corresponding to the last character in the regular expression is acquired, the update execution expression corresponding to the last character is used as the target execution expression, and the target information is acquired based on the target execution expression.

[0099] The specific details of each of the above-mentioned information acquisition devices have been described in detail in the corresponding information acquisition method, so they will not be repeated here.

[0100] It should be noted that, although several modules or units of the device for execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0101] In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.

[0102] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".

[0103] Refer to the following Figure 6 The electronic device 600 according to this embodiment of the present invention is described. Figure 6 The electronic device 600 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0104] like Figure 6 As shown, the electronic device 600 is in the form of a general computing device. The components of the electronic device 600 may include but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different system components (including the storage unit 620 and the processing unit 610), and a display unit 640.

[0105] The storage unit stores program codes, which can be executed by the processing unit 610, so that the processing unit 610 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 610 can perform the following steps: Figure 1 In the step S110 shown in the figure, a regular expression is obtained, and the current character is obtained from the regular expression in sequence; in the step S120, an initial keyword and an initial execution expression are created; in the step S130, when the current character is a non-special character, a target keyword is determined according to the current character and the initial keyword; in the step S140, when the current character is a special character, the initial execution expression is updated according to the current character and the target keyword to obtain an updated execution expression, and the updated execution expression is used as a new initial execution expression; in the step S150, the above steps are repeated until an updated execution expression corresponding to the last character in the regular expression is obtained, the updated execution expression corresponding to the last character is used as a target execution expression, and the target information is obtained based on the target execution expression.

[0106] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .

[0107] The storage unit 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, such program modules 605 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0108] Bus 630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0109] The electronic device 600 may also communicate with one or more external devices 800 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable viewers to interact with the electronic device 600, and / or communicate with any device that enables the electronic device 600 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 650. Furthermore, the electronic device 600 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 660. As shown, the network adapter 660 communicates with other modules of the electronic device 600 via a bus 630. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0110] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0111] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.

[0112] refer to Figure 7As shown, a program product 700 for implementing the above method according to an embodiment of the present invention is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0113] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0114] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0115] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0116] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0117] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0118] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The specification and examples are to be considered as exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.

[0119] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A method for obtaining information, It is characterized in that include: Obtain a regular expression, and obtain the current characters from the regular expression in sequence; Create initial keywords and initial execution expressions; When the current character is a non-special character, determining a target keyword according to the current character and the initial keyword includes: combining the current character with the initial keyword to form an updated keyword; using the updated keyword as a new initial keyword, repeating the previous step until the current character obtained is a special character, and using the finally obtained updated keyword as the target keyword; When the current character is a special character, updating the initial execution expression according to the current character and the target keyword to obtain an updated execution expression, and using the updated execution expression as a new initial execution expression; Repeat the above steps until an update execution expression corresponding to the last character in the regular expression is obtained, the update execution expression corresponding to the last character is used as a target execution expression, and target information is obtained based on the target execution expression; Wherein, when the current character is a special character, updating the initial execution expression according to the current character and the target keyword to obtain the updated execution expression includes: When the current character is a special character, determining whether there is a tag; If it exists, matching the target keyword with the text to be detected, and updating the initial execution expression according to the matching result and the current character to obtain the updated execution expression; If not present, the current character is added to the initial execution expression to obtain the updated execution expression.

2. The information acquisition method according to claim 1, It is characterized in that The method further comprises: When the current character is the non-special character, a label is generated.

3. The information acquisition method according to claim 1, It is characterized in that Updating the initial execution expression according to the matching result and the current character to obtain the updated execution expression includes: Identification information is determined according to the matching result, and the initial execution expression is updated according to the identification information and the current character to obtain the updated execution expression.

4. The information acquisition method according to claim 3, It is characterized in that The identification information includes a first identification and a second identification; Updating the initial execution expression according to the identification information and the current character to obtain the updated execution expression includes: If the target keyword exists in the text to be detected, adding the current character and the first identifier to the initial execution expression to obtain the updated execution expression; If the target keyword does not exist in the text to be detected, the current character and the second identifier are added to the initial execution expression to obtain the updated execution expression.

5. The information acquisition method according to claim 1, It is characterized in that After taking the updated execution expression as a new initial execution expression, the method further includes: Clear the target keyword and delete the tag.

6. The information acquisition method according to claim 1, It is characterized in that Get an update execution expression corresponding to the last character in the regular expression, including: When the last character is a non-special character, the update keyword corresponding to the last character is used as the target keyword; The target keyword is matched with the text to be detected, and an update execution expression corresponding to the last character is obtained according to the matching result.

7. The information acquisition method according to claim 6, It is characterized in that Obtaining an update execution expression corresponding to the last character according to the matching result, including: If the target keyword corresponding to the last character exists in the text to be detected, adding a third identifier to the initial execution expression to obtain an updated execution expression corresponding to the last character; If the target keyword corresponding to the last character does not exist in the text to be detected, the fourth identifier is added to the initial execution expression to obtain an updated execution expression corresponding to the last character.

8. The information acquisition method according to claim 1, It is characterized in that Obtaining target information based on the target execution expression includes: Statistics and / or evaluation are performed according to the target execution expression to determine statistical information and / or evaluation information.

9. An information acquisition device, It is characterized in that include: An expression acquisition module is used to acquire a regular expression and sequentially acquire the current character from the regular expression; Create an initial word module to create initial keywords and initial execution expressions; An update keyword module, used for determining a target keyword according to the current character and the initial keyword when the current character is a non-special character, including: combining the current character with the initial keyword to form an update keyword; using the update keyword as a new initial keyword, repeating the previous step until the current character obtained is a special character, and using the finally obtained update keyword as the target keyword; an expression determination module, configured to update the initial execution expression according to the current character and the target keyword to obtain an updated execution expression when the current character is a special character, and use the updated execution expression as a new initial execution expression; A target information acquisition module, used to repeat the above steps until an update execution expression corresponding to the last character in the regular expression is acquired, the update execution expression corresponding to the last character is used as a target execution expression, and target information is acquired based on the target execution expression; Among them, when the current character is a special character, the initial execution expression is updated according to the current character and the target keyword to obtain the updated execution expression, including: when the current character is a special character, judging whether there is a tag; if so, matching the target keyword with the text to be detected, and updating the initial execution expression according to the matching result and the current character to obtain the updated execution expression; if not, adding the current character to the initial execution expression to obtain the updated execution expression.

10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the information acquisition method according to any one of claims 1 to 8 is implemented.

11. An electronic device, It is characterized in that include: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enables the one or more processors to implement the information acquisition method as described in any one of claims 1 to 8.