WO2014041783A1 - 文字列検出回路及び文字列検出方法 - Google Patents

文字列検出回路及び文字列検出方法 Download PDF

Info

Publication number
WO2014041783A1
WO2014041783A1 PCT/JP2013/005319 JP2013005319W WO2014041783A1 WO 2014041783 A1 WO2014041783 A1 WO 2014041783A1 JP 2013005319 W JP2013005319 W JP 2013005319W WO 2014041783 A1 WO2014041783 A1 WO 2014041783A1
Authority
WO
WIPO (PCT)
Prior art keywords
character string
input
length
match
detection
Prior art date
Application number
PCT/JP2013/005319
Other languages
English (en)
French (fr)
Inventor
浩明 井上
Original Assignee
日本電気株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 日本電気株式会社 filed Critical 日本電気株式会社
Priority to JP2014535372A priority Critical patent/JPWO2014041783A1/ja
Publication of WO2014041783A1 publication Critical patent/WO2014041783A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • G06F16/90344Query processing by using string matching techniques

Definitions

  • the present invention relates to a character string detection circuit and a character string detection method for detecting matching of character strings.
  • the present invention relates to a character string detection device and a character string detection method in consideration of the matching length of character strings.
  • Character string match detection has various applications in the industry, such as network intrusion detection and spam filter. In particular, in recent years, attention has been focused on matching detection in consideration of matching lengths of character strings.
  • FIG. 9 is a diagram showing a character string detection circuit 90 with a repetition number constraint for performing coincidence detection considering general character string repetition. Note that an example of the method of FIG. 9 is disclosed in Non-Patent Document 1.
  • the minimum repetition is 1 and the maximum number of repetitions is 40.
  • the input character string is detected by the state transition machine 91 generated from a regular expression, for example.
  • the state transition machine 91 sends a signal to the counter 92 to increment the internal counter if they match. That is, each time the state transition is repeated, the repetition count is increased by one.
  • the comparator 93 sends coincidence information to the output circuit 95 if the output result of the internal counter is 1 or more and 40 or less.
  • the non-coincidence detection circuit 94 monitors the internal state of the state transition machine 91 and sends a reset signal to the counter 92 and the output circuit 95 if there is no possibility of coincidence in the future.
  • the counter 92 returns the internal counter value to 0 by the reset signal. That is, if the state transition is not repeated, the number of repetitions is set to 0.
  • the output circuit 95 receives the reset signal, if the output results of the comparator 93 match, it determines that they match, and outputs a match result.
  • the state transition machine 91 of the method shown in FIG. 9 can detect a character string in consideration of the matching length for a character string consisting of one character repetition.
  • a character string formed by repeating one character is expressed as a repetition of a specific character or an arbitrary character such as “AAAAAA”. In this case, since the number of repetitions of “A” is 5 and the number of repetitions is 5, the number of repetitions is equal to the matching length. For this reason, it is possible to detect a character string in consideration of the matching length.
  • the method shown in FIG. 9 has a problem that a character string having no repetition cannot be detected as a character string in consideration of the matching length.
  • the present invention has been made in view of the above-described problems, and an object of the present invention is to provide an apparatus and method for processing match detection in consideration of the match length of a character string without limitation and at high speed.
  • the character string detection circuit includes a leading end detection unit that detects position information and matching information of a leading character string including the leading end of the detected character string from the input character string, and a termination including the end of the detected character string from the input character string.
  • End detection means for detecting position information and match information of the character string; intermediate detection means for detecting match information of the intermediate character string sandwiched between the leading character string and the end character string of the detected character string from the input character string;
  • a range length detecting means for detecting a detected character string in consideration of a match length from an input character string using position information and match information.
  • the character string detection method of the present invention detects the position information and the matching information of the leading character string including the leading end of the detected character string from the input character string, and the positional information of the terminal character string including the end of the detected character string from the input character string. And the matching information are detected, and the matching information of the intermediate character string sandwiched between the leading character string and the terminal character string in the detected character string is detected from the input character string in parallel, and the position information and the matching information are used.
  • a detection character string is detected from the input character string in consideration of the matching length.
  • match detection in consideration of the match length of a character string can be performed without being limited to repeated character strings. Also, match detection can be processed very quickly by utilizing multi-byte input.
  • FIG. 1 is a diagram showing a configuration example of a character string detection circuit 1 according to the first embodiment of the present invention.
  • the character string detection circuit 1 according to the embodiment of the present invention refers to a character string detection circuit with a matching length constraint. Further, the character string detection circuit 1 according to the embodiment of the present invention can be applied not only to the regular expression characters but also to the coincidence detection of symbols and patterns that are not in the regular expressions.
  • the character string detection circuit 1 includes a front end detection unit 2, an intermediate detection unit 3, an end detection unit 4, and a range length detection unit 5.
  • the character string detection circuit 1 is a circuit that compares the input character string with the detected character string and determines the match in consideration of the match length.
  • the leading edge detection unit 2, the middle detection unit 3, and the termination detection unit 4 detect the leading character string, the middle character string, and the termination character string of the detected character string from the input character string.
  • the front end detection unit 2, the intermediate detection unit 3, and the end detection unit 4 are separate components. However, if these detection functions can be realized as one coincidence detection unit, all of the detection units are not necessarily provided. It does not have to be an individual component.
  • the range length detection unit 5 receives the results output from the front end detection unit 2, the intermediate detection unit 3, and the end detection unit 4, and determines whether the input character string matches the detection character string based on the results.
  • FIG. 2 is a diagram showing a configuration of the detected character string 20 detected by the character string detection circuit 1 according to the first embodiment of the present invention.
  • the detected character string 20 includes a leading character string 21, an intermediate character string 22, and a terminal character string 23.
  • the leading character string 21 and the terminating character string 23 are character strings including the leading and trailing ends of the detected character string 20, respectively.
  • the leading character string 21 and the terminating character string 23 are generally assigned different codes from the intermediate character string 22.
  • the character lengths of the leading character string 21 and the terminal character string 23 are arbitrary, and can be specified as, for example, 1 byte or more.
  • the intermediate character string 22 corresponds to a character string considering the matching length.
  • the matching length indicates the number of characters in the intermediate character string 22 sandwiched between the leading character string 21 and the terminal character string 23.
  • the coincidence length is set as a range including either the minimum length or the maximum length, or both the minimum length and the maximum length. Since the intermediate character string 22 only needs to consider the matching length, only the number of characters need be defined. However, the intermediate character string 22 may include a specific character string as necessary.
  • the detected character string 20 is defined as “ABC... CYZ”, the leading character string 21 is defined as AB, the terminating character string 23 is defined as YZ, and the intermediate character string 22 is defined as a C repeating character string.
  • the maximum matching length is 5
  • the character strings “ABYZ”, “ABCYZ”, “ABCCYZ”, “ABCCCCYZ”, “ABCCCCYZ”, and “ABCCCCCYZ” are detected.
  • “ABCCCCCCYZ” is not a detection target because the matching length of the intermediate character string 22 is 6.
  • a C repeated character string is used as the intermediate character string 22.
  • the intermediate character string 22 may be composed of any character, and only the matching length is detected.
  • the character string detection circuit 1 In the character string detection circuit 1 according to the first exemplary embodiment of the present invention, not only the character string that completely matches the detected character string 20 is detected, but the leading character string 21 and the terminal character string 23 are completely matched. A character string including the intermediate character string 22 that matches the specified matching length condition is to be detected.
  • leading character string 21 and the terminating character string 23 can be defined in an arbitrary character string
  • the definition of the detected character string according to the embodiment of the present invention can be applied to a general character string.
  • the detected character string 20 may be realized as a logic circuit, stored in a storage element, or generally implemented in any manner that can determine a character.
  • FIG. 3 is a diagram showing the configuration of the input character string 30 input to the character string detection circuit 1 according to the first embodiment of the present invention.
  • a character string represented by a regular expression or the like can be handled.
  • a symbol string including symbols and patterns not represented by regular expressions can be handled as a character string.
  • the input character string 30 is composed of a plurality of partial character strings 31a, 31b,.
  • a character string that matches the detected character string 20 in consideration of the matching length is detected from the input character string 30.
  • the description is made using the partial character strings 31a, 31b,.
  • the input character string 30 is “ABCCCCCCCCYZ”.
  • the maximum character string length that the character string detection circuit 1 can process at a time is 4, the partial character string 31 can be set to “ABCC”, “CCCC”, and “CCYZ”.
  • the input character string 30 can be input to the character string detection circuit 1 at a time.
  • the lengths of the partial character strings 31a, 31b,..., 31n may all be set to the same, or may be set according to the appearance order of the character strings.
  • the partial character string 31 may include a code part and a data part, respectively. If each partial character string 31 can be stored at a specified address, the partial character string 31 includes only a data part. May be.
  • FIG. 4 shows an input character string 40 composed of a partial character string 41, a partial character string, and 42.
  • the input character string 40 is an example of the input character string 30 in FIG.
  • FIG. 5 is a diagram showing an example of an input method in the character string detection circuit 1 according to the first embodiment of the present invention.
  • the character string detection circuit 1 performs character string detection considering the matching length when the partial character string 41 and the partial character string 42 exist.
  • the partial character string 41 is input to the character string detection circuit 1 at time T0, and the partial character string 42 is input at time T1. That is, these partial character strings 41 and 42 are input to the character string detection circuit 1 in order at a certain time.
  • the input character string 40 is input to the front end detection unit 2, the intermediate detection unit 3, and the end detection unit 4 at the same time. Therefore, character strings are detected in parallel in each of the leading character string 21, the intermediate character string 22, and the terminal character string 23. Therefore, it is possible to perform character string detection processing at high speed.
  • the timing at which the partial character strings 41 and 42 are input to the character string detection circuit 1 is determined according to the processing capability of the range length detection unit 5. For example, when the range length detection unit 5 cannot perform parallel processing, the partial character string 42 may be input to the character string detection circuit 1 after the character string detection processing of the partial character string 41 is completed.
  • the partial character string 41 may be input to the character string detection circuit 1 even when the character string detection processing of the partial character string 41 is being executed. For example, by providing a plurality of front end detection units 2, intermediate detection units 3 and end detection units 4, paralleling internal processing of each detection unit, or providing a storage device inside each detection unit, Processing is possible. In addition, if the detection process can be executed in a pipeline manner, parallel processing can be executed continuously, so that higher-speed processing is possible. The character string detection in consideration of the matching length is performed according to the input method of the partial character strings 41 and 42. The detection method of the character string detection circuit 1 according to the first embodiment of the present invention is described here. Not limited to those.
  • the input character string 30 is defined as “FFABCCCCCYZFF”
  • the leading character string 21 is defined as “AB”
  • the terminating character string 23 is defined as “YZ”
  • the intermediate character string 22 is defined as a C repeated character string.
  • the maximum matching length is set to 5
  • the length of the partial character string is set to 4.
  • the leading edge detector 2 receives the partial character string 31 and detects the leading character string 21 in the partial character string 31.
  • the leading end position 11 and the leading end coincidence information 12 are transmitted to the range length detecting unit 5.
  • the leading end position 11 indicates the position of the leading end character string 21 in the partial character string 31.
  • the position means an offset in the partial character string 31.
  • it can be defined by the character position at the end of the leading character string 21.
  • an offset is an integer representing a distance from the head, but in the present embodiment, the position can be designated from either the left or the right of the partial character string 31.
  • the position is designated with reference to the left of the partial character string 31, if “FFAB” is input, the leading character string “AB” is third when counted from the top, and the leading edge position 11 is 3 Become.
  • the leading end matching information 12 indicates whether any character string in the partial character string 31 matches the leading character string 21 or is in the process of matching. That is, the leading end coincidence information 12 includes three pieces of information on coincidence, disagreement, and coincidence.
  • “on the way of matching” means a case where the leading character string 21 straddles a continuous partial character string 31 when the length of the leading character string 21 is 1 or more.
  • the intermediate detector 3 receives the partial character string 31 and detects the intermediate character string 22 in the partial character string 31.
  • the intermediate match information 13 indicating whether or not they match is transmitted to the range length detection unit 5.
  • the match information of the intermediate character string 22 indicates whether or not the match length is within a predetermined range.
  • the end detection unit 4 receives the partial character string 31 and detects the end character string 23 in the partial character string 31.
  • the end position 14 and the end match information 15 are transmitted to the range length detection unit 5.
  • the end position 14 indicates the position of the end character string 23 in the partial character string 23. For example, it can be defined at the character position where the terminal character string 23 starts. For example, when the position is specified with reference to the left of the partial character string 31, if “YZFF” is input, the terminal character string “ZF” is positioned second in the partial character string 31 when counted from the top.
  • a numerical value obtained by adding 2 to the partial character string length input so far is the end position 14.
  • the end match information 15 indicates whether any character string in the partial character string 31 matches the end character string 23 or is in the process of being matched.
  • the terminal match information 15 includes three pieces of information on match, mismatch, and matching.
  • the range length detection unit 5 includes a tip position 11 and tip match information 12 output from the tip detection unit 2, intermediate match information 13 output from the intermediate detection unit 3, and a termination position 14 and termination output from the termination detection unit 4.
  • a state transition machine that receives position information such as the coincidence information 15 and coincidence information is configured.
  • the range length detector 5 includes a counter (not shown) inside. Therefore, it is possible to consider either the minimum match length or the maximum match length, or both the minimum match length and the maximum match length.
  • FIG. 6 is a configuration diagram of the range length detection unit 5 according to the first embodiment of the present invention. The counter is not shown.
  • the range length detection unit 5 is configured as a state transition machine 60 including three states of an undetected state 61, a detecting state 62, and a semi-terminal state 63.
  • the undetected state 61 is a state in which a character string to be detected is not detected, and corresponds to a so-called initial state.
  • the detecting state 62 corresponds to a state in which the character string to be verified is verified based on the tip position 11, the tip match information 12, and the intermediate match information 13 output from the intermediate detection unit 3.
  • the semi-terminal state 63 is a state where the terminal character string 23 straddles the partial character string 31 to be input next, that is, the terminal character string 23 may be the terminal character string 23 but is the terminal character string 23 until the next time. This is a transition state when it is not possible to determine whether or not.
  • the range length detection unit 5 only needs to be a circuit that can calculate the range length from the information extracted by the front end detection unit 2, the intermediate detection unit 3, and the end detection unit 4. It is not necessarily limited to the configuration of FIG.
  • the state transition conditions of the state transition machine 60 shown in FIG. 6 will be described in detail.
  • the numerical value range is expressed by the expression “ ⁇ more than or less than”, but this is appropriately applied to general range expressions such as “greater than” or “less than”. It is possible to substitute.
  • the leading edge position 11 and the trailing edge position 14 are defined by positions with respect to the same reference such as the left end and the right end of the character string.
  • FFABCCCCCYZFF is set as the input character string 30, and “ABC... CYZ” including the leading character string “AB”, the intermediate character string “C... C”, and the terminal character string “YZ” is detected character string 20.
  • the length of the partial character string 31 is a value arbitrarily set in each state transition condition, and does not limit the embodiment of the present invention.
  • State transition condition S1 In the state transition condition S1, in the undetected state 61, the match information of the leading character string 21 indicates a match, the match information of the intermediate character string 22 indicates a match, and the match information of the end character string 23 indicates a match. It is a transition condition.
  • the match length of the intermediate character string 22 is determined to match.
  • the match result is output. Note that 0 or 1 can be specified for the minimum length, and 1 or more can be specified for the maximum length.
  • State transition condition S2 In the state transition condition S2, in the undetected state 61, the match information of the leading character string 21 indicates a match, the match information of the intermediate character string 22 indicates a match, and the match information of the end character string 23 indicates a mismatch. It is a transition condition.
  • the matching length of the intermediate character string 22 calculated from the partial character string length and the leading end position 11 is substituted into the counter. That is, since the leading character string 21 is detected and the intermediate character string is still within the predetermined range, the terminal character string 23 is awaiting detection.
  • the state transition condition S3 is a transition condition when the matching information of the leading character string 21 indicates mismatch, the matching information of the intermediate character string 22 matches, and the matching information of the terminal character string 23 indicates mismatch in the detecting state 62. It is.
  • the state transition condition S3 the state is changed from the detecting state 62 to the detecting state 62.
  • the partial character string length is added to the counter. Under this transition condition, a match with the leading character string 21 has already been detected, and the terminal character string 23 has not yet been detected. Therefore, while the intermediate character string 22 is within the predetermined range, the detecting state 62 is maintained. It shows that
  • the state transition condition S4 is a case where, in the detecting state 62, the matching information of the leading character string 21 indicates mismatch, the matching information of the intermediate character string 22 indicates matching, and the matching information of the terminal character string 23 indicates matching. It is a transition condition.
  • the matching length of the intermediate character string 22 calculated from the partial character string length and the end position 14 is added to the counter.
  • the matching length of the intermediate character string is within a predetermined range of not less than the specified minimum length and not more than the specified maximum length, the matching length of the leading character string 21, the intermediate character string 22, and the terminal character string Since 23 matches, a match result is output.
  • 0 or 1 can be specified for the minimum length, and 1 or more can be specified for the maximum length.
  • the case where “YZFF” is input corresponds to this condition.
  • the matching length of the intermediate character string 22 is 0, 0 is substituted for the counter.
  • the matching length is 4. That is, if the designated maximum length is 5, it is determined that the input character string 30 and the detected character string 20 match, and the character string detection circuit 1 outputs a match result.
  • the state transition condition S5 is a transition when the matching information of the leading character string 21 indicates mismatch, the matching information of the intermediate character string 22 matches, and the matching information of the terminal character string 23 indicates that the matching is in progress. It is a condition.
  • the match length of the intermediate character string 22 calculated from the partial character string length and the end position 14 is added to the counter.
  • the matching length of the intermediate character string 22 is not less than the specified minimum length and not more than the specified maximum length, the transition from the detecting state 62 to the half-terminated state 63 is made. That is, the leading character string 21 has already been detected, the intermediate character string 22 is determined to have a matching length, and the terminal character string 23 has been detected halfway.
  • the state transition condition S6 is a transition condition when the matching information of the leading character string 21 indicates matching, the matching information of the intermediate character string 22 matches, and the matching information of the terminal character string indicates that matching is in progress in the undetected state 61. It is.
  • the match length of the intermediate character string 22 calculated from the partial character string length and the end position 14 is added to the counter. As a result, if it is not less than the specified minimum length and not more than the specified maximum length, the state transits from the undetected state 61 to the half-terminated state 63.
  • the state transition condition S7 is a transition condition when the match information of the leading character string 21 indicates mismatch, the match information of the intermediate character string 22 matches, and the match information of the end character string 23 indicates match in the semi-terminal state 63. In the state transition condition S7, the transition from the semi-terminal state 63 to the undetected state 61 occurs.
  • the matching length of the intermediate character string 22 is within a predetermined range, and the terminal character string 23 has also been matched, the matching result is output unconditionally.
  • the state transition condition S8 is a transition condition when none of the state transition conditions S3, S4, and S5 is satisfied in the detecting state 62.
  • the state transition condition S8 the state is changed from the detecting state 62 to the undetected state 61.
  • the transition to the undetected state 61 is made. It is a condition.
  • the state transition condition S8 can be taken when inputting “FFABCCCCCCYZFF”, “FFABCCCCYKFF”, or the like.
  • the state transition condition S9 is a transition condition when the state transition condition S7 is not satisfied in the semi-terminal state 63.
  • the leading character string 21 is detected, the matching condition of the intermediate character string 22 is also satisfied, and a partial character string 31 is input when a part of the terminal character string 23 is matched.
  • This is a condition when the match information does not match or the match information of the terminal character string 23 does not match.
  • positions such as the leading edge information 11 and the leading edge matching information 12, the trailing edge information 14 and the trailing edge matching information 15, and the intermediate matching information 13 with respect to the input character string.
  • the intermediate character string 22 having the designated range length can be detected from the information and the matching information.
  • the character string detection circuit 1 As described above, according to the character string detection circuit 1 according to the first embodiment of the present invention, by focusing on the leading character string 21 and the terminal character 23, a wide range of matching lengths that do not remain in the repeated character string is considered. Character string detection processing is possible.
  • the state transition machine 60 is driven by the information extracted by the front end detection unit 2, the intermediate detection unit 3, and the end detection unit 4. That is, since processing is performed using multi-byte input, very high speed processing is possible.
  • the character string detection circuit 1 As described above, according to the character string detection circuit 1 according to the first embodiment of the present invention, since the state transition machine is used after extracting important information, very high-speed processing is possible. .
  • FIG. 7 shows a character string detection circuit 70 according to the second embodiment of the present invention.
  • the character string detection circuit 70 includes a front end detection unit 72, an intermediate detection unit 73, an end detection unit 74, a range length detection unit 75, and a character string processing unit 71. That is, in the character string detection circuit 70, a character string processing unit 71 is added to the character string detection circuit 1 according to the first embodiment. In addition, since the output result of each character string detection part is the same as 1st Embodiment, the flow of the output result was shown only with the arrow.
  • the character string processing unit 71 divides the input character string 30 into partial character strings 31 having a predetermined length. Note that the length of the character string to be divided can be arbitrarily set.
  • the character string processing unit 71 divides the input character string 30 into equal parts, a length based on the lengths of the leading character string 21 and the terminal character string 23, or a length based on the intermediate character string 22. be able to.
  • the input character string 30 is “ABCCCCCCCCYZ”, it is possible to set “ABCC”, “CCCC”, and “CCYZ” by dividing into three equal parts. Further, when it is known that the leading character string 21 and the terminating character string 23 include a code, the partial character string may be set in consideration of the length of the code.
  • a value that makes the length of the partial character string 31 longer than the length of the detected character string 20 may be set, or conversely, the length of the partial character string 31 may be changed. Good.
  • the length of the partial character string 31 can be gradually shortened or lengthened.
  • the partial character string 31 can be “ABCCC”, “CCCC”, “CYZ”, or “ABC”, “CCCC”, “CCCYZ”.
  • the length of the partial character string 31 may be set at random, for example, “AB”, “CCCCCC”, “YZ”. Note that the method of generating the partial character string 31 by dividing the input character string 30 is not limited to the above, but depends on the processing capability of each detection unit and the performance and settings of the devices at the external input source and output destination. Can be set arbitrarily.
  • the division of the input character string 30 by the character string processing unit 71 is not limited to the above.
  • FIG. 8 is a diagram illustrating an example of the configuration of the character string processing unit 71.
  • the character string processing unit 71 shown in FIG. 8 includes a character string dividing unit 81, a storage unit 82, a timing unit 83, a selection unit 84, and an output unit 85.
  • the character string dividing unit 81 divides the input character string 30 into a predetermined length and creates a partial character string 31.
  • the length for dividing the input character string 30 can be arbitrarily set.
  • the character string dividing unit 81 may divide the input character string 30 into equal parts, may be divided into lengths set according to the length of the detected character string 20, or may be divided into random lengths. May be.
  • the length of the code part of the input character string 30 is known in advance, only the code part may be taken out and the other data part may be divided into arbitrary lengths.
  • the storage unit 82 stores the partial character string 31 divided into a predetermined length.
  • the timing unit 83 transmits a signal to the selection unit 84 at the timing of acquiring the partial character string 31 from the storage unit 82.
  • the timing unit 83 can transmit a signal at a set timing. Further, if the timing unit 83 is synchronized with the counter in the range length detection unit 75, a signal can be transmitted in accordance with the processing of the range length detection unit 75. When synchronizing with a counter provided in an external arithmetic processing unit, processing may be performed in accordance with the timing of the counter.
  • the selection unit 84 selects the partial character string 31 from the storage unit 82 according to the timing of the signal from the timing unit 83 and transmits it to the output unit 85.
  • the output unit 85 outputs the partial character string 31 transmitted from the selection unit 84. Note that the selection unit 84 and the output unit 85 may be common components.
  • the above is a brief description of the configuration and operation of the character string processing unit 71.
  • the character string processing unit 71 is not limited to the above-described configuration and operation as long as the input character string 30 is divided.
  • the input character string can be input without being divided into the partial character strings 31 before the input character string 30 is input to the character string detection circuit 70. 30 can be input as it is. Further, the partial character string 31 can be transmitted to the range length detection unit 75 at the timing of the internal timing unit 83 without setting the input timing of the partial character string 31. As described above, according to the character string detection circuit 70 of the second embodiment, the input character string 30 is divided into lengths that can be easily processed by the range length detection unit 75, so that processing at higher speed is possible. Become.

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

 入力文字列から検出文字列の先端を含む先端文字列の位置情報と一致情報とを検出する先端検出手段と、入力文字列から検出文字列の終端を含む終端文字列の位置情報と一致情報とを検出する終端検出手段と、検出文字列において先端文字列と終端文字列に挟まれた中間文字列の一致情報を入力文字列から検出する中間検出手段と、を有する一致検出手段と、位置情報及び一致情報を用いて入力文字列から一致長を考慮して検出文字列を検出する範囲長検出手段と、を備える文字列検出回路とする。

Description

文字列検出回路及び文字列検出方法
 本発明は、文字列の一致検出をする文字列検出回路及び文字列検出方法に関する。特に、文字列の一致長を考慮した文字列検出装置及び文字列検出方法に関する。
 文字列一致検出は、ネットワーク侵入検知や迷惑メールフィルタ等、産業界で様々な応用が存在する。とりわけ近年、文字列の一致長を考慮した一致検出に注目が集まっている。
 例えば、最大一致長が2文字として任意のアルファベットとの一致検出を考える。この例では、AやABという文字列に関しては一致検出されるものの、ABCという文字列に関しては最大一致長が3となるために検出されない。このように、一致長を指定することで、より高精度な文字列一致検出を実現することができる。しかしながら、このような文字列の一致長を考慮した一致検出を高速に実現することは非常に困難であった。
 図9は、一般的な文字列の繰返しを考慮した一致検出を行う繰返し数制約付き文字列検出回路90を示した図である。なお、図9の方式の一例は、非特許文献1に開示されている。
 この例では、最小繰返しを1、最大繰返し数を40としている。文字列検出回路90では、入力文字列を、例えば、正規表現から生成される状態遷移機械91によって一致検出を行う。この状態遷移機械91は、もし一致していればカウンタ92に内部カウンタを増加させる信号を送る。すなわち、状態遷移が繰り返されるたびに、繰返し回数を1増やす。比較器93は内部カウンタの出力結果が1以上40以下であれば、一致情報を出力回路95へ送る。
 続いて、非一致検出回路94は状態遷移機械91の内部状態を監視し、もし今後一致する可能性がなければカウンタ92と出力回路95にリセット信号を送る。カウンタ92はリセット信号により内部カウンタ値を0に戻す。すなわち、状態遷移が繰り返されなければ繰返し回数を0とし、出力回路95はリセット信号を受信した際に、比較器93の出力結果が一致していれば一致と判定し、一致結果を出力する。
 図9に示した方式の状態遷移機械91は、1文字の繰返しからなる文字列に関しては、一致長を考慮した文字列の検出が可能である。1文字の繰返しからなる文字列とは「AAAAA」のような、特定の文字や任意の文字の繰返しとして表現される。この場合、「A」の繰返し数は5で、かつ、繰返し回数は5となるため、繰返し回数が一致長と同値になる。そのため、一致長を考慮した文字列の検出が可能となる。
