Information processing device, information processing method, and information processing program

By incorporating a determination and confirmation mechanism to align results, the solution addresses the inaccuracy of conventional regular expression modification techniques, ensuring precise and user-intended corrections.

WO2025220143A1PCT designated stage Publication Date: 2025-10-23NT T INC
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
PCT/JP2024/015194
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-04-16
Publication Date
2025-10-23

AI Technical Summary

Technical Problem

Conventional techniques for modifying regular expressions are inaccurate due to the reliance on user-provided positive and negative examples, which may not comprehensively represent the user's intentions, leading to bugs or vulnerabilities in programs.

Method used

A determination unit checks if the results of applying a character string to a first and second regular expression are the same, with a confirmation unit prompting the user when results differ, ensuring accurate modification by iteratively refining the regular expression based on user feedback.

Benefits of technology

The solution allows for precise modification of regular expressions, aligning them with user intentions, thereby preventing bugs and vulnerabilities by ensuring accurate correction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure JP2024015194_23102025_PF_FP_ABST
    Figure JP2024015194_23102025_PF_FP_ABST
Patent Text Reader

Abstract

A repair device (10) according to an embodiment includes a determining unit (105) and a verifying unit (108). The determining unit (105) determines whether or not a first result obtained by applying a character string to a regular expression before repair and a second result obtained by applying the character string to the repaired regular expression obtained by repairing the regular expression prior to repair are the same. Furthermore, if the determining unit (105) determines that the first result and the second result are different, the verifying unit (108) outputs data for prompting verification by the user.
Need to check novelty before this filing date? Find Prior Art

Description

Information processing device, information processing method, and information processing program

[0001] The present invention relates to an information processing device, an information processing method, and an information processing program.

[0002] Regular expressions are widely used as a way to represent string patterns. However, despite their convenience, it is known that writing regular expressions to represent the intended pattern is often difficult. If a regular expression that does not represent the intended pattern is incorporated into a program, it can lead to bugs or vulnerabilities in the program. Therefore, active research is being conducted to obtain the intended regular expression. Among such research, techniques that have attracted particular attention are examples-based regular expression modification techniques and techniques for generating regular expressions from natural language (see, for example, Non-Patent Document 1).

[0003] N. Chida and T. Terauchi, "Repairing DoS Vulnerability of Real-World Regexes," In Proc. S&P'22., [online], [Retrieved April 4, 2024], Internet (https: / / arxiv.org / pdf / 2010.12450.pdf)

[0004] However, conventional techniques may not be able to accurately modify regular expressions.

[0005] For example, the technique described in Non-Patent Document 1 provides a modified regular expression that satisfies a user's intention. The user's intention is expressed, for example, by positive examples and negative examples that the user prepares in advance.

[0006] On the other hand, it is not always possible for a user to comprehensively prepare positive examples and negative examples that match his or her intentions. In other words, the correction of regular expressions using the technique described in Non-Patent Document 1 is merely performed depending on the positive examples and negative examples prepared by the user, and the correction is not performed accurately as intended by the user.

[0007] In order to solve the above-mentioned problems and achieve the object, the present invention is characterized by comprising a determination unit that determines whether a first result obtained by applying a character string to a first regular expression is the same as a second result obtained by applying the character string to a second regular expression obtained by modifying the first regular expression, and a confirmation unit that outputs data to prompt a user for confirmation when the determination unit determines that the first result and the second result are different.

[0008] According to the present invention, regular expressions can be precisely modified.

[0009] FIG. 1 is a diagram illustrating an example of the configuration of a correction device according to a first embodiment. FIG. 2 is a diagram illustrating operators of regular expressions. FIG. 3 is a diagram illustrating an example of the operation of the correction device. FIG. 4 is a diagram illustrating a process for passing data related to correction. FIG. 5 is a diagram illustrating a process for selecting a tool. FIG. 6 is a diagram illustrating a process for executing correction. FIG. 7 is a diagram illustrating an example of a syntax for describing the intention of correction. FIG. 8 is a diagram illustrating a process related to confirmation. FIG. 9 is a diagram illustrating an example of an editor screen. FIG. 10 is a diagram illustrating an example of an editor screen. FIG. 11 is a diagram illustrating an example of an editor screen. FIG. 12 is a diagram illustrating an example of an editor screen. FIG. 13 is a diagram illustrating an example of a confirmation screen. FIG. 14 is a flowchart illustrating the flow of processing by the correction device. FIG. 15 is a flowchart illustrating the flow of correction processing. FIG. 16 is a diagram illustrating an example of a computer that executes a program.

[0010] Hereinafter, embodiments of an information processing device, an information processing method, and an information processing program according to the present application will be described in detail with reference to the accompanying drawings. Note that the present invention is not limited to the embodiments described below. Also, the correction device in the embodiments is an example of an information processing device.

[0011] [First Embodiment] The configuration of a repairing device according to a first embodiment will be described with reference to Fig. 1. Fig. 1 is a diagram showing an example of the configuration of a repairing device according to a first embodiment.

[0012] The regular expression before correction, the positive examples for correction, and the negative examples for correction are input to the correction device 10. The regular expression, the positive examples, and the negative examples input to the correction device 10 are information indicating the intention of the user U1. Here, the user U1 may not necessarily have a comprehensive set of positive examples and negative examples that match his or her intention.

[0013] Both the positive examples and the negative examples are character strings or a collection of multiple character strings. The correction device 10 corrects the regular expression before correction to a regular expression that accepts character strings included in the positive examples for correction and does not accept character strings included in the negative examples for correction. Note that when a regular expression satisfies the positive examples, it means that the regular expression accepts character strings included in the positive examples. Also, when a regular expression satisfies the negative examples, it means that the regular expression does not accept (rejects) character strings included in the negative examples. Furthermore, the correction device 10 performs processing to confirm whether the corrected regular expression truly matches the user's intention.

[0014] Here, the regular expressions in this embodiment comply with the syntax defined by Backus Naur Form (BNF) (reference URL: https: / / tc39.es / ecma262 / ). Also, the operators in BNF are as shown in Figure 2. Figure 2 is a diagram showing the operators of regular expressions.

[0015] As shown in Fig. 3, the editing device 10 is executed via an editor. Fig. 3 is a diagram showing an example of the operation of the editing device. The editor is software that allows a user to write a program. For example, the editor is an integrated development environment (IDE). The editor may be a function of a device different from the editing device 10, or may be included in the functions of the editing device 10.

[0016] The function of the correction device 10 to correct a regular expression is realized, for example, as a plug-in for an editor. The editor passes the pre-correction regular expression, positive examples, and negative examples to the plug-in and executes a correction command. When the editor executes the correction command, the plug-in returns the corrected regular expression to the editor. For example, the plug-in automatically replaces the pre-correction regular expression in code written in the editor with the corrected regular expression.

[0017] 1 , the modification device 10 includes a modification control unit 101, a selection unit 102, a modification unit 103, a generation unit 104, a determination unit 105, an extraction unit 106, a determination unit 107, a confirmation unit 108, and a generation unit 109. The modification device 10 also includes storage units 151, 152, and 153, which are storage areas.

[0018] 4, the correction control unit 101 receives input data 51 and correction candidate data 53 (step S121). Fig. 4 is a diagram illustrating the process of passing data related to correction. The correction control unit 101 also controls the selection unit 102 and the correction unit 103 based on the received data.

[0019] The input data 51 includes a regular expression before correction, a positive example for correction, and a negative example for correction. The input data 51 may include either a positive example for correction or a negative example for correction. In the example of FIG. 4, the input data 51 includes the regular expression before correction ".@.*[.].*", a positive example "{"abc@de"}", and a negative example "{"@"}". The regular expression before correction is an example of a first regular expression.

[0020] The correction candidate data 53 is a candidate for a regular expression after correction. The candidate for a regular expression after correction (correction candidate) may be received from another device or may be enumerated by the correction device 10. Note that the method for correcting a regular expression based on positive examples and negative examples is not limited to the method of enumerating candidates. For example, the method for correcting a regular expression based on positive examples and negative examples may be the method described in Non-Patent Document 1.

[0021] Here, an example will be described in which the correction device 10 lists candidates for corrected regular expressions. The correction device 10 can list candidates for corrected regular expressions in cooperation with a large-scale language model. The large-scale language model outputs a response in natural language in response to an input (prompt) in natural language. For example, the large-scale language model is provided as an external service. The correction device 10 can obtain a response from the large-scale language model by executing an API (Application Programming Interface) on a server connected via a network.

[0022] The correction device 10 converts the input data 51 into prompt data, which is a natural language explanation. For example, the correction device 10 can create prompt data by embedding regular expressions, positive examples, and negative examples of the input data 51 in a pre-prepared template. The number of correction candidates (e.g., 10) may be determined in advance as a constant or may be specified by the user.

[0023] The editing device 10 creates the text "I would like to edit the regular expression .@.*[.].* so that abc@de is accepted and @ is rejected. Please list 10 edit candidates." as prompt data.

[0024] The correction device 10 obtains correction candidate data 53 based on the result of inputting prompt data into the large-scale language model. The large-scale language model outputs natural language text such as "The first one is '.@.*[.].*', the second one is '.?@.?[.].?', ..., the tenth one is '.*@.*[.].*'" as an answer. The correction control unit 101 appropriately parses the text output from the large-scale language model and extracts regular expressions.

[0025] For example, the correction control unit 101 removes non-regular expressions such as "the first one" and "the second one," as well as parentheses surrounding regular expressions, extracts the remaining parts as regular expressions, and obtains text in which each regular expression is separated by a line break, or an array with each regular expression as an element, as correction candidate data 53.

[0026] In this way, the correction device 10 can use a large-scale language model to enumerate candidate regular expressions that are obtained by correcting pre-correction regular expressions based on positive examples, which are sets of character strings, and negative examples, which are sets of character strings, and that accept character strings included in the positive examples but do not accept character strings included in the negative examples.

[0027] However, the regular expressions output by the large-scale language model do not necessarily satisfy the positive and negative examples, and the accuracy with which the large-scale language model outputs regular expressions that satisfy the positive and negative examples varies depending on the performance of the large-scale language model, the method of writing the prompt data, etc.

[0028] The processing of the selection unit 102 will be described with reference to Fig. 5. Fig. 5 is a diagram illustrating the processing of selecting a tool. As shown in Fig. 5, the selection unit 102 selects a correction tool based on input data 51 (step S131). The correction tool accepts input of a regular expression, positive examples, and negative examples, corrects the input regular expression so that it satisfies the positive examples and negative examples, and returns the corrected regular expression.

[0029] The selection unit 102 selects, from among a plurality of correction tools (the automatic correction tool group 20 in FIG. 1 ), one that matches the input data 51. The correction tool may be one that is included in the correction device 10, or may be one that is provided by another device that cooperates with the correction device 10.

[0030] Non-Patent Document 1 describes a modification tool called REMEDY (Regular Expression Modifier for Ensuring Deterministic Property). Reference 1 also describes a modification tool called R3 (Repairing Regex for extRaction). Reference 1 further describes that R3 can handle positive examples and negative examples that include a portion enclosed by a special left parenthesis (Unicode: U+2987) and a special right parenthesis with a subscript (Unicode: U+2988).

[0031] Reference 1: N. Chida and T. Terauchi, “Repairing Regular Expressions for Extraction”, In Proc. PLDI'23.

[0032] When a positive example or a negative example includes a special symbol, the selection unit 102 can select a correction tool corresponding to the special symbol. For example, when a positive example or a negative example of the input data 51 includes a portion enclosed by a special left parenthesis and a special right parenthesis with a subscript, the selection unit 102 selects R3 from among REMEDY and R3. Furthermore, when a positive example or a negative example of the input data 51 does not include a portion enclosed by a special left parenthesis and a special right parenthesis with a subscript, the selection unit 102 selects REMEDY from among REMEDY and R3.

[0033] The selection unit 102 passes information for identifying the correction tool or the correction tool itself to the correction unit 103 (step S132).

[0034] In this way, when at least one of the positive examples and negative examples contains a string that includes a specific symbol (for example, a special left parenthesis and a special right parenthesis with a subscript), the selection unit 102 selects a correction tool from among the multiple tools that can interpret the specific symbol.

[0035] For example, if one correction tool has a fast correction speed but cannot interpret specific symbols, and the other correction tool has a slow correction speed but can interpret specific symbols, the selection unit 102 can select the most appropriate correction tool.

[0036] The processing of the correction unit 103 will be described with reference to Fig. 6. Fig. 6 is a diagram illustrating the processing for executing correction. As shown in Fig. 6, the correction unit 103 attempts to correct the regular expression using a correction tool based on the input data 51 and correction candidate data 53. Here, the correction tool selected by the selection unit 102 is referred to as a first tool.

