KR20200075295A - An order-preserving pattern matching algorithm using fingerprint of secondary q-grams - Google Patents
An order-preserving pattern matching algorithm using fingerprint of secondary q-grams Download PDFInfo
- Publication number
- KR20200075295A KR20200075295A KR1020180163814A KR20180163814A KR20200075295A KR 20200075295 A KR20200075295 A KR 20200075295A KR 1020180163814 A KR1020180163814 A KR 1020180163814A KR 20180163814 A KR20180163814 A KR 20180163814A KR 20200075295 A KR20200075295 A KR 20200075295A
- Authority
- KR
- South Korea
- Prior art keywords
- gram
- pattern
- ranking
- fingerprint
- pattern matching
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F7/00—Methods or arrangements for processing data by operating upon the order or content of the data handled
- G06F7/02—Comparing digital values
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Software Systems (AREA)
- Computational Mathematics (AREA)
- Mathematical Analysis (AREA)
- Mathematical Optimization (AREA)
- Pure & Applied Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
아래의 설명은 복수 개의 q-그램에 대한 핑거프린트를 이용하여 수행시간을 개선한 순위패턴매칭 알고리즘에 관한 것이다.The following description relates to a ranking pattern matching algorithm that improves execution time by using a fingerprint for a plurality of q -grams.
두 문자열의 길이가 같고, 각 문자열에서 문자들의 상대적인 순위가 모든 위치에서 일치하면 순위동형이라 한다. 예를 들면, T=(15, 33, 26, 41, 7, 6, 51)와 P=(33, 21, 7)가 주어졌을 때, 과 P는 순위동형이다. 순위패턴매칭문제(order-preserving pattern matching problem)는 대소비교가 가능한 알파벳 로 구성된 텍스트 T와 패턴 P가 주어졌을 때, P와 순위동형인 T의 모든 부분문자열을 찾는 문제이다. 이때, 순위패턴매칭문제는 두 음악의 유사멜로디 검출이나 주가분석 등에 활용될 수 있다.If two strings have the same length, and the relative rank of characters in each string matches in all positions, it is called a ranking isomorphism. For example, given T=(15, 33, 26, 41, 7, 6, 51) and P=(33, 21, 7), And P are ranking isotypes. The order-preserving pattern matching problem can be compared with the alphabet When the text T and pattern P consisting given, the problem of finding all the parts of a string P and ranking homozygous T. At this time, the ranking pattern matching problem can be used for detecting similar melody of two music or analyzing the stock price.
최근 순위패턴매칭문제를 해결하기 위한 연구들이 활발하게 진행되고 있다. 길이가 각각 n, m인 텍스트 T와 패턴 P가 주어졌을 때, 순위패턴매칭문제를 KMP알고리즘을 기반으로 시간에 해결하는 알고리즘이 제시되었다. 다른 연구에서는 P와 순위동형인 T의 부분문자열의 개수를 occ라 할 때, 순위접미사트리(order-preserving suffix trees)를 시간에 생성하는 알고리즘을 제시하고, 이를 이용하여 순위패턴매칭문제를 시간에 해결하는 알고리즘을 제시하였다. 또 다른 연구에서는 q개의 연속된 문자인 q-그램(q-gram)에 대한 핑거프린트(fingerprint)와 Horspool 알고리즘의 오문자규칙(bad-character heuristic)을 이용하여, 정수 알파벳일 때 시간, 일반 알파벳일 때 시간에 순위패턴매칭문제를 해결하는 알고리즘을 제시하였고, KMP 알고리즘을 함께 이용하여 정수 알파벳일 때 시간, 일반 알파벳일 때 시간에 순위패턴매칭문제를 해결하는 알고리즘이 제시되었다. Recently, studies to solve the ranking pattern matching problem have been actively conducted. Given a text T and a pattern P of length n and m respectively, the ranking pattern matching problem is based on the KMP algorithm. An algorithm for solving in time was presented. In another study, when the number of substrings of P and the rank isomorphic T is called occ, order-preserving suffix trees are used. We present the algorithm that we generate in time and use it to solve the ranking pattern matching problem. We presented an algorithm to solve in time. In another study, using the rules ohmunja (bad-character heuristic) of the fingerprint (fingerprint) and Horspool algorithms for the q consecutive letters g of q- (q-gram), when an integer alphabet Time, in the general alphabet We proposed an algorithm that solves the problem of ranking pattern matching in time, and when it is an integer alphabet using KMP algorithm together Time, in the general alphabet An algorithm was proposed to solve the ranking pattern matching problem in time.
복수 개의 q-그램에 대한 핑거프린트들을 이용한 순위패턴매칭 알고리즘을 제공할 수 있다.A ranking pattern matching algorithm using fingerprints for a plurality of q-grams may be provided.
전처리부 및 계산부를 포함하는 순위패턴매칭 장치에서 수행되는 핑거프린트를 이용한 순위패턴매칭 방법은, 상기 전처리부에서, 패턴(P)에 대한 위치테이블, 이동테이블 및 복수 개의 q-그램에 대한 핑거프린트를 계산하는 전처리 단계; 및 상기 계산부에서, 상기 패턴(P)에 대한 위치테이블, 상기 이동테이블 및 상기 복수 개의 q-그램에 대한 핑거프린트를 계산한 값을 이용하여 상기 패턴(P)과 순위동형인 텍스트(T)의 부분문자열을 탐색하는 계산 단계를 포함할 수 있다. The ranking pattern matching method using the fingerprint performed by the ranking pattern matching device including the pre-processing unit and the calculation unit, in the pre-processing unit, the position table for the pattern P, the moving table and the fingerprints for a plurality of q-grams Pre-processing step for calculating; And in the calculation unit, text (T) equal to the rank of the pattern (P) using the position table for the pattern (P), the movement table, and the values calculated for the plurality of q-gram fingerprints. It may include a calculation step of searching for the substring of.
상기 복수 개의 q-그램은, 상기 패턴(P)와 텍스트(T)가 주어졌을 때, 상기 패턴(P)의 가장 오른쪽 q-그램을 1차 q-그램, 상기 1차 q-그램을 기준으로 상기 1차 q-그램의 이전에 위치한 q- 그램을 2차 q-그램이라고 하고, 상기 1차 q-그램 및 상기 2차 q-그램을 포함할 수 있다.The plurality of q-grams, when given the pattern (P) and the text (T), the rightmost q-gram of the pattern (P) is based on the first q-gram and the first q-gram The q-gram located before the first q-gram is referred to as a second q-gram, and may include the first q-gram and the second q-gram.
상기 계산 단계는, 과 비교를 시작하는 텍스트(T)의 위치를 i라고 할 때, 각 에 대해 1차 q-그램의 핑거프린트인 와 가 일치하는지 판단하는 단계를 포함할 수 있다. The calculation step, When i is the position of the text T that starts comparing with Is the first q-gram fingerprint for Wow It may include the step of determining whether the match.
상기 계산 단계는, 상기 각 에 대해 1차 q-그램의 핑거프린트인 와 가 일치할 경우, 2차 q-그램의 핑거프린트인 와 가 일치하는지 확인하는 단계를 포함할 수 있다. The calculation step, the angle Is the first q-gram fingerprint for Wow If is, the 2nd q-gram fingerprint Wow It may include the step of confirming that the match.
상기 계산 단계는, 상기 2차 q-그램의 핑거프린트인 와 가 일치할 경우, 패턴(P)와 의 순위동형 여부를 위치테이블을 이용하여 확인하고, 을 단계를 포함할 수 있다. The calculating step is a fingerprint of the second q-gram Wow If is, the pattern (P) and Check the ranking isomorphism using the location table, It may include a step.
상기 계산 단계는, 순위동형 여부에 관계없이 텍스트의 위치(i)를 만큼 증가시기는 단계를 포함할 수 있다. The calculation step, the position of the text (i) regardless of the ranking isomorphism The increase period can include steps.
순위패턴매칭 장치는, 패턴(P)에 대한 위치테이블, 이동테이블 및 복수 개의 q-그램에 대한 핑거프린트를 계산하는 전처리부; 및 상기 패턴(P)에 대한 위치테이블, 상기 이동테이블 및 상기 복수 개의 q-그램에 대한 핑거프린트를 계산한 값을 이용하여 상기 패턴(P)과 순위동형인 텍스트(T)의 부분문자열을 탐색하는 계산부를 포함할 수 있다.The ranking pattern matching device includes: a pre-processing unit for calculating a fingerprint for a position table, a movement table, and a plurality of q-grams for the pattern P; And a substring of the text (T) equal to the rank of the pattern (P) using the position table for the pattern (P), the movement table, and the values calculated for the plurality of q-grams. It may include a calculation unit.
2개의 q-그램을 이용하여 순위동형을 검증하는 횟수를 감소시켜 수행속도를 개선할 수 있다.By using two q-grams, the number of times the ranking isomorphism is verified can be reduced to improve the performance speed.
도 1은 일 실시예에 따른 2개의 q-그램에 대한 핑거프린트들을 이용한 순위패턴매칭 알고리즘을 나타낸 예이다.
도 2는 일 실시예에 따른 순위패턴매칭 장치의 구성을 설명하기 위한 블록도이다.
도 3은 일 실시예에 따른 순위패턴매칭 장치에서 수행되는 순위패턴매칭 방법을 설명하기 위한 흐름도이다.
도 4는 일 실시예에 있어서, 텍스트 T와 q-그램 핑거프린트의 분포율을 나타낸 그래프이다.1 is an example of a ranking pattern matching algorithm using fingerprints for two q-grams according to an embodiment.
2 is a block diagram illustrating a configuration of a ranking pattern matching device according to an embodiment.
3 is a flowchart illustrating a ranking pattern matching method performed in the ranking pattern matching apparatus according to an embodiment.
4 is a graph showing a distribution ratio of text T and q-gram fingerprints in one embodiment.
이하, 실시예를 첨부한 도면을 참조하여 상세히 설명한다.Hereinafter, embodiments will be described in detail with reference to the accompanying drawings.
알파벳 는 상수시간에 비교 가능한 정수문자 집합이다. 로 구성된 길이가 m인 문자열들의 집합을 로 표기한다. 문자열 의 길이를 , 의 i번째 문자를 로 표시한다. 문자열 의 i번째부터 j번째까지의 부분문자열 를 로 표기한다. 에서 i=0이면, 이를 의 접두사(prefix)라고 하고, 이면 의 접미사(suffix)라 한다. 두 문자열 , 에 대해 이고 이면 , 는 순위동형이라 하고 로 표기한다.alphabet Is a set of integer characters that can be compared at constant time. A set of strings of length m consisting of Is denoted as. String The length of , I th Character It is indicated by. String I th through j th substrings To Is denoted as. In i = 0, Is called the prefix of Back side It is called the suffix of. Two strings , About ego Back side , Is called ranking isomorphism Is denoted as.
문자열의 순위관계를 표현하는 방법으로 접두사표현(prefix representation)과 최근접이웃표현(nearest neighbor representation)이 있다. 문자열 의 접두사표현은 접두사테이블(prefix table) 를 이용하여 정의된다.Prefix representation and nearest neighbor representation are used to express the rank relationship of strings. String The prefix expression of the prefix table It is defined using
다시 말해서, 는 문자열 에서 보다 작은 문자들의 수이다. 문자열 , 에 대한 가 주어졌을 때, 이면, 이다. In other words, Is a string in The number of smaller characters. String , for Is given, If it is, to be.
문자열 에 대한 최근접이웃표현은 위치테이블(location table) , 을 이용하여 정의된다. String The nearest neighbor expression for is a location table , It is defined using.
다시 말해서, 는 에서 보다 작은 값 중 가장 큰 값의 위치 이고, 은 에서 보다 큰 값 중 가장 작은 값의 위치 j이다. 만약 그러한 j가 복수 개 존재한다면, 가장 큰 위치를 저장한다. 만약, 그러한 위치 j가 존재하지 않으면, -1을 저장한다. 문자열 , 와 , 가 주어졌을 때, 이면, 이다.In other words, The in The position of the largest of the smaller values ego, silver in It is the location j of the smaller of the larger values. If there are multiple such js , the largest location is stored. If no such location j exists, -1 is stored. String , Wow , Is given, If it is, to be.
표 1은 문자열 P=(11, 83, 32, 40, 9, 56)일 때, P에 대한 접두사테이블 와 위치테이블 , 를 보여준다. 접두사테이블은 순위통계트리, 위치테이블은 정렬알고리즘을 이용하여 각각 시간에 계산할 수 있다.Table 1 shows the prefix table for P when the string P=(11, 83, 32, 40, 9, 56) And position table , Shows. The prefix table is a ranking statistic tree, and the position table is a sorting algorithm. Can be calculated in time.
표 1: P=(11, 83, 32, 40, 9, 56)에 대한 접두사테이블과 위치테이블Table 1: Prefix table and position table for P=(11, 83, 32, 40, 9, 56)
순위패턴매칭문제에서 입력은 텍스트 , 패턴 이고, 출력은 인 모든 위치 i 이다. 편의상 P와 T는 서로 다른 정수로 구성된다고 가정한다. In the ranking pattern matching problem, input is text , pattern And the output is It is all positions i . For convenience, it is assumed that P and T are composed of different integers.
도 1은 일 실시예에 따른 2개의 q-그램에 대한 핑거프린트들을 이용한 순위패턴매칭 알고리즘을 나타낸 예이다.1 is an example of a ranking pattern matching algorithm using fingerprints for two q-grams according to an embodiment.
실시예에서는 복수 개의 q-그램, 예를 들면, 2개의 q-그램을 이용하여 순위동형을 검증하는 횟수를 감소시켜 수행속도를 개선하는 방법을 설명하기로 한다. 예를 들면, q 개의 연속된 문자인 q-그램 에 대한 핑거프린트 가 다음과 같이 정의될 수 있다.In an embodiment, a method of improving the performance speed by reducing the number of times the ranking isomorphism is verified using a plurality of q -grams, for example, two q -grams, will be described. For example, q consecutive characters q -gram Fingerprint for Can be defined as
이때, 는 계승수체계(factorial number system)를 사용하므로 0~q!-1 중 하나의 정수로 변환될 수 있다. 예를 들면, q=3일 때, q-그램 =(11, 83, 32)라면, =(0, 1, 1)이며, 에 대한 핑거프린트 =(0X0!)+(1X1!)+(1X2!)=3이다. At this time, Since it uses a factorial number system, it can be converted to an integer from 0 to q !-1. For example, when q = 3, q -gram =(11, 83, 32), =(0, 1, 1), Fingerprint for =(0X0!)+(1X1!)+(1X2!)=3.
일 때, 의 일치여부를 확인한 뒤 일치하였을 경우에 위치테이블을 이용하여 순위동형 여부를 확인한다. 이때, 는 패턴 P의 가장 오른쪽 q-그램 핑거프린트를 의미할 수 있다. when, After confirming whether or not matches are made, if they match, the position table is used to check whether the ranking is the same. At this time, Can mean the rightmost q -gram fingerprint of pattern P.
도 2는 일 실시예에 따른 순위패턴매칭 장치의 구성을 설명하기 위한 블록도이고, 도 3은 일 실시예에 따른 순위패턴매칭 장치에서 수행되는 순위패턴매칭 방법을 설명하기 위한 흐름도이다.2 is a block diagram illustrating a configuration of a ranking pattern matching apparatus according to an embodiment, and FIG. 3 is a flowchart illustrating a ranking pattern matching method performed in the ranking pattern matching apparatus according to an embodiment.
실시예에서 제시하는 알고리즘은 전처리 단계(310)와 계산 단계(320)로 구성될 수 있다. 이러한 알고리즘은 전처리부(210)와 계산부(220)를 포함하는 순위패턴매칭 장치(200)에 의해 수행될 수 있다. 을 P의 1차 q-그램, 을 P의 2차 q-그램이라고 하자. 다시 말해서, 2차 q-그램은 1차 q-그램의 바로 앞에 위치한 q-그램이 된다. The algorithm presented in the embodiment may be composed of a
전처리 단계(310)에서 전처리부(210)는 패턴 P에 대한 위치테이블과 이동테이블, 2개의 q-그램에 대한 핑거프린트를 계산할 수 있다. 이때, 예를 들면, 이동테이블 D는 모든 가능한 q-그램 에 대해 최대이동거리 m-q+1로 초기화한 뒤, 다음의 수식을 이용하여 계산될 수 있다. 이동테이블 D는 모든 가능한 q-그램에 대한 정보를 저장할 수 있다. In the
계산 단계(320)에서 계산부(220)는 패턴 P에 대한 위치테이블과 이동테이블, 2개의 q-그램에 대한 핑거프린트를 계산한 각각의 값을 이용하여 패턴 P와 순위동형인 텍스트 T의 모든 부분문자열을 탐색할 수 있다. 구체적으로, 과 비교를 시작하는 텍스트 T의 위치를 i라고 할 때, 각 에 대해 1차 q-그램의 핑거프린트인 와 가 일치하면 2차 q-그램의 핑거프린트인 와 가 일치하는지 확인한다. 만약, 2차q-그램의 핑거프린트도 일치하면, 패턴 P와 의 순위동형 여부를 위치테이블을 이용하여 확인하여 이면, 위치 i-m+1을 출력할 수 있다. 이후, 순위동형 여부에 관계없이 i를 만큼 증가시키고 위 과정을 반복할 수 있다.In the
도 1을 참고하면, 예를 들면, T=(15, 33, 26, 41, 18, 6, 51, 99, 36, 2)와 P=(33, 21, 7, 35, 70)이 주어졌을 때, 단계 7은 다음과 같이 수행될 수 있다. 텍스트 T와 패턴 P의 1차 q-그램의 핑거프린트가 5로 일치하므로 2차 q-그램의 핑거프린트를 계산하고 비교한다. 이 두 값도 4로 일치하므로 두 문자열이 순위동형인지 확인한다. 순위동형을 확인한 결과, 이므로 3을 출력하고 이동테이블 D[5]=3을 이용하여 비교위치i를 10으로 증가시킨다. 이때, i>n-1이므로 탐색을 종료한다.Referring to Figure 1, for example, T = (15, 33, 26, 41, 18, 6, 51, 99, 36, 2) and P = (33, 21, 7, 35, 70) is given At this time,
실시예에서 제안된 알고리즘의 전처리 단계에서 패턴 P에 대한 위치테이블, 이동테이블은 각각 , 시간에 계산할 수 있다. 계산 단계에서 q-그램들의 핑거프린트 계산과, P와 의 순위동형 확인은 각각 총 시간, 시간에 수행할 수 있다. 이에 따라, 실시예에서 제안된 알고리즘의 총 수행시간은 시간이 된다. In the preprocessing step of the algorithm proposed in the embodiment, the position table and the movement table for the pattern P are respectively , Can be calculated in time. Fingerprint calculation of q -grams at the calculation stage, P and The ranking isomorphism of each is total time, Can be done in time. Accordingly, the total execution time of the algorithm proposed in the embodiment is It's time.
도 4는 일 실시예에 있어서, 텍스트 T와 q-그램 핑거프린트의 분포율을 나타낸 그래프이다.4 is a graph showing a distribution ratio of text T and q -gram fingerprints in one embodiment.
실시예에서 제안된 알고리즘에 대한 실험이 수행될 수 있다. 실험 환경으로 OS는 Windows 10(64 비트), CPU 및 RAM은 Intel Core i7-6700(3.4GHz), 32GB RAM, 개발 툴 및 언어는 Visual studio 2015, c++이 구성될 수 있다. 텍스트 T와 패턴 P는 C++ boost library를 이용하여 에 대해 무작위로 생성한 정수형 문자열(n=5,000,000)과 1985년 2월 16일부터 2010년 12월 31일까지의 다우존스산업평균지수의 일별 종가(n=34,685)로 생성한 다우존스지수 데이터를 이용하였다. m은 5, 10, 15에 대해, q는 3부터 7까지 변경하며 실험이 진행될 수 있다.Experiments on the algorithms proposed in the embodiments can be performed. As an experimental environment, Windows 10 (64-bit) for the OS, Intel Core i7-6700 (3.4 GHz) for CPU and RAM, 32 GB RAM, development tools and languages for Visual studio 2015, c++ can be configured. Text T and pattern P are available using the C++ boost library. The Dow Jones index data generated by the randomly generated integer string (n=5,000,000) and the daily closing price (n=34,685) of the Dow Jones Industrial Average from February 16, 1985 to December 31, 2010 Was used. m is 5, 10, 15, q is changed from 3 to 7, the experiment can proceed.
수행시간은 무작위로 생성된 정수형 문자열에 대해 1000번 실험한 수행시간의 합으로, 다우존스지수 데이터에 대해 10000번 실험한 수행시간의 합이 측정될 수 있다. 무작위로 생성한 문자열의 경우 패턴 또한 무작위로 생성될 수 있으며, 다우존스지수 데이터에서 패턴은 T의 위치에서 무작위로 추출될 수 있다. 편의상 종래의 연속된 문자인 q-그램(q-gram)에 대한 핑거프린트(fingerprint)와 Horspool 알고리즘의 오문자규칙(bad-character heuristic)을 이용하여 순위패턴매칭문제를 해결하는 알고리즘을 OPQ, 실시예에서 제안된 알고리즘을 OPSQ로 기재하여 설명하기로 한다. The execution time is the sum of the execution time of 1000 experiments on a randomly generated integer string, and the sum of the execution time of 10000 experiments on the Dow Jones Indices data can be measured. In the case of a randomly generated character string, the pattern may also be randomly generated, and in the Dow Jones Index data, the pattern may be randomly extracted at the location of T. Examples of the fingerprint (fingerprint) and Horspool algorithm ohmunja rule (bad-character heuristic) an algorithm to solve the ranking pattern matching problem by using for the g (q-gram) OPQ, - for convenience of q conventional consecutive characters The proposed algorithm will be described as OPSQ.
제1 실험으로서, 입력 데이터에 대한 수행시간을 비교하는 실험이 수행될 수 있다. 표 2는 입력 데이터에 따른 OPQ와 OPSQ의 수행시간을 나타낸 것이다. 각 실험에서 수행시간이 가장 빠른 알고리즘을 진하게 표시하였다. As a first experiment, an experiment comparing the execution time for the input data may be performed. Table 2 shows the execution time of OPQ and OPSQ according to the input data. In each experiment, the algorithm with the fastest execution time is shown in bold.
표 2: m=4, 10, 15, 3≤q≤7에 대한 OPQ와 OPSQ의 수행시간Table 2: Execution time of OPQ and OPSQ for m = 4, 10, 15, 3≤ q ≤7
ran은 무작위로 생성된 입력 데이터, dow는 다우존스지수 입력 데이터를 의미한다. ran의 경우, m=10, q=3일 때, OPSQ 가 OPQ보다 약 12% 빠르게 수행되었다. m, q의 크기와 상관없이 모든 경우에서 OPSQ 가 OPQ보다 평균 약 9% 빠른 수행시간을 보여준다. = 4, 10인 경우에도 유사한 결과를 보인다. ran means randomly generated input data, and dow means Dow Jones Index input data. In the case of ran , when m = 10 and q = 3, OPSQ was performed about 12% faster than OPQ. In all cases, regardless of the size of m or q , OPSQ shows an average of 9% faster execution time than OPQ. = 4 and 10 show similar results.
dow의 경우, m=10, q=3일 때, OPSQ 가 OPQ보다 최대 약 10% 빠르게 수행되었다. 그런데, q≥4일 때에는 ran의 경우와 달리, OPSQ의 수행시간은 OPQ에 비해 크게 개선되지 않고 평균적으로 1% 정도 빠르게 수행되었다. 특히, m=15, q=6일 때, OPSQ는 OPQ보다 오히려 느린 수행시간을 보인다. 이러한 결과에 대해서 다음 실험을 통하여 분석할 수 있다. For dow , when m = 10 and q = 3, OPSQ was performed up to about 10% faster than OPQ. However, when q ≥ 4, unlike in the case of ran , the execution time of OPSQ was not significantly improved compared to that of OPQ, and was performed on average about 1% faster. In particular, when m = 15 and q = 6, OPSQ shows a slower execution time than OPQ. These results can be analyzed through the following experiments.
제2 실험은 알고리즘의 성능에 영향을 미치는 요소는 분석한 것이다. 제1 실험의 결과, 실시예에서 제안된 알고리즘은 dow의 경우, q≥4일 때 기존의 알고리즘보다 수행시간이 크게 개선되지 않았다. 이는 다우존스지수의 특성상 q-그램 핑거프린트가 균일하게 나타나지 않기 때문이라 유추될 수 있다. 이러한 경우, 알고리즘의 성능을 향상시키기 위하여 제1 실험에서 사용된 텍스트 T의 모든 q-그램 핑거프린트의 분포를 확인하고 그 결과를 이용하여 패턴을 추출한 실험이 진행될 수 있다. The second experiment analyzed the factors affecting the performance of the algorithm. The first case of the algorithm proposed in the dow result, embodiments of the experiment, q is ≥4 processing time were not significantly improved compared to conventional algorithms when. This can be inferred because the q -gram fingerprint does not appear uniformly due to the nature of the Dow Jones index. In this case, in order to improve the performance of the algorithm, the distribution of all q -gram fingerprints of the text T used in the first experiment may be checked, and an experiment may be performed using the result to extract the pattern.
도 4는 제1 실험에서 사용한 ran과 dow에서 길이가 각각 3, 4이고, 시작 위치가 인 q-그램 핑거프린트 의 분포를 나타낸 것이다. 핑거프린트 함수에 의하면, q가 커질수록 가능한 핑거프린트의 범위는 증가한다. ran에 대해서는 모든 핑거프린트가 거의 동일하게 분포되지만, dow는 그렇지 않으며, 특히 핑거프린트가 q!-1인 경우 자주 발생되었다. 과거부터 지속적으로 주가가 상승해온 dow의 특성에 의한 것으로 판단된다. 이러한 이유로 제1 실험의 dow에서 패턴을 랜덤으로 추출하였지만 2차 q-그램 핑거프린트가 q!-1인 경우가 상대적으로 많았고, 이로 인하여 순위동형 검증 횟수를 줄인 효과가 감소하여 ran에 비해 수행시간이 크게 줄지 않았다.Fig. 4 shows lengths of 3 and 4, respectively, in the ran and dow used in the first experiment, and the starting position In q -gram fingerprint It shows the distribution of. According to the fingerprint function, as q increases, the range of possible fingerprints increases. For ran all fingerprints are distributed almost identically, but dow is not, especially when the fingerprint is q !-1. We believe this is due to the characteristics of dow , which has been continuously rising in the past. For this reason, although the pattern was randomly extracted from the dow of the first experiment, the secondary q -gram fingerprint was relatively frequent in q !-1, and the effect of reducing the number of ranking homogeneity tests was reduced, which led to the execution time compared to ran . This did not decrease significantly.
표 3은 제1 실험에서 사용된 dow를 패턴 P에서 생성할 때, P의 1, 2차 q-그램 핑거프린트가 q!-1이 되지 않도록 추출하여 실험한 OPQ와 OPSQ의 수행시간이다. 실험결과, 모든 경우에서 제1 실험의 OPSQ보다 제2 실험의 OPSQ가 더 빠르게 수행되었다. q=3일 때, OPSQ가 OPQ보다 평균 18% 정도 빠르게 수행되었고, q≥4일 때도 평균적으로 11% 정도 빠르게 수행되었다. 특히, m=15, q=3일 때는 OPSQ가 OPQ보다 약 23% 빠르게 수행되었다. Table 3 shows the execution time of the OPQ and OPSQ, which were extracted and extracted so that the primary and secondary q -gram fingerprints of P did not become q !-1 when the dow used in the first experiment was generated from the pattern P. As a result, in all cases, the OPSQ of the second experiment was performed faster than the OPSQ of the first experiment. When q = 3 days, OPSQ have been performing an average of 18% faster than the OPQ, q ≥4 days when the average was about 11% faster to perform. In particular, when m = 15 and q = 3, OPSQ was performed about 23% faster than OPQ.
표 3: T에서 드물게 나타나는 부분문자열을 P로 설정했을 때의 OPQ와 OPSQ의 수행시간Table 3: OPQ and OPSQ execution time when the substring that is rare in T is set to P
이상에서 설명된 장치는 하드웨어 구성요소, 소프트웨어 구성요소, 및/또는 하드웨어 구성요소 및 소프트웨어 구성요소의 조합으로 구현될 수 있다. 예를 들어, 실시예들에서 설명된 장치 및 구성요소는, 예를 들어, 프로세서, 콘트롤러, ALU(arithmetic logic unit), 디지털 신호 프로세서(digital signal processor), 마이크로컴퓨터, FPGA(field programmable gate array), PLU(programmable logic unit), 마이크로프로세서, 또는 명령(instruction)을 실행하고 응답할 수 있는 다른 어떠한 장치와 같이, 하나 이상의 범용 컴퓨터 또는 특수 목적 컴퓨터를 이용하여 구현될 수 있다. 처리 장치는 운영 체제(OS) 및 상기 운영 체제 상에서 수행되는 하나 이상의 소프트웨어 애플리케이션을 수행할 수 있다. 또한, 처리 장치는 소프트웨어의 실행에 응답하여, 데이터를 접근, 저장, 조작, 처리 및 생성할 수도 있다. 이해의 편의를 위하여, 처리 장치는 하나가 사용되는 것으로 설명된 경우도 있지만, 해당 기술분야에서 통상의 지식을 가진 자는, 처리 장치가 복수 개의 처리 요소(processing element) 및/또는 복수 유형의 처리 요소를 포함할 수 있음을 알 수 있다. 예를 들어, 처리 장치는 복수 개의 프로세서 또는 하나의 프로세서 및 하나의 콘트롤러를 포함할 수 있다. 또한, 병렬 프로세서(parallel processor)와 같은, 다른 처리 구성(processing configuration)도 가능하다.The device described above may be implemented with hardware components, software components, and/or combinations of hardware components and software components. For example, the devices and components described in the embodiments include, for example, processors, controllers, arithmetic logic units (ALUs), digital signal processors (micro signal processors), microcomputers, field programmable gate arrays (FPGAs). , A programmable logic unit (PLU), microprocessor, or any other device capable of executing and responding to instructions, may be implemented using one or more general purpose computers or special purpose computers. The processing device may run an operating system (OS) and one or more software applications running on the operating system. Further, the processing device may access, store, manipulate, process, and generate data in response to the execution of the software. For convenience of understanding, a processing device may be described as one being used, but a person having ordinary skill in the art, the processing device may include a plurality of processing elements and/or a plurality of types of processing elements. It can be seen that may include. For example, the processing device may include a plurality of processors or a processor and a controller. In addition, other processing configurations, such as parallel processors, are possible.
소프트웨어는 컴퓨터 프로그램(computer program), 코드(code), 명령(instruction), 또는 이들 중 하나 이상의 조합을 포함할 수 있으며, 원하는 대로 동작하도록 처리 장치를 구성하거나 독립적으로 또는 결합적으로(collectively) 처리 장치를 명령할 수 있다. 소프트웨어 및/또는 데이터는, 처리 장치에 의하여 해석되거나 처리 장치에 명령 또는 데이터를 제공하기 위하여, 어떤 유형의 기계, 구성요소(component), 물리적 장치, 가상 장치(virtual equipment), 컴퓨터 저장 매체 또는 장치에 구체화(embody)될 수 있다. 소프트웨어는 네트워크로 연결된 컴퓨터 시스템 상에 분산되어서, 분산된 방법으로 저장되거나 실행될 수도 있다. 소프트웨어 및 데이터는 하나 이상의 컴퓨터 판독 가능 기록 매체에 저장될 수 있다.The software may include a computer program, code, instruction, or a combination of one or more of these, and configure the processing device to operate as desired, or process independently or collectively You can command the device. Software and/or data may be interpreted by a processing device, or to provide instructions or data to a processing device, of any type of machine, component, physical device, virtual equipment, computer storage medium or device. Can be embodied in The software may be distributed on networked computer systems and stored or executed in a distributed manner. Software and data may be stored in one or more computer-readable recording media.
실시예에 따른 방법은 다양한 컴퓨터 수단을 통하여 수행될 수 있는 프로그램 명령 형태로 구현되어 컴퓨터 판독 가능 매체에 기록될 수 있다. 상기 컴퓨터 판독 가능 매체는 프로그램 명령, 데이터 파일, 데이터 구조 등을 단독으로 또는 조합하여 포함할 수 있다. 상기 매체에 기록되는 프로그램 명령은 실시예를 위하여 특별히 설계되고 구성된 것들이거나 컴퓨터 소프트웨어 당업자에게 공지되어 사용 가능한 것일 수도 있다. 컴퓨터 판독 가능 기록 매체의 예에는 하드 디스크, 플로피 디스크 및 자기 테이프와 같은 자기 매체(magnetic media), CD-ROM, DVD와 같은 광기록 매체(optical media), 플롭티컬 디스크(floptical disk)와 같은 자기-광 매체(magneto-optical media), 및 롬(ROM), 램(RAM), 플래시 메모리 등과 같은 프로그램 명령을 저장하고 수행하도록 특별히 구성된 하드웨어 장치가 포함된다. 프로그램 명령의 예에는 컴파일러에 의해 만들어지는 것과 같은 기계어 코드뿐만 아니라 인터프리터 등을 사용해서 컴퓨터에 의해서 실행될 수 있는 고급 언어 코드를 포함한다. The method according to the embodiment may be implemented in the form of program instructions that can be executed through various computer means and recorded on a computer-readable medium. The computer-readable medium may include program instructions, data files, data structures, or the like alone or in combination. The program instructions recorded on the medium may be specially designed and configured for the embodiments or may be known and usable by those skilled in computer software. Examples of computer-readable recording media include magnetic media such as hard disks, floppy disks, and magnetic tapes, optical media such as CD-ROMs, DVDs, and magnetic media such as floptical disks. Includes hardware devices specifically configured to store and execute program instructions such as magneto-optical media, and ROM, RAM, flash memory, and the like. Examples of program instructions include high-level language code that can be executed by a computer using an interpreter, etc., as well as machine language codes produced by a compiler.
이상과 같이 실시예들이 비록 한정된 실시예와 도면에 의해 설명되었으나, 해당 기술분야에서 통상의 지식을 가진 자라면 상기의 기재로부터 다양한 수정 및 변형이 가능하다. 예를 들어, 설명된 기술들이 설명된 방법과 다른 순서로 수행되거나, 및/또는 설명된 시스템, 구조, 장치, 회로 등의 구성요소들이 설명된 방법과 다른 형태로 결합 또는 조합되거나, 다른 구성요소 또는 균등물에 의하여 대치되거나 치환되더라도 적절한 결과가 달성될 수 있다.As described above, although the embodiments have been described by a limited embodiment and drawings, those skilled in the art can make various modifications and variations from the above description. For example, the described techniques are performed in a different order than the described method, and/or the components of the described system, structure, device, circuit, etc. are combined or combined in a different form from the described method, or other components Alternatively, proper results can be achieved even if replaced or substituted by equivalents.
그러므로, 다른 구현들, 다른 실시예들 및 특허청구범위와 균등한 것들도 후술하는 특허청구범위의 범위에 속한다.Therefore, other implementations, other embodiments, and equivalents to the claims are also within the scope of the following claims.
Claims (7)
상기 전처리부에서, 패턴(P)에 대한 위치테이블, 이동테이블 및 복수 개의 q-그램에 대한 핑거프린트를 계산하는 전처리 단계; 및
상기 계산부에서, 상기 패턴(P)에 대한 위치테이블, 상기 이동테이블 및 상기 복수 개의 q-그램에 대한 핑거프린트를 계산한 값을 이용하여 상기 패턴(P)과 순위동형인 텍스트(T)의 부분문자열을 탐색하는 계산 단계
를 포함하는 순위패턴매칭 방법. In the ranking pattern matching method using a fingerprint performed in the ranking pattern matching device including a pre-processing unit and a calculation unit,
In the pre-processing unit, a pre-processing step of calculating a fingerprint for a position table, a movement table and a plurality of q-grams for the pattern P; And
In the calculator, the position table for the pattern (P), the movement table, and the values of the fingerprints for the plurality of q-grams are calculated using the values of the pattern (P) and the text (T) of the same rank Calculation step to search for substring
Ranking pattern matching method comprising a.
상기 복수 개의 q-그램은,
상기 패턴(P)와 텍스트(T)가 주어졌을 때, 상기 패턴(P)의 가장 오른쪽 q-그램을 1차 q-그램, 상기 1차 q-그램을 기준으로 상기 1차 q-그램의 이전에 위치한 q- 그램을 2차 q-그램이라고 하고, 상기 1차 q-그램 및 상기 2차 q-그램을 포함하는 순위패턴매칭 방법.According to claim 1,
The plurality of q-grams,
Given the pattern (P) and text (T), the rightmost q-gram of the pattern (P) is the first q-gram, and the first q-gram is transferred based on the first q-gram. The q-gram located at is called a secondary q-gram, and the ranking pattern matching method including the primary q-gram and the secondary q-gram.
상기 계산 단계는,
과 비교를 시작하는 텍스트(T)의 위치를 i라고 할 때, 각 에 대해 1차 q-그램의 핑거프린트인 와 가 일치하는지 판단하는 단계
를 포함하는 순위패턴매칭 방법.According to claim 1,
The calculation step,
When i is the position of the text T that starts comparing with Is the first q-gram fingerprint for Wow To determine if is a match
Ranking pattern matching method comprising a.
상기 계산 단계는,
상기 각 에 대해 1차 q-그램의 핑거프린트인 와 가 일치할 경우, 2차 q-그램의 핑거프린트인 와 가 일치하는지 확인하는 단계
를 포함하는 순위패턴매칭 방법.According to claim 3,
The calculation step,
Each of the above Is the first q-gram fingerprint for Wow If is, the 2nd q-gram fingerprint Wow To make sure it matches
Ranking pattern matching method comprising a.
상기 계산 단계는,
상기 2차 q-그램의 핑거프린트인 와 가 일치할 경우, 패턴(P)와 의 순위동형 여부를 위치테이블을 이용하여 확인하고, 을 단계
를 포함하는 순위패턴매칭 방법.According to claim 4,
The calculation step,
Fingerprint of the second q-gram Wow If is, the pattern (P) and Check the ranking isomorphism using the location table, Step
Ranking pattern matching method comprising a.
상기 계산 단계는,
순위동형 여부에 관계없이 텍스트의 위치(i)를 만큼 증가시기는 단계
를 포함하는 순위패턴매칭 방법.According to claim 1,
The calculation step,
The position of the text (i), regardless of ranking As much as it increases
Ranking pattern matching method comprising a.
패턴(P)에 대한 위치테이블, 이동테이블 및 복수 개의 q-그램에 대한 핑거프린트를 계산하는 전처리부; 및
상기 패턴(P)에 대한 위치테이블, 상기 이동테이블 및 상기 복수 개의 q-그램에 대한 핑거프린트를 계산한 값을 이용하여 상기 패턴(P)과 순위동형인 텍스트(T)의 부분문자열을 탐색하는 계산부
를 포함하는 순위패턴매칭 장치.
In the ranking pattern matching device,
A pre-processing unit that calculates a fingerprint for a position table, a movement table, and a plurality of q-grams for the pattern P; And
Searching for a substring of the text (T), which is the same rank as the pattern (P), by using the position table for the pattern (P), the movement table, and the values of the fingerprints for the plurality of q-grams Calculation
Ranking pattern matching device comprising a.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020180163814A KR102158317B1 (en) | 2018-12-18 | 2018-12-18 | An order-preserving pattern matching algorithm using fingerprint of secondary q-grams |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020180163814A KR102158317B1 (en) | 2018-12-18 | 2018-12-18 | An order-preserving pattern matching algorithm using fingerprint of secondary q-grams |
Publications (2)
Publication Number | Publication Date |
---|---|
KR20200075295A true KR20200075295A (en) | 2020-06-26 |
KR102158317B1 KR102158317B1 (en) | 2020-09-21 |
Family
ID=71136959
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
KR1020180163814A KR102158317B1 (en) | 2018-12-18 | 2018-12-18 | An order-preserving pattern matching algorithm using fingerprint of secondary q-grams |
Country Status (1)
Country | Link |
---|---|
KR (1) | KR102158317B1 (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0696124A (en) * | 1992-09-11 | 1994-04-08 | Sumitomo Metal Ind Ltd | Information retrieving device |
KR20110110736A (en) * | 2010-04-01 | 2011-10-07 | 삼성전자주식회사 | Method, apparatus and system for searching nucleic acid sequence |
JP2014063306A (en) * | 2012-09-20 | 2014-04-10 | Casio Comput Co Ltd | Search device, search method, and program |
KR101662957B1 (en) * | 2015-07-30 | 2016-10-05 | 인하대학교 산학협력단 | A method for order-preserving multiple pattern matching based on hashing |
-
2018
- 2018-12-18 KR KR1020180163814A patent/KR102158317B1/en active IP Right Grant
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0696124A (en) * | 1992-09-11 | 1994-04-08 | Sumitomo Metal Ind Ltd | Information retrieving device |
KR20110110736A (en) * | 2010-04-01 | 2011-10-07 | 삼성전자주식회사 | Method, apparatus and system for searching nucleic acid sequence |
JP2014063306A (en) * | 2012-09-20 | 2014-04-10 | Casio Comput Co Ltd | Search device, search method, and program |
KR101662957B1 (en) * | 2015-07-30 | 2016-10-05 | 인하대학교 산학협력단 | A method for order-preserving multiple pattern matching based on hashing |
Non-Patent Citations (1)
Title |
---|
유광모 등, "2개의 q-그램에 대한 핑거프린트를 이용한 순위패턴매칭알고리즘", 정보과학회논문지, 한국정보과학회, Vol.45, no.11, pp.1111-1116 1부.* * |
Also Published As
Publication number | Publication date |
---|---|
KR102158317B1 (en) | 2020-09-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11481494B2 (en) | System and method for identifying and comparing code by semantic abstractions | |
WO2015101097A1 (en) | Method and device for feature extraction | |
KR102584035B1 (en) | Apparatus and method for performing a splice operation | |
US7818278B2 (en) | Large scale item representation matching | |
Huang et al. | JSContana: Malicious JavaScript detection using adaptable context analysis and key feature extraction | |
Wu et al. | Mining distinguishing subsequence patterns with nonoverlapping condition | |
Kang et al. | Malware categorization using dynamic mnemonic frequency analysis with redundancy filtering | |
Jain et al. | Co-linear chaining with overlaps and gap costs | |
KR101662957B1 (en) | A method for order-preserving multiple pattern matching based on hashing | |
Aldwairi et al. | MultiPLZW: A novel multiple pattern matching search in LZW-compressed data | |
CN104685493A (en) | Dictionary creation device for monitoring text information, dictionary creation method for monitoring text information, and dictionary creation program for monitoring text information | |
Pungila et al. | A new high-performance approach to approximate pattern-matching for plagiarism detection in blockchain-based non-fungible tokens (NFTs) | |
CN112926647B (en) | Model training method, domain name detection method and domain name detection device | |
Ulmer et al. | Massively parallel acceleration of a document-similarity classifier to detect web attacks | |
US20150363177A1 (en) | Multi-branch determination syntax optimization apparatus | |
Oehlert et al. | MacAnova user's guide | |
KR102158317B1 (en) | An order-preserving pattern matching algorithm using fingerprint of secondary q-grams | |
KR20160067469A (en) | Apparatus and method for extracting social relation between entity | |
JP2014228891A (en) | Compiler and compilation method | |
KR102190285B1 (en) | A space-efficient order-preserving multiple pattern matching algorithm | |
Susik et al. | Fast and simple circular pattern matching | |
Beth | A comparison of similarity techniques for detecting source code plagiarism | |
Ozsoy et al. | Fast longest common subsequence with general integer scoring support on gpus | |
Xiao et al. | Efficient algorithms for finding edit-distance based motifs | |
KR102288282B1 (en) | Method and Apparatus for An Order-Preserving Pattern Matching based on the Horspool Algorithm using Binary Encoding |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
E701 | Decision to grant or registration of patent right | ||
GRNT | Written decision to grant |