M.Faezipour、M.Nourani、"Constraint Repetition Inspection for Regular Expression on FPGA、"16th IEEE Symposium on High Performance Interconnects、pp.111-118(2008)
 図9に示した方式では、「ABBBC」という繰返し文字列ではない文字列の一致長を出力したい場合、入力文字列として「ABBBC」が与えられたとしても、AとCという異なる文字が付加されている。そのため、本方式では繰返し回数の1が出力され、実際の一致長である5は出力されない。
 すなわち、図9に示した方式では、繰返しを持たない文字列に関しては、一致長を考慮した文字列として検出できないという課題があった。
 また、図9に示した方式では、単一の状態遷移機械によってシリアルに処理を行うため、多バイト入力による処理が難しい。そのため、多バイト入力によって、文字列を高速に処理することができないという課題があった。
 本発明は上述の課題を鑑みてなされたものであり、文字列の一致長を考慮した一致検出を、制限なく、かつ高速に処理する装置及び方法を提供することを目的とする。
 本発明の文字列検出回路は、入力文字列から検出文字列の先端を含む先端文字列の位置情報と一致情報とを検出する先端検出手段と、入力文字列から検出文字列の終端を含む終端文字列の位置情報と一致情報とを検出する終端検出手段と、検出文字列の先端文字列と終端文字列に挟まれた中間文字列の一致情報を入力文字列から検出する中間検出手段と、を有する一致検出手段と、位置情報及び一致情報を用いて入力文字列から一致長を考慮して検出文字列を検出する範囲長検出手段と、を備える。
 本発明の文字列検出方法は、入力文字列から検出文字列の先端を含む先端文字列の位置情報と一致情報との検出、入力文字列から検出文字列の終端を含む終端文字列の位置情報と一致情報との検出、及び検出文字列において先端文字列と終端文字列に挟まれた中間文字列の一致情報を入力文字列からの検出、を並列で行い、位置情報及び一致情報を用いて入力文字列から一致長を考慮して検出文字列を検出する。
 本発明によれば、文字列の一致長を考慮した一致検出を、繰返し文字列に制限されずに実施することができる。また、一致検出を、多バイト入力を活用することで、非常に高速に処理することができる。