[0037] First, the correction unit 103 prepares correction trial data that combines the regular expression before correction and each of the candidate regular expressions included in the candidate correction data 53, as well as positive and negative examples, and assigns each of the trial correction data to each of the multiple instances together with the first tool (step S141).

[0038] For example, the correction trial data 541 includes the pre-correction regular expression ".@.*[.].*", the positive example "{"abc@de"}", and the negative example "{"@"}". For example, the correction trial data 543 includes the correction candidate regular expression ".?@.?[.].?", the positive example "{"abc@de"}", and the negative example "{"@"}".

[0039] Next, the modifying unit 103 executes the modifying tool on each instance (step S142). The processes of each instance are executed simultaneously by parallel processing.

[0040] Each of the multiple instances solves a problem of obtaining a corrected regular expression that satisfies the positive examples and negative examples. The correction unit 103 determines the corrected regular expression obtained first among the multiple instances (the regular expression output by the correction tool of the instance that solved the problem the fastest) as the output of the correction device 10. The correction unit 103 reflects the determined corrected regular expression in the editor.

[0041] The first corrected regular expression can be said to be the regular expression that was corrected most quickly. The corrector 103 may measure the correction speed or the time required for correction for each of the multiple instances and determine the regular expression that was corrected most quickly as the output.

[0042] In this way, correction unit 103 corrects each of the regular expression candidates included in correction candidate data 53 using a correction tool based on the positive examples and negative examples, and outputs a regular expression that satisfies the conditions from among the regular expressions obtained by the correction. The regular expression output by correction unit 103 is an example of a second regular expression.

[0043] A fast correction speed means that the regular expression is closer to the input regular expression before correction (for example, the edit distance is smaller). Therefore, the correction unit 103 can output a regular expression that is closer to the regular expression input by the user and satisfies both positive and negative examples.

[0044] [Confirmation Processing] The confirmation processing will be described with reference to Fig. 8. Fig. 8 is a diagram illustrating the confirmation processing. First, the corrector 103 stores the corrected regular expression in the storage unit 151.

[0045] The generation unit 104 generates positive examples and negative examples based on the pre-correction regular expression. Any method may be used to generate positive examples and negative examples. For example, the generation unit 104 may generate positive examples and negative examples corresponding to the pre-correction regular expression using artificial intelligence (AI). The generation unit 104 may also acquire, from a plurality of pre-prepared character strings (e.g., email addresses), character strings that are accepted by the pre-correction regular expression as positive examples and character strings that are rejected by the pre-correction regular expression as negative examples. The generation unit 104 stores the generated positive examples and negative examples in the storage unit 152. The generation unit 104 may generate either positive examples or negative examples. For example, in the following description, the terms positive examples and negative examples may be interchangeable with the generated positive examples or negative examples. In the following description, the positive examples and negative examples may be referred to as character string examples without distinction.

[0046] The determination unit 105 obtains the corrected regular expression from the storage unit 151. The determination unit 105 also obtains the generated positive examples and negative examples from the storage unit 152.

[0047] The determination unit 105 determines whether a first result obtained by applying a character string to the pre-correction regular expression is the same as a second result obtained by applying a character string to a corrected regular expression obtained by correcting the pre-correction regular expression. The character strings here are the positive examples and negative examples obtained from the storage unit 152.

[0048] Specifically, the determination unit 105 determines that the first result and the second result are different when a positive example, which is a string that is accepted by the regular expression before correction, is rejected by the regular expression after correction, or when a negative example, which is a string that is rejected by the regular expression before correction, is accepted by the regular expression after correction.

[0049] In the first result, positive examples are accepted and negative examples are rejected. However, in the second result, positive examples are not necessarily accepted and negative examples are not necessarily rejected. For example, the modified regular expression is guaranteed to accept the input positive examples for correction, but is not guaranteed to accept the generated positive examples. Similarly, the modified regular expression is guaranteed to reject the input negative examples for correction, but is not guaranteed to reject the generated negative examples.

[0050] Furthermore, at this point, it is unclear whether it is user U1's intention not to accept the positive examples for which the modified regular expressions have been generated, and not to reject the negative examples for which the modified regular expressions have been generated.

