This invention relates to a method of extracting sections of a data stream.
There are many instances where a user wishes to find and extract only certain data types from a larger body of data. The data is typically presented as a data stream, whether from a store, or in real time, and if all of the data were processed fully, this would be very slow.
A particular example of searching data streams is in SPAM filtering where it is desirable to extract data having a particular label, or end point identifier, such as an email address, a domain name, a uniform resource locator, or telephone number.
In accordance with the present invention, a method of extracting sections of a data stream, the sections comprising a set of sequences, wherein each sequence is encoded separately and coupled together to define the section, comprises determining a combination of at least two sequences of the set; comparing the combination of sequences with sequences in the data stream; and rejecting or accepting extraction of the section of the data stream based upon the result of the comparison; wherein if the combination of sequences does not include a start and end marker for the section, a search for the start and end markers is carried out before the section is extracted.
The present invention provides a high performance generic extraction framework which allows data stream content to be processed at high speed and used in a real time context.
Preferably, extraction of the section is accepted if the combination of sequences in any order matches stored sequences in the section of the data stream.
Preferably, extraction of the section is rejected if the combination of sequences does not match any of the sequences in the section of the data stream; and thereafter the search continues for further instances of the combination of sequences in another section.
Preferably, a sequence comprises a series of bits having a predetermined format, such as an anchor, or a bridge.
Preferably, the anchor is a statistically rare, or low probability sequence in the data stream.
Typically, the probability of occurrence is less than about 1%.
Preferably, the combination of sequences comprises an anchor and a sequence adjacent to the anchor.
This improves throughput by reducing the likelihood of a match.
Preferably, the combination of sequences comprises at least the first and last sequence of the section.
This allows the section to be extracted immediately if a match is found, whereas a successful match with a combination of sequences which does not include both start and end points requires the additional step of identifying these before extracting the section.
In one embodiment, the combination of sequences comprises more than one sequence associated with an anchor; wherein the combination of anchor and sequences to form the section is determined; and wherein the section is only extracted if all sequences forming the section are present.
This has the effect of only extracting sections where there is a complete match.
Preferably, searches for combinations of sequences are carried out in parallel on different sections of the data stream.
This could be by splitting the data stream, or looking for different combinations of sequences in the same part of the data stream.
Preferably, each sequence comprises a series of bits of data, or multiple bytes of data.
Preferably, the section comprises an end point identifier, such as a domain name; an email address; a uniform resource locator; or a telephone number.
Choosing a particular type of end point identifier allows a large amount of irrelevant data to be immediately discarded without having to search for a specific instance. For example, a SPAM filter could search for the domain name structure, so data lacking that format would not need to be considered.
Preferably, each sequence is encoded in a separate state machine and multiple state machines are combined to represent the section.
This makes the method more flexible.
Preferably, a bridge provides a transition between separate state machines representing the sequences of the section.
This allows the super state machine to be built up.
Preferably, the method further comprises filtering the extracted sections of the data stream; the filtering comprising determining a set of characters of interest; testing each section of the data stream for the presence of one or more of the set of characters of interest; and extracting sections in which at least one of the characters is present.
Having extracted sections which satisfy a minimum requirement, for example having a domain name format, then filtering is carried out to reduce the number of results more specifically, such as only emails having “.roke.” in their address.
Preferably, the method further comprises determining a further set of characters of interest; testing for at least one character from the further set of characters in the portion of the data stream; and extracting sections in which at least one of the characters from the further sets of characters is also present in the section.
This step can be repeated until the amount of data which needs to be tested for a complete match is reduced to a reasonable amount.
Although, all the processing steps could be carried out in real time, preferably, the extracted sections are stored in a store and extracted as and when needed.
Preferably, the extracted sections are input to a comparison stage; compared with specific examples of end point identifiers; and discarded if the section does not match a specific example in the comparison stage.
An example of a method of extracting sections of a data stream will now be described with reference to the accompanying drawings in which:
The present invention describes a technique which allows structural forms of data to be identified and extracted, such as identifying and extracting data based on it being a domain name, an email address, or a data and time format. Other examples include, in search engine indexing automating the process of document retrieval and classification, e.g. if using a web spider for extraction of hyperlinks from html documents in order to construct a list of URLs to subsequently retrieve. Given the vast quantities of html content available on the Internet efficient extraction of hyperlinks from web pages is required. Another example is use in real time SPAM classification. Part of SPAM classification involves the identification of URLs/URLs, domain names or email addresses associated with SPAM objects. Such identification is used with whitelist/blacklists of SPAM items to filter out SPAM content. Due to the large quantities of SPAM present in modern communications networks, an efficient identification and filtering of SPAM content is desired.
A section of data, typically representing an end point identifier, label, or meta-data, which section is to be identified and extracted, is broken down by encoding each subsection of the format within an individual state machine. Particular characters can then be used as bridges to move between one state machine and another, where a bridge character is used to move between the different machines describing a meta-data format. Thus, a complete format is defined by creating a number of smaller machines that describe each subsection of the format. The machines are then used with the bridges to create a super machine that describes the entire format. Complete traversal of the super machine from its start state to its terminal state is used to identify the end point identifier format. Anchors are signatures that are associated with the label of interest, in particular, single characters or sequences of characters that are statistically rare in free text, or binary data. This property can be used to quickly lock on to a location in free text that has a higher than average probability of being a subpart of the label of interest.
For example of the present invention may be described with respect to identification and extraction of a hyperlink consisting of a sequence of characters followed by a domain name e.g. href=http://www.roke.co.uk. In general a hyperlink can be identified by recognising the domain name part of the format. The domain name part of the hyperlink can be described using the following syntax:
DNIV domain.domain[.domain] DNIV.
Within this syntax the following subgroups are identified:
[ ]—square brackets are used to signify one or more optional components.
DNIV—this is the set of characters that are illegal within the domain name part.
domain—this is the set of character that are legal within the domain name part.
.—the dot symbol is a bridge between two domain name parts.
In general the set of characters that compose the DNIV, and domain name parts of the syntax are defined by the standards for internet based computer names. DNIV is also defined by the expression-!domain.
The mechanism for extracting sections of the data stream is described in more detail with respect to
From startdomain name 1, if a valid domain name character Chd 2 is identified, the test moves on to the next point 3. If an invalid character 4, or bridge character 5, are found, the test fails 6. From point 3, an invalid character 7 causes a fail 8 and a valid character 9 loops back on itself, but a bridge character 10 moves the test on to the next point 11. From point 11 a bridge character 12, or an invalid character 13 cause a fail 6, whereas a valid character 14 moves on to the next point 15. A bridge character 16 moves to point 11, a valid character 17 loops back on itself to point 15 and an invalid character 18 moves to the end point, enddomain name 19. For startDNIV, an invalid character moves the test to endDNIV (not shown). Having determined a start and end point for the domain name, the series of sequences making up this section of the data stream can be extracted for storage, or further processing. In the state machine the domain name format is identified in a left to right fashion as the text is examined. However, in principal the sub parts of the format can be identified in any order.
The label or end point identifier which is used to determine which sections of the data stream are extracted is made up of parts, some of which may be statistically rarer than others in free text. Consequently, an effective method to increase the practical performance of the identification algorithm is to look for these parts before the others. These parts, known as anchor points, can be used to ‘lock on’ to a position in the data stream that may be an instance of the end point identifier type sought.
Once an anchor point has been found in the data stream, validation of the data is carried out by parsing outwards (forward and backwards) around the anchor point. For the domain name example the ‘.’ symbols are statistically rarer in free text than the other characters contained in the domain name format. This modification splits the domain name algorithm into two distinct machines as shown in
The series of steps in
Finally performance can be further improved by exploiting the machine word size. The meta-data format is defined as a collection of bytes. However, modern processors have register sizes that are multiple bytes wide. The machine register size can be exploited by adapting the state machines so that the state machine transitions are labelled with multi byte values rather than single byte values. In this instance the input byte stream is processed multiple bytes at a time instead of a single byte at a time. Thus, in effect the multi-byte state machine runs multiple instances of the single byte state machine each starting at different byte offset, i.e. the throughput is increased by processing the data in multiple machines operating in parallel.
An example of a simplified ‘.domain’ state machine that processes two bytes at a time is shown in
The machine is started by finding a pair of bytes defined by either of the following sequences Chd. or .Chd 50 followed by a valid domain name that satisfies this version of the domain name state machine.
Thus, the algorithm no longer looks for the ‘.’ symbol specifically but searches for a 16 bit sequence containing the ‘.’ symbol. This modification also has the advantage that a 16 bit sequence containing an ‘.’ is statistically rarer than a bare‘.’ symbol. Consequently, the algorithm rejects a larger fraction of potential alignments by enforcing the formatting of the characters around the ‘.’.
The machine is started by finding a pair of bytes defined by either of the following sequences, Chd. or .Chd 50 and in this case the test moves to the next point 51. At point 51 if the next two bytes are Chd. or .Chd the search loops back on itself 52. At point 51 if the next two bytes are ChdChd 53 the test moves to the next point 54. At point 54 if the next two bytes are Chd. or .Chd 55 the search moves back to point 51. At point 54 if the next two bytes are ChdChd the search loops back on itself 56. At point 54 if the next two bytes are any of the following Chd! Chd or !ChdChd or !Chd!Chd 57 the search has failed 58. At point 54 if the next two bytes are Chd. or .Chd 59 then the search moves to point 60. At point 60 if the next two bytes are Chd. or .Chd 61 then the search moves to point 51. At point 60 if the next two bytes are ChdChd 62 then the search loops back on itself. At point 60 if the next two bytes are Chd!Chd or !ChdChd or !Chd ! Chd 64 then a domain name has been found 65. At point 60 if the next two bytes are Chd. or .Chd 63 then a domain name has been found 69. At point 69 if the next two bytes are ChdChd 66 then the search moves to point 54. At point 69 if the next two bytes are Chd. or .Chd 67 then the search moves back to point 51.
In summary, the invention uses a set of state machines to describe the format of an end point identifier, label or meta-data. A super machine is created by linking the smaller machines using bridge characters. Anchor points may be defined in the format, so these are identified first to increase throughput. A further feature is that multi-byte versions of the state machines may be defined to enable the input to be processed in parallel. Rather than process the byte stream 8 bits at a time a pointer is used to access the data several bytes at a time. Each vertex of the machine is labelled using a multi byte value. The value of the sequence of bytes pointed at by the pointer is then used to traverse the vertices of the machine. This means that several bytes of the input are processed for each transition of the machine which improves the throughput. In effect this can be thought of as running several single character machines in parallel i.e. the state machine design exploits the machine word size to enable parallel processing in software.
More generally, in the example of searching for a hyperlink_. The pattern is:
href=“http://URL”
In this case the pair of labels are:
href=“http://and”
The labels are separated by a sequence of characters from the valid set of characters that can be used within a URL. The example is shown in
Starting at point 78, the sequence href=“http://79 takes the search to point 80. From point 80 a symbol from the set ChURL (the set of valid URL characters) 82 takes the search to point 85. From point 80 a symbol that is not in the set ChURL (!ChURL) 81 takes the search to point 83 and the search fails. From point 85 a valid URL character 86 loops the search back to point 85. From point 85 an invalid URL character 84 results in failure 83. From point 85 the quote character 87 takes the search to point 88. At this point a valid hyperlink has been found and can be extracted.
When searching a page for a title, having a pattern
<title> page title </title>
In this case the pair of labels are:
<title> and </title>
The labels are separated by a sequence of characters from the set A-Z, a-z, 0-9 as illustrated in
Starting at 70 the sequence <title>71 takes the search to point 72. At point 72 the characters A-Z, a-z, 0-9 (73) loop the search back to point 72. At point 72 the symbols in the set !(A-Z, a-z, 0-9)! (</title>) 76 take the search to point 77 and the search fails. At point 72 the sequence </title>74 takes the search to point 75 and the end. Thus, the identification of the pair of sequences <title> </title> identifies a page title between them.
Alternatively, when the search may be for a Date-Time format.
The pattern is:
Jan. 1 2008 SPACE10:20:22
In this case the pair of labels are:
Month and :NUM NUM !(NUM)
The month can be one from the set of patterns Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec. NUM indicates one of the characters 0-9 and !(NUM) means not one of the characters 0-9. In this case a bridge character is needed to link the date and time parts. A suitable bridge is the SPACE character after the year. The example is shown in
Starting at point 89, a valid month 90 moves the search to point 91. From point 91 any character 92 takes the search to point 93. At point 93 any character loops the search back to point 93. At point 93 the SPACE character 95 takes the search to point 96. At point 96 any character 97 takes the search to point 98. At point 98 any character 99 loops the search back to point 98. At point 98 the sequence: NUMNUM!(NUM) 100 completes the search 101.
The present invention allows sections of data to be identified and extracted. Although the examples have been described using hyperlinks and domain names, the invention can be applied to many other end user identifier types including email address identification; URI/URL identification; Session Initiation Protocol (SIP) URI identification; E.164 telephone number detection; tag detection in other data formats; IP addresses, port range, protocol and session identifier detection; xml data structures, xml objects; HTML structures and objects; and detection of content types and identification of content from packet payloads. The basic method can be improved to increase throughput and processing speed by use of an anchor structure, or looking for an ngram containing an anchor symbol.
The combination of separate encoded sequences represented by smaller state machines into a group of state machines to produce the full format of an end user identifier, or label, allows labels of arbitrary complexity to be detected. Further improvements in throughput arise from the use of parallel processing, exploiting machine word size to run several instances of a super machine in parallel.
In the arrangement of
In the arrangement of
In the arrangement of
In the arrangement of
In the arrangement of
In the arrangement of
Although
It will be recognized from the discussion of
The foregoing disclosure has been set forth merely to illustrate the invention and is not intended to be limiting. Since modifications of the disclosed embodiments incorporating the spirit and substance of the invention may occur to persons skilled in the art, the invention should be construed to include everything within the scope of the appended claims and equivalents thereof.
Number | Date | Country | Kind |
---|---|---|---|
0700926.9 | Jan 2007 | GB | national |
0700928.5 | Jan 2007 | GB | national |
This application is a continuation of PCT International Application No. PCT/GB2008/000184, filed Jan. 18, 2008, which claims priority under 35 U.S.C. § 119 to Great Britain Patent Application No. 0700926.9, filed Jan. 18, 2007, and Great Britain Patent Application No. 0700928.5, filed Jan. 18, 2007, the entire disclosures of the aforementioned applications are herein expressly incorporated by reference. The present application is also related to U.S. patent application Ser. No. ______, entitled “A Method of Filtering Sections of a Data Stream” and filed on even date herewith, which is a continuation of PCT International Application No. PCT/GB2008/000172, filed Jan. 18, 2008, which claims priority under 35 U.S.C. § 119 to Great Britain Patent Application No. 0700926.9, filed Jan. 18, 2007, and Great Britain Patent Application No. 0700928.5, filed Jan. 18, 2007, the entire disclosures of the aforementioned applications are herein expressly incorporated by reference.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/GB2008/000184 | Jan 2008 | US |
Child | 12505147 | US |