本発明の第1の実施形態に係る文字列検出回路の構成図である。 本発明の第1の実施形態において検出対象とする文字列の構成図である。 本発明の第1の実施形態に係る文字列検出回路における入力文字列の構成図である。 本発明の第1の実施形態に係る文字列検出回路における入力文字列の構成図の一例である。 本発明の第1の実施形態に係る文字列検出回路の動作例を示す図である。 本発明の第1の実施形態に係る文字列検出回路の範囲長検出部の状態遷移図である。 本発明の第2の実施形態に係る文字列検出回路の構成図である。 本発明の第2の実施形態に係る文字列検出回路の文字列処理部の構成図である。 一般的な構成の最大長制約付き文字列検出回路の構成図である。
 以下において、本発明を実施するための形態について図面を参照しながら説明する。
 (第1の実施形態)
 (文字列検出回路)
 図1は、本発明の第1の実施形態に係る文字列検出回路1の構成例を示す図である。なお、本発明の実施形態に係る文字列検出回路1は、一致長制約付き文字列検出回路のことを指す。また、本発明の実施形態に係る文字列検出回路1は、正規表現の文字だけではなく、正規表現にはない記号やパターンなどの一致検出にも適応できる。
 図1を参照すると、文字列検出回路1は、先端検出部2、中間検出部3、終端検出部4及び範囲長検出部5を備えている。
 文字列検出回路1は、入力された文字列と検出文字列との比較を行い、一致長を考慮してそれらの一致を判定する回路である。
 先端検出部2、中間検出部3、終端検出部4は、入力された文字列から、検出文字列の先端文字列、中間文字列、終端文字列のそれぞれを検出する。なお、先端検出部2、中間検出部3、終端検出部4は、それぞれ別の構成要素としているが、これらの検出機能を一つの一致検出部として実現することができれば、必ずしも検出部の全てを個別の構成要素としなくてもよい。
 範囲長検出部5は、先端検出部2、中間検出部3、終端検出部4から出力された結果を入力し、それらの結果から入力された文字列と検出文字列の一致を判定する。
 なお、上述の各構成要素の詳細については、後ほどあらためて説明する。
 (検出文字列)
 図2は、本発明の第1の実施形態に係る文字列検出回路1が検出する検出文字列20の構成を示す図である。
 検出文字列20は、先端文字列21、中間文字列22及び終端文字列23からなる。
 先端文字列21及び終端文字列23は、それぞれ検出文字列20の先端、終端を含む文字列である。先端文字列21及び終端文字列23には、一般に中間文字列22とは異なる符号が割り当てられている。また、先端文字列21及び終端文字列23の文字長は任意であり、例えば、1バイト以上などと指定できる。
 中間文字列22は、一致長を考慮する文字列に相当する。なお、一致長とは、先端文字列21と終端文字列23に挟まれた中間文字列22の文字数を示す。また、一致長は、最小長または最大長のいずれか一方、もしくは最小長及び最大長の両方を含む範囲として設定される。中間文字列22は、一致長のみを考慮すればよいため、文字数のみを定義すればよい。ただし、中間文字列22については、必要に応じて特定の文字列を含むこととしても構わない。
 例えば、検出文字列20を、「ABC・・・CYZ」とし、先端文字列21をAB、終端文字列23をYZ、中間文字列22をCの繰返し文字列と定義する。仮に、最大一致長を5とすると、「ABYZ」、「ABCYZ」、「ABCCYZ」、「ABCCCYZ」、「ABCCCCYZ」、「ABCCCCCYZ」という文字列が検出対象となる。しかしながら、「ABCCCCCCYZ」は、中間文字列22の一致長が6となるため、検出対象外である。この例では、中間文字列22としてCの繰返し文字列をあげたが、中間文字列22は任意の文字で構成されていてもよく、一致長のみを検出対象とする。
 本発明の第1の実施形態に係る文字列検出回路1では、検出文字列20と完全一致した文字列のみを検出対象とするのではなく、先端文字列21、終端文字列23と完全一致し、指定した一致長の条件に合致する中間文字列22を含む文字列が検出対象となる。
 このように、任意の文字列において先端文字列21及び終端文字列23を規定することができるため、本発明の実施形態に係る検出文字列の定義は、一般的な文字列に適用できる。
 なお、検出文字列20は、論理回路として実現されてもよいし、記憶素子に格納されていてもよいし、一般に文字が判定できる方式であればどのような実装でも構わない。
 (入力文字列)
 図3は、本発明の第1の実施形態に係る文字列検出回路1に入力される入力文字列30の構成を示す図である。入力文字列30としては、正規表現などで表される文字列を取り扱うことができる。また、正規表現で表されていない記号やパターンなどを含む記号列を文字列として取り扱うこともできる。
 入力文字列30は、任意長の文字列からなる複数個の部分文字列31a、31b、・・・、31nから構成される。この入力文字列30から検出文字列20と一致長を考慮した上で一致する文字列を検出する。なお、本発明の実施形態においては、部分文字列31a、31b、・・・、31nを用いて説明する際に、特に区別する必要がないときは部分文字列31と記載する。
 例えば、入力文字列30が「ABCCCCCCCCYZ」であるとする。文字列検出回路1が一度に処理できる最大の文字列長が4である場合、部分文字列31は、「ABCC」、「CCCC」、「CCYZ」に設定できる。無論、最大の文字列長が入力文字列長より大きければ、入力文字列30を一度に文字列検出回路1へと入力することができる。
 ただし、部分文字列31a、31b、・・・、31nのそれぞれの長さは、全て同じに設定してもよく、文字列の出現順などに応じて設定してもよい。
 なお、部分文字列31は、それぞれ符号部分とデータ部分を含んでいてもよく、また、それぞれの部分文字列31を指定したアドレスに保存することができるのであれば、データ部分のみから構成されていてもよい。
 (動作)
 以下において、図4及び図5を用いて本発明の第1の実施形態に係る文字列検出回路1の動作を説明する。
 図4は、部分文字列41と部分文字列と42からなる入力文字列40である。入力文字列40は、図3の入力文字列30の一例である。
 図5は、本発明の第1の実施形態に係る文字列検出回路1における入力方式の一例を示した図である。
 文字列検出回路1は、部分文字列41及び部分文字列42が存在したときに、一致長を考慮した文字列検出を行う。
 文字列検出回路1に対して、時刻T0では部分文字列41を入力し、時刻T1では部分文字列42を入力する。すなわち、これらの部分文字列41、42は、ある時刻で、順序良く文字列検出回路1に入力される。この際、入力文字列40は、先端検出部2、中間検出部3及び終端検出部4に同時刻に入力されることになる。そのため、先端文字列21、中間文字列22、終端文字列23のそれぞれにおいて、並列で文字列検出される。そのため、高速での文字列検出処理が可能となる。
 なお、部分文字列41、42を文字列検出回路1に入力するタイミングは、範囲長検出部5の処理能力に応じて決定される。例えば、範囲長検出部5が並列処理できない場合、部分文字列42は、部分文字列41の文字列検出処理が終了してから文字列検出回路1に入力すればよい。
 また、文字列検出回路1において並列処理が可能であれば、部分文字列41の文字列検出処理が実行中であっても、部分文字列41を文字列検出回路1に入力してもよい。例えば、先端検出部2、中間検出部3及び終端検出部4を複数設けたり、それぞれの検出部の内部処理を並行にしたり、それぞれの検出部の内部に記憶装置を設けたりすることによって、並行処理が可能となる。また、パイプライン方式で検出処理を実行することが可能であれば、並列処理を連続的に実行することができるため、さらに高速な処理が可能となる。なお、部分文字列41、42の入力方式によって、一致長を考慮した文字列検出が実施されるが、本発明の第1の実施形態に係る文字列検出回路1の検出方式は、ここであげたものに限らない。
 以下において、文字列検出回路1の構成を詳細に説明する。例として、入力文字列30を「FFABCCCCYZFF」とし、先端文字列21を「AB」、終端文字列23を「YZ」、中間文字列22をCの繰返し文字列と定義する。この時、最大一致長を5とし、部分文字列の長さは4とする。
 (先端検出部)
 先端検出部2は、部分文字列31を入力とし、その部分文字列31における先端文字列21を検出する。
 先端文字列21が検出された場合には、先端位置11と先端一致情報12とを範囲長検出部5へと送信する。
 先端位置11とは、部分文字列31内における先端文字列21の位置を示す。ここで、位置とは部分文字列31におけるオフセットを意味する。例えば、先端文字列21の末尾の文字位置で定義することができる。一般に、オフセットとは先頭からの距離を表わす整数であるが、本実施形態においては、部分文字列31の左または右からのどちらからでも位置を指定可能である。例えば、部分文字列31の左を基準として位置を指定する場合、「FFAB」を入力すると、先端文字列「AB」は先頭から数えると3番目に位置しているので、先端位置11は3となる。
 また、先端一致情報12とは、部分文字列31内のいずれかの文字列が、先端文字列21と一致したか否か、または、一致途上か、のいずれかを示す。すなわち、先端一致情報12は、一致、不一致、一致途上の3つの情報を含む。ここで、一致途上とは、先端文字列21の長さが1以上の場合において、先端文字列21が連続する部分文字列31にまたがっている場合を意味する。
 (中間検出部)
 中間検出部3は、部分文字列31を入力とし、その部分文字列31において、中間文字列22を検出する。
 中間文字列22が検出された場合には、一致したか否かを示す中間一致情報13を、範囲長検出部5へと送信する。ここで、中間文字列22の一致情報は、一致長が所定の範囲内にあるか否かを示すことになる。
 (終端検出部)
 終端検出部4は、部分文字列31を入力とし、その部分文字列31において、終端文字列23を検出する。
 終端文字列23が検出された場合には、終端位置14と終端一致情報15とを範囲長検出部5へと送信する。
 終端位置14とは、部分文字列23内における終端文字列23の位置を示す。例えば終端文字列23が始まる文字位置で定義することができる。例えば、部分文字列31の左を基準として位置を指定する場合、「YZFF」を入力すると、終端文字列「ZF」はその部分文字列31においては先頭から数えると2番目に位置している。ここで、それまでに入力した部分文字列長に2を加えた数値が終端位置14となる。
 また、終端一致情報15とは、部分文字列31内のいずれかの文字列が、終端文字列23と一致したか否か、一致途上か、のいずれかを示す。すなわち、終端一致情報15は、一致、不一致、一致途上の3つの情報を含む。
 (範囲長検出部)
 範囲長検出部5は、先端検出部2から出力された先端位置11及び先端一致情報12、中間検出部3から出力された中間一致情報13、終端検出部4から出力された終端位置14及び終端一致情報15、といった位置情報と一致情報を入力とする状態遷移機械を構成する。範囲長検出部5は、内部に図示しないカウンタを備える。そのため、最小一致長または最大一致長のいずれか一方、もしくは最小一致長及び最大一致長の両方を考慮することが可能である。
 図6は、本発明の第1の実施形態に係る範囲長検出部5の構成図である。なお、カウンタは図示していない。
 図6を参照すると、範囲長検出部5は、未検出状態61、検出中状態62、半終端状態63の3状態からなる状態遷移機械60として構成される。
 未検出状態61は、検出する文字列を検出していない状態であり、いわゆる初期状態に相当する。
 検出中状態62は、先端位置11と先端一致情報12、中間検出部3から出力された中間一致情報13を元に、検証対象の文字列を検証している状態に対応する。
 半終端状態63は、終端文字列23が次に入力される部分文字列31にまたがっている状態、すなわち、終端文字列23である可能性はあるが次の時刻まで終端文字列23であるか否かの判断がつかない場合に遷移する状態である。
 ただし、本発明の実施形態に係る範囲長検出部5は、先端検出部2、中間検出部3、終端検出部4によって抽出された情報から、範囲長を算出できる回路でありさえすればよく、図6の構成に限定されるわけではない。
 ここで、図6に示した状態遷移機械60の状態遷移条件について詳細に説明する。なお、これ以降の説明においては、数値範囲を「~以上、~以下」という表現で範囲しているが、これは、「~より大きい」、「~より小さい」といった、一般の範囲表現に適宜置換することが可能である。また、以下の状態遷移条件の説明においては、先端位置11及び終端位置14は、文字列の左端、右端などといった同じ基準に対する位置で定義する。
 以下の説明においては、一般的な文字列を入力することを想定し、実施形態としてはS1~S9という状態遷移条件について説明している。
 また、「FFABCCCCYZFF」を入力文字列30とし、先端文字列「AB」、中間文字列「C・・・C」、終端文字列「YZ」からなる「ABC・・・CYZ」を検出文字列20とした例を交えて説明を加える。なお、以下に加える説明は一例であり、部分文字列31の長さは、各状態遷移条件において任意に設定した値であって、本発明の実施形態を限定するものではない。
 (状態遷移条件S1)
 状態遷移条件S1は、未検出状態61において、先端文字列21の一致情報が一致を示し、中間文字列22の一致情報が一致を示し、終端文字列23の一致情報が一致を示した場合の遷移条件である。
 状態遷移条件S1では、未検出状態61から未検出状態61へと遷移する。
 ここで、終端位置14と先端位置11との差が、指定された最小長以上かつ指定された最大長以下という所定の範囲内に含まれるため、中間文字列22の一致長が一致と判定されることになり、一致結果を出力する。なお、最小長には0または1、最大長には1以上無限大が指定可能である。
 例えば、「FFABCCCCYZFF」を入力する例において、「FFABCCCCYZFF」を入力した場合が、この条件に相当する。
 (状態遷移条件S2)
 状態遷移条件S2は、未検出状態61において、先端文字列21の一致情報が一致を示し、中間文字列22の一致情報が一致を示し、終端文字列23の一致情報が不一致を示した場合の遷移条件である。
 状態遷移条件S2では、未検出状態61から検出中状態62へと遷移する。
 ここで、部分文字列長と先端位置11から算出された中間文字列22の一致長をカウンタに代入する。すなわち、先端文字列21が検出され、中間文字列は未だ所定の範囲内にあるため、終端文字列23の検出待ちの状態となる。
 例えば、「FFABCCCCYZFF」を入力する例において、「FFAB」を入力した場合が、この条件に相当する。「FFAB」を入力した場合、中間文字列の一致長は0なので、カウンタには0を代入する。
 (状態遷移条件S3)
 状態遷移条件S3は、検出中状態62において、先端文字列21の一致情報が不一致を示し、中間文字列22の一致情報が一致、終端文字列23の一致情報が不一致を示した場合の遷移条件である。
 状態遷移条件S3では、検出中状態62から検出中状態62へと遷移する。
 ここで、部分文字列長をカウンタに加算する。この遷移条件では、先端文字列21との一致は既に検出されており、終端文字列23が未だ未検出であるため、中間文字列22が所定の範囲内にあるうちは検出中状態62を維持することを示している。
 例えば、「FFABCCCCYZFF」を入力する例において、「CCCC」を入力した場合が、この条件に相当する。中間文字列22「CCCC」を入力した場合、カウンタに4を加算することになる。
 (状態遷移条件S4)
 状態遷移条件S4は、検出中状態62において、先端文字列21の一致情報が不一致を示し、中間文字列22の一致情報が一致を示し、終端文字列23の一致情報が一致を示した場合の遷移条件である。
 状態遷移条件S4では、検出中状態62から未検出状態61へと遷移する。
 ここで、部分文字列長と終端位置14から算出された、中間文字列22の一致長をカウンタに加算する。その結果、中間文字列の一致長が指定された最小長以上かつ指定された最大長以下という所定の範囲内であれば、先端文字列21と、中間文字列22の一致長と、終端文字列23が一致することになるため、一致結果を出力する。なお、最小長には0または1、最大長には1以上無限大が指定可能である。
 例えば、「FFABCCCCYZFF」を入力する例において、「YZFF」を入力した場合が、この条件に相当する。「YZFF」を入力した場合、中間文字列22の一致長は0なので、カウンタには0を代入する。ここで、状態遷移条件S3の結果と合わせると、その一致長は4である。すなわち、指定された最大長を5とすると、入力文字列30と検出文字列20とは一致すると判定され、文字列検出回路1からは、一致結果が出力される。
 (状態遷移条件S5)
 状態遷移条件S5は、検出中状態62において、先端文字列21の一致情報が不一致を示し、中間文字列22の一致情報が一致、終端文字列23の一致情報が一致途上を示した場合の遷移条件である。
 状態遷移条件S5では、部分文字列長と終端位置14から算出された、中間文字列22の一致長をカウンタに加算する。その結果、中間文字列22の一致長が指定された最小長以上かつ指定された最大長以下であれば、検出中状態62から半終端状態63へと遷移する。すなわち、先端文字列21は既に検出され、中間文字列22は一致長が一致と判定され、終端文字列23が途中まで検出された状態となる。
 例えば、「FFABCCCCYZFF」を入力する例において、既に先端文字列「AB」が検出済みであり、そこに「CCCY」を入力した場合が、この条件に相当する。「CCCY」を入力した場合、終端文字列「YZ」の途中までが検出された状態となる。
 (状態遷移条件S6)
 状態遷移条件S6は、未検出状態61において、先端文字列21の一致情報が一致を示し、中間文字列22の一致情報が一致、終端文字列の一致情報が一致途上を示した場合の遷移条件である。
 状態遷移条件S6では、部分文字列長と終端位置14から算出された、中間文字列22の一致長をカウンタに加算する。その結果、指定された最小長以上かつ指定された最大長以下であれば、未検出状態61から半終端状態63へと遷移する。
 例えば、「FFABCCCCYZFF」を入力する例において、「ABCCCY」を入力した場合が、この条件に相当する。「FFABCCCY」を入力した場合、終端文字列23「YZ」の途中までが検出された状態となる。
 (状態遷移条件S7)
 状態遷移条件S7は、半終端状態63において、先端文字列21の一致情報が不一致を示し、中間文字列22の一致情報が一致、終端文字列23の一致情報が一致を示した場合の遷移条件である
 状態遷移条件S7では、半終端状態63から未検出状態61へと遷移する。
 この場合、既に先端文字列21は検出済みであり、中間文字列22の一致長は所定の範囲内にあり、終端文字列23も一致したことになるため、無条件で一致結果を出力する。
 例えば、「FFABCCCCYZFF」を入力する例において、既に先端文字列「AB」が検出済みであり、そこに「CYZFF」を入力した場合が、この条件に相当する。「CYZFF」を入力した場合、中間文字列22と終端文字列23の両方が一致と判定されるため、検出文字列20が検出されたことになる。
 (状態遷移条件S8)
 状態遷移条件S8は、検出中状態62において、状態遷移条件S3、S4、S5の、いずれの条件も満足しない場合の遷移条件である。
 状態遷移条件S8では、検出中状態62から未検出状態61へと遷移する。
 すなわち、先端文字列21は検出されていたものの、中間文字列22が一致長の範囲内になかった場合、もしくは終端文字列23が一致条件を満たさなかった場合などに未検出状態61に遷移する条件である。
 例えば、「ABC・・・CYZ」を検出文字列20とし、中間文字列22の一致長を5とした場合に、「FFABCCCCCCYZFF」や「FFABCCCCYKFF」などを入力する際に状態遷移条件S8を取りうる。
 (状態遷移条件S9)
 状態遷移条件S9は、半終端状態63において、状態遷移条件S7を満足しない場合の遷移条件である。
 状態遷移条件S9では、半終端状態63から未検出状態61へと遷移する。
 すなわち、先端文字列21は検出され、中間文字列22の一致条件も満たされ、終端文字列23の一部が一致していたところに、ある部分文字列31が入力され、中間文字列22の一致情報が不一致、もしくは終端文字列23の一致情報が不一致となった際の条件である。
 例えば、「ABC・・・CYZ」を検出文字列20とした場合において、入力文字列30「FFABCCCCYKFF」を、「FFABC」、「CCCY」、「KFF」などの部分文字列31として入力する際に状態遷移条件S9を取りうる。
 このように、本発明の第1の実施形態によると、入力された文字列に対して、先端情報11及び先端一致情報12と、終端情報14及び終端一致情報15と、中間一致情報13といった位置情報と一致情報から、指定された範囲長の中間文字列22を検出することができる。
 以上が、本発明の第1の実施形態に係る範囲長検出部5の状態遷移条件の説明である。なお、本発明の第1の実施形態に係る範囲長検出部5の状態遷移条件は、上述の条件に限定されず、各状態遷移条件に種々の変形を加えてもよい。
 以上のように、本発明の第1の実施形態に係る文字列検出回路1によれば、先端文字列21と終端文字23に着目することで、繰返し文字列に留まらない幅広い、一致長を考慮した文字列検出処理が可能である。
 また、部分文字列31を状態遷移機械60で直接受信するのではなく、先端検出部2、中間検出部3、終端検出部4において抽出された情報によって状態遷移機械60を駆動する。すなわち、多バイト入力を活用して処理することになるため、非常に高速な処理が可能となる。
 このように、本発明の第1の実施形態に係る文字列検出回路1によれば、重要な情報を抽出してから状態遷移機械を活用するため、非常に高速な処理が可能となっている。
 (第2の実施形態)
 図7に、本発明の第2の実施形態に係る文字列検出回路70を示した。
 第2の実施形態に係る文字列検出回路70は、先端検出部72、中間検出部73、終端検出部74、範囲長検出部75及び文字列処理部71を備えている。すなわち、文字列検出回路70においては、第1の実施形態に係る文字列検出回路1に、文字列処理部71が追加されている。なお、それぞれの文字列検出部の出力結果は第1の実施形態と同じであるため、出力結果の流れを矢印のみで示した。
 文字列処理部71は、入力文字列30を所定の長さの部分文字列31に分割する。なお、分割する文字列の長さは、任意に設定可能である。
 文字列処理部71は、入力文字列30を、等分としたり、先端文字列21や終端文字列23の長さを基準とした長さとしたり、中間文字列22を基準とした長さにすることができる。
 例えば、入力文字列30が「ABCCCCCCCCYZ」である場合、3等分すると、「ABCC」、「CCCC」、「CCYZ」と設定できる。また、先端文字列21や終端文字列23に符号が含まれることが分かっている場合など、その符号の長さを考慮して部分文字列を設定してもよい。
 また、検出文字列20の長さよりも、部分文字列31の長さが長くなるような値を設定してもよいし、反対に部分文字列31の長さが変化するように設定してもよい。
 例えば、部分文字列31を入力していくにつれて、部分文字列31の長さを次第に短くしたり、次第に長くしたりすることができる。例えば、入力文字列30が「ABCCCCCCCCYZ」である場合、部分文字列31を「ABCCC」、「CCCC」、「CYZ」としたり、「ABC」、「CCCC」、「CCCYZ」としたりできる。
 また、部分文字列31の長さをランダムに設定してもよく、例えば、「AB」、「CCCCCC」、「YZ」とすることもできる。なお、入力文字列30を分割して部分文字列31を生成する方法はここにあげた限りではなく、各検出部の処理能力や外部の入力元・出力先にある装置の性能や設定に応じて任意に設定可能である。
 ただし、文字列処理部71による入力文字列30の分割は、ここであげた限りではない。
 図8は、文字列処理部71の構成の一例を示す図である。
 図8に示した文字列処理部71は、文字列分割部81と、記憶部82と、タイミング部83と、選択部84と、出力部85と、を備えている。
 文字列分割部81は、入力文字列30を所定の長さに分割し、部分文字列31を作製する。入力文字列30を分割する長さは、任意に設定可能である。例えば、文字列分割部81は、入力文字列30を、等分してもよく、検出文字列20の長さに応じて設定された長さに分割してもよく、ランダムな長さに分割してもよい。さらに、入力文字列30の符号部分の長さが予め分かっている場合は、符号部分のみを取り出し、それ以外のデータ部分を任意の長さに分割してもよい。
 記憶部82は、所定の長さに分割された部分文字列31を記憶する。
 タイミング部83は、選択部84に、記憶部82から部分文字列31を取得するタイミングで信号を送信する。タイミング部83は、設定されたタイミングで信号を送信できる。また、タイミング部83を範囲長検出部75内部のカウンタと同期させれば、範囲長検出部75の処理に合わせて信号を送信することもできる。外部の演算処理装置に設けられたカウンタと同期させる場合は、そのカウンタのタイミングに合わせて処理を行えばよい。
 選択部84は、タイミング部83からの信号のタイミングに応じて、記憶部82から部分文字列31を選択し、出力部85に送信する。
 出力部85は、選択部84から送信されてきた部分文字列31を出力する。なお、選択部84と出力部85は、共通の構成要素としてもよい。
 以上が文字列処理部71の構成及び動作の簡単な説明である。なお、文字列処理部71は、入力文字列30を分割しさえすれば、上述の構成及び動作に限定することはない。
 以上のように、第2の実施形態に係る文字列検出回路70によれば、文字列検出回路70に入力文字列30を入力する前に、部分文字列31に分割しなくても入力文字列30をそのままの形で入力することができる。また、部分文字列31の入力タイミングを設定しなくても、内部のタイミング部83のタイミングで部分文字列31を範囲長検出部75に送信できる。このように、第2の実施形態の文字列検出回路70によれば、入力文字列30は、範囲長検出部75が処理しやすい長さに分割されるため、さらに高速での処理が可能となる。
 以上、本発明を上記実施形態に即して説明したが、本発明は、上記実施形態の構成や動作にのみ限定されるものではなく、本発明の範囲内で当業者であればなしうることが可能な各種変形、修正を含むことはもちろんである。
 この出願は、2012年9月11日に出願された日本出願特願2012-199015を基礎とする優先権を主張し、その開示の全てをここに取り込む。
 1  文字列検出回路
 2  先端検出部
 3  中間検出部
 4  終端検出部
 5  範囲長検出部
 20  検出文字列
 21  先端文字列
 22  中間文字列
 23  終端文字列
 30  入力文字列
 31  部分文字列
 40  入力文字列
 41、42  部分文字列
 61  未検出状態
 62  検出中状態
 63  半終端状態
 70  文字列検出回路
 71  文字列処理部
 72  先端検出部
 73  中間検出部
 74  終端検出部
 75  範囲長検出部
 81  文字列分割部
 82  記憶部
 83  タイミング部
 84  選択部
 85  出力部
 90  文字列検出回路
 91  状態遷移機械
 92  カウンタ
 93  比較器
 94  非一致検出回路
 95  出力回路

