Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP6809119B2 - Document comparison program, document comparison method, and document comparison device - Google Patents
[go: Go Back, main page]

JP6809119B2 - Document comparison program, document comparison method, and document comparison device - Google Patents

Document comparison program, document comparison method, and document comparison device Download PDF

Info

Publication number
JP6809119B2
JP6809119B2 JP2016201933A JP2016201933A JP6809119B2 JP 6809119 B2 JP6809119 B2 JP 6809119B2 JP 2016201933 A JP2016201933 A JP 2016201933A JP 2016201933 A JP2016201933 A JP 2016201933A JP 6809119 B2 JP6809119 B2 JP 6809119B2
Authority
JP
Japan
Prior art keywords
document
vector
documents
correlation
calculation
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
Application number
JP2016201933A
Other languages
Japanese (ja)
Other versions
JP2018063596A (en
Inventor
謙介 馬場
謙介 馬場
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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2016201933A priority Critical patent/JP6809119B2/en
Publication of JP2018063596A publication Critical patent/JP2018063596A/en
Application granted granted Critical
Publication of JP6809119B2 publication Critical patent/JP6809119B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Description

本発明は、文書比較プログラム、文書比較方法、及び文書比較装置に関する。 The present invention relates to a document comparison program, a document comparison method, and a document comparison device.

従来より、文書間の比較を行う際は、計算量を削減するため、各文書について、特徴量や特徴を表わす文を抽出し、抽出した特徴量や文書同士を比較することで文書間の類似度を評価している。 Conventionally, when comparing documents, in order to reduce the amount of calculation, for each document, sentences representing the features and features are extracted, and the extracted features and documents are compared to make the documents similar. I am evaluating the degree.

類似度を評価する観点において、1つ以上の検索キーワードの、データベースに予め保存された文書での出現頻度、検索キーワード間の近接度及び検索キーワードを評価する技術が提案されている。 From the viewpoint of evaluating the similarity, a technique for evaluating the frequency of appearance of one or more search keywords in a document stored in advance in a database, the proximity between search keywords, and the search keywords has been proposed.

特定のユーザの嗜好情報のベクトル値と、複数の任意のユーザの嗜好情報の各ベクトル値との内積が所定の値を上回っている場合にユーザの嗜好情報の一致を判別する技術等が知られている。 A technique for determining a match between user preference information when the inner product of the vector value of the preference information of a specific user and each vector value of the preference information of a plurality of arbitrary users exceeds a predetermined value is known. ing.

特表2009−515249号公報Special Table 2009-515249 特開2001−306606号公報Japanese Unexamined Patent Publication No. 2001-306606 特開2012−252484号公報Japanese Unexamined Patent Publication No. 2012-252484

D.Gusfield:Algorithms on Strings,Trees and Sequences:Computer Science and Computational Biology,Cambridge University Press,1997D. Gusfield: Algorithms on Strings, Trees and Sequences: Computer Science and Computational Biology, Cambridge University Press, 1997 T.Mikolov,K.Chen,G.Corrado,and J.Dean.Efficient estimation of word representations in vector space.ICLR,2013T. Mikolov, K. Chen, G. Corrado, and J. Dean. Efficient estimation of word representations in vector space. ICLR, 2013 “MeCab(和布蕪)とは”、[online]、[平成28年7月21日検索]、インターネット<URL:http://taku910.github.io/mecab>"What is MeCab (Wakame seaweed)", [online], [Search on July 21, 2016], Internet <URL: http: // taku910. github. io / mecab > C.D.Manning,P.Raghavan,H.Schutze:Introduction to Information Retrieval,Cambridge University Press,2008C. D. Manning, P.M. Raghavan, H. et al. Schutze: Introduction to Information Retrieval, Cambridge University Press, 2008

上述した技術では、類似度を評価するが、類似と剽窃の区別など、文書間の類似の詳細について、情報を得ることは困難である。 Although the techniques described above evaluate the degree of similarity, it is difficult to obtain information on the details of similarity between documents, such as the distinction between similarity and theft.

近年、機械学習やニューラルネットワーク等の技術を用いることにより、文書ごとの語のベクトル表現を得られるようになっているが、単純に、文中に出現する語の間の重みを計算すると、計算量が非常に膨大となってしまう。 In recent years, it has become possible to obtain a vector representation of words for each document by using technologies such as machine learning and neural networks. However, simply calculating the weights between words appearing in a sentence is a calculation amount. Becomes very huge.

したがって、1つの側面では、本発明は、文書間の相関値を算出する際の計算量を軽減することを目的とする。 Therefore, in one aspect, the present invention aims to reduce the amount of calculation when calculating the correlation value between documents.

一態様によれば、比較対象の複数の文書それぞれを複数の要素に分離し、前記複数の文書のうち、一方の文書に対して、他方の文書で語順を変えてある場所をずれ位置とし、前記複数の文書の全てのずれ位置における、前記複数の要素それぞれの、要素間の重み付けを含めた相関値を、該要素の特徴をベクトルで表すことで、各要素に対応付けた該ベクトルの内積とした離散フーリエ変換により算出する処理をコンピュータに行わせる文書比較プログラムが提供される。
According to one aspect, each of the plurality of documents to be compared is separated into a plurality of elements, and the position where the word order of the other document is changed with respect to one of the plurality of documents is set as the offset position. The inner product of the vector associated with each element by expressing the correlation value of each of the plurality of elements including the weighting between the elements at all the deviation positions of the plurality of documents as a vector. A document comparison program is provided that allows a computer to perform a process calculated by the discrete Fourier transform.

また、上記課題を解決するための手段として、文書比較方法及び文書比較装置とすることもできる。 Further, as a means for solving the above problems, a document comparison method and a document comparison device can be used.

文書間の相関値を算出する際の計算量を軽減することができる。 The amount of calculation when calculating the correlation value between documents can be reduced.

位置ずれを説明するための図である。It is a figure for demonstrating the misalignment. 重みテーブルの例を示す図である。It is a figure which shows the example of the weight table. 計算と計算時間との関係を説明するための図である。It is a figure for demonstrating the relationship between a calculation and a calculation time. 相関計算の結果例を示す図である。It is a figure which shows the result example of the correlation calculation. 文書比較装置のハードウェア構成を示す図である。It is a figure which shows the hardware configuration of the document comparison apparatus. 文書比較装置の機能構成例を示す図である。It is a figure which shows the functional structure example of a document comparison apparatus. ベクトル表現収集処理を説明するためのフローチャート図である。It is a flowchart for demonstrating the vector expression collection process. 文書比較処理を説明するためのフローチャート図である。It is a flowchart for demonstrating the document comparison process. 図8のステップS204を第1の計算方法の場合の重み付き相関計算処理を説明するためのフローチャート図である。FIG. 5 is a flowchart for explaining the weighted correlation calculation process in the case where step S204 of FIG. 8 is the first calculation method. 図8のステップS204を第2の計算方法の場合の重み付き相関計算処理を説明するためのフローチャート図である。It is a flowchart for demonstrating the weighted correlation calculation process in the case of the 2nd calculation method in step S204 of FIG.

以下、本発明の実施の形態を図面に基づいて説明する。先ず、2つの文書の重み付き相関を求める問題について考察する。ここで、
「相関」とは、すべての位置ずれで対応させた語との一致数を表し、
「重み」とは、語の対に付加されるある値域の連続値で表される。
Hereinafter, embodiments of the present invention will be described with reference to the drawings. First, consider the problem of finding the weighted correlation of two documents. here,
"Correlation" represents the number of matches with the words associated with all misalignments.
The "weight" is represented by the continuous value of a certain range added to a word pair.

文章間の相関を求める既存手法には、以下の2つが存在する。第1の手法は、語の比較を順に行い、重みを表から参照するものである。第2の手法は、相関を比較的高速に求める手法として知られている重み無しのFFT(Fast Fourier Transform)-based algorithmである。それぞれの計算時間は、σを語の種類の数、nを各文章の長さとした場合、
第1の手法に掛る時間は、O(n2(logσ)2)で表され、
第2の手法に掛る時間は、O(σn2logn)で表される。
There are the following two existing methods for finding the correlation between sentences. The first method is to compare words in order and refer to the weights from the table. The second method is an unweighted FFT (Fast Fourier Transform) -based algorithm, which is known as a method for obtaining correlation at a relatively high speed. Each calculation time is calculated when σ is the number of word types and n is the length of each sentence.
The time required for the first method is represented by O (n 2 (logσ) 2 ).
The time required for the second method is represented by O (σn 2 log n).

第1の手法及び第2の手法について考察する前に、2つの文書の重み付き相関を求める問題について、以下のように定式化するものとする。
・文書:語の列、W:語の集合、Wn:長さ(語の数)nの文書全体からなる集合
・si:文章sのi番目の語
・st:文章sとtとをつなげた文書、wn:n個の語wからなる文書
Before considering the first method and the second method, the problem of finding the weighted correlation of two documents shall be formulated as follows.
-Document: string of words, W: set of words, W n : set consisting of the entire document of length (number of words) n-s i : i-th word of sentence s-st: sentences s and t Connected documents, w n : A document consisting of n words w

Figure 0006809119
の相関C(s,t)は、2n-1次元ベクトルで、i番目の要素は、
Figure 0006809119
Correlation C (s, t) is a 2n-1 dimensional vector, and the i-th element is

Figure 0006809119
で表される。ただし、
Figure 0006809119
It is represented by. However,

Figure 0006809119
について、
Figure 0006809119
about,

Figure 0006809119
のように文字列を数式のように表わすことで、範囲外の形式的な比較のためにダミーの語を付加することを表現する。このようにすることで、位置ずれを考慮して相関を算出できる。
Figure 0006809119
By expressing a character string like a mathematical formula, it is expressed that a dummy word is added for a formal comparison outside the range. By doing so, the correlation can be calculated in consideration of the positional deviation.

図1は、位置ずれを説明するための図である。図1では、文書sの文書tに対するi番目の要素の位置ずれを考慮するために、文書tの前後に、文書sにも文書tにも属さないダミーの語xを付加する概念図を示している。 FIG. 1 is a diagram for explaining misalignment. FIG. 1 shows a conceptual diagram in which a dummy word x that does not belong to either the document s or the document t is added before and after the document t in order to consider the misalignment of the i-th element with respect to the document t of the document s. ing.

文章sを1語ずつずらして、ずらした位置における文書tの1語との相関を算出する。文書tに対して、文書sでは語順を変えてある場合がずれ位置に相当する。 The sentence s is shifted word by word, and the correlation with one word of the document t at the shifted position is calculated. In the document s, when the word order is changed with respect to the document t, it corresponds to the shift position.

更に、φを2つの語から連続的な値への関数とすると、 Furthermore, if φ is a function from two words to a continuous value,

Figure 0006809119
の重み付き関数C’(s,t)は、
Figure 0006809119
The weighted function C'(s, t) of

Figure 0006809119
で表される。数6において、各φは-1から+1の間の値を取り、j=1〜nまでを積算することにより、重み付き相関の要素C’iは、-nから+nの値を取る。
Figure 0006809119
It is represented by. In Equation 6, the φ takes a value between -1 to +1, by integrating up to j = 1 to n, the element C 'i weighted correlation takes a value from -n + n ..

既存の第1の手法について、3つの文章s、t及びuを
文章s:This is a dog.
文章t:That is a cat.
文章u:This is a pen.
とする。この場合、図2に示すような重みテーブルが作成される。図2は、重みテーブルの例を示す図である。
Regarding the existing first method, three sentences s, t and u are written s: This is a dog.
Sentence t: That is a cat.
Sentence u: This is a pen.
And. In this case, a weight table as shown in FIG. 2 is created. FIG. 2 is a diagram showing an example of a weight table.

図2において、重みテーブル3は、文章s、t及びuから得た語をマトリクスで示し、語と語の相関の重みを示している。重みテーブル3を参照すると、語義が一致する場合、重み「1」が与えられ、一致しない場合、重み「0」が与えられる。また、語義の類似度は、0と1の間の数値で与えられる。例えば、「cat」と「dog」の語義の類似度に対する重みは「0.7」が与えられ、「pen」と「cat」の語義の類似度に対して重みは「0.1」が与えられている。 In FIG. 2, the weight table 3 shows words obtained from sentences s, t, and u in a matrix, and shows the weights of word-to-word correlation. With reference to the weight table 3, if the meanings match, the weight "1" is given, and if they do not match, the weight "0" is given. Also, the similarity of the semantics is given by a numerical value between 0 and 1. For example, the weight for the similarity between the meanings of "cat" and "dog" is given by "0.7", and the weight for the similarity between the meanings of "pen" and "cat" is given by "0.1". Has been done.

第1の手法において、重み無しの相関Cは、
C(s,t)=(0,0,0,2,0,0,0)
C(s,u)=(0,0,0,3,0,0,0)
C(t,u)=(0,0,0,2,0,0,0)
として得られ、それぞれに重みテーブル3を参照して、
C’(s,t)=(0,0,0,3.5,0,0,0)
C’(s,u)=(0,0,0,3.1,0,0,0)
C’(t,u)=(0,0,0,2.9,0,0,0)
このような重み付き相関C’を得る。この結果から、文書sと文書tとが最も近く、次に、文書sと文書uとが近く、文書tと文書uとは最も似ていない、と判断できる。
In the first method, the unweighted correlation C is
C (s, t) = (0,0,0,2,0,0,0)
C (s, u) = (0,0,0,3,0,0,0)
C (t, u) = (0,0,0,2,0,0,0)
And refer to the weight table 3 for each,
C'(s, t) = (0,0,0,3.5,0,0,0)
C'(s, u) = (0,0,0,3.1,0,0,0)
C'(t, u) = (0,0,0,2.9,0,0,0)
We get such a weighted correlation C'. From this result, it can be determined that the document s and the document t are the closest, then the document s and the document u are the closest, and the document t and the document u are the least similar.

この第1の手法では、予め語の対ごとに重みを示す重みテーブル3を作成し、語の比較を順に行い、重みテーブル3を参照して重みを取得する。具体的には、 In this first method, a weight table 3 showing weights for each word pair is created in advance, words are compared in order, and weights are acquired by referring to the weight table 3. In particular,

Figure 0006809119
として、σ×σの語の対から重みへの表を予め準備する。
Figure 0006809119
As a result, a table from pairs of words of σ × σ to weights is prepared in advance.

すべての位置ずれについて、対応する語を順に比較し、語の対に対応する重みを重みテーブル3から取得する。 For all misalignments, the corresponding words are compared in order, and the weights corresponding to the word pairs are obtained from the weight table 3.

上述した処理手順により、語の比較はO(n2)回行われ、1回の重みテーブル3の参照がO((logσ)2)時間で表される。即ち、全ての語の対に対して、
O(n2) × O((logσ)2) = O(n2(logσ)2)時間
掛ると考えられる。ここで、nは語数を示し、σは重みテーブル3の長さを示す。
According to the processing procedure described above, the word comparison is performed O (n 2 ) times, and one reference to the weight table 3 is represented by O ((log σ) 2 ) time. That is, for all word pairs
It is considered that O (n 2 ) × O ((logσ) 2 ) = O (n 2 (logσ) 2 ) time is required. Here, n indicates the number of words, and σ indicates the length of the weight table 3.

既存の第2の手法に関して、まず、FFTによる畳み込みの計算について説明する。 Regarding the existing second method, first, the calculation of convolution by FFT will be described.

2つのn次元ベクトルuとvとの巡回畳み込みrは、 The circular convolution r of two n-dimensional vectors u and v is

Figure 0006809119
で表される。ただし、-n+1≦i≦0についてはvi=vn+iである。
Figure 0006809119
It is represented by. However, for -n + 1 ≤ i ≤ 0, v i = v n + i .

R,U,Vをそれぞれr,u,vの離散フーリエ変換としoを要素ごとの積とすると、 If R, U, and V are discrete Fourier transforms of r, u, and v, respectively, and o is the product of each element,

Figure 0006809119
で表される。このことから、rは、uとvとからFFTによりO(nlogn)時間で計算可能である。計算ルートと計算時間との関係を図3で説明する。
Figure 0006809119
It is represented by. From this, r can be calculated from u and v by FFT in O (nlogn) time. The relationship between the calculation route and the calculation time will be described with reference to FIG.

図3は、計算と計算時間との関係を説明するための図である。図3において、nは文章の長さを表わす。uとvとからrを得る計算、即ち、語uと語vの比較rを行う計算の場合、計算時間O(n2)で表される。 FIG. 3 is a diagram for explaining the relationship between the calculation and the calculation time. In FIG. 3, n represents the length of the sentence. In the case of a calculation that obtains r from u and v, that is, a calculation that compares the word u and the word v, it is expressed by the calculation time O (n 2 ).

一方、u,vの離散フーリエ変換U,Vの計算時間はO(nlogn)であり、U,Vの要素毎の積Rの計算時間は、O(n)である。また、Rからrへの逆離散フーリエ変換の計算時間は、O(nlogn)である。 On the other hand, the calculation time of the discrete Fourier transforms U and V of u and v is O (nlogn), and the calculation time of the product R for each element of U and V is O (n). The calculation time of the inverse discrete Fourier transform from R to r is O (nlogn).

次に、FFT-based Algorithmの概要について説明する。文書間の重み無し関数を語を数値化して得られるベクトルの畳み込みにより計算する。語の集合W内のある語aを1、それ以外を0に置き換えると、aの一致のみを考慮した相関を畳み込みで表すことができ、O(nlogn)時間で計算可能である。文書から数値列への置き換えはO(n)時間である。また、乗算で一致又は不一致を表現できるので、畳み込み演算が適用可能である。 Next, the outline of the FFT-based Algorithm will be described. The unweighted function between documents is calculated by the convolution of vectors obtained by digitizing words. By replacing some words a in the set of words W with 1 and others with 0, the correlation considering only the match of a can be expressed by convolution, and it can be calculated in O (nlogn) time. The replacement of a document with a numeric sequence is O (n) hours. Moreover, since a match or a mismatch can be expressed by multiplication, a convolution operation can be applied.

O(nlogn)時間の畳み込み演算をσ回繰り返し、要素ごとの和をとることで相関を計算する。具体的には、 The correlation is calculated by repeating the convolution operation of O (nlogn) time σ times and taking the sum of each element. In particular,

Figure 0006809119
について、φaは、aを1、それ以外を0に写す関数である。定義より、1≦i≦2n-1について、相関Ciは、
Figure 0006809119
For, φ a is a function that copies a to 1 and the others to 0. By definition, for 1 ≤ i ≤ 2n-1, the correlation Ci is

Figure 0006809119
と表される。
Figure 0006809119
It is expressed as.

(ua,1, ua,2,..., ua,2n-1)と(va,1, va,2,..., va,2n-1)とを、 (U a, 1 , u a, 2 , ..., u a, 2n-1 ) and (va , 1 , v a, 2 , ..., v a, 2n-1 )

Figure 0006809119
である2n−1次元ベクトルとすると、数11は、
Figure 0006809119
Assuming that the 2n-1 dimensional vector is, the number 11 is

Figure 0006809119
で表される。数13内の
Figure 0006809119
It is represented by. Within the number 13

Figure 0006809119
は畳み込み演算である。
Figure 0006809119
Is a convolution operation.

このFFT-based Algorithmでは、第1の手法では、文書長さnの自乗時間(O(n2logσ) 2時間)に比べて、重み無し相関については非常に高速(O(σnlogn)時間)に行える。しかしながら、φの評価を重みテーブル3を用いて実現使用とすると、C’(s,t)の式を畳み込みとみなすことができないため、重みテーブル3を用いて第2の手法の拡張は困難である。既存の手法の組合せでは、高速化することが困難である。 In this FFT-based Algorithm, in the first method, the weightless correlation is much faster (O (σn log n) time) than the square time of document length n (O (n 2 log σ) 2 hours). You can. However, if the evaluation of φ is realized and used using the weight table 3, it is difficult to extend the second method using the weight table 3 because the equation of C'(s, t) cannot be regarded as a convolution. is there. It is difficult to increase the speed by combining existing methods.

出願人は、上述したような既存の第1の手法及び第2の手法の考察において、2以上の文章の各要素間の相関を表わす行列、即ち、相関Cが疎であり、内積を用いても計算量を抑えられることに着目した。即ち、重みを重みテーブル3の代わりにベクトルの内積により第2の手法を重み付き関数へと拡張することを見出した。 In the consideration of the existing first method and the second method as described above, the applicant uses the inner product because the matrix representing the correlation between each element of two or more sentences, that is, the correlation C is sparse. Also focused on the fact that the amount of calculation can be suppressed. That is, we have found that the second method is extended to a weighted function by the inner product of vectors instead of the weight table 3.

以下に、発明者による実施例について説明する。 Examples described by the inventor will be described below.

β:W→Rd:ベクトル表現、R:実数全体からなる集合 β: W → R d : Vector representation, R: Set consisting of all real numbers

Figure 0006809119
について、
Figure 0006809119
about,

Figure 0006809119
で表す。定数α、γについて
Figure 0006809119
It is represented by. About constants α and γ

Figure 0006809119
としてもよい。
Figure 0006809119
May be.

重みをベクトルの内積で表現することで、重み付き相関を畳み込み演算によりO(dnlogn)時間で行える。 By expressing the weight as the inner product of the vectors, the weighted correlation can be performed in O (dnlogn) time by the convolution operation.

d=σであるベクトル表現でも計算をO(σnlogn)時間で行える。一例として、ある語に対応する要素が1、それ以外が0のベクトルであり、ベクトルが疎で、すべて直交している場合等である。 Even with the vector representation where d = σ, the calculation can be performed in O (σnlogn) time. One example is a vector in which the element corresponding to a certain word is 1 and the other elements are 0, and the vectors are sparse and all orthogonal.

現実的な文書又は言語ではd<<σであると考えられる。つまり、重みの値の分布は何らかの偏りを持つので、表のサイズσよりも小さい次元dでφを表わすことができる。誤記を表わすベクトルがすべて直交するようなベクトル表現でなくてもよい。 In a realistic document or language, it is considered to be d << σ. That is, since the distribution of weight values has some bias, φ can be represented by a dimension d smaller than the table size σ. It does not have to be a vector representation in which all the vectors representing errors are orthogonal.

既存の第1の手法の重みテーブル3の参照をベクトルの内積に置き換えた場合の計算時間はO(dn2)である。 The calculation time when the reference of the weight table 3 of the existing first method is replaced with the inner product of the vectors is O (dn 2 ).

次に、語のベクトル表現を用いることによる、第2の手法の重み付き相関への拡張について、以下に示す。定義により重み付き相関は、1≦i≦2n-1について、数6に数16を適用することで、 Next, the extension of the second method to weighted correlation by using the vector representation of words is shown below. By definition, the weighted correlation is obtained by applying the number 16 to the number 6 for 1 ≤ i ≤ 2n-1.

Figure 0006809119
ベクトル表現に置き換えて、内積についての畳み込み演算を得る。
Figure 0006809119
Replace with a vector representation to get a convolution operation on the dot product.

そして、d次元におけるベクトル内積の積算に変形し、 Then, it transforms into the integration of the vector inner product in the d dimension,

Figure 0006809119
を得る。この数18に対して、発明者は、積算する順番を入れ替えることで、
Figure 0006809119
To get. For this number 18, the inventor can change the order of integration.

Figure 0006809119
を得る。
Figure 0006809119
To get.

即ち、次元毎にすべてのずれ位置におけるベクトルの内積を算出した後、d次元全体で合計値を得ることで、数19内の That is, after calculating the inner product of the vectors at all the deviation positions for each dimension, the total value is obtained for the entire d dimension, so that the number 19

Figure 0006809119
が畳み込み演算となる。後述にて、数20は、配列[Zk,i]で表される。
Figure 0006809119
Is the convolution operation. Later, the equation 20 is represented by an array [Z k, i ].

図2に示す重みテーブル3を行列と考えた場合、各要素間の相関を表わす行列が疎であり、内積を用いても計算量が抑えられる。1≦i≦2n-1についての数20の計算は、第1の手法と同様にO(nlogn)時間で行える。よって、重み付き相関C’(s,t)は次元数dを乗算したd×O(nlogn)時間で計算可能になる。 When the weight table 3 shown in FIG. 2 is considered as a matrix, the matrix representing the correlation between each element is sparse, and the amount of calculation can be suppressed even if the inner product is used. The calculation of the number 20 for 1 ≦ i ≦ 2n-1 can be performed in O (nlogn) time as in the first method. Therefore, the weighted correlation C'(s, t) can be calculated in d × O (nlogn) time multiplied by the number of dimensions d.

次に、重みの有無による文書間の相関計算の結果例について例示する。図4は、相関計算の結果例を示す図である。図4中、縦軸にベクトルの値を示し、横軸に文書内の要素の順番(i番目)を示している。上段には重み無し相関を示し、下段には重み付き相関を示している。更に、剽窃無、剽窃有、言い換えを含む剽窃有のそれぞれを上下で対応させて示している。 Next, an example of the result of correlation calculation between documents depending on the presence or absence of weight will be illustrated. FIG. 4 is a diagram showing an example of the result of the correlation calculation. In FIG. 4, the vertical axis shows the vector value, and the horizontal axis shows the order (i-th) of the elements in the document. The upper row shows the unweighted correlation, and the lower row shows the weighted correlation. Furthermore, each of the non-theft, the theft, and the theft including paraphrase is shown in the vertical correspondence.

剽窃無の場合、いずれの場合も変動幅に突出する変化はない。単純なコピーによる剽窃有の場合、重み無し相関においてピーク6aが示され、また、重み付き相関においてもピーク6bが出現している。 In the case of no theft, there is no significant change in the fluctuation range in any case. In the case of theft by a simple copy, the peak 6a is shown in the unweighted correlation, and the peak 6b also appears in the weighted correlation.

しかしながら、言い換えを含む剽窃有については、重み無し相関と重み付き相関とでは異なっている。重み無し相関では、ピークを特定することが困難であるのに対して、重み付き相関では、ピーク6cを特定できる。 However, for theft, including paraphrasing, the unweighted correlation and the weighted correlation are different. In the unweighted correlation, it is difficult to specify the peak, whereas in the weighted correlation, the peak 6c can be specified.

本実施例では、重みテーブル3を用いた第1の手法と比べて、計算時間をO(dnlogn)時間に抑えて、重み付き相関の算出を実現することができる。 In this embodiment, as compared with the first method using the weight table 3, the calculation time can be suppressed to O (dnlogn) time, and the calculation of the weighted correlation can be realized.

本実施例に係る文書比較装置100は、図5に示すようなハードウェア構成を有する。図5は、文書比較装置のハードウェア構成を示す図である。図5において、文書比較装置100は、コンピュータによって制御される情報処理装置であって、CPU(Central Processing Unit)11と、主記憶装置12と、補助記憶装置13と、入力装置14と、表示装置15と、通信I/F(インターフェース)17と、ドライブ装置18とを有し、バスBに接続される。 The document comparison device 100 according to this embodiment has a hardware configuration as shown in FIG. FIG. 5 is a diagram showing a hardware configuration of the document comparison device. In FIG. 5, the document comparison device 100 is an information processing device controlled by a computer, and is a CPU (Central Processing Unit) 11, a main storage device 12, an auxiliary storage device 13, an input device 14, and a display device. It has 15, a communication I / F (interface) 17, and a drive device 18, and is connected to the bus B.

CPU11は、主記憶装置12に格納されたプログラムに従って文書比較装置100を制御するプロセッサに相当する。主記憶装置12には、RAM(Random Access Memory)、ROM(Read Only Memory)等が用いられ、CPU11にて実行されるプログラム、CPU11での処理に必要なデータ、CPU11での処理にて得られたデータ等を記憶又は一時保存する。 The CPU 11 corresponds to a processor that controls the document comparison device 100 according to a program stored in the main storage device 12. A RAM (Random Access Memory), a ROM (Read Only Memory), or the like is used in the main storage device 12, and is obtained by a program executed by the CPU 11, data required for processing by the CPU 11, and processing by the CPU 11. Store or temporarily store the data, etc.

補助記憶装置13には、HDD(Hard Disk Drive)等が用いられ、各種処理を実行するためのプログラム等のデータを格納する。補助記憶装置13に格納されているプログラムの一部が主記憶装置12にロードされ、CPU11に実行されることによって、各種処理が実現される。 An HDD (Hard Disk Drive) or the like is used in the auxiliary storage device 13, and data such as a program for executing various processes is stored in the auxiliary storage device 13. Various processes are realized by loading a part of the program stored in the auxiliary storage device 13 into the main storage device 12 and executing the program in the CPU 11.

入力装置14は、マウス、キーボード等を有し、ユーザが文書比較装置100による処理に必要な各種情報を入力するために用いられる。表示装置15は、CPU11の制御のもとに必要な各種情報を表示する。入力装置14と表示装置15とは、一体化したタッチパネル等によるユーザインタフェースであってもよい。通信I/F17は、有線又は無線などのネットワークを通じて通信を行う。通信I/F17による通信は無線又は有線に限定されるものではない。
文書比較装置100によって行われる処理を実現するプログラムは、例えば、CD−ROM(Compact Disc Read-Only Memory)等の記憶媒体19によって文書比較装置100に提供される。
The input device 14 has a mouse, a keyboard, and the like, and is used by the user to input various information necessary for processing by the document comparison device 100. The display device 15 displays various information required under the control of the CPU 11. The input device 14 and the display device 15 may be a user interface using an integrated touch panel or the like. The communication I / F17 communicates through a network such as wired or wireless. Communication by communication I / F17 is not limited to wireless or wired.
A program that realizes the processing performed by the document comparison device 100 is provided to the document comparison device 100 by a storage medium 19 such as a CD-ROM (Compact Disc Read-Only Memory), for example.

ドライブ装置18は、ドライブ装置18にセットされた記憶媒体19(例えば、CD−ROM等)と文書比較装置100とのインターフェースを行う。 The drive device 18 interfaces the storage medium 19 (for example, a CD-ROM or the like) set in the drive device 18 with the document comparison device 100.

また、記憶媒体19に、後述される本実施の形態に係る種々の処理を実現するプログラムを格納し、この記憶媒体19に格納されたプログラムは、ドライブ装置18を介して文書比較装置100にインストールされる。インストールされたプログラムは、文書比較装置100により実行可能となる。 Further, a program for realizing various processes according to the present embodiment described later is stored in the storage medium 19, and the program stored in the storage medium 19 is installed in the document comparison device 100 via the drive device 18. Will be done. The installed program can be executed by the document comparison device 100.

尚、プログラムを格納する記憶媒体19はCD−ROMに限定されず、コンピュータが読み取り可能な、構造(structure)を有する1つ以上の非一時的(non-transitory)な、有形(tangible)な媒体であればよい。コンピュータ読取可能な記憶媒体として、CD−ROMの他に、DVD(Digital Versatile Disk)ディスク、USBメモリ等の可搬型記録媒体、フラッシュメモリ等の半導体メモリであっても良い。 The storage medium 19 for storing the program is not limited to the CD-ROM, and is one or more non-transitory, tangible media having a structure that can be read by a computer. It should be. The computer-readable storage medium may be a DVD (Digital Versatile Disk) disk, a portable recording medium such as a USB memory, or a semiconductor memory such as a flash memory, in addition to the CD-ROM.

図6は、文書比較装置の機能構成例を示す図である。図6において、文書比較装置100は、主に、ベクトル表現収集部40と、文書比較部50とを有する。ベクトル表現収集部40と、相関取得部50とは、CPU11が対応するプログラムを実行することで行われる処理により実現される。 FIG. 6 is a diagram showing a functional configuration example of the document comparison device. In FIG. 6, the document comparison device 100 mainly has a vector representation collection unit 40 and a document comparison unit 50. The vector expression collection unit 40 and the correlation acquisition unit 50 are realized by processing performed by the CPU 11 executing the corresponding program.

また、記憶部130は、複数の文書70の集合、文書70ごとの語の列72の集合、ベクトル表現DB74、比較対象の2以上の文書80、比較対象の文書80ごとの語の列82、重み付き相関結果89等を記憶する。 Further, the storage unit 130 includes a set of a plurality of documents 70, a set of word strings 72 for each document 70, a vector representation DB 74, two or more documents 80 to be compared, and a word sequence 82 for each document 80 to be compared. The weighted correlation result 89 and the like are stored.

ベクトル表現収集部40は、予め収集し蓄積された文書70の集合を用いて、文書の構成単位でベクトル表現に変換し、ベクトル表現DB74に記憶する処理部であり、分解部41と、変換部42とを有する。文書の構成単位は、品詞ごとであっても良いし、文字又はフレーズごとであってもよい。構成単位は、文書の要素である。 The vector expression collection unit 40 is a processing unit that converts a set of documents 70 that have been collected and accumulated in advance into a vector expression in the structural unit of the document and stores it in the vector expression DB 74, and is a decomposition unit 41 and a conversion unit. It has 42 and. The structural unit of the document may be for each part of speech, or for each character or phrase. A building block is an element of a document.

分解部41は、記憶部130から文書70を読み込んで、読み込んだ文書70を空白の検出、又は形態素解析により構成単位に分割して、語の列72を生成する。文書70ごとの語の列72が記憶部130に記憶される。文書70が英文の場合、空白により文書70を分解してもよい。文書70が和文の場合、形態素解析(mecab等)による分かち書きにより分解してもよい。 The decomposition unit 41 reads the document 70 from the storage unit 130, divides the read document 70 into structural units by detecting blanks or morphological analysis, and generates a word string 72. The word sequence 72 for each document 70 is stored in the storage unit 130. If the document 70 is in English, the document 70 may be decomposed by blanks. When the document 70 is in Japanese, it may be decomposed by morphological analysis (mecab or the like).

変換部42は、語の列72をベクトル表現に変換する。ベクトル表現として、出現頻度、出現位置、それらの組合等へ変換すればよい。出現頻度への変換は、tfidf、LSI等を用いればよい。また、出現位置への変換は、word2vec等を用いればよい。ベクトル表現は、ベクトル列で表される。 The conversion unit 42 converts the word string 72 into a vector representation. As a vector expression, it may be converted into the appearance frequency, the appearance position, their union, and the like. Conversion to the frequency of appearance may be performed using tfidf, LSI, or the like. In addition, word2vec or the like may be used for conversion to the appearance position. The vector representation is represented by a vector sequence.

文書比較部50は、比較対象の文書80を重み付きで相関を計算し、重み付き相関結果89を記憶部130に出力する。文書比較部50は、更に、分解部51と、変換部52と、重み付き相関計算部53とを有する。 The document comparison unit 50 calculates the correlation of the documents 80 to be compared with weights, and outputs the weighted correlation result 89 to the storage unit 130. The document comparison unit 50 further includes a decomposition unit 51, a conversion unit 52, and a weighted correlation calculation unit 53.

分解部51は、比較対象の2つの文書80を入力して、それぞれの文書80を構成単位で分割することで、2つの語の例72を生成する。入力する文書80は、3以上であってもよい。文書80ごとに語の列72が生成され記憶部130に記憶される。構成単位への分割は、ベクトル表現収集部40での分解部41と同様でよい。 The decomposition unit 51 inputs two documents 80 to be compared and divides each document 80 into constituent units to generate an example 72 of two words. The document 80 to be input may be 3 or more. A word string 72 is generated for each document 80 and stored in the storage unit 130. The division into the constituent units may be the same as the decomposition unit 41 in the vector representation collection unit 40.

変換部52は、ベクトル表現DB74を参照して、分解部51によって得られた語の列80を、それぞれベクトル列84へと変換する。比較対象の各文書80に対するベクトル列84が記憶部130に記憶される。 The conversion unit 52 converts the word sequence 80 obtained by the decomposition unit 51 into the vector sequence 84, respectively, with reference to the vector representation DB 74. The vector sequence 84 for each document 80 to be compared is stored in the storage unit 130.

重み付き相関計算部53は、ベクトル列84を用いて、構成単位ごとの2つのベクトルの内積を重みとして用いて、文書80の相関を計算する。重み付き相関計算部53は、畳み込み演算部54をするように構成することで、計算時間を抑えることができる。得られた重み付き相関結果89は、記憶部130に記憶される。 The weighted correlation calculation unit 53 calculates the correlation of the document 80 by using the vector sequence 84 and using the inner product of two vectors for each constituent unit as a weight. By configuring the weighted correlation calculation unit 53 so as to perform the convolution calculation unit 54, the calculation time can be suppressed. The obtained weighted correlation result 89 is stored in the storage unit 130.

次に、処理フローについて説明する。先ず、ベクトル表現収集部40によるベクトル表現収集処理の手順について説明する。図7は、ベクトル表現収集処理を説明するためのフローチャート図である。 Next, the processing flow will be described. First, the procedure of the vector expression collection process by the vector expression collection unit 40 will be described. FIG. 7 is a flowchart for explaining the vector representation collection process.

図7において、ベクトル表現収集部40では、分解部41が文書70の集合から1つの文書70を読み込み(ステップS101)、読み込んだ文書70を構成単位に分解して、語の列72を作成する。文章70が「吾輩は猫である」を例とすると、この文章70は、「吾輩、は、猫、で、ある」の語の列72で表される。語の列72は記憶部130に記憶される。 In FIG. 7, in the vector expression collecting unit 40, the decomposition unit 41 reads one document 70 from the set of documents 70 (step S101), decomposes the read document 70 into constituent units, and creates a word string 72. .. Taking sentence 70 as an example of "I am a cat", this sentence 70 is represented by the column 72 of the words "I am a cat." The word sequence 72 is stored in the storage unit 130.

語の列72が作成されると、次に、変換部42が、語の列72の各語をベクトルに変換してベクトル列を生成し、ベクトル表現DB74に蓄積する(ステップS103)。ベクトル表現DB74には、語「吾輩」に対応付けてベクトル表現(1,0,1)、語「は」に対応付けてベクトル表現(0,1,2)、語「猫」に対応付けてベクトル表現(1,1,3、語「で」に対応付けてベクトル表現(0,2,4)、そして、語「ある」に対応付けてベクトル表現(0,3,5)が蓄積される。 When the word string 72 is created, the conversion unit 42 then converts each word in the word string 72 into a vector to generate a vector sequence, which is stored in the vector representation DB 74 (step S103). In the vector expression DB74, the vector expression (1,0,1) is associated with the word "I", the vector expression (0,1,2) is associated with the word "ha", and the word "cat" is associated with the vector expression DB74. Vector representations (1,1,3, vector representations (0,2,4) associated with the word "de", and vector representations (0,3,5) associated with the word "aru" are accumulated. ..

ベクトル表現収集部40は、文書70の集合に未処理の文書70があるか否かを判断する(ステップS104)。未処理の文章70がある場合(ステップS104のYES)、ベクトル表現収集部40は、ステップS101へと戻り、上述同様の処理を繰り返す。一方、未処理の文章70がある場合(ステップS104のNO)、ベクトル表現収集部40は、このベクトル表現収集処理を終了する。 The vector representation collection unit 40 determines whether or not there is an unprocessed document 70 in the set of documents 70 (step S104). When there is an unprocessed sentence 70 (YES in step S104), the vector expression collecting unit 40 returns to step S101 and repeats the same processing as described above. On the other hand, when there is an unprocessed sentence 70 (NO in step S104), the vector expression collecting unit 40 ends the vector expression collecting process.

文書70を分解する構成単位は、文字であってもよい。この場合、英文の場合等での空白による分割、和文の場合等での分かち書きの必要がない。上記文章例「吾輩は猫である」の場合、[“吾”,“輩”,“は”,“猫”,“で”,“あ”,“る”]に分解される。分割した各文字をベクトルで示したベクトル列を生成しベクトル表現DB74に蓄積する。 The structural unit for decomposing the document 70 may be characters. In this case, there is no need to divide by spaces in the case of English text, or to divide in the case of Japanese text. In the case of the above sentence example "I am a cat", it is decomposed into ["I", "I am", "ha", "cat", "de", "a", "ru"]. A vector sequence in which each divided character is represented by a vector is generated and stored in the vector representation DB 74.

また、文字単位によるベクトル表現の獲得方法は、文書比較部50においてベクトル表現DB74を参照して行われる。この際には、語でなく文字単位で分割して、文字に対応付けられたベクトルを取得し、ベクトル列を作成する。 Further, the method of acquiring the vector expression in character units is performed in the document comparison unit 50 with reference to the vector expression DB 74. In this case, the vector is divided into character units instead of words, and the vector associated with the character is acquired to create a vector string.

他の例として、構成単位は、フレーズであってもよい。フレーズを構成単位とする場合、フレーズを定義し、それに基づいた構文解析が必要となる。上記文章例「吾輩は猫である」の場合、[“吾輩は”,“猫である”]に分解される。 As another example, the structural unit may be a phrase. When a phrase is used as a constituent unit, it is necessary to define the phrase and perform parsing based on it. In the case of the above sentence example "I am a cat", it is decomposed into ["I am a cat", "I am a cat"].

フレーズに対するベクトル表現を獲得する場合には、フレーズを構成する語のベクトル表現から計算すればよい。即ち、
β(“吾輩は”)=(β(“吾輩”)+β(“は”))/2
により得られる。ベクトル表現取得の前にフレーズを設定し、それらを語とみなしてベクトル表現を学習する。
To obtain a vector representation for a phrase, it may be calculated from the vector representation of the words that make up the phrase. That is,
β (“I am”) = (β (“I am”) + β (“ha”)) / 2
Obtained by Set phrases before getting vector expressions, and learn vector expressions by regarding them as words.

次に、文書比較部50による文書比較処理について説明する。図8は、文書比較処理を説明するためのフローチャート図である。図8における説明では、比較対象の文書80をそれぞれ文書A及び文書Bとする。 Next, the document comparison process by the document comparison unit 50 will be described. FIG. 8 is a flowchart for explaining the document comparison process. In the description of FIG. 8, the document 80 to be compared is referred to as document A and document B, respectively.

文書比較部50において、分割部51は、比較対象の文書A及び文書Bとを読み込む(ステップS201)。そして、分割部51は、文書Aと文書Bとをそれぞれ構成単位で分割して、語の列Aと語の列Bとを作成する(ステップS202)。 In the document comparison unit 50, the division unit 51 reads the document A and the document B to be compared (step S201). Then, the division unit 51 divides the document A and the document B into constituent units to create the word column A and the word column B (step S202).

次に、変換部52は、ベクトル表現DB74を参照して、語の列Aをベクトル列Aに変換し、同様に、語の列Bをベクトル列Bに変換する(ステップS203)。 Next, the conversion unit 52 converts the word string A into the vector string A with reference to the vector representation DB 74, and similarly converts the word string B into the vector string B (step S203).

そして、重み付き相関計算部53は、ベクトル列Aとベクトル列Bとの相関を重み付けして算出する(ステップS204)。重み付き計算結果89が記憶部130に出力される。重み付き計算結果89が表示装置15に表示されるようにしてもよい。図4の下段の重み付き相関のグラフが表示されることで、ユーザは、視覚的に類似又は剽窃の有無を知ることができる。 Then, the weighted correlation calculation unit 53 weights and calculates the correlation between the vector column A and the vector column B (step S204). The weighted calculation result 89 is output to the storage unit 130. The weighted calculation result 89 may be displayed on the display device 15. By displaying the weighted correlation graph in the lower part of FIG. 4, the user can visually know whether or not there is similarity or theft.

次に、重み付き相関の計算手順について説明する。重み付き相関の計算では、数18による第1の計算方法と、計算量を抑えることができる数19による第2の計算方法とがある。先ず、図8のステップS204において、第1の計算方法にて重み付き相関を計算する場合について説明する。第1の計算方法は、内積についての畳み込みを行うが、重み付き相関計算部53に図6の畳み込み演算部54は含まれない。 Next, the calculation procedure of the weighted correlation will be described. In the calculation of the weighted correlation, there are a first calculation method using the number 18 and a second calculation method using the number 19 that can reduce the amount of calculation. First, in step S204 of FIG. 8, a case where the weighted correlation is calculated by the first calculation method will be described. In the first calculation method, the inner product is convolved, but the weighted correlation calculation unit 53 does not include the convolution calculation unit 54 of FIG.

図9は、図8のステップS204を第1の計算方法の場合の重み付き相関計算処理を説明するためのフローチャート図である。図9において、重み付き相関計算部53は、2つのベクトル列A及びBを読み込み(ステップS211)、変数i及び変数kを1に設定する(ステップS212)。変数iはずれ位置を示し、変数kはベクトルの次元を示す。 FIG. 9 is a flowchart for explaining the weighted correlation calculation process in the case where step S204 of FIG. 8 is the first calculation method. In FIG. 9, the weighted correlation calculation unit 53 reads the two vector sequences A and B (step S211), and sets the variable i and the variable k to 1 (step S212). The variable i indicates the out-of-position position, and the variable k indicates the dimension of the vector.

ベクトル列Aの各要素(構成単位のベクトル)は、 Each element (vector of the constituent unit) of the vector sequence A is

Figure 0006809119
で表される。β(si)は、文書Aのi番目の構成のベクトル表現を示す。また、ベクトル列Bの各要素は、
Figure 0006809119
It is represented by. β (s i ) indicates the vector representation of the i-th configuration of document A. Further, each element of the vector column B is

Figure 0006809119
で表される。β(ti)は、文書Bのi番目の構成のベクトル表現を示す。
Figure 0006809119
It is represented by. β (t i ) indicates the vector representation of the i-th configuration of document B.

変数i及び変数jの初期化後、重み付き相関計算部53は、変数iが2n-1以下か否かを判断する(ステップS213)。 After the variables i and j are initialized, the weighted correlation calculation unit 53 determines whether or not the variable i is 2n-1 or less (step S213).

一方、変数iが2n-1以下の場合(ステップS213のYES)、重み付き相関計算部53は、C’iをゼロに初期化する(ステップS214)。C’iは、ずれ位置iにおける重み付き相関の要素を示す変数である。 On the other hand, if the variable i is 2n-1 or less (YES in step S213), the weighted correlation calculation unit 53 initializes to zero the C 'i (step S214). C'i is a variable that indicates the element of weighted correlation at the shift position i.

そして、重み付き相関計算部53は、変数jが1以上かつn以下であるか否かを判断する(ステップS215)。nは、文章A及びBの長さを示す。変数jが1以上かつn以下である場合(ステップS215のYES)、重み付き相関計算部53は、変数xjをゼロに初期化する(ステップS216)。変数xjは、すべてのベクトル次元dに対する内積を示す。 Then, the weighted correlation calculation unit 53 determines whether or not the variable j is 1 or more and n or less (step S215). n indicates the length of sentences A and B. When the variable j is 1 or more and n or less (YES in step S215), the weighted correlation calculation unit 53 initializes the variable x j to zero (step S216). The variable x j indicates the dot product for all vector dimensions d.

そして、重み付き相関計算部53は、変数kが1以上かつ次元d以下であるか否かを判断する(ステップS217)。変数kが1以上かつ次元d以下である場合(ステップS217のYES)、重み付き相関計算部53は、次元kのベクトルの内積ykを求め(ステップS218)、内積ykを変数xjに加算する(ステップS219)。そして、重み付き相関計算部53は、ステップS217へと戻り上述同様の処理を繰り返し、次元dまでのベクトルの内積を全て加算する。 Then, the weighted correlation calculation unit 53 determines whether or not the variable k is 1 or more and the dimension d or less (step S217). When the variable k is 1 or more and the dimension d or less (YES in step S217), the weighted correlation calculation unit 53 obtains the inner product y k of the vectors of the dimension k (step S218), and sets the inner product y k to the variable x j . Add (step S219). Then, the weighted correlation calculation unit 53 returns to step S217 and repeats the same process as described above to add all the inner products of the vectors up to the dimension d.

一方、変数kが1以上かつ次元d以下でない場合(ステップS217のNO)、重み付き相関計算部53は、ずれ位置iの相関C’iに変数xjの値を加算して(ステップS220)、ステップS215へと戻り、上述同様の処理を繰り返すことでずれ位置iに対する重み付き相関値を得る。 On the other hand, if the variable k is not less than 1 and not more than dimension d (NO in step S217), the weighted correlation calculating unit 53 adds the value of the variable x j on the correlation C 'i shift position i (step S220) , Return to step S215 and repeat the same process as described above to obtain a weighted correlation value for the shift position i.

一方、変数jが1以上かつn以下でない場合(ステップS215のNO)、重み付き相関計算部53は、ずれ位置iに対応付けて相関C’iの値を重み付き相関結果89に記録する(ステップS221)。ステップS213へと戻り、ダミーの語の列の長さを含めてずれ位置iにおける重み付き相関値を取得するため、上記同様の処理を繰り返す。 On the other hand, if the variable j is not less than 1 and not more than n (NO in step S215), the weighted correlation calculating unit 53 in association with the shift position i records the value of the correlation C 'i the weighted correlation results 89 ( Step S221). Returning to step S213, the same process as described above is repeated in order to acquire the weighted correlation value at the shift position i including the length of the dummy word column.

そして、最終的に、変数iが2n-1以下でないと判断した場合(ステップS213のNO)、すべてのずれ位置に対する重み付き相関を得られたため、重み付き相関計算部53は、すべてのずれ位置の重み付き相関値を示す重み付き相関結果89を記憶部130に出力して(ステップS222)、重み付き相関計算処理を終了する。 Finally, when it is determined that the variable i is not 2n-1 or less (NO in step S213), the weighted correlation for all the deviation positions is obtained, so that the weighted correlation calculation unit 53 performs all the deviation positions. The weighted correlation result 89 indicating the weighted correlation value of is output to the storage unit 130 (step S222), and the weighted correlation calculation process is completed.

図10は、図8のステップS204を第2の計算方法の場合の重み付き相関計算処理を説明するためのフローチャート図である。図10において、重み付き相関計算部53は、2つのベクトル列A及びBを読み込み(ステップS231)、変数i及び変数kを1に設定する(ステップS232)。変数iはずれ位置を示し、変数kはベクトルの次元を示す。 FIG. 10 is a flowchart for explaining the weighted correlation calculation process in the case where step S204 of FIG. 8 is the second calculation method. In FIG. 10, the weighted correlation calculation unit 53 reads the two vector sequences A and B (step S231), and sets the variable i and the variable k to 1 (step S232). The variable i indicates the off-position, and the variable k indicates the dimension of the vector.

ベクトル列Aの各要素(構成単位のベクトル)は数21で表され、ベクトル列Bの各要素は数22で表されるのは、図9で説明した通りである。変数i及び変数jの初期化後、重み付き相関計算部53は、すべてのC’i(1≦i≦2n−1)をゼロに初期化する(ステップS233)。 As described in FIG. 9, each element of the vector sequence A (the vector of the constituent unit) is represented by the equation 21, and each element of the vector sequence B is represented by the equation 22. After the variables i and j are initialized, the weighted correlation calculation unit 53 initializes all C'i (1 ≦ i ≦ 2n-1) to zero (step S233).

重み付き相関計算部53は、変数kが1以上かつ次元d以下であるか否かを判断する(ステップS234)。変数kが1以上かつ次元d以下である場合(ステップS234のYES)、重み付き相関計算部53は、畳み込み演算を行う(ステップS235)。配列[Zk,i](数20)が求められる。 The weighted correlation calculation unit 53 determines whether or not the variable k is 1 or more and the dimension d or less (step S234). When the variable k is 1 or more and the dimension d or less (YES in step S234), the weighted correlation calculation unit 53 performs a convolution operation (step S235). The array [Z k, i ] (Equation 20) is obtained.

重み付き相関計算部53は、変数iが1以上かつ2n-1であるか否かを判断する(ステップS236)。変数iが1以上かつ2n-1である場合(ステップS236のYES)、重み付き相関計算部53は、畳み込み演算結果をずれ位置iの相関C’iに加算する(ステップS237)。配列[Zk,i]の値が相関C’iに蓄積される。変数iが2n-1まで、重み付き相関計算部53は、相関C’iの値を加算する。 The weighted correlation calculation unit 53 determines whether or not the variable i is 1 or more and 2n-1 (step S236). When the variable i is 1 or more and 2n-1 (YES in step S236), the weighted correlation calculating unit 53 adds the correlation C 'i for position i deviation convolution operation result (step S237). Sequence [Z k, i] the value of are stored in the correlation C 'i. Variable i is up to 2n-1, weighted correlation calculating unit 53 adds the value of the correlation C 'i.

変数iが1以上かつ2n-1でない場合(ステップS236のNO)、重み付き相関計算部53は、ずれ位置iの相関C’iを重み付き相関結果89に記録して(ステップS238)、ステップS234へと戻り、上述同様の処理を繰り返す。 If the variable i is 1 or more and not 2n-1 (NO in step S236), the weighted correlation calculating unit 53 may record the correlation C 'i shift position i to the weighted correlation results 89 (step S238), step Returning to S234, the same process as described above is repeated.

一方、変数kが1以上かつ次元d以下でない場合(ステップS234のNO)、すべてのずれ位置に対する重み付き相関を得られたため、重み付き相関計算部53は、すべてのずれ位置の重み付き相関値を示す重み付き相関結果89を記憶部130に出力して(ステップS239)、重み付き相関計算処理を終了する。 On the other hand, when the variable k is 1 or more and not the dimension d or less (NO in step S234), the weighted correlation for all the deviation positions is obtained, so that the weighted correlation calculation unit 53 has the weighted correlation value for all the deviation positions. The weighted correlation result 89 indicating the above is output to the storage unit 130 (step S239), and the weighted correlation calculation process is completed.

上述した第2の計算方法では、文書80間の重み付き相関を文書サイズの準線形時間で取得可能である。 In the second calculation method described above, the weighted correlation between the documents 80 can be obtained in the quasi-linear time of the document size.

また、第1の計算方法も第2の計算方法も同様に、重みをベクトルの内積で表現することで文書80間の相関を得るものであるが、図9に示す第1の計算方法では、ステップS213、ステップS215、及びステップS217の判断により、繰り返し処理が3重構造を示す。よって、
(2n-1) × n × d 回
の繰り返し処理を行うことになる。
Similarly, both the first calculation method and the second calculation method obtain the correlation between the documents 80 by expressing the weights by the inner product of the vectors. However, in the first calculation method shown in FIG. Based on the determination of step S213, step S215, and step S217, the iterative process shows a triple structure. Therefore,
(2n-1) × n × d Iterative processing will be performed.

一方、図10に示す第2の計算方法では、畳み込み演算へと変形させたことで、ステップ233での単独の繰り返し処理と、ステップS234及びS236による2重構造の繰り返し処理で行われる。よって
(2n-1) + (2n-1) × d 回
の繰り返し処理で行うことができ、第1の計算方法よりも計算処理の負担をより軽減することができる。
On the other hand, in the second calculation method shown in FIG. 10, by transforming it into a convolution operation, it is performed by a single iterative process in step 233 and a double structure iterative process in steps S234 and S236. Therefore
It can be performed by repeating processing (2n-1) + (2n-1) × d times, and the burden of calculation processing can be further reduced compared to the first calculation method.

ここで、文書80の実データのサイズについて、概ねの範囲を示す。 Here, the approximate range of the size of the actual data of the document 80 is shown.

σについて、
・2バイト文字:65536
・単一言語の語録数:数千〜数万
nについて
・ニュース記事:数百〜
・学術論文(語の数):数千〜数万
dについて
・word2vecのデフォルト値:200
文書データより分散表現(低次元のベクトル表現)を得るツールとして、word2vecを一例とした場合の次元数である。ベクトルの近さが概ね語義の近さを表わす。文書分類等で精度良く類似を判定できる。
About σ
-Double-byte characters: 65536
・ Number of words in a single language: Thousands to tens of thousands
About n ・ News articles: Hundreds ~
・ Academic treatise (number of words): Thousands to tens of thousands
About d ・ Default value of word2vec: 200
This is the number of dimensions when word2vec is taken as an example as a tool for obtaining a distributed representation (low-dimensional vector representation) from document data. The closeness of the vector generally represents the closeness of the meaning. Similarity can be judged accurately by document classification.

このようにd<<σであるため、既存の第1の手法(重み無し相関)のO(n2(logσ)2)時間に比べ、本実施例における重み付き相関であってもO(dnlogn)時間であることから、大幅に計算時間を短縮できる。 Since d << σ in this way, compared to the O (n 2 (logσ) 2 ) time of the existing first method (unweighted correlation), even the weighted correlation in this embodiment is O (dnlogn). ) Since it is time, the calculation time can be significantly reduced.

また、本実施例では、重み付き相関をえることができるため、図4の下段に示すように、重み無し相関では検出の困難な言い換えを含む剽窃あることを検出できる。より精度良く、文書間の類似を評価可能である。 Further, in this embodiment, since the weighted correlation can be obtained, as shown in the lower part of FIG. 4, it is possible to detect the theft including paraphrases that are difficult to detect by the unweighted correlation. It is possible to evaluate the similarity between documents with higher accuracy.

上述した実施例において、分解部51は分離部に相当し、重み付き相関計算部53は算出部に相当する。 In the above-described embodiment, the decomposition unit 51 corresponds to the separation unit, and the weighted correlation calculation unit 53 corresponds to the calculation unit.

本発明は、具体的に開示された実施例に限定されるものではなく、特許請求の範囲から逸脱することなく、主々の変形や変更が可能である。 The present invention is not limited to the specifically disclosed examples, and major modifications and modifications can be made without departing from the scope of claims.

以上の実施例を含む実施形態に関し、更に以下の付記を開示する。
(付記1)
比較対象の複数の文書それぞれを複数の要素に分離し、
前記複数の文書の全てのずれ位置における、前記複数の要素それぞれの、該要素間の重み付けを含めた相関値を、該要素の特徴をベクトルで表すことで、各要素に対応付けた該ベクトルの内積とした離散フーリエ変換により算出する
処理をコンピュータに行わせる文書比較プログラム。
(付記2)
前記コンピュータに、
前記ベクトルの次元ごとに、前記複数の文書の前記各要素に対応付けた前記ベクトルの内積とした前記離散フーリエ変換により畳み込み演算を行って、該次元の各ずれ位置における演算値を取得し、
各ずれ位置で前記ベクトルの次元ごとで得た演算値を合計する
処理を行わせる付記1記載の文書比較プログラム。
(付記3)
前記コンピュータに、
前記複数の文書を、品詞、文字、フレーズ、又は空白を区切りとした単語のいずれかを要素として分離させる
ことを特徴とする付記1又は2記載の文書比較プログラム。
(付記4)
前記コンピュータに、
複数のサンプル文書から分離した要素ごとに特徴を表わす前記ベクトルを記憶した記憶部を参照して、前記複数の文書それぞれの各要素を、特徴を表わす前記ベクトルに変換する処理を行わせる
ことを特徴とする付記1乃至3のいずれか一項記載の文書比較プログラム。
(付記5)
比較対象の複数の文書それぞれを複数の要素に分離し、
前記複数の文書の全てのずれ位置における、前記複数の要素それぞれの、要素間の重み付けを含めた相関値を、該要素の特徴をベクトルで表すことで、各要素に対応付けた該ベクトルの内積とした離散フーリエ変換により算出する
処理をコンピュータが行う文書比較方法。
(付記6)
比較対象の複数の文書それぞれを複数の要素に分離する分離部と、
前記複数の文書の全てのずれ位置における、前記複数の要素それぞれの、要素間の重み付けを含めた相関値を、該要素の特徴をベクトルで表すことで、各要素に対応付けた該ベクトルの内積とした離散フーリエ変換により算出する算出部と
を有する文書比較装置。
The following additional notes will be further disclosed with respect to the embodiments including the above embodiments.
(Appendix 1)
Separate multiple documents to be compared into multiple elements
The correlation value of each of the plurality of elements at all the deviation positions of the plurality of documents, including the weighting between the elements, is represented by a vector of the characteristics of the element, so that the vector associated with each element is associated with the vector. A document comparison program that lets a computer perform the processing calculated by the discrete Fourier transform as the inner product.
(Appendix 2)
On the computer
For each dimension of the vector, a convolution operation is performed by the discrete Fourier transform which is the inner product of the vector associated with each element of the plurality of documents, and the calculated value at each deviation position of the dimension is acquired.
The document comparison program according to Appendix 1, which performs a process of summing up the calculated values obtained for each dimension of the vector at each deviation position.
(Appendix 3)
On the computer
The document comparison program according to Appendix 1 or 2, wherein the plurality of documents are separated by any of a part of speech, a character, a phrase, or a word separated by a space as an element.
(Appendix 4)
On the computer
The feature is that each element of each of the plurality of documents is converted into the vector representing the feature by referring to the storage unit that stores the vector representing the feature for each element separated from the plurality of sample documents. The document comparison program according to any one of Appendix 1 to 3.
(Appendix 5)
Separate multiple documents to be compared into multiple elements
The correlation value of each of the plurality of elements at all the deviation positions of the plurality of documents, including the weighting between the elements, is represented by a vector, and the inner product of the vector associated with each element. A document comparison method in which a computer performs a process of calculating by the discrete Fourier transform.
(Appendix 6)
A separator that separates each of the multiple documents to be compared into multiple elements,
The correlation value of each of the plurality of elements at all the deviation positions of the plurality of documents, including the weighting between the elements, is represented by a vector, and the inner product of the vector associated with each element. A document comparison device having a calculation unit calculated by the discrete Fourier transform.

11 CPU
12 主記憶装置
13 補助記憶装置
14 入力装置
15 表示装置
17 通信I/F
18 ドライブ装置
19 記憶媒体
40 ベクトル表現収集部
41 分割部
42 変換部
50 文書比較部
51 分割部
52 変換部
53 重み付き相関計算部
54 畳み込み演算部
70、80 文章
72、82 語の列
74 ベクトル表現DB
84 ベクトル列
89 重み付き相関結果
11 CPU
12 Main storage device 13 Auxiliary storage device 14 Input device 15 Display device 17 Communication I / F
18 Drive device 19 Storage medium 40 Vector expression collection unit 41 Division 42 Conversion unit 50 Document comparison unit 51 Division 52 Conversion unit 53 Weighted correlation calculation unit 54 Convolution calculation unit 70, 80 Sentence 72, 82 word sequence 74 Vector representation DB
84 Vector column 89 Weighted correlation result

Claims (5)

比較対象の複数の文書それぞれを複数の要素に分離し、
前記複数の文書のうち、一方の文書に対して、他方の文書で語順を変えてある場所をずれ位置とし、前記複数の文書の全てのずれ位置における、前記複数の要素それぞれの、要素間の重み付けを含めた相関値を、該要素の特徴をベクトルで表すことで、各要素に対応付けた該ベクトルの内積とした離散フーリエ変換により算出する
処理をコンピュータに行わせる文書比較プログラム。
Separate multiple documents to be compared into multiple elements
Of the plurality of documents, the position where the word order is changed in the other document is set as the shift position with respect to one document, and the gap between the elements of each of the plurality of elements at all the shift positions of the plurality of documents. A document comparison program that allows a computer to perform a process of calculating a correlation value including weighting by a discrete Fourier transform that is the inner product of the vector associated with each element by expressing the characteristics of the element with a vector.
前記コンピュータに、
前記ベクトルの次元ごとに、前記複数の文書の前記各要素に対応付けた前記ベクトルの内積とした前記離散フーリエ変換により畳み込み演算を行って、該次元の各ずれ位置における演算値を取得し、
各ずれ位置で前記ベクトルの次元ごとで得た演算値を合計する
処理を行わせる請求項1記載の文書比較プログラム。
On the computer
For each dimension of the vector, a convolution operation is performed by the discrete Fourier transform which is the inner product of the vector associated with each element of the plurality of documents, and the calculated value at each deviation position of the dimension is acquired.
The document comparison program according to claim 1, wherein a process of summing the calculated values obtained for each dimension of the vector is performed at each deviation position.
前記コンピュータに、
前記複数の文書を、品詞、文字、フレーズ、又は空白を区切りとした単語のいずれかを要素として分離させる
ことを特徴とする請求項1又は2記載の文書比較プログラム。
On the computer
The document comparison program according to claim 1 or 2, wherein the plurality of documents are separated by any of a part of speech, a character, a phrase, or a word separated by a space as an element.
比較対象の複数の文書それぞれを複数の要素に分離し、
前記複数の文書のうち、一方の文書に対して、他方の文書で語順を変えてある場所をずれ位置とし、前記複数の文書の全てのずれ位置における、前記複数の要素それぞれの、要素間の重み付けを含めた相関値を、該要素の特徴をベクトルで表すことで、各要素に対応付けた該ベクトルの内積とした離散フーリエ変換により算出する
処理をコンピュータが行う文書比較方法。
Separate multiple documents to be compared into multiple elements
Of the plurality of documents, the position where the word order is changed in the other document is set as the shift position with respect to one document, and the gap between the elements of each of the plurality of elements at all the shift positions of the plurality of documents. A document comparison method in which a computer performs a process of calculating a correlation value including a weight by a discrete Fourier transform which is an inner product of the vector associated with each element by expressing the feature of the element with a vector.
比較対象の複数の文書それぞれを複数の要素に分離する分離部と、
前記複数の文書のうち、一方の文書に対して、他方の文書で語順を変えてある場所をずれ位置とし、前記複数の文書の全てのずれ位置における、前記複数の要素それぞれの、要素間の重み付けを含めた相関値を、該要素の特徴をベクトルで表すことで、各要素に対応付けた該ベクトルの内積とした離散フーリエ変換により算出する算出部と
を有する文書比較装置。
A separator that separates each of the multiple documents to be compared into multiple elements,
Of the plurality of documents, the position where the word order is changed in the other document is set as the shift position with respect to one document, and the gap between the elements of each of the plurality of elements at all the shift positions of the plurality of documents. A document comparison device having a calculation unit that calculates a correlation value including weighting by a discrete Fourier transform as an inner product of the vector associated with each element by expressing the characteristics of the element with a vector.
JP2016201933A 2016-10-13 2016-10-13 Document comparison program, document comparison method, and document comparison device Expired - Fee Related JP6809119B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2016201933A JP6809119B2 (en) 2016-10-13 2016-10-13 Document comparison program, document comparison method, and document comparison device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2016201933A JP6809119B2 (en) 2016-10-13 2016-10-13 Document comparison program, document comparison method, and document comparison device

Publications (2)

Publication Number Publication Date
JP2018063596A JP2018063596A (en) 2018-04-19
JP6809119B2 true JP6809119B2 (en) 2021-01-06

Family

ID=61966809

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2016201933A Expired - Fee Related JP6809119B2 (en) 2016-10-13 2016-10-13 Document comparison program, document comparison method, and document comparison device

Country Status (1)

Country Link
JP (1) JP6809119B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102669428B1 (en) * 2023-06-08 2024-05-27 주식회사 무하유 Apparatus, and mehtod for determinigng plagiarism of japanese document

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10269235A (en) * 1997-03-25 1998-10-09 Toshiba Corp Similar document search device and similar document search method
JPH1153381A (en) * 1997-08-01 1999-02-26 Toshiba Corp Similar document search device and similar document search method
JP2003281190A (en) * 2002-03-22 2003-10-03 Fumiyoshi Adachi General-purpose data search method
US6847966B1 (en) * 2002-04-24 2005-01-25 Engenium Corporation Method and system for optimally searching a document database using a representative semantic space
JP2006139708A (en) * 2004-11-15 2006-06-01 Ricoh Co Ltd Text data similarity calculation method, text data similarity calculation device, and text data similarity calculation program
JP5577546B2 (en) * 2010-05-13 2014-08-27 株式会社日立製作所 Computer system

Also Published As

Publication number Publication date
JP2018063596A (en) 2018-04-19

Similar Documents

Publication Publication Date Title
CN108628971B (en) Text classification method, text classifier and storage medium for unbalanced data set
CN110750640B (en) Text data classification method and device based on neural network model and storage medium
US11080480B2 (en) Matrix generation program, matrix generation apparatus, and plagiarism detection program
Trevisani et al. A portrait of JASA: the History of Statistics through analysis of keyword counts in an early scientific journal
Bortnikova et al. Queries classification using machine learning for implementation in intelligent manufacturing
Das et al. RETRACTED ARTICLE: Data analysis on music classification system and creating a sentiment word dictionary for Kokborok language
CN114328860A (en) Interactive consultation method and device based on multi-model matching and electronic equipment
CN109858035A (en) A sentiment classification method, apparatus, electronic device and readable storage medium
JP5463873B2 (en) Multimedia classification system and multimedia search system
CN113302601B (en) Meaning relationship learning device, meaning relationship learning method, and recording medium recording meaning relationship learning program
JP6809119B2 (en) Document comparison program, document comparison method, and document comparison device
JP7055848B2 (en) Learning device, learning method, learning program, and claim mapping device
JP5284761B2 (en) Document search apparatus and method, program, and recording medium recording program
JP2006338342A (en) Word vector generation device, word vector generation method and program
JP5533272B2 (en) Data output device, data output method, and data output program
CN113326348A (en) Blog quality evaluation method and tool
Doughman et al. Time-aware word embeddings for three Lebanese news archives
CN112949287A (en) Hot word mining method, system, computer device and storage medium
Cleophas et al. Kernel Ridge regression in clinical research
JP6181890B2 (en) Literature analysis apparatus, literature analysis method and program
JP6740877B2 (en) Similarity calculation program, similarity calculation method, and similarity calculation device
Putri et al. Application of the naïve bayes and support vector machine in sentiment analysis for the 2024 Indonesian presidential candidates
CN118093822B (en) Legal knowledge intelligent question and answer matching method in the legal field
CN112395413B (en) A text analysis method based on diverse deep topic models
Li et al. Compressing parameters in Bayesian high-order models with application to logistic sequence models

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20190709

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20200417

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20200526

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20200727

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20201110

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20201123

R150 Certificate of patent or registration of utility model

Ref document number: 6809119

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees