US7257576B2 - Method and system for a pattern matching engine - Google Patents

Method and system for a pattern matching engine Download PDF

Info

Publication number
US7257576B2
US7257576B2 US10/177,087 US17708702A US7257576B2 US 7257576 B2 US7257576 B2 US 7257576B2 US 17708702 A US17708702 A US 17708702A US 7257576 B2 US7257576 B2 US 7257576B2
Authority
US
United States
Prior art keywords
string
pattern
patterns
value
characters
Prior art date
Legal status (The legal status 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 status listed.)
Expired - Fee Related, expires
Application number
US10/177,087
Other versions
US20030236783A1 (en
Inventor
Vlad Eminovici
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Microsoft Technology Licensing LLC
Original Assignee
Microsoft Corp
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 Microsoft Corp filed Critical Microsoft Corp
Priority to US10/177,087 priority Critical patent/US7257576B2/en
Assigned to MICROSOFT CORPORATION reassignment MICROSOFT CORPORATION ASSIGNMENT OF ASSIGNORS INTEREST (SEE DOCUMENT FOR DETAILS). Assignors: EMINOVICI, VLAD
Publication of US20030236783A1 publication Critical patent/US20030236783A1/en
Priority to US11/837,881 priority patent/US7873626B2/en
Application granted granted Critical
Publication of US7257576B2 publication Critical patent/US7257576B2/en
Assigned to MICROSOFT TECHNOLOGY LICENSING, LLC reassignment MICROSOFT TECHNOLOGY LICENSING, LLC ASSIGNMENT OF ASSIGNORS INTEREST (SEE DOCUMENT FOR DETAILS). Assignors: MICROSOFT CORPORATION
Adjusted expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10TECHNICAL SUBJECTS COVERED BY FORMER USPC
    • Y10STECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10S707/00Data processing: database and file management or data structures
    • Y10S707/99931Database or file accessing
    • Y10S707/99933Query processing, i.e. searching
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10TECHNICAL SUBJECTS COVERED BY FORMER USPC
    • Y10STECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10S707/00Data processing: database and file management or data structures
    • Y10S707/99931Database or file accessing
    • Y10S707/99933Query processing, i.e. searching
    • Y10S707/99935Query augmenting and refining, e.g. inexact access
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10TECHNICAL SUBJECTS COVERED BY FORMER USPC
    • Y10STECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10S707/00Data processing: database and file management or data structures
    • Y10S707/99931Database or file accessing
    • Y10S707/99933Query processing, i.e. searching
    • Y10S707/99936Pattern matching access
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10TECHNICAL SUBJECTS COVERED BY FORMER USPC
    • Y10STECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10S707/00Data processing: database and file management or data structures
    • Y10S707/99931Database or file accessing
    • Y10S707/99937Sorting

Definitions

  • This invention relates generally to a pattern matching engine and more specifically to a matching engine to match a string of characters to one or more defined string patterns.
  • a user may have a string pattern that he wants to compare to many different strings of characters.
  • a user may have a list of file names and will want to search the file names for the pattern “ab*.txt”, wherein the character “*” is a wildcard character representing an unknown string of characters comprised of as many as zero to an unlimited number of characters.
  • a search engine may go through the list of characters sequentially to determine which of the strings match the user selected pattern.
  • this typical matching engine it is a user selected pattern that is being compared and matched to one or more character strings.
  • this typical matching engine will find all strings that match the pattern and is not able to qualitatively or quantitatively differentiate between the strings that match the pattern.
  • a matching engine that will allow an input string to be compared and matched to a group of predefined string patterns.
  • Such a matching engine should be able to determine, for a given input string, which group of predefined pattern strings match the input string, and of these predefined patterns which is the pattern that is most similar to the input string (i.e., the best matching pattern).
  • Such a matching engine has many different uses, for example, it can be used in scenarios that involve making decisions based on information attached to a particular pattern. Thus, when the best pattern match to a given input string is found, information attached to the pattern can be used to take further action.
  • the matching engine may be implemented in a Session Initiation Protocol (SIP) server to make routing decisions.
  • SIP Session Initiation Protocol
  • the present invention is directed to a matching engine for finding the best match for an input string from a group of defined string patterns.
  • the predefined patterns may include one or more wildcard characters that could represent a string of any length of characters, including no characters at all.
  • a pattern is identical to an input string it is the best matching pattern. If a pattern is not identical to an input string and the pattern does not include any wildcard “*” characters, the pattern does not match the input string. If a pattern includes at least one wildcard character, techniques well known to those with ordinary skill in the art exist to determine if the pattern matches the input string.
  • the present invention is directed to a method and system for computing a metric value for each pattern.
  • the metric value can then be used to determine which pattern best matches the input string from among all patterns that match the input string. Generally, the higher the metric value of the pattern, the better match it is to the input string.
  • the metric value of a pattern is computed by dividing the pattern into one or more substrings. Each substring is comprised of one or more contiguous characters separated from other characters by a wildcard “*” character. The value of each substring is computed by counting the number of characters in each substring. The metric value of the pattern is computed by adding the values of all the substrings comprising the pattern. If the pattern does not include any wildcard characters, then the metric value of the pattern is equal to twice the value of the length of the pattern.
  • information of different types may be attached to the patterns. Accordingly, when the best pattern is found from among a group of string patterns, the information attached to the pattern may be provided to a user. Any type of information may be attached to the pattern. For example, the information attached to the pattern may be used to make a routing decision or to run a specific program module or the like.
  • FIG. 1 is a block diagram of an exemplary computer system on which the present invention may reside.
  • FIG. 2 is a block diagram of the structure of a predefined string pattern.
  • FIG. 3 is a block diagram-representing a matching engine.
  • FIG. 4 is a flow chart of the steps performed to calculate a metric value for a pattern.
  • FIG. 5 is a flow chart of the steps performed by a matching engine to determine the pattern that best matches an input string.
  • FIG. 6 is a block diagram of a matching tree according to one implementation of the invention.
  • FIG. 7 is a block diagram of the structure of a node in the matching tree.
  • FIG. 8 is a flow diagram of the steps performed to build a matching tree.
  • program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types.
  • program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types.
  • program modules may be practiced with other computer system configurations, including hand-held devices, multi-processor systems, microprocessor based or programmable consumer electronics, network PCs, minicomputers, mainframe computers, and the like.
  • the invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network.
  • program modules may be located in both local and remote memory storage devices.
  • an exemplary system for implementing the invention includes a general purpose computing device in the form of a conventional personal computer 20 , including a processing unit 21 , a system memory 22 , and a system bus 23 that couples various system components including the system memory to the processing unit 21 .
  • the system bus 23 may be any of several types of bus structures including a memory bus or memory controller, a peripheral bus, and a local bus using any of a variety of bus architectures.
  • the system memory includes read only memory (ROM) 24 and random access memory (RAM) 25 .
  • ROM read only memory
  • RAM random access memory
  • a basic input/output system (BIOS) 26 containing the basic routines that help to transfer information between elements within the personal computer 20 , such as during start-up, is stored in ROM 24 .
  • the personal computer 20 further includes a hard disk drive 27 for reading from and writing to a hard disk 60 , a magnetic disk drive 28 for reading from or writing to a removable magnetic disk 29 , and an optical disk drive 30 for reading from or writing to a removable optical disk 31 such as a CD ROM or other optical media.
  • a hard disk drive 27 for reading from and writing to a hard disk 60
  • a magnetic disk drive 28 for reading from or writing to a removable magnetic disk 29
  • an optical disk drive 30 for reading from or writing to a removable optical disk 31 such as a CD ROM or other optical media.
  • the hard disk drive 27 , magnetic disk drive 28 , and optical disk drive 30 are connected to the system bus 23 by a hard disk drive interface 32 , a magnetic disk drive interface 33 , and an optical disk drive interface 34 , respectively.
  • the drives and their associated computer-readable media provide nonvolatile storage of computer readable instructions, data structures, program modules and other data for the personal computer 20 .
  • exemplary environment described herein employs a hard disk 60 , a removable magnetic disk 29 , and a removable optical disk 31 , it will be appreciated by those skilled in the art that other types of computer readable media which can store data that is accessible by a computer, such as magnetic cassettes, flash memory cards, digital video disks, Bernoulli cartridges, random access memories, read only memories, and the like may also be used in the exemplary operating environment.
  • a number of program modules may be stored on the hard disk 60 , magnetic disk 29 , optical disk 31 , ROM 24 or RAM 25 , including an operating system 35 , one or more applications programs 36 , other program modules 37 , and program data 38 .
  • a user may enter commands and information into the personal computer 20 through input devices such as a keyboard 40 and a pointing device 42 .
  • Other input devices may include a microphone, joystick, game pad, satellite dish, scanner, or the like.
  • These and other input devices are often connected to the processing unit 21 through a serial port interface 46 that is coupled to the system bus, but may be connected by other interfaces, such as a parallel port, game port or a universal serial bus (USB).
  • a monitor 47 or other type of display device is also connected to the system bus 23 via an interface, such as a video adapter 48 .
  • personal computers typically include other peripheral output devices, not shown, such as speakers and printers.
  • the personal computer 20 may operate in a networked environment using logical connections to one or more remote computers, such as a remote computer 49 .
  • the remote computer 49 may be another personal computer, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to the personal computer 20 , although only a memory storage device 50 has been illustrated in FIG. 1 .
  • the computer 20 may act as a server computer to one or more remote computers 49 .
  • the logical connections depicted in FIG. 1 include a local area network (LAN) 51 and a wide area network (WAN) 52 .
  • LAN local area network
  • WAN wide area network
  • the personal computer 20 When used in a LAN networking environment, the personal computer 20 is connected to the local network 51 through a network interface or adapter 53 . When used in a WAN networking environment, the personal computer 20 typically includes a modem 54 or other means for establishing communications over the WAN 52 .
  • the modem 54 which may be internal or external, is connected to the system bus 23 via the serial port interface 46 .
  • program modules depicted relative to the personal computer 20 may be stored in the remote memory storage device. It will be appreciated that the network connections shown are exemplary and other means of establishing a communications link between the computers may be used.
  • FIG. 2 is a block diagram of the structure of the patterns to which an input string may be compared.
  • the pattern 100 is comprised of a string of characters 102 .
  • the string 102 may be comprised of one or more substrings 104 .
  • Each substring 104 may be comprised of one or more contiguous characters separated from other characters by a wildcard “*” character 106 .
  • the string 102 may include no wildcard characters.
  • the string 102 may commence and/or end with a wildcard 106 , i.e., the wildcard character does not necessarily have to be in the middle of the string.
  • the concept of a wildcard is well known to those with ordinary skill in the art.
  • the wildcard character 106 represents an undefined string that represents anything from zero to an unlimited number of characters.
  • FIG. 3 is a block diagram representation of the matching engine according the present invention.
  • An input string 120 is inputted by a user for comparison to one or more predefined patterns 100 by the matching engine 122 .
  • the input string 120 may be inputted by any user, e.g., a human, a process, another routine or program, a server, etc.
  • the input string 120 consists of the characters “abc”.
  • the pattern strings 100 consist of “ab” 100 a , “ab*” 100 b , and “abc” 100 c .
  • the predefined patterns 100 may be created in any appropriate or desired manner, e.g., a human, a process, another routine or program, etc. It is to be understood that the invention is broad enough to apply to any input string of characters and any string patterns.
  • the string patterns are generally in a form of “user@host”.
  • the matching engine 120 uses a metric value to determine which of the patterns is the best match for the input string 120 .
  • a pattern that exactly matches an input string always has a higher metric value than a pattern that includes at least one wildcard character because: 2 ⁇ l p >l i1 +l i2 + . . . +l in
  • the predefined pattern for which a metric value is to be computed is determined.
  • the metric value of the pattern is determined by multiplying the value of the string by two. If at step 142 the pattern does have at least one wildcard, then at step 148 the pattern is divided into substrings.
  • Each substring 104 is comprised of one or more contiguous characters that are separated from other characters by a wildcard.
  • the value of each substring is determined by counting the number of characters in each substring.
  • the metric value of the pattern is calculated by adding together the value of each substring.
  • the metric value of the patterns may be computed by the matching engine 122 or by any other appropriate process, routine, module or the like.
  • an input string is received by the matching engine 122 .
  • the matching engine compares the input string to one of the predefined patterns. In one embodiment, this comparison is accomplished by performing an operation to determine if the two strings are equal. Techniques for performing this comparison, even when one of the strings includes one or more wildcard “*” characters, are well-known to those with ordinary skill in the art.
  • the matching engine 122 determines if there are any other predefined patterns that should be compared to the input string. Once the input string has been compared to all of the predefined patterns that it should be compared to, at step 170 the matching engine selects the pattern that had the highest match value with the input string.
  • the pattern “ab” has a metric value of 4 (i.e., 2 ⁇ 2) but does not match the input string “abc” because the pattern does not have all the characters that appear in the string. Accordingly, this pattern is not a match.
  • the pattern “ab*” does match the pattern “abc”.
  • the metric value of this match is calculated as follows.
  • the pattern “ab*” has only one substring (i.e., “ab”) with a value of 2 and, therefore, the sum of all substrings results in a metric value of 2.
  • pattern string 100 b i.e., “ab*” matches the input string 120 and the match has a metric value of 2.
  • the pattern string 100 c (i.e., “abc”) also matches the input string 120 “abc”. Because the pattern string 100 c does not have a wildcard 106 , the metric value of the pattern is 6, i.e., twice the number of characters in the pattern. Accordingly, although both the pattern strings 100 b and 100 c match the input string 120 , the pattern string 100 c is considered the best match to the input string because it has a higher metric value.
  • the best matching pattern is determined by comparing the substrings of the two patterns in ascending order and the pattern with the higher substring value is the better match. For example, if two patterns with the same metric value match an input string but one pattern has a substring 1 value of 3 while the second pattern has a substring 1 value of 2, the first pattern is the better matching pattern. If substring 1 of both patterns have the same value, then the same comparison is performed with respect to substring 2 and so on until the better match is found.
  • the best match to an input string may be defined in any desired way.
  • the best match may be found by comparing the substrings of the patterns in descending order.
  • the best matching pattern from among a plurality of matching patterns may be defined as the pattern with the lowest metric value. Accordingly, the manner in which the metric value of a pattern (found in accordance with the invention) is used to compare an input string to one or more predefined patterns is not limited in any particular manner.
  • the pattern 100 may also, but is not required to, include additional user defined and added information.
  • the user may be a human or another computer, routine or automated process. The invention is not limited by how the user defined information is created.
  • the user defined information may include a client ID (or handle) 110 .
  • the client ID 110 identifies the source of the pattern, i.e., the user that created the pattern.
  • the pattern 100 may also include one or more pieces of data 114 .
  • the data 114 may consist of any information desired by the user. For example, the data 114 may consists of routing information that determines where messages or packages should be sent once the pattern 100 is identified by the matching engine of the invention.
  • the data 114 may include a routine or program that is run once the pattern 100 is identified.
  • the data 114 may include information that is returned to a user who inputted the string that matched to the pattern 100 .
  • the data 114 may consist of pointers to routing information, a procedure or program, or other information.
  • the structure of the pattern 100 allows the matching engine 122 to be used to take further action based on the data 114 attached to the pattern 100 .
  • the matching engine may be used in a Real-Time Communication (RTC) server to direct users to a particular server or destination.
  • RTC Real-Time Communication
  • a pattern 100 d may consist of (“a*”, “Server A”), wherein “a*” is the pattern string 102 and “Server A” is the user added data 114 .
  • “Server A” includes the data needed to direct a request or other information to a Server A.
  • a pattern 100 e may consist of the pattern string and information (“b*”, “Server B”)
  • a pattern 100 f may consist of the pattern string and information (“*”, “Server C”). If a request is received from a user who is identified by the string “andy”, for example, the matching engine determines that both the pattern strings “a*” and “*” match the input string “andy.” Given that the best match is defined by the pattern string “a*” the request from user “andy” is directed to Server A.
  • the matching engine may be used to determine all patterns that match the input string.
  • all pattern strings 100 that match the input string 120 may be identified and provided to the requester, a user or additional routine, program or component.
  • the matching engine may be used, for example, to identify all patterns that match a specific input string and were created by a specific client ID.
  • the pattern 100 may include more than one data 114 .
  • FIG. 2 depicts a pattern 100 that contains data 114 a and 114 b , the number of different data structures that are included in the pattern 100 as data 114 is unlimited.
  • the information may be of different data types.
  • data 114 a may include data structures regarding routing information to Server A
  • data 114 b may include data structures regarding running a particular routine or program module.
  • the pattern 100 may also include a metric 112 that allows a user to determine which of the data 114 attached to the pattern 100 is the best information.
  • the data 114 and metric 112 that may be included with a pattern 100 allow the matching engine of the present invention to be extremely robust. Once the best pattern is determined using the steps set forth above, any other user, program module, routine and/or automated process may use the data 114 attached to the pattern to perform further processing.
  • the patterns 100 are organized in a tree structure.
  • the tree 200 is comprised of a root 202 and one or more nodes 204 a to 204 n , wherein the subscript n indicates that the tree may have an unlimited number of nodes.
  • Each node 204 may also include one or more pieces of additional data 214 .
  • the node 204 is comprised of a string pattern 206 , substring values 208 for one or more substrings, a metric value for the pattern 210 , and one or more pointers 212 to one or more additional data 214 a through 214 n , wherein the subscript n indicates that the number of additional data associated with a node is unlimited.
  • Nodes in the tree may have parent and child relationships with other nodes in the tree. For example, in the general implementation depicted in FIG.
  • node 204 a is the parent of node 204 c
  • node 204 f is the child of node 204 c
  • the tree is constructed to minimize the size of the tree. Accordingly, to the extent possible pattern strings are consolidated into nodes that are closest to the root 202 .
  • the data 214 that may be associated with each node 204 may be comprised of a metric value 216 , an ID 218 and the data 220 .
  • the metric value 216 helps a client, user, program module, process or the like evaluate the importance of the data 214 vis a vis other data 214 that may be associated with the node 204 .
  • the metric value 216 is set by a user, automated process, program module or the like. Accordingly, the metric value does not affect the performance of the matching engine per se. Rather, the metric value 216 affects the order in which data attached to the pattern may be accessed and/or used once the pattern is matched to an input string using the matching engine of the present invention.
  • the ID 218 of the data 214 identifies the client, user, program module, process or the like that associated the data 214 with the pattern represented by the node 204 .
  • the data 220 represents the actual information. As previously discussed, this data 220 may be any appropriate information such as routing information, a program module, pointers, etc.
  • a tree for use within the invention may be built.
  • no patterns have been created or entered into the tree and the tree is comprised only of an empty root 202 .
  • the pattern (“abc”, I 1 ) is added to the tree, wherein I 1 is the additional data associated with the pattern. Consequently, at step 234 node 204 a is added to the tree 200 to add this pattern to the tree. Because the pattern string 206 a (“abc”) does not have a wildcard in the pattern, the pattern has a substring value 208 a of 3 and a metric value 210 a of 6. (For the purposes of this example, the client ID 218 is not discussed or shown in FIG.
  • the node 204 a also has a pointer 212 a to additional data (I 1 ) 214 a .
  • the pattern (“ab*”, I 2 ) is added to the tree.
  • nodes 204 b and 204 c are created. Because the patterns “abc” and “ab*” share the same two characters “ab”, the characters “ab” are maintained at node 204 a in the tree.
  • the sole substring value 208 a is changed to 2 and the metric value 210 a is changed to 4.
  • Nodes 204 b and 204 c are children of node 204 a , which means that the patterns represented by these nodes share characters with node 204 a .
  • Node 204 b contains the substring 206 b “c”, which together with node 204 a comprise the string “abc”. Because the string represented by node 204 b also does not have any wildcard characters, the sole substring value 208 b is 3 and the metric value 210 b is 6.
  • Node 204 b also has a pointer 212 b to additional data (I 1 ) 214 a .
  • Node 204 c contains the substring “*”, which together with node 204 a comprise the string “ab*”.
  • the string “ab*” has one substring value 208 a of 2 and a metric value of 2.
  • Node 214 c also has a pointer 212 c to additional data (I 2 ) 114 b .
  • the pattern (“ab*xyz”, I 3 ) is added to the tree 200 .
  • node 204 d is added to the tree 200 as a child to node 204 c .
  • the pattern “ab*xyz” has two substrings 208 d with values of 2 and 3, and a metric value 210 d of 5.
  • Node 204 d also includes a pointer 212 d to the additional data (I 3 ) 214 c.
  • a collapse operation may be performed on the tree to reduce the size of the tree. For example, assume the following tree structure:
  • the collapsed tree has the advantage of requiring less memory to store and being faster to search.
  • the matching engine of the present invention is not limited to an implementation using a tree structure. Instead, any organization of the string patterns is permissible so long as the string patterns are searchable by the matching engine.
  • the string patterns may be implemented as a list.

Abstract

A system and method directed to a matching engine for finding the best match for an input string from among a group of predefined string patterns is disclosed. The predefined patterns may include one or more wildcard characters. A metric value is computed for every predefined string pattern. If the input string matches more than one predefined pattern, then the pattern with the highest metric value is determined as the best match to the input string. Additionally, information of different types may be attached to the predefined patterns and used for further processing of information, for example, to make routing decisions or to run a program module.

Description

TECHNICAL FIELD
This invention relates generally to a pattern matching engine and more specifically to a matching engine to match a string of characters to one or more defined string patterns.
BACKGROUND OF THE INVENTION
In many applications, there is often a need to compare and or match strings of characters to one another. In a typical scenario, a user may have a string pattern that he wants to compare to many different strings of characters. For example, a user may have a list of file names and will want to search the file names for the pattern “ab*.txt”, wherein the character “*” is a wildcard character representing an unknown string of characters comprised of as many as zero to an unlimited number of characters. A search engine may go through the list of characters sequentially to determine which of the strings match the user selected pattern. Thus, in this typical matching engine, it is a user selected pattern that is being compared and matched to one or more character strings. Moreover, this typical matching engine will find all strings that match the pattern and is not able to qualitatively or quantitatively differentiate between the strings that match the pattern.
There remains the need, however, for a matching engine that will allow an input string to be compared and matched to a group of predefined string patterns. Such a matching engine should be able to determine, for a given input string, which group of predefined pattern strings match the input string, and of these predefined patterns which is the pattern that is most similar to the input string (i.e., the best matching pattern). Such a matching engine has many different uses, for example, it can be used in scenarios that involve making decisions based on information attached to a particular pattern. Thus, when the best pattern match to a given input string is found, information attached to the pattern can be used to take further action. In one implementation, for example, the matching engine may be implemented in a Session Initiation Protocol (SIP) server to make routing decisions.
SUMMARY OF THE INVENTION
The present invention is directed to a matching engine for finding the best match for an input string from a group of defined string patterns. The predefined patterns may include one or more wildcard characters that could represent a string of any length of characters, including no characters at all.
Generally, if a pattern is identical to an input string it is the best matching pattern. If a pattern is not identical to an input string and the pattern does not include any wildcard “*” characters, the pattern does not match the input string. If a pattern includes at least one wildcard character, techniques well known to those with ordinary skill in the art exist to determine if the pattern matches the input string.
The present invention is directed to a method and system for computing a metric value for each pattern. The metric value can then be used to determine which pattern best matches the input string from among all patterns that match the input string. Generally, the higher the metric value of the pattern, the better match it is to the input string.
The metric value of a pattern is computed by dividing the pattern into one or more substrings. Each substring is comprised of one or more contiguous characters separated from other characters by a wildcard “*” character. The value of each substring is computed by counting the number of characters in each substring. The metric value of the pattern is computed by adding the values of all the substrings comprising the pattern. If the pattern does not include any wildcard characters, then the metric value of the pattern is equal to twice the value of the length of the pattern.
Additionally, information of different types may be attached to the patterns. Accordingly, when the best pattern is found from among a group of string patterns, the information attached to the pattern may be provided to a user. Any type of information may be attached to the pattern. For example, the information attached to the pattern may be used to make a routing decision or to run a specific program module or the like.
BRIEF DESCRIPTION OF THE DRAWINGS
While the appended claims set forth the features of the present invention with particularity, the invention, together with its objects and advantages, may be best understood from the following detailed description taken in conjunction with the accompanying drawings of which:
FIG. 1 is a block diagram of an exemplary computer system on which the present invention may reside.
FIG. 2 is a block diagram of the structure of a predefined string pattern.
FIG. 3 is a block diagram-representing a matching engine.
FIG. 4 is a flow chart of the steps performed to calculate a metric value for a pattern.
FIG. 5 is a flow chart of the steps performed by a matching engine to determine the pattern that best matches an input string.
FIG. 6 is a block diagram of a matching tree according to one implementation of the invention.
FIG. 7 is a block diagram of the structure of a node in the matching tree.
FIG. 8 is a flow diagram of the steps performed to build a matching tree.
DETAILED DESCRIPTION OF THE INVENTION
Turning to the drawings, wherein like reference numerals refer to like elements, the invention is illustrated as being implemented in a suitable computing environment. Although not required, the invention will be described in the general context of computer-executable instructions, such as program modules, being executed by a personal computer and/or server. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. Moreover, those skilled in the art will appreciate that the invention may be practiced with other computer system configurations, including hand-held devices, multi-processor systems, microprocessor based or programmable consumer electronics, network PCs, minicomputers, mainframe computers, and the like. The invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote memory storage devices.
With reference to FIG. 1, an exemplary system for implementing the invention includes a general purpose computing device in the form of a conventional personal computer 20, including a processing unit 21, a system memory 22, and a system bus 23 that couples various system components including the system memory to the processing unit 21. The system bus 23 may be any of several types of bus structures including a memory bus or memory controller, a peripheral bus, and a local bus using any of a variety of bus architectures. The system memory includes read only memory (ROM) 24 and random access memory (RAM) 25. A basic input/output system (BIOS) 26, containing the basic routines that help to transfer information between elements within the personal computer 20, such as during start-up, is stored in ROM 24. The personal computer 20 further includes a hard disk drive 27 for reading from and writing to a hard disk 60, a magnetic disk drive 28 for reading from or writing to a removable magnetic disk 29, and an optical disk drive 30 for reading from or writing to a removable optical disk 31 such as a CD ROM or other optical media.
The hard disk drive 27, magnetic disk drive 28, and optical disk drive 30 are connected to the system bus 23 by a hard disk drive interface 32, a magnetic disk drive interface 33, and an optical disk drive interface 34, respectively. The drives and their associated computer-readable media provide nonvolatile storage of computer readable instructions, data structures, program modules and other data for the personal computer 20. Although the exemplary environment described herein employs a hard disk 60, a removable magnetic disk 29, and a removable optical disk 31, it will be appreciated by those skilled in the art that other types of computer readable media which can store data that is accessible by a computer, such as magnetic cassettes, flash memory cards, digital video disks, Bernoulli cartridges, random access memories, read only memories, and the like may also be used in the exemplary operating environment.
A number of program modules may be stored on the hard disk 60, magnetic disk 29, optical disk 31, ROM 24 or RAM 25, including an operating system 35, one or more applications programs 36, other program modules 37, and program data 38. A user may enter commands and information into the personal computer 20 through input devices such as a keyboard 40 and a pointing device 42. Other input devices (not shown) may include a microphone, joystick, game pad, satellite dish, scanner, or the like. These and other input devices are often connected to the processing unit 21 through a serial port interface 46 that is coupled to the system bus, but may be connected by other interfaces, such as a parallel port, game port or a universal serial bus (USB). A monitor 47 or other type of display device is also connected to the system bus 23 via an interface, such as a video adapter 48. In addition to the monitor, personal computers typically include other peripheral output devices, not shown, such as speakers and printers.
The personal computer 20 may operate in a networked environment using logical connections to one or more remote computers, such as a remote computer 49. The remote computer 49 may be another personal computer, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to the personal computer 20, although only a memory storage device 50 has been illustrated in FIG. 1. Additionally, the computer 20 may act as a server computer to one or more remote computers 49. The logical connections depicted in FIG. 1 include a local area network (LAN) 51 and a wide area network (WAN) 52. Such networking environments are commonplace in offices, enterprise-wide computer networks, intranets and the Internet.
When used in a LAN networking environment, the personal computer 20 is connected to the local network 51 through a network interface or adapter 53. When used in a WAN networking environment, the personal computer 20 typically includes a modem 54 or other means for establishing communications over the WAN 52. The modem 54, which may be internal or external, is connected to the system bus 23 via the serial port interface 46. In a networked environment, program modules depicted relative to the personal computer 20, or portions thereof, may be stored in the remote memory storage device. It will be appreciated that the network connections shown are exemplary and other means of establishing a communications link between the computers may be used.
In the description that follows, the invention will be described with reference to acts and symbolic representations of operations that are performed by one or more computers, unless indicated otherwise. As such, it will be understood that such acts and operations, which are at times referred to as being computer-executed, include the manipulation by the processing unit of the computer of electrical signals representing data in a structured form. This manipulation transforms the data or maintains it at locations in the memory system of the computer, which reconfigures or otherwise alters the operation of the computer in a manner well understood by those skilled in the art. The data structures where data is maintained are physical locations of the memory that have particular properties defined by the format of the data. However, while the invention is being described in the foregoing context, it is not meant to be limiting as those of skill in the art will appreciate that various of the acts and operations described hereinafter may also be implemented in hardware.
FIG. 2 is a block diagram of the structure of the patterns to which an input string may be compared. The pattern 100 is comprised of a string of characters 102. The string 102 may be comprised of one or more substrings 104. Each substring 104 may be comprised of one or more contiguous characters separated from other characters by a wildcard “*” character 106. It is also possible for the string 102 to include no wildcard characters. Although not specifically shown in FIG. 2, the string 102 may commence and/or end with a wildcard 106, i.e., the wildcard character does not necessarily have to be in the middle of the string. The concept of a wildcard is well known to those with ordinary skill in the art. Specifically, the wildcard character 106 represents an undefined string that represents anything from zero to an unlimited number of characters.
FIG. 3 is a block diagram representation of the matching engine according the present invention. An input string 120 is inputted by a user for comparison to one or more predefined patterns 100 by the matching engine 122. The input string 120 may be inputted by any user, e.g., a human, a process, another routine or program, a server, etc. For purposes of illustration, the input string 120 consists of the characters “abc”. Also for purposes of illustration, assume that the pattern strings 100 consist of “ab” 100 a, “ab*” 100 b, and “abc” 100 c. Similarly, the predefined patterns 100 may be created in any appropriate or desired manner, e.g., a human, a process, another routine or program, etc. It is to be understood that the invention is broad enough to apply to any input string of characters and any string patterns. For example, in an SIP server implementation, the string patterns are generally in a form of “user@host”.
The matching engine 120 uses a metric value to determine which of the patterns is the best match for the input string 120. As shown in FIG. 2, we can consider a pattern 100 to be comprised of one or more substrings 104 separated by the wildcard character “*” 106 such that:
Pattern=substring1* substring2* . . . * substringn
Each substring may contain any character other than the wildcard character “*”. If we consider li as the length in characters for substringi, and lp as the length in characters of the entire pattern including any wildcard characters, then it is always true that
l p >=l i1 +l i2 + . . . +l in
The two sides of the equation above are equal only when there is no wildcard character “*” included in the pattern. In one embodiment, a pattern that exactly matches the input string should be considered to be a better match than a matching pattern that includes at least one wildcard character. Accordingly, if the pattern does not include any wildcard characters, then the metric value (mp) of the pattern is:
m p=2×l p
If the pattern does contain one or more wildcard characters, then the metric value of the pattern is:
m p =l i1 +l i2 + . . . +l in
Accordingly, in one embodiment, a pattern that exactly matches an input string always has a higher metric value than a pattern that includes at least one wildcard character because:
2×lp>li1+li2+ . . . +lin
The specific steps of computing the metric value of a pattern are discussed with reference to FIG. 4. At step 140, the predefined pattern for which a metric value is to be computed is determined. At step 142, it is determined whether the predefined pattern has any wildcard characters 106. If the predefined pattern does not have any wildcards, then at step 144 the value of the characters in the pattern is determined. One method of determining the value of the characters is to count the number of characters in the pattern. At step 146, the metric value of the pattern is determined by multiplying the value of the string by two. If at step 142 the pattern does have at least one wildcard, then at step 148 the pattern is divided into substrings. Each substring 104 is comprised of one or more contiguous characters that are separated from other characters by a wildcard. At step 150 the value of each substring is determined by counting the number of characters in each substring. And at step 152 the metric value of the pattern is calculated by adding together the value of each substring. The metric value of the patterns may be computed by the matching engine 122 or by any other appropriate process, routine, module or the like.
The operation of the matching engine is further discussed with respect to the flowchart of FIG. 5. At step 160 an input string is received by the matching engine 122. At step 162 the matching engine compares the input string to one of the predefined patterns. In one embodiment, this comparison is accomplished by performing an operation to determine if the two strings are equal. Techniques for performing this comparison, even when one of the strings includes one or more wildcard “*” characters, are well-known to those with ordinary skill in the art.
If at step 164 the input string matches the predefined pattern, then at step 166 the metric value of the pattern is assigned as the value of the match between the string and the pattern. If at step 164 the input string does not match the predefined pattern, then at 168, the matching engine 122 determines if there are any other predefined patterns that should be compared to the input string. Once the input string has been compared to all of the predefined patterns that it should be compared to, at step 170 the matching engine selects the pattern that had the highest match value with the input string.
In the example of FIG. 3, the pattern “ab” has a metric value of 4 (i.e., 2×2) but does not match the input string “abc” because the pattern does not have all the characters that appear in the string. Accordingly, this pattern is not a match. The pattern “ab*” does match the pattern “abc”. The metric value of this match is calculated as follows. The pattern “ab*” has only one substring (i.e., “ab”) with a value of 2 and, therefore, the sum of all substrings results in a metric value of 2. Thus, pattern string 100 b (i.e., “ab*”) matches the input string 120 and the match has a metric value of 2. The pattern string 100 c (i.e., “abc”) also matches the input string 120 “abc”. Because the pattern string 100 c does not have a wildcard 106, the metric value of the pattern is 6, i.e., twice the number of characters in the pattern. Accordingly, although both the pattern strings 100 b and 100 c match the input string 120, the pattern string 100 c is considered the best match to the input string because it has a higher metric value.
If there are two pattern strings that have the same metric value with respect to an input string, in one embodiment the best matching pattern is determined by comparing the substrings of the two patterns in ascending order and the pattern with the higher substring value is the better match. For example, if two patterns with the same metric value match an input string but one pattern has a substring1 value of 3 while the second pattern has a substring1 value of 2, the first pattern is the better matching pattern. If substring1 of both patterns have the same value, then the same comparison is performed with respect to substring2 and so on until the better match is found.
It is to be understood that when the metric value of patterns is found according to the method and system of the present invention, the best match to an input string may be defined in any desired way. In an alternative embodiment, for example, if two patterns that match an input string have the same metric value, the best match may be found by comparing the substrings of the patterns in descending order. As another example, the best matching pattern from among a plurality of matching patterns may be defined as the pattern with the lowest metric value. Accordingly, the manner in which the metric value of a pattern (found in accordance with the invention) is used to compare an input string to one or more predefined patterns is not limited in any particular manner.
Referring back to FIG. 2, the pattern 100 may also, but is not required to, include additional user defined and added information. The user may be a human or another computer, routine or automated process. The invention is not limited by how the user defined information is created. The user defined information may include a client ID (or handle) 110. The client ID 110 identifies the source of the pattern, i.e., the user that created the pattern. The pattern 100 may also include one or more pieces of data 114. The data 114 may consist of any information desired by the user. For example, the data 114 may consists of routing information that determines where messages or packages should be sent once the pattern 100 is identified by the matching engine of the invention. Alternatively, the data 114 may include a routine or program that is run once the pattern 100 is identified. As another alternative, the data 114 may include information that is returned to a user who inputted the string that matched to the pattern 100. Alternatively, the data 114 may consist of pointers to routing information, a procedure or program, or other information.
The structure of the pattern 100 allows the matching engine 122 to be used to take further action based on the data 114 attached to the pattern 100. For example, the matching engine may be used in a Real-Time Communication (RTC) server to direct users to a particular server or destination. In one implementation, for example, a pattern 100 d may consist of (“a*”, “Server A”), wherein “a*” is the pattern string 102 and “Server A” is the user added data 114. Specifically, “Server A” includes the data needed to direct a request or other information to a Server A. Additionally, a pattern 100 e may consist of the pattern string and information (“b*”, “Server B”), and a pattern 100 f may consist of the pattern string and information (“*”, “Server C”). If a request is received from a user who is identified by the string “andy”, for example, the matching engine determines that both the pattern strings “a*” and “*” match the input string “andy.” Given that the best match is defined by the pattern string “a*” the request from user “andy” is directed to Server A.
In another embodiment, the matching engine may be used to determine all patterns that match the input string. In this embodiment, all pattern strings 100 that match the input string 120 may be identified and provided to the requester, a user or additional routine, program or component. Additionally, in the implementation of the patterns 100 in which the patterns include a client ID 110, the matching engine may be used, for example, to identify all patterns that match a specific input string and were created by a specific client ID.
The pattern 100 may include more than one data 114. Although FIG. 2 depicts a pattern 100 that contains data 114 a and 114 b, the number of different data structures that are included in the pattern 100 as data 114 is unlimited. If the pattern 100 includes more than one data 114, the information may be of different data types. For example, data 114 a may include data structures regarding routing information to Server A, whereas data 114 b may include data structures regarding running a particular routine or program module. If more than one data 114 is included in the pattern 100, then the pattern 100 may also include a metric 112 that allows a user to determine which of the data 114 attached to the pattern 100 is the best information. The data 114 and metric 112 that may be included with a pattern 100 allow the matching engine of the present invention to be extremely robust. Once the best pattern is determined using the steps set forth above, any other user, program module, routine and/or automated process may use the data 114 attached to the pattern to perform further processing.
As shown in FIG. 6, in one embodiment of the invention, the patterns 100 are organized in a tree structure. Generally, the tree 200 is comprised of a root 202 and one or more nodes 204 a to 204 n, wherein the subscript n indicates that the tree may have an unlimited number of nodes. Each node 204 may also include one or more pieces of additional data 214.
The structure of the nodes 204 and additional data 214 is discussed further with reference to FIG. 7. In one embodiment of the invention, the node 204 is comprised of a string pattern 206, substring values 208 for one or more substrings, a metric value for the pattern 210, and one or more pointers 212 to one or more additional data 214 a through 214 n, wherein the subscript n indicates that the number of additional data associated with a node is unlimited. Nodes in the tree may have parent and child relationships with other nodes in the tree. For example, in the general implementation depicted in FIG. 6, node 204 a is the parent of node 204 c, and node 204 f is the child of node 204 c. In one implementation of the tree, the tree is constructed to minimize the size of the tree. Accordingly, to the extent possible pattern strings are consolidated into nodes that are closest to the root 202.
The data 214 that may be associated with each node 204 may be comprised of a metric value 216, an ID 218 and the data 220. The metric value 216 helps a client, user, program module, process or the like evaluate the importance of the data 214 vis a vis other data 214 that may be associated with the node 204. The metric value 216 is set by a user, automated process, program module or the like. Accordingly, the metric value does not affect the performance of the matching engine per se. Rather, the metric value 216 affects the order in which data attached to the pattern may be accessed and/or used once the pattern is matched to an input string using the matching engine of the present invention.
The ID 218 of the data 214 identifies the client, user, program module, process or the like that associated the data 214 with the pattern represented by the node 204. Finally, the data 220 represents the actual information. As previously discussed, this data 220 may be any appropriate information such as routing information, a program module, pointers, etc.
The manner in which a tree for use within the invention may be built is discussed with respect to FIG. 8. At step 230 no patterns have been created or entered into the tree and the tree is comprised only of an empty root 202. At step 232, the pattern (“abc”, I1) is added to the tree, wherein I1 is the additional data associated with the pattern. Consequently, at step 234 node 204 a is added to the tree 200 to add this pattern to the tree. Because the pattern string 206 a (“abc”) does not have a wildcard in the pattern, the pattern has a substring value 208 a of 3 and a metric value 210 a of 6. (For the purposes of this example, the client ID 218 is not discussed or shown in FIG. 8.) The node 204 a also has a pointer 212 a to additional data (I1) 214 a. At step 236, the pattern (“ab*”, I2) is added to the tree. To add this pattern to the tree, at step 238, nodes 204 b and 204 c are created. Because the patterns “abc” and “ab*” share the same two characters “ab”, the characters “ab” are maintained at node 204 a in the tree. As node 204 a now contains a string with no wildcards and only two characters, the sole substring value 208 a is changed to 2 and the metric value 210 a is changed to 4.
Nodes 204 b and 204 c are children of node 204 a, which means that the patterns represented by these nodes share characters with node 204 a. Node 204 b contains the substring 206 b “c”, which together with node 204 a comprise the string “abc”. Because the string represented by node 204 b also does not have any wildcard characters, the sole substring value 208 b is 3 and the metric value 210 b is 6. Node 204 b also has a pointer 212 b to additional data (I1) 214 a. Node 204 c contains the substring “*”, which together with node 204 a comprise the string “ab*”. As indicated at node 204 c, the string “ab*” has one substring value 208 a of 2 and a metric value of 2. Node 214 c also has a pointer 212 c to additional data (I2) 114 b.
At step 240 the pattern (“ab*xyz”, I3) is added to the tree 200. At step 242, node 204 d is added to the tree 200 as a child to node 204 c. As indicated in FIG. 8, the pattern “ab*xyz” has two substrings 208 d with values of 2 and 3, and a metric value 210 d of 5. Node 204 d also includes a pointer 212 d to the additional data (I3) 214 c.
If a pattern is ever deleted from the tree such that a node only has one child, then a collapse operation may be performed on the tree to reduce the size of the tree. For example, assume the following tree structure:
Figure US07257576-20070814-C00001

If the pattern “abc” is removed from the tree, the tree could look like:
Figure US07257576-20070814-C00002

If the tree is collapsed, however, the tree could look like:
Figure US07257576-20070814-C00003

The collapsed tree has the advantage of requiring less memory to store and being faster to search.
The matching engine of the present invention, however, is not limited to an implementation using a tree structure. Instead, any organization of the string patterns is permissible so long as the string patterns are searchable by the matching engine. For example, the string patterns may be implemented as a list.
In view of the many possible embodiments to which the principles of this invention may be applied, it should be recognized that the embodiment described herein with respect to the drawing figures is meant to be illustrative only and should not be taken as limiting the scope of invention. For example, those of skill in the art will recognize that the elements of the illustrated embodiment shown in software may be implemented in hardware and vice versa or that the illustrated embodiment can be modified in arrangement and detail without departing from the spirit of the invention. Therefore, the invention as described herein contemplates all such embodiments as may come within the scope of the following claims and equivalents thereof.

Claims (32)

1. A computer-implemented method of finding a best match to a string of characters from among a plurality of string patterns; comprising:
computing a metric value for each of the string patterns so that when the string of characters matches multiple string patterns, the metric values of the string patterns differentiate the quality of the matches;
comparing the string of characters to each of the string patterns to determine which string patterns the string of characters matches;
selecting from the matching string patterns a matching string pattern as the best match based on the quality of the match as indicated by the computed metric values of the matching string patterns; and
storing and reporting the selected matching string pattern,
wherein at least one of the string patterns includes at least one wildcard character;
wherein computing the metric value of a string pattern further comprises:
assigning a prefix value to all characters appearing before the wildcard;
assigning a suffix value to all characters appearing after the wildcard; and
adding the prefix value to the suffix value to obtain the metric value.
2. The method of claim 1, wherein the string of characters contains no wildcards.
3. The method of claim 1, wherein a string pattern comprises a handle to identify a client that added the string pattern to the plurality of string patterns.
4. The method of claim 3, wherein a string pattern further comprises additional user defined information.
5. The method of claim 4, wherein the additional user defined information is routing information.
6. The method of claim 4, wherein the additional user defined information is a program module.
7. The method of claim 4, wherein the additional user defined information is a pointer.
8. The method of claim 1, wherein the string patterns are organized in a tree structure.
9. A system for finding the best match to an input string from among a plurality of predefined string patterns, comprising:
means for computing a metric value for each predefined string pattern so that when the input string matches multiple predefined string patterns, the metric values of the string patterns differentiate the quality of the matches;
means for determining which of the predefined string patterns match the input string;
means for indicating a best match for the input string based on the quality of the match as indicated by the metric values of the matching predefined string patterns; and
means for storing and reporting the best matching string pattern,
wherein at least one of the string patterns includes at least one wildcard character;
wherein the means for computing a metric value for each predefined string pattern further comprises:
means for dividing the at least one string pattern into at least one substring;
means for counting the number of characters in the at least one substring to obtain a substring value for the at least one substring; and
means for adding the substring values of the at least one substring to obtain a metric value of the at least one pattern.
10. The system of claim 9, wherein the at least one substring is comprised of one or more contiguous characters separated from other characters by a wildcard character.
11. The system of claim 9, further comprising means for selecting the predefined string pattern that best matches the input string.
12. The system of claim 11, wherein the predefined string pattern that best matches the input string has the highest metric value.
13. A computer-readable medium having computer executable instructions for finding a best match to a string of characters from among a plurality of string patterns, which, when executed comprise:
computing a metric value for each of the string patterns so that when the string of characters matches multiple string patterns, the metric values of the string patterns differentiate the quality of the matches;
comparing the string of characters to each of the string patterns to determine which string patterns match;
selecting a string pattern from the matching string patterns as the best match based on the quality of the match as indicated by the computed metric value of the matching string patterns; and
storing and reporting the selected matching string pattern,
wherein at least one of the string patterns includes at least one wildcard character;
wherein the computer executable instructions for computing the metric value of the first pattern, when executed, further comprise:
assigning a prefix value to all characters appearing before the wildcard;
assigning a suffix value to all characters appearing after the wildcard; and
adding the prefix value to the suffix value to obtain the metric value.
14. The computer-readable medium of claim 13, wherein the string of characters contains no wildcards.
15. The computer-readable medium of claim 13, wherein a string pattern comprises a handle to identify a client that added the string pattern to the plurality of string patterns.
16. The computer-readable medium of claim 15, wherein a string pattern further comprises additional user defined information.
17. The computer-readable medium of claim 16, wherein the additional user defined information is a routing information.
18. The computer-readable medium of claim 16, wherein the additional user defined information is a program module.
19. The computer-readable medium of claim 13, wherein a string pattern is organized in a tree structure.
20. A computer-implemented method of determining a best matching string pattern among a plurality of string patterns each including at least one wildcard character, comprising:
dividing each string pattern into one or more substrings;
determining a value for each substring;
calculating a metric value of each pattern by adding together the value of each substring of the string pattern so that when an input string matches multiple string patterns, the metric values of the string patterns differentiate the quality of the matches;
determining which string patterns match the input string;
determining the best matching string pattern from among multiple matching string patterns based on the quality of the match as indicated by comparing the metric values of each matching string pattern; and
storing and reporting the determined best matching string pattern.
21. The method of claim 20, wherein the step of determining a value for each substring is comprised of counting the number of characters in the substring.
22. The method of claim 20, wherein the at least one pattern further comprises a handle to identify a client that added the pattern to a list of predefined patterns.
23. The method of claim 22, wherein the at least one pattern further comprises additional user defined information.
24. The method of claim 23, wherein the additional user defined information is a routing information.
25. The method of claim 23, wherein the additional user defined information is a program module.
26. The method of claim 23, wherein the additional user defined information is a pointer.
27. The method of claim 20, wherein the string patterns are organized in a tree structure.
28. A computer-implemented method of determining a metric value for a pattern including at least one wildcard, comprising:
dividing the pattern into one or more substrings, wherein each substring is comprised of one or more contiguous characters separated from other characters by a wildcard character;
counting the number of characters in each substring to obtain a value of the substring;
adding the value of each substring to obtain a total value;
assigning the total value as the metric value for the pattern, so that when an input string matches multiple patterns, the metric values of the patterns differentiate the quality of the matches; and
storing and reporting the metric value for the string pattern.
29. A computer-implemented method of determining the best match to an input string from among predefined string patterns, comprising:
receiving the input string;
determining the predefined string patterns that match the input string; and
selecting the predefined string pattern that is the best match for the input string from the matching predefined string patterns based on the quality of the match as indicated by a metric value computed for each string pattern that differentiates the quality of the matches; and
storing and reporting the selected matching string pattern,
wherein at least one of the predefined string patterns includes at least one wildcard character;
wherein the metric value computed for each string pattern, further comprise:
assigning a prefix value to all characters appearing before the wildcard;
assigning a suffix value to all characters appearing after the wildcard; and
adding the prefix value to the suffix value to obtain the metric value.
30. The method of claim 29, wherein selecting the best match further comprises selecting the matching string pattern with the greatest metric value.
31. The method of claim 30, wherein the metric value of a matching predefined string pattern indicates the number of characters in common between the input string and the predefined string pattern.
32. The method of claim 30, wherein the metric value is determined such that a matching predefined string pattern that does not contain wildcard characters will have a higher metric value than a matching predefined string pattern that contains wildcard characters.
US10/177,087 2002-06-21 2002-06-21 Method and system for a pattern matching engine Expired - Fee Related US7257576B2 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US10/177,087 US7257576B2 (en) 2002-06-21 2002-06-21 Method and system for a pattern matching engine
US11/837,881 US7873626B2 (en) 2002-06-21 2007-08-13 Method and system for a pattern matching engine

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
US10/177,087 US7257576B2 (en) 2002-06-21 2002-06-21 Method and system for a pattern matching engine

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US11/837,881 Continuation US7873626B2 (en) 2002-06-21 2007-08-13 Method and system for a pattern matching engine

Publications (2)

Publication Number Publication Date
US20030236783A1 US20030236783A1 (en) 2003-12-25
US7257576B2 true US7257576B2 (en) 2007-08-14

Family

ID=29734290

Family Applications (2)

Application Number Title Priority Date Filing Date
US10/177,087 Expired - Fee Related US7257576B2 (en) 2002-06-21 2002-06-21 Method and system for a pattern matching engine
US11/837,881 Expired - Fee Related US7873626B2 (en) 2002-06-21 2007-08-13 Method and system for a pattern matching engine

Family Applications After (1)

Application Number Title Priority Date Filing Date
US11/837,881 Expired - Fee Related US7873626B2 (en) 2002-06-21 2007-08-13 Method and system for a pattern matching engine

Country Status (1)

Country Link
US (2) US7257576B2 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050185773A1 (en) * 2004-02-24 2005-08-25 Snowshore Networks, Inc. System and method for providing user input information to multiple independent, concurrent applications
US20060039389A1 (en) * 2004-02-24 2006-02-23 Burger Eric W Remote control of device by telephone or other communication devices
US20080177737A1 (en) * 2002-06-21 2008-07-24 Microsoft Corporation Method and system for a pattern matching engine
US20100017397A1 (en) * 2008-07-17 2010-01-21 International Business Machines Corporation Defining a data structure for pattern matching
US20170154126A1 (en) * 2015-11-30 2017-06-01 International Business Machines Corporation Matching an ordered set of strings containing wild cards

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9195766B2 (en) * 2004-12-14 2015-11-24 Google Inc. Providing useful information associated with an item in a document
US20060265357A1 (en) * 2005-04-26 2006-11-23 Potts Matthew P Method of efficiently parsing a file for a plurality of strings
US10664454B2 (en) * 2010-07-30 2020-05-26 Wai-Lin Maw Fill in the blanks word completion system
US8407245B2 (en) * 2010-11-24 2013-03-26 Microsoft Corporation Efficient string pattern matching for large pattern sets
IL224482B (en) 2013-01-29 2018-08-30 Verint Systems Ltd System and method for keyword spotting using representative dictionary
US11727005B2 (en) * 2013-03-05 2023-08-15 Cubic Design Studios Llc Fill in the blanks word completion system
IL226056A (en) * 2013-04-28 2017-06-29 Verint Systems Ltd Systems and methods for keyword spotting using adaptive management of multiple pattern matching algorithms
US9806809B2 (en) 2014-11-06 2017-10-31 Facebook, Inc. Deploying line-of-sight communication networks
IL242218B (en) 2015-10-22 2020-11-30 Verint Systems Ltd System and method for maintaining a dynamic dictionary
IL242219B (en) 2015-10-22 2020-11-30 Verint Systems Ltd System and method for keyword searching using both static and dynamic dictionaries

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4882699A (en) 1988-09-19 1989-11-21 International Business Machines Corp. Communications network routing and management system
US5761440A (en) 1994-09-15 1998-06-02 International Business Machines Corporation System and method utilizing multiple search trees to route data within a data processing network
US5995971A (en) 1997-09-18 1999-11-30 Micdrosoft Corporation Apparatus and accompanying methods, using a trie-indexed hierarchy forest, for storing wildcard-based patterns and, given an input key, retrieving, from the forest, a stored pattern that is identical to or more general than the key
US6041053A (en) 1997-09-18 2000-03-21 Microsfot Corporation Technique for efficiently classifying packets using a trie-indexed hierarchy forest that accommodates wildcards
US20030125931A1 (en) * 2001-12-07 2003-07-03 Shannon Roy Campbell Method for matching strings
US20030204703A1 (en) * 2002-04-25 2003-10-30 Priya Rajagopal Multi-pass hierarchical pattern matching
US6701369B1 (en) * 1998-09-11 2004-03-02 L.V. Partners, L.P. Method and apparatus for accessing a remote location by sensing a machine-resolvable code
US6738779B1 (en) * 2001-02-21 2004-05-18 Telecom Italia S.P.A. Apparatus for and method of multiple parallel string searching
US6785677B1 (en) * 2001-05-02 2004-08-31 Unisys Corporation Method for execution of query to search strings of characters that match pattern with a target string utilizing bit vector

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6411952B1 (en) * 1998-06-24 2002-06-25 Compaq Information Technologies Group, Lp Method for learning character patterns to interactively control the scope of a web crawler
US7257576B2 (en) * 2002-06-21 2007-08-14 Microsoft Corporation Method and system for a pattern matching engine

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4882699A (en) 1988-09-19 1989-11-21 International Business Machines Corp. Communications network routing and management system
US5761440A (en) 1994-09-15 1998-06-02 International Business Machines Corporation System and method utilizing multiple search trees to route data within a data processing network
US5995971A (en) 1997-09-18 1999-11-30 Micdrosoft Corporation Apparatus and accompanying methods, using a trie-indexed hierarchy forest, for storing wildcard-based patterns and, given an input key, retrieving, from the forest, a stored pattern that is identical to or more general than the key
US6041053A (en) 1997-09-18 2000-03-21 Microsfot Corporation Technique for efficiently classifying packets using a trie-indexed hierarchy forest that accommodates wildcards
US6701369B1 (en) * 1998-09-11 2004-03-02 L.V. Partners, L.P. Method and apparatus for accessing a remote location by sensing a machine-resolvable code
US6738779B1 (en) * 2001-02-21 2004-05-18 Telecom Italia S.P.A. Apparatus for and method of multiple parallel string searching
US6785677B1 (en) * 2001-05-02 2004-08-31 Unisys Corporation Method for execution of query to search strings of characters that match pattern with a target string utilizing bit vector
US20030125931A1 (en) * 2001-12-07 2003-07-03 Shannon Roy Campbell Method for matching strings
US20030204703A1 (en) * 2002-04-25 2003-10-30 Priya Rajagopal Multi-pass hierarchical pattern matching

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7873626B2 (en) 2002-06-21 2011-01-18 Microsoft Corporation Method and system for a pattern matching engine
US20080177737A1 (en) * 2002-06-21 2008-07-24 Microsoft Corporation Method and system for a pattern matching engine
US20050185773A1 (en) * 2004-02-24 2005-08-25 Snowshore Networks, Inc. System and method for providing user input information to multiple independent, concurrent applications
US20080107246A1 (en) * 2004-02-24 2008-05-08 Dialogic Corporation System and method for providing user input information to multiple independent concurrent applications
US7406696B2 (en) * 2004-02-24 2008-07-29 Dialogic Corporation System and method for providing user input information to multiple independent, concurrent applications
US20060039389A1 (en) * 2004-02-24 2006-02-23 Burger Eric W Remote control of device by telephone or other communication devices
US7885272B2 (en) * 2004-02-24 2011-02-08 Dialogic Corporation Remote control of device by telephone or other communication devices
US8286190B2 (en) 2004-02-24 2012-10-09 Dialogic Corporation System and method for providing user input information to multiple independent concurrent applications
US20100017397A1 (en) * 2008-07-17 2010-01-21 International Business Machines Corporation Defining a data structure for pattern matching
US8407261B2 (en) * 2008-07-17 2013-03-26 International Business Machines Corporation Defining a data structure for pattern matching
US20120158780A1 (en) * 2008-07-17 2012-06-21 International Business Machines Corporation Defining a data structure for pattern matching
US8495101B2 (en) * 2008-07-17 2013-07-23 International Business Machines Corporation Defining a data structure for pattern matching
US20170154126A1 (en) * 2015-11-30 2017-06-01 International Business Machines Corporation Matching an ordered set of strings containing wild cards
US10204177B2 (en) * 2015-11-30 2019-02-12 International Business Machines Corporation Matching an ordered set of strings containing wild cards

Also Published As

Publication number Publication date
US20080177737A1 (en) 2008-07-24
US7873626B2 (en) 2011-01-18
US20030236783A1 (en) 2003-12-25

Similar Documents

Publication Publication Date Title
US7873626B2 (en) Method and system for a pattern matching engine
US8914720B2 (en) Method and system for constructing a document redundancy graph
RU2421802C2 (en) Ranging functions using shifted distance measured by quantity of serial transitions, to document in network
AU2005201890B2 (en) Query to task mapping
JP4634105B2 (en) Computer-assisted query-task mapping
US20160210301A1 (en) Context-Aware Query Suggestion by Mining Log Data
US9576073B2 (en) Distance queries on massive networks
US7266559B2 (en) Method and apparatus for adapting a search classifier based on user queries
EP3292481B1 (en) Method, system and computer program product for performing numeric searches
US20060167851A1 (en) Systems and methods for providing a user interface with an automatic search menu
US7720883B2 (en) Key profile computation and data pattern profile computation
US7574457B2 (en) Non-mutating tree-structured file identifiers
US10572544B1 (en) Method and system for document similarity analysis
US7941464B2 (en) Reassembling fragmented files or documents in a file order-independent manner
Zhou et al. Efficient sequential access pattern mining for web recommendations
US7895237B2 (en) Reassembling fragmented files or documents in an order-independent manner that ensures each of the fragments belongs to only one reassembled file
JP2003016101A (en) System and method for retrieving electronic catalog
JP5224537B2 (en) Locality-detectable hash construction device, similar neighborhood search processing device, and program
US11080288B2 (en) Data querying system and method
US11093483B2 (en) Multilevel data lineage view
US8176051B2 (en) Search via fast case insensitive ASCII tree
CN117278521B (en) Asset identification method and computer device
CN110892401A (en) System and method for generating filters for k mismatched searches
CN113626600B (en) Text processing method, device, computer equipment and storage medium
Meng et al. Reference-free lossless compression of nanopore sequencing reads using an approximate assembly approach

Legal Events

Date Code Title Description
AS Assignment

Owner name: MICROSOFT CORPORATION, WASHINGTON

Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:EMINOVICI, VLAD;REEL/FRAME:013032/0174

Effective date: 20020619

FPAY Fee payment

Year of fee payment: 4

AS Assignment

Owner name: MICROSOFT TECHNOLOGY LICENSING, LLC, WASHINGTON

Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:MICROSOFT CORPORATION;REEL/FRAME:034541/0477

Effective date: 20141014

REMI Maintenance fee reminder mailed
LAPS Lapse for failure to pay maintenance fees
STCH Information on status: patent discontinuation

Free format text: PATENT EXPIRED DUE TO NONPAYMENT OF MAINTENANCE FEES UNDER 37 CFR 1.362

FP Lapsed due to failure to pay maintenance fee

Effective date: 20150814