Claims (10)

  1.  入力文字列から検出文字列の先端を含む先端文字列の位置情報と一致情報とを検出する先端検出手段と、前記入力文字列から前記検出文字列の終端を含む終端文字列の位置情報と一致情報とを検出する終端検出手段と、前記検出文字列の前記先端文字列と前記終端文字列に挟まれた中間文字列の一致情報を前記入力文字列から検出する中間検出手段と、を有する一致検出手段と、
     前記位置情報及び前記一致情報を用いて前記入力文字列から一致長を考慮して前記検出文字列を検出する範囲長検出手段と、を備えることを特徴とする文字列検出回路。
  2.  前記入力文字列は、前記先端検出手段、前記中間検出手段及び前記終端検出手段のそれぞれに同じタイミングで入力されることを特徴とする請求項1に記載の文字列検出回路。
  3.  前記入力文字列は複数の部分文字列に分割され、
     前記複数の部分文字列はそれぞれタイミングをずらして前記一致検出手段に入力されることを特徴とする請求項1または2に記載の文字列検出回路。
  4.  前記範囲長検出手段は、
     前記複数の部分文字列を入力された順に処理することを特徴とする請求項3に記載の文字列検出回路。
  5.  前記範囲長検出手段は、
     前記先端文字列及び前記終端文字列の一致とともに、前記中間文字列の一致長を考慮した一致を検出する状態遷移機械を備え、
     前記状態遷移機械は、前記位置情報及び前記一致情報を入力とし、前記中間文字列の一致長を加算するカウンタを備えることを特徴とする請求項1乃至4のいずれか一項に記載の文字列検出回路。
  6.  前記状態遷移機械は、
     前記先端文字列が検出されていない未検出状態と、
     前記先端文字列の位置情報及び一致情報と前記中間文字列の一致情報を基に前記検出文字列が検出されている検出中状態と、
     前記終端文字列が部分的に検出されている半終端状態と、を有することを特徴とする請求項5に記載の文字列検出回路。
  7.  前記検出中状態において、
     前記範囲長検出手段は、
     前記終端文字列を部分的に検出した際に、前記部分文字列の長さと前記終端位置とから算出された前記中間文字列の一致長を前記カウンタに加算し、
     前記カウンタのカウンタ値が所定の範囲内である場合は前記半終端状態へと遷移し、
     前記カウンタのカウンタ値が前記所定の範囲内にない場合は前記未検出状態へと遷移することを特徴とする請求項5または6に記載の文字列検出回路。
  8.  前記半終端状態において、
     前記範囲長検出手段は、
     前記終端文字列が検出された場合、前記カウンタのカウンタ値が所定の範囲内である場合は一致結果を出力して前記未検出状態へと遷移し、
     前記カウンタのカウンタ値が前記所定の範囲内にない、もしくは前記終端文字列が検出されなかった場合、一致結果を出力することなく前記未検出状態へと遷移することを特徴とする請求項5または6に記載の文字列検出回路。
  9.  さらに、前記入力文字列を分割して前記部分文字列を作成する文字列処理手段を備えることを特徴とする請求項1乃至7のいずれか一項に記載の文字列検出回路。
  10.  入力文字列から検出文字列の先端を含む先端文字列の位置情報と一致情報との検出、前記入力文字列から前記検出文字列の終端を含む終端文字列の位置情報と一致情報との検出、及び前記検出文字列において前記先端文字列と前記終端文字列に挟まれた中間文字列の一致情報を前記入力文字列からの検出、を並列で行い、
     前記位置情報及び前記一致情報を用いて前記入力文字列から一致長を考慮して前記検出文字列を検出することを特徴とする文字列検出方法。