[0051] Therefore, the extraction unit 106 extracts a portion to be confirmed by the user U1 from the determination result of the determination unit 105 (step S151). For example, the extraction unit 106 extracts a difference between the regular expression before and after the correction, that is, a positive example and a negative example when the first result and the second result are different, as a portion to be confirmed by the user U1.

[0052] Suppose the generated positive examples are "user@example.com", "john.doe@domain.test", and "info@example.net". Among the generated positive examples, "john.doe@domain.test" is rejected by the modified regular expression.

[0053] Also, suppose the generated negative examples are "user@example.co.jp", "john.doe@domain.co.jp", and "info@example.co.jp". Of the generated negative examples, "info@example.co.jp" is assumed to be accepted by the modified regular expression.

[0054] In this case, the extraction unit 106 extracts the positive example "john.doe@domain.test" and the negative example "info@example.co.jp".

[0055] The determining unit 107 groups the example strings extracted by the extracting unit 106 and determines the priority and confirmation content of each group (step S152). For example, the determining unit 107 performs grouping based on the length of a specific portion of the example string or whether the example string partially matches a specific string.

[0056] Here, it is assumed that the positive examples and negative examples are email addresses. In this case, the determining unit 107 performs grouping based on the length of the portion before the "@". For example, the determining unit 107 groups the example strings into groups of one character before the "@", groups of two characters before the "@", etc.

[0057] Then, the determining unit 107 determines the priority based on the number of example strings in each group. For example, if the number of example strings in a group with five characters before the "@" is 1 and the number of example strings in a group with eight characters before the "@" is 10, the determining unit 107 determines the priority of the group with eight characters before the "@" to be higher than that of the group with five characters before the "@".

[0058] Furthermore, the determining unit 107 may perform grouping by the top level domain of the email address (for example, a group with the top level domain "co.jp", a group with the top level domain "com", etc.).

[0059] If the determination unit 105 determines that the first result and the second result are different, the confirmation unit 108 outputs data for prompting the user for confirmation (steps S153 and S154).

[0060] Specifically, the confirmation unit 108 outputs a message or the like for confirming the user's intention based on the confirmation content determined by the determination unit 107. At this time, the confirmation unit 108 may determine whether to perform confirmation based on the priority. For example, the confirmation unit 108 outputs a confirmation message for confirmation content whose priority is higher than a threshold or for a certain number of confirmation content whose priority is higher.

[0061] The confirmation unit 108 receives the confirmation result from the user U1. For example, the confirmation result is information indicating whether or not to accept the difference (difference) between the results of acceptance or rejection of the example string before and after the correction.

[0062] If the check result indicates that the difference is acceptable, the modifying device 10 outputs the modified regular expression. On the other hand, if the check result indicates that the difference is not acceptable, the modifying device 10 modifies the regular expression again.

[0063] When the regular expression is to be corrected again, the generation unit 109 generates new positive examples and negative examples for correction by adding the generated positive examples and negative examples for which the differences were not accepted to the positive examples and negative examples for correction stored in the storage unit 153. The correction control unit 101 receives the newly generated positive examples and negative examples for correction from the generation unit 109 and performs correction processing.

[0064] Furthermore, the generating unit 109 updates the positive examples and negative examples for correction stored in the storage unit 153 with the newly generated positive examples and negative examples for correction. This allows the correction device 10 to recursively repeat the correction process until all differences are accepted by the user U1 or until no differences occur.

[0065] [Example of Screen] Here, a description will be given of screen transitions when a regular expression correction process is executed by the correction device 10 from the editor. First, the user describes the intention of the correction in the code to be written in the editor. The intention of the correction is described according to the syntax shown in Fig. 7. Fig. 7 is a diagram showing an example of the syntax for describing the intention of the correction.

[0066] The syntax in FIG. 7 indicates that the regular expression before correction, positive examples, and negative examples are written using "@auto-fix." The syntax in FIG. 7 also indicates that one or more positive examples and negative examples can be written, separated by ",". The syntax in FIG. 7 also indicates that positive examples are written following "positive" or "p," and negative examples are written following "negative" or "n." However, "p" and "n" may be uppercase.

[0067] 9, 10, 11, and 12 are diagrams showing examples of editor screens. Each screen shows code written by the user. The numbers written outside the box on the left indicate the number of lines. The number of lines is displayed for illustrative purposes only and does not necessarily need to be displayed in the actual editor.

[0068] As shown in screen 301 of Figure 9, the editor displays the program code written by the user. The "." enclosed in " / " on line 503 is a regular expression. The regular expression "." means that any one or more characters are followed by a "," (comma). However, it is assumed that the user wants to modify the regular expression so that it will accept strings that have at least one more character after the comma.

[0069] As shown on screen 302 in Fig. 10, the user writes positive examples and negative examples as comments on line 500. " / / " means to comment out. Positive examples and negative examples are expressed by "@auto-fix" according to the syntax in Fig. 7. Furthermore, the user encloses the regular expression on line 503 in "@auto-fix" and parentheses.

[0070] In response to a trigger, the editor passes the entire code in Fig. 10 or the portion marked with "@auto-fix" to the correction device 10 functioning as a plug-in. For example, the trigger may be a user right-clicking the mouse on the part marked with "@auto-fix" and the parentheses in the editor to call up a menu and selecting an extension command from the menu.

[0071] The correction device 10 reads the regular expression before correction intended by the user, the positive example, and the negative example from the part marked with "@auto-fix." In the example of Fig. 10, the correction device 10 reads that the regular expression before correction is ".", the positive example is "{"a,b"}", and the negative example is "{"a", "a,"}".

[0072] In this way, the correction device 10 reads pre-correction regular expressions, positive examples, and negative examples from the program code written in the editor. The correction device 10 lists regular expression candidates based on the pre-correction regular expressions, positive examples, and negative examples that it has read.

[0073] In particular, the correction device 10 reads a regular expression in the code that has a specific string (for example, "@auto-fix") attached to it as a regular expression before correction, and reads positive examples and negative examples from comments that have the specific string attached to them.

[0074] The corrector 103 returns the corrected regular expression ".,." to the editor. As shown on screen 303 in Fig. 11, the part "@auto-fix(.,)" containing the regular expression before correction is replaced with the corrected regular expression ".,."

[0075] In this way, it is possible to incorporate the functions of the editing device 10 into an editor such as an IDE. As a result, it becomes possible to statically edit regular expressions during the development process. This makes it possible to create regular expressions as intended by the user, and is expected to prevent security problems and bugs from being introduced into programs.

[0076] Note that, as in screen 304 of Fig. 12, when commented-out "@auto-fix" indicating the intention of correction is present in multiple locations, the one closest to the "@auto-fix" surrounding the regular expression is selected with priority. For example, in the example of Fig. 12, the commented-out "@auto-fix" on line 500 is selected, rather than lines 480 and 460, as the positive and negative examples corresponding to the "@auto-fix" surrounding the regular expression on line 503.

[0077] If there are multiple commented out "@auto-fix"s indicating the intention of correction on the same line, the correction device 10 gives priority to selecting the one on the left.

[0078] 13 is a diagram showing an example of a confirmation screen. As shown in FIG. 13, the confirmation unit 108 outputs a message for confirming the user's intention on a confirmation screen 305. The message may be displayed as a pop-up on the editor. Also, the confirmation screen 305 displays a button 3051 labeled "OK" and a button 3052 labeled "NG (re-correct)."

[0079] When the button 3051 is pressed, the editing device 10 determines that the user U1 has accepted the difference. On the other hand, when the button 3052 is pressed, the editing device 10 determines that the user U1 has not accepted the difference.

[0080] 13 is an example of a case where a positive example for which a corrected regular expression has been generated is rejected. When a negative example for which a corrected regular expression has been generated is accepted, the confirmation unit 108 can output a message such as "info@example.co.jp was originally rejected, but will be accepted after the correction. Is this OK?"

[0081] [Processing of the First Embodiment] The processing flow of the correction device 10 will be described with reference to Fig. 14. Fig. 14 is a flowchart showing the processing flow of the correction device. As shown in Fig. 14, first, the correction device 10 receives input of a regular expression and positive and negative examples for correction (step S11).

[0082] Next, the correction device 10 corrects the input regular expression (step S12), and generates positive examples and negative examples of the input regular expression (step S13).

[0083] Here, the correction device 10 selects one unselected positive example or negative example from the generated positive examples or negative examples (step S14).

[0084] The correction device 10 applies the selected positive example or negative example to the pre-correction regular expression and determines whether to accept or reject it (step S15). Note that if it is guaranteed in step S13 that the generated positive example is accepted by the pre-correction regular expression and the generated negative example is rejected by the pre-correction regular expression, step S15 may be omitted.