PCT/JP2013/005319 2012-09-11 2013-09-09 文字列検出回路及び文字列検出方法 WO2014041783A1 (ja)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2014535372A JPWO2014041783A1 (ja) 2012-09-11 2013-09-09 文字列検出回路及び文字列検出方法

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2012-199015 2012-09-11
JP2012199015 2012-09-11

Publications (1)

Publication Number Publication Date
WO2014041783A1 true WO2014041783A1 (ja) 2014-03-20

Family

ID=50277925

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2013/005319 WO2014041783A1 (ja) 2012-09-11 2013-09-09 文字列検出回路及び文字列検出方法

Country Status (2)

Country Link
JP (1) JPWO2014041783A1 (ja)
WO (1) WO2014041783A1 (ja)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009517782A (ja) * 2005-12-02 2009-04-30 エクセジー・インコーポレイテツド 高性能正規表現パターンマッチングのための方法および装置
JP2009093599A (ja) * 2007-10-12 2009-04-30 Nec Corp 文字列照合回路
WO2009147794A1 (ja) * 2008-06-04 2009-12-10 日本電気株式会社 有限オートマトン生成システム

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009517782A (ja) * 2005-12-02 2009-04-30 エクセジー・インコーポレイテツド 高性能正規表現パターンマッチングのための方法および装置
JP2009093599A (ja) * 2007-10-12 2009-04-30 Nec Corp 文字列照合回路
WO2009147794A1 (ja) * 2008-06-04 2009-12-10 日本電気株式会社 有限オートマトン生成システム

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
YUSAKU KANEDA ET AL.: "Kosoku Stream Shori no Tameno Bit Heiretsu Pattern Shogo Shuho ni Motozuku Hardware Algorithm", DAI 1 KAI FORUM ON DATA ENGINEERING AND INFORMATION MANAGEMENT -DEIM FORUM- RONBUNSHU, 25 December 2009 (2009-12-25), pages 1 - 5 *

Also Published As

Publication number Publication date
JPWO2014041783A1 (ja) 2016-08-12

Similar Documents

Publication Publication Date Title
JP4957500B2 (ja) 文字列照合回路
KR102137956B1 (ko) 블록 마이닝 방법 및 장치
US8972450B2 (en) Multi-stage parallel multi-character string matching device
KR102314619B1 (ko) 소프트웨어-규정된 네트워크 엔진에서 패킷 수정 및 포워딩을 위해서 룩업들을 생성하고 결정들을 수행하기 위한 장치 및 방법
JP5377667B2 (ja) ビット列生成装置及びビット列生成方法
JP2019201418A (ja) ランダムなデジタル値を生成する装置及び方法
JP6113091B2 (ja) ハッシュ値生成装置
TWI806340B (zh) 用於包括待測試的時序器件的流水線級的測試電路、測試方法和包括測試電路的計算系統
Geffert et al. Transforming two-way alternating finite automata to one-way nondeterministic automata
JP6423270B2 (ja) 乱数生成装置及び乱数生成方法
US20140237013A1 (en) Pseudo-random bit sequence generator
WO2014041783A1 (ja) 文字列検出回路及び文字列検出方法
JP6379032B2 (ja) 乱数生成装置及び乱数生成方法
JP2014232523A (ja) サブワード有限状態機械を利用する探索装置
WO2015165323A1 (zh) 一种数据处理方法、处理器及数据处理设备
CN101187692B (zh) 半导体集成电路
KR101276796B1 (ko) 패턴 매칭 장치 및 방법
Chen et al. A hybrid multiple-character transition finite-automaton for string matching engine
Klimushyn et al. Crypto-resistant methods and random number generators in internet of things (iot) devices
US9978451B2 (en) Connection for quick search of regular expressions in data
JP5298823B2 (ja) アラーム処理回路及びアラーム処理方法
JP2013175832A (ja) 画像処理装置、信号伝達回路及び半導体集積回路
JP6629640B2 (ja) コマンド制御装置、コマンド制御方法、及びコマンド制御プログラム
JP5960639B2 (ja) 情報処理装置および情報処理方法
Yun et al. Regular expression pattern matching supporting constrained repetitions

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13837773

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2014535372

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 13837773

Country of ref document: EP

Kind code of ref document: A1