[0085] The correction device 10 applies the selected positive or negative example to the corrected regular expression and determines whether to accept or reject it (step S16).

[0086] The editing device 10 extracts the portion to be checked based on the judgment result (step S17). That is, the editing device 10 extracts the example character strings for which the result of acceptance or rejection differs before and after editing.

[0087] If there are unselected positive examples or negative examples (step S18, Yes), the correction device 10 returns to step S14 and repeats the process. If there are no unselected positive examples or negative examples (step S18, No), the correction device 10 proceeds to step S19.

[0088] The editing device 10 determines the priority of each part to be checked (step S19), and then checks the intention based on the part to be checked and the priority (step S20).

[0089] If the correction device 10 determines as a result of the check that further correction is necessary (user U1 did not accept the difference) (step S21, Yes), it adds the generated positive examples and negative examples to the positive examples or negative examples for correction (step S22) and proceeds to step S12. If the correction device 10 determines as a result of the check that further correction is not necessary (user U1 accepted the difference) (step S21, No), it ends the processing. When ending the processing, the correction device 10 outputs the corrected regular expression.

[0090] The flow of the regular expression correction process (step S12 in FIG. 14) will be described with reference to FIG. 15. FIG. 15 is a flowchart showing the flow of the correction process.

[0091] The processing flow of the editing device 10 will be described with reference to Fig. 15. Fig. 15 is a flowchart showing the processing flow of the editing device. As shown in Fig. 15, it is assumed that the editing device 10 has already acquired correction candidates.

[0092] The editing device 10 selects an appropriate editing tool for each of the edit candidates based on the input regular expression (step S1201). The editing device 10 can select an editing tool based on whether or not the positive and negative examples contain special symbols.

[0093] The editing device 10 attempts to perform editing using the selected editing tool (step S1202). At this time, the editing device 10 attempts to perform editing for each of the editing candidates.

[0094] The editing device 10 outputs the regular expression that satisfies the condition from among the obtained edited regular expressions (step S1203). For example, the editing device 10 outputs the regular expression that has been edited most quickly.

[0095] [Effects of the First Embodiment] As described above, the determination unit 105 determines whether a first result obtained by applying a character string to a pre-correction regular expression is the same as a second result obtained by applying a character string to a corrected regular expression obtained by correcting the pre-correction regular expression. Furthermore, if the determination unit 105 determines that the first result and the second result are different, the confirmation unit 108 outputs data for prompting the user to confirm. Specifically, the determination unit 105 determines that the first result and the second result are different if a positive example, which is a character string accepted by the pre-correction regular expression, is rejected by the corrected regular expression, or if a negative example, which is a character string rejected by the pre-correction regular expression, is accepted by the corrected regular expression.

[0096] In this way, if a difference occurs between a regular expression before and after correction, the correction device 10 can directly confirm with the user whether the difference is what the user intended. Therefore, the correction device 10 can accurately correct the regular expression as intended by the user. Furthermore, even if the correction device 10 does not correct the regular expression, it can support accurate correction by outputting the confirmation result.

[0097] [System Configuration, etc.] The components of each device shown in the figure are conceptual functional units and do not necessarily have to be physically configured as shown. In other words, the specific form of distribution and integration of each device is not limited to that shown, and all or part of the devices can be functionally or physically distributed or integrated in any unit depending on various loads, usage conditions, etc. Furthermore, all or any part of the processing functions performed by each device can be realized by a CPU (Central Processing Unit) and a program analyzed and executed by the CPU, or can be realized as hardware using wired logic.

[0098] Furthermore, among the processes described in this embodiment, all or part of the processes described as being performed automatically may be performed manually. It is also possible to perform the processes manually, or all or part of the processes described as being performed manually may be performed automatically using a known method. Furthermore, the information including the processing procedures, control procedures, specific names, various data, and parameters shown in the above documents or drawings may be changed as desired unless otherwise specified.

[0099] [Program] In one embodiment, the correction device 10 can be implemented by installing a program that executes the above-described processes as package software or online software on a desired computer. For example, by executing the above-described program on an information processing device, the information processing device can function as the correction device 10. The information processing device referred to here includes desktop and notebook personal computers. Furthermore, other information processing devices also include mobile communication terminals such as smartphones, tablet PCs, and the like.

[0100] The correction device 10 may also be implemented as a server device that provides a service related to the above processing to a client terminal device used by a user. For example, the server device may be implemented as a server device that receives an uncorrected regular expression as input and outputs a corrected regular expression as output. In this case, the server device may be implemented as a web server or as a cloud that provides a service related to the above processing by outsourcing.

[0101] 16 is a diagram showing an example of a computer that executes a program. The computer 1000 includes, for example, a memory 1010 and a CPU 1020. The computer 1000 also includes a hard disk drive interface 1030, a disk drive interface 1040, a serial port interface 1050, a video adapter 1060, and a network interface 1070. These components are connected by a bus 1080.

[0102] The memory 1010 includes a read-only memory (ROM) 1011 and a random access memory (RAM) 1012. The ROM 1011 stores a boot program such as a basic input / output system (BIOS). The hard disk drive interface 1030 is connected to a hard disk drive 1090. The disk drive interface 1040 is connected to a disk drive 1100. A removable storage medium such as a magnetic disk or optical disk is inserted into the disk drive 1100. The serial port interface 1050 is connected to a mouse 1110 and a keyboard 1120, for example. The video adapter 1060 is connected to a display 1130, for example.

[0103] The hard disk drive 1090 stores, for example, an OS 1091, an application program 1092, a program module 1093, and program data 1094. That is, the program that defines each process of the modification device 10 is implemented as a program module 1093 in which computer-executable code is written. The program module 1093 is stored, for example, in the hard disk drive 1090. For example, the program module 1093 for executing processes similar to those of the functional configuration of the modification device 10 is stored in the hard disk drive 1090. Note that the hard disk drive 1090 may be replaced with an SSD (Solid State Drive).

[0104] Furthermore, setting data used in the processing of the above-described embodiment is stored as program data 1094, for example, in the memory 1010 or the hard disk drive 1090. Then, the CPU 1020 reads the program module 1093 or the program data 1094 stored in the memory 1010 or the hard disk drive 1090 into the RAM 1012 as necessary, and executes the processing of the above-described embodiment.

[0105] The program module 1093 and program data 1094 may not necessarily be stored in the hard disk drive 1090, but may also be stored in a removable storage medium and read by the CPU 1020 via the disk drive 1100 or the like. Alternatively, the program module 1093 and program data 1094 may be stored in another computer connected via a network (such as a local area network (LAN) or a wide area network (WAN)). The program module 1093 and program data 1094 may then be read by the CPU 1020 from the other computer via the network interface 1070.

[0106] REFERENCE SIGNS LIST 10 Correction device 20 Automatic correction tool group 101 Correction control unit 102 Selection unit 103 Correction unit 104 Generation unit 105 Determination unit 106 Extraction unit 107 Decision unit 108 Confirmation unit 151, 152, 153 Storage unit 51 Input data 53 Correction candidate data 541, 542, 543, 544 Trial correction data

Claims

1. An information processing device comprising: a judgment unit that determines whether a first result obtained by applying a character string to a first regular expression is the same as a second result obtained by applying the character string to a second regular expression obtained by modifying the first regular expression; and a confirmation unit that outputs data to prompt a user for confirmation when the judgment unit determines that the first result and the second result are different.

2. The information processing device described in claim 1, characterized in that the judgment unit judges that the first result and the second result are different when a positive example, which is a string accepted by the first regular expression, is rejected by the second regular expression, or when a negative example, which is a string rejected by the first regular expression, is accepted by the second regular expression.

3. An information processing method executed by an information processing device, comprising: a determination step of determining whether a first result obtained by applying a character string to a first regular expression is the same as a second result obtained by applying the character string to a second regular expression obtained by modifying the first regular expression; and a confirmation step of outputting data to prompt a user for confirmation if the determination step determines that the first result and the second result are different.

4. An information processing program that causes a computer to execute the following steps: a determination step of determining whether a first result obtained by applying a character string to a first regular expression is the same as a second result obtained by applying the character string to a second regular expression obtained by modifying the first regular expression; and a confirmation step of outputting data to prompt a user for confirmation if the determination step determines that the first result and the second result are different.

Citation Information

Patent Citations

  • Information processing device, information processing method, and information processing program

    WO2021205922A1

  • Correction device, correction method, and correction program

    WO2023238239A1