JP2022069194A - Similar character string detection apparatus, method, program, and system - Google Patents
Similar character string detection apparatus, method, program, and system Download PDFInfo
- Publication number
- JP2022069194A JP2022069194A JP2020178242A JP2020178242A JP2022069194A JP 2022069194 A JP2022069194 A JP 2022069194A JP 2020178242 A JP2020178242 A JP 2020178242A JP 2020178242 A JP2020178242 A JP 2020178242A JP 2022069194 A JP2022069194 A JP 2022069194A
- Authority
- JP
- Japan
- Prior art keywords
- character string
- length
- character
- similar
- score
- 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.)
- Pending
Links
Images
Landscapes
- Machine Translation (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
本発明は、類似文字列検出装置、方法、プログラム、およびシステムに関する。 The present invention relates to similar string detectors, methods, programs, and systems.
従来、ある文字列に類似する文字列を複数の文字列のなかから検出する方法が知られている(特許文献1)。類似する文字列を検出する際に用いられる類似度として、例えば、レーベンシュタイン距離やジャロ・ウィンクラー距離が挙げられる。 Conventionally, a method of detecting a character string similar to a certain character string from a plurality of character strings has been known (Patent Document 1). Examples of the similarity used when detecting similar character strings include the Levenshtein distance and the Jaro-Winkler distance.
レーベンシュタイン距離では、一方の文字列を他方の文字列にするために必要な編集(1文字の挿入、削除、置換)の回数により類似度を表している。ジャロ・ウィンクラー距離では、文字列間で一致する文字数と置換の要否により類似度を表している。そのため、レーベンシュタイン距離やジャロ・ウィンクラー距離の手法は、タイプミス等による僅かな相違(例えば、1文字だけの相違等)がある文字列を検出するのに適している。 In the Levenshtein distance, the similarity is expressed by the number of edits (insertion, deletion, replacement of one character) required to make one character string into the other character string. In the Jaro-Winkler distance, the degree of similarity is expressed by the number of matching characters between character strings and the necessity of replacement. Therefore, the Levenshtein distance and Jaro-Winkler distance methods are suitable for detecting a character string having a slight difference (for example, a difference of only one character) due to a typo or the like.
しかしながら、レーベンシュタイン距離やジャロ・ウィンクラー距離の手法では、複数の単語の語順が入れ替わっている文字列を検出することは難しい。例えば、"50%溶液"という文字列と"溶液(50%)"という文字列があったとする。"50%溶液"と"溶液(50%)"は、同じことを意図している、つまり、両者は類似していると判断されるべきであるとする。ところが、レーベンシュタイン距離やジャロ・ウィンクラー距離の手法では、このような複数の単語の語順が入れ替わっている文字列同士を、全く異なる文字列であると判断してしまう。 However, with the Levenshtein distance and Jaro-Winkler distance methods, it is difficult to detect a character string in which the word orders of multiple words are interchanged. For example, suppose that there is a character string "50% solution" and a character string "solution (50%)". It is assumed that "50% solution" and "solution (50%)" are intended to be the same, that is, they should be judged to be similar. However, in the Levenshtein distance and Jaro-Winkler distance methods, character strings in which the word orders of a plurality of words are interchanged are judged to be completely different character strings.
そこで、本発明では、類似する文字列の検出の精度を向上させることを目的とする。 Therefore, it is an object of the present invention to improve the accuracy of detecting similar character strings.
[1]第1の文字列と、第2の文字列と、の間で共通する文字列の各々の長さの和を、前記第1の文字列の長さと前記第2の文字列の長さとのうちの長い方の長さで除算した第1のスコアを算出する第1スコア算出部と、
前記第1のスコアに基づいて、類似している文字列の組み合わせを出力する出力部と
を備えた類似文字列検出装置。
[2]前記第1の文字列と、前記第2の文字列と、の間で共通する部分の最長の文字数を、前記第1の文字列の長さと前記第2の文字列の長さとのうち短い方の長さで除算した第2のスコアを算出する第2スコア算出部、をさらに備え、
前記出力部は、前記第2のスコアに基づいて、類似している文字列の組み合わせを出力する、[1]に記載の類似文字列検出装置。
[3]前記第1の文字列と、前記第2の文字列と、の間で共通する文字列の各々の長さは2以上である、[1]に記載の類似文字列検出装置。
[4]前記第1の文字列と、前記第2の文字列と、の間で共通する部分の最長の文字数は、連続した文字列の長さである、[2]に記載の類似文字列検出装置。
[5]コンピュータが実行する方法であって、
第1の文字列と、第2の文字列と、の間で共通する文字列の各々の長さの和を、前記第1の文字列の長さと前記第2の文字列の長さとのうちの長い方の長さで除算した第1のスコアを算出するステップと、
前記第1のスコアに基づいて、類似している文字列の組み合わせを出力するステップと
を含む方法。
[6]コンピュータを、
第1の文字列と、第2の文字列と、の間で共通する文字列の各々の長さの和を、前記第1の文字列の長さと前記第2の文字列の長さとのうちの長い方の長さで除算した第1のスコアを算出する第1スコア算出部、
前記第1のスコアに基づいて、類似している文字列の組み合わせを出力する出力部
として機能させるためのプログラム。
[7]類似文字列検出装置とユーザ端末とを含むシステムであって、
前記類似文字列検出装置は、
第1の文字列と、第2の文字列と、の間で共通する文字列の各々の長さの和を、前記第1の文字列の長さと前記第2の文字列の長さとのうちの長い方の長さで除算した第1のスコアを算出する第1スコア算出部と、
前記第1のスコアに基づいて、類似している文字列の組み合わせを出力する出力部と、を備え、
前記ユーザ端末は、
前記類似している文字列の組み合わせを表示する、システム。
[1] The sum of the lengths of the character strings common between the first character string and the second character string is the length of the first character string and the length of the second character string. The first score calculation unit that calculates the first score divided by the longer of the strings, and
A similar character string detection device including an output unit that outputs a combination of similar character strings based on the first score.
[2] The maximum number of characters in the portion common between the first character string and the second character string is the length of the first character string and the length of the second character string. It also has a second score calculation unit, which calculates the second score divided by the shorter length.
The similar character string detection device according to [1], wherein the output unit outputs a combination of similar character strings based on the second score.
[3] The similar character string detecting device according to [1], wherein the length of each of the character strings common between the first character string and the second character string is 2 or more.
[4] The similar character string according to [2], wherein the longest number of characters in the portion common between the first character string and the second character string is the length of continuous character strings. Detection device.
[5] This is a method executed by a computer.
The sum of the lengths of the character strings common between the first character string and the second character string is the sum of the length of the first character string and the length of the second character string. And the step to calculate the first score divided by the longer of
A method including a step of outputting a combination of similar character strings based on the first score.
[6] Computer
The sum of the lengths of the character strings common between the first character string and the second character string is the sum of the length of the first character string and the length of the second character string. 1st score calculation unit, which calculates the 1st score divided by the longer length of
A program for functioning as an output unit that outputs a combination of similar character strings based on the first score.
[7] A system including a similar character string detection device and a user terminal.
The similar character string detection device is
The sum of the lengths of the character strings common between the first character string and the second character string is the sum of the length of the first character string and the length of the second character string. The first score calculation unit that calculates the first score divided by the longer length of
An output unit that outputs a combination of similar character strings based on the first score is provided.
The user terminal is
A system that displays a combination of similar strings.
本発明では、類似する文字列の検出の精度を向上させることができる。 In the present invention, the accuracy of detecting similar character strings can be improved.
以下、各実施形態について添付の図面を参照しながら説明する。なお、本明細書および図面において、実質的に同一の機能構成を有する構成要素については、同一の符号を付することにより重複した説明を省略する。 Hereinafter, each embodiment will be described with reference to the attached drawings. In the present specification and the drawings, the components having substantially the same functional configuration are designated by the same reference numerals, and duplicate description thereof will be omitted.
<用語の説明>
・「文字列」とは、1つ以上の文字が連なったものをいう。
・「文字列群」とは、複数の文字列からなる集合のことをいう。
<Explanation of terms>
-A "character string" is a series of one or more characters.
-"Character string group" means a set consisting of a plurality of character strings.
なお、本実施形態では、2つの文字列群(以下、文字列群1および文字列群2とする)のそれぞれに含まれる文字列(つまり、文字列群1に含まれる文字列と文字列群2に含まれる文字列)を比較する場合を説明する。文字列群1および文字列群2は、異なる文字列群であってもよいし、同一の文字列群であってもよい。ただし、本実施形態は、ユーザ等が指定した文字列と、ある文字列群に含まれる文字列と、を比較する場合にも適用することができる。
In this embodiment, a character string included in each of the two character string groups (hereinafter referred to as a
<システム構成>
図1は、本発明の一実施形態に係る類似文字列検出装置10を含む全体のシステム構成を示す図である。図1に示されるように、類似文字列検出システム1は、類似文字列検出装置10と、ユーザ端末20と、を含む。類似文字列検出装置10は、任意のネットワークを介してユーザ端末20とデータを送受信することができる。以下、それぞれについて説明する。
<System configuration>
FIG. 1 is a diagram showing an overall system configuration including a similar character
類似文字列検出装置10は、類似する文字列(以下、「類似文字列」ともいう)の検出の処理を行う装置(例えば、サーバ)である。具体的には、類似文字列検出装置10は、ある文字列に類似する文字列を、文字列群のなかから検出する。
The similar character
ユーザ端末20は、類似文字列検出装置10に類似文字列を検出させるユーザが利用する端末である。具体的には、ユーザ端末20は、ユーザによって入力された文字列群の指定を受け付ける。また、ユーザ端末20は、受け付けた文字列群の指定を、類似文字列検出装置10に通知する。例えば、ユーザ端末20は、パーソナルコンピュータ等である。
The
なお、類似文字列検出装置10がユーザ端末20の一部または全部の機能を有してもよい。
The similar character
<機能ブロック>
類似文字列検出装置10は、第1スコア算出部104と、出力部107と、を備える。以下、類似文字列検出装置10について、図2を参照しながら詳細に説明する。
<Functional block>
The similar character
図2は、本発明の一実施形態に係る類似文字列検出装置10の機能ブロックを示す図である。図2に示されるように、類似文字列検出装置10は、文字列群取得部101と、文字列選択部102と、共通部分文字列長演算部103と、第1スコア算出部104と、第2スコア算出部105と、類似文字列検出部106と、出力部107と、を備えることができる。これら各部は、類似文字列検出装置10にインストールされたプログラムが類似文字列検出装置10のCPUに実行させる処理により実現される。以下、それぞれについて説明する。
FIG. 2 is a diagram showing a functional block of the similar character
文字列群取得部101は、比較対象となる2つの文字列群(文字列群1および文字列群2とする)を取得する。例えば、文字列群取得部101は、ユーザがユーザ端末20で指定した2つの文字列群を取得する。なお、各文字列群は、類似文字列検出装置10に記憶されていてもよいし、類似文字列検出装置10以外に記憶されていてもよい。
The character string
文字列選択部102は、文字列群取得部101が取得した各文字列群(つまり、文字列群1および文字列群2のそれぞれ)から1つずつ文字列を選択する。
The character
共通部分文字列長演算部103は、文字列選択部102が選択した2つの文字列で共通する文字列の長さ(以下、「共通部分文字列長」ともいう)を演算する。
The common substring
第1スコア算出部104は、共通部分文字列長演算部103が演算した結果を用いて、第1スコアを算出する。
The first
第2スコア算出部105は、共通部分文字列長演算部103が演算した結果を用いて、第2スコアを算出する。
The second
類似文字列検出部106は、第1スコア算出部104あるいは第2スコア算出部105が算出したスコアに基づいて、類似文字列を検出する。なお、第1のスコアのみが用いられてもよいし、第1のスコアと第2のスコアとの両方が用いられてもよい。例えば、類似文字列検出部106は、スコアの高い順に、文字列の組み合わせ(つまり、類似している文字列の組み合わせ)を検出する。
The similar character
出力部107は、類似文字列検出部106が検出した類似文字列を出力(例えば、ユーザ端末20に表示、類似文字列検出装置10に保存等)する。例えば、出力部107は、各スコアの高い順に、文字列の組み合わせ(つまり、類似している文字列の組み合わせ)を出力する。
The
<処理方法>
図3は、本発明の一実施形態に係る類似文字列検出処理の流れを示すフローチャートである。
<Processing method>
FIG. 3 is a flowchart showing the flow of the similar character string detection process according to the embodiment of the present invention.
ステップ1(S1)において、文字列群取得部101は、比較対象となる2つの文字列群(文字列群1および文字列群2とする)を取得する。
In step 1 (S1), the character string
ステップ2-1(S2-1)において、文字列選択部102は、S1で取得された文字列群1から未処理の文字列を選択する。文字列群1のi個目の文字列をS1iとする。
In step 2-1 (S2-1), the character
ステップ2-2(S2-2)において、文字列選択部102は、S1で取得された文字列群2から未処理の文字列を選択する。文字列群2のj個目の文字列をS2jとする。
In step 2-2 (S2-2), the character
ステップ3(S3)において、共通部分文字列長演算部103および第1スコア算出部104(あるいは第2スコア算出部105)は、スコアを算出する。具体的には、共通部分文字列長演算部103および第1スコア算出部104(あるいは第2スコア算出部105)は、S1iとS2jのスコアを算出する。
In step 3 (S3), the common substring
ステップ4(S4)において、第1スコア算出部104あるいは第2スコア算出部105は、文字列群2に含まれる全ての文字列のスコアを算出したか否かを判断する。算出した場合にはステップ5へ進む。算出していない場合、ステップ2-2へ戻り、文字列選択部102は、jに1を加えて、文字列群2のうちj+1番目の文字列を選択する。
In step 4 (S4), the first
ステップ5(S5)において、類似文字列検出部106は、文字列群2に含まれる文字列のうち、スコアの高い1つまたは複数の文字列(例えば、最もスコアの高い文字列)を、S1iに対応する文字列として保存する。
In step 5 (S5), the similar character
ステップ6(S6)において、第1スコア算出部104あるいは第2スコア算出部105は、文字列群1に含まれる全ての文字列のスコアを算出したか否かを判断する。算出した場合にはステップ7へ進む。算出していない場合、ステップ2-1へ戻り、文字列選択部102は、iに1を加えて、文字列群1のうちi+1番目の文字列を選択する。
In step 6 (S6), the first
ステップ7(S7)において、類似文字列検出部106は、スコアに基づいて、類似文字列を検出する。なお、第1のスコアのみが用いられてもよいし、第1のスコアと第2のスコアとの両方が用いられてもよい。例えば、類似文字列検出部106は、スコアの高い順に、文字列の組み合わせ(つまり、類似している文字列の組み合わせ)を検出する。
In step 7 (S7), the similar character
ステップ8(S8)において、出力部107は、S5およびS7で検出された類似文字列を出力する。
In step 8 (S8), the
続いて、図3のS3の詳細について説明する。図4は、本発明の一実施形態に係る第1スコア算出処理の流れを示すフローチャートである。 Subsequently, the details of S3 in FIG. 3 will be described. FIG. 4 is a flowchart showing the flow of the first score calculation process according to the embodiment of the present invention.
ステップ11(S11)において、共通部分文字列長演算部103は、S1i(文字列群1のi個目の文字列)とS2j(文字列群2のj個目の文字列)の共通部分文字列長を演算する。なお、S1iとS2jとの間に、共通する文字列が複数有る場合、各文字列の文字列長が共通部分文字列長として演算される。したがって、複数の共通部分文字列長が演算されうる。
In step 11 (S11), the intersection character string
ステップ12(S12)において、第1スコア算出部104は、S11で演算された共通部分文字列長の和を、S1i(文字列群1のi個目の文字列)の文字列の長さとS2j(文字列群2のj個目の文字列)の文字列の長さのうちの長いほうで除算する。第1スコア算出部104は、共通部分文字列長の和を、S1iの文字列の長さとS2jの文字列の長さのうちの長いほうで除算した値を第1スコアとする。第1スコアは、値が大きいほど類似した文字列であることを示す。
In step 12 (S12), the first
図5は、本発明の一実施形態に係る第2スコア算出処理の流れを示すフローチャートである。 FIG. 5 is a flowchart showing the flow of the second score calculation process according to the embodiment of the present invention.
ステップ21(S21)において、共通部分文字列長演算部103は、S1i(文字列群1のi個目の文字列)とS2j(文字列群2のj個目の文字列)の共通部分文字列長を演算する。S11と同様に、複数の共通部分文字列長が演算されうる。
In step 21 (S21), the intersection character string
ステップ22(S22)において、第2スコア算出部105は、S21で演算された共通部分文字列長のうち最長の共通部分文字列長(以下、「最長共通部分文字列長」ともいう)を、S1i(文字列群1のi個目の文字列)の文字列の長さとS2j(文字列群2のj個目の文字列を)の文字列の長さのうちの短いほうで除算する。第2スコア算出部105は、最長共通部分文字列長を、S1iの文字列の長さとS2jの文字列の長さのうちの短いほうで除算した値を第2スコアとする。第2スコアは、値が大きいほど類似した文字列であることを示す。
In step 22 (S22), the second
なお、上記の最長共通部分文字列長の代わりに、最長共通部分列長を用いるようにしてもよい。最長共通部分列長は、2つの文字列で共通する文字の文字数であり、この文字は連続している必要はない。 The longest common substring length may be used instead of the longest common substring length described above. The longest common subsequence length is the number of characters that are common to two strings, and these characters do not have to be continuous.
続いて、図4のS11および図5のS21の詳細について説明する。図6は、本発明の一実施形態に係る共通部分文字列長演算処理の流れを示すフローチャートである。なお、図7に示されるように、列数が、文字列S1の文字列の長さ+1であり、行数が、文字列S2の文字列の長さ+1である、データ保存用の表(テーブル)が用いられる。共通部分文字列長演算部103は、左端から2番目の列から順に、文字列S1の各文字を割り当てる。また、共通部分文字列長演算部103は、上端から2番目の行から順に、文字列S2の各文字を割り当てる。
Subsequently, the details of S11 in FIG. 4 and S21 in FIG. 5 will be described. FIG. 6 is a flowchart showing a flow of common substring length calculation processing according to an embodiment of the present invention. As shown in FIG. 7, the number of columns is the length of the character string of the character string S1 + 1, and the number of lines is the length of the character string of the character
ステップ101(S101)において、共通部分文字列長演算部103は、最長部分文字列長を0で初期化する。具体的には、共通部分文字列長演算部103は、1行目(上端の行)の各列と1列目(左端の列)の各行の値を0とする。つまり、この時点の最長部分文字列長は0である。
In step 101 (S101), the intersection string
共通部分文字列長演算部103は、文字列S1と文字列S2の先頭の文字から探索を開始する。iは、文字列S1の先頭の文字からi文字目であることを示す。jは、文字列S2の先頭の文字からj文字目であることを示す。i=0、j=0(つまり、先頭の文字)から探索を行う。
The intersection string
ステップ102(S102)において、共通部分文字列長演算部103は、文字列S1のi文字目と文字列S2のj文字目が等しいか否かを判断する。等しい場合にはステップ103へ進み、等しくない場合にはステップ104へ進む。ステップ104(S104)において、共通部分文字列長演算部103は、表(テーブル)のj+1行目のi+1列目のマスに0を入力し、ステップ105へ進む。
In step 102 (S102), the intersection character string
ステップ103(S103)において、共通部分文字列長演算部103は、表(テーブル)のj+1行のi+1列目のマスに、j行目のi列目のマスの値に1を加えた値を入力する。その時点での最長部分文字列長よりも大きな値であったとき、その値を最長部分列文字列長として更新する。
In step 103 (S103), the intersection string
ステップ105(S105)において、共通部分文字列長演算部103は、文字列S1の後端の文字まで探索したか否かを判断する。後端の文字まで探索した場合にはステップ106へ進み、後端の文字まで探索していない場合には、iに1を加えてS102へ戻る。
In step 105 (S105), the intersection character string
ステップ106(S106)において、共通部分文字列長演算部103は、文字列S2の後端の文字まで探索したか否かを判断する。後端の文字まで探索した場合には処理を終了し、後端の文字まで探索していない場合にはjに1を加えてS102へ戻る。
In step 106 (S106), the intersection character string
S101~S106の処理によって、全ての文字の比較が完了する。表(テーブル)において、共通部分文字列長は、右下のマスが0であるマス、または、右下のマスが存在しないマスであって、0以外の値が入力されたマスの値である。また、最長共通部分文字列長は、表(テーブル)に入力されている値のうち最も大きな値である。 By the processing of S101 to S106, the comparison of all characters is completed. In the table, the intersection string length is the value of the cell in which the lower right cell is 0, or the cell in which the lower right cell does not exist, and a value other than 0 is input. .. The longest common substring length is the largest value among the values entered in the table.
<共通部分文字列長の演算>
図7~図12は、本発明の一実施形態に係る共通部分文字列長の演算について説明するための図である。文字列S1「ABCDEFG」と文字列S2「AbcDE」の2つの文字列についての比較を行うとする。
<Calculation of common substring length>
7 to 12 are diagrams for explaining the calculation of the common substring length according to the embodiment of the present invention. It is assumed that two character strings of the character string S1 "ABCDEFG" and the character string S2 "AbcDE" are compared.
図7~図12に示されるように、列数が、文字列S1の文字列の長さ+1(例では、「ABCDEFG」の長さ:7に1を加えた8)であり、行数が、文字列S2の文字列の長さ+1(本例では、「AbcDE」の長さ:5に1を加えた6)である、データ保存用の表(テーブル)が用いられる。左端から2番目の列から順に、文字列S1の各文字(本例では、「A」、「B」、「C」、「D」、「E」、「F」、「G」)が割り当てられる。また、上端から2番目の行から順に、文字列S2の各文字(本例では、「A」、「b」、「c」、「D」、「E」)が割り当てられる。 As shown in FIGS. 7 to 12, the number of columns is the length of the character string of the character string S1 + 1 (in the example, the length of "ABCDEFG": 7 plus 1 is 8), and the number of rows is. , The length of the character string of the character string S2 + 1 (in this example, the length of "AbcDE": 5 plus 1 6), a table for data storage is used. Each character of the character string S1 (in this example, "A", "B", "C", "D", "E", "F", "G") is assigned in order from the second column from the left end. Be done. Further, each character of the character string S2 (in this example, "A", "b", "c", "D", "E") is assigned in order from the second line from the upper end.
最初に、最長部分文字列長を0で初期化する。具体的には、1行目(上端の行)の各列と1列目(左端の列)の各行の値を0とする。つまり、この時点の最長部分文字列長は0である。 First, the longest substring length is initialized to 0. Specifically, the value of each column of the first row (uppermost row) and each row of the first column (leftmost column) is set to 0. That is, the longest substring length at this point is 0.
以下、2つの文字列の各文字を比較した結果の値を、比較した文字が交わるマスに入力していく。具体的には、2つの文字が等しい場合には、比較した文字が交わるマスの左上のマスの値に1を加えた値を、比較した文字が交わるマスに入力する。2つの文字が等しくない場合には、比較した文字が交わるマスに0を入力する。その時点での最長部分文字列長よりも大きな値が入力されたとき、その値を最長部分列文字列長として更新する。 Hereinafter, the value of the result of comparing each character of the two character strings is input to the cell where the compared characters intersect. Specifically, when the two characters are equal, the value obtained by adding 1 to the value of the upper left cell of the cell where the compared characters intersect is input to the cell where the compared characters intersect. If the two characters are not equal, enter 0 in the cell where the compared characters intersect. When a value larger than the longest substring string length at that time is input, that value is updated as the longest substring string length.
まず、各文字列の1文字目(本例では、文字列S1の「A」と文字列S2の「A」)を比較する。本例では、両者が等しいので、比較した文字が交わるマスの左上のマスの値に1を加えた値を、比較した文字が交わるマスに入力する(図7参照)。 First, the first character of each character string (in this example, "A" of the character string S1 and "A" of the character string S2) is compared. In this example, since both are equal, the value obtained by adding 1 to the value of the upper left cell of the cell where the compared characters intersect is input to the cell where the compared characters intersect (see FIG. 7).
次に、一方の文字列の1文字目と他方の文字列の2文字目以降を比較する。まず、本例では、文字列S1の2文字目の「B」と文字列S2の1文字目の「A」を比較する。本例では、両者が等しくないので、比較した文字が交わるマスに0を入力する(図8参照)。同様に繰り返し、文字列S1の各文字と文字列S2の1文字目との比較が完了する(図9参照)。 Next, the first character of one character string and the second and subsequent characters of the other character string are compared. First, in this example, the second character "B" of the character string S1 and the first character "A" of the character string S2 are compared. In this example, since they are not equal, 0 is input to the square where the compared characters intersect (see FIG. 8). Similarly, the comparison between each character of the character string S1 and the first character of the character string S2 is completed (see FIG. 9).
次に、一方の文字列の2文字目と他方の文字列の各文字を比較する。まず、本例では、文字列S1の1文字目の「A」と文字列S2の2文字目の「b」を比較する。本例では、両者が等しくないので、比較した文字が交わるマスに0を入力する(図10参照)。同様に繰り返し、文字列S1の各文字と文字列S2の2文字目との比較が完了する(図11参照)。 Next, the second character of one character string and each character of the other character string are compared. First, in this example, the first character "A" of the character string S1 and the second character "b" of the character string S2 are compared. In this example, since they are not equal, 0 is input to the square where the compared characters intersect (see FIG. 10). Similarly, the comparison between each character of the character string S1 and the second character of the character string S2 is completed (see FIG. 11).
このように、2つの文字列の各文字を比較した結果の値を当該各文字が交わるマスに入力していく。図12では、全ての文字の比較が完了している。共通部分文字列長は、右下のマスが0であるマス、または、右下のマスが存在しないマスであって、0以外の値が入力されたマスの値である(図12の例では、AとAが交わるマスの「1」、および、EとEが交わるマスの「2」)。つまり、図12の例では、共通部分文字列長の和は、3(「1」と「2」の和)である。また、最長共通部分文字列長は、表(テーブル)に入力されている値のうち最も大きな値(図12の例では、2)である。 In this way, the value of the result of comparing each character of the two character strings is input to the cell where the characters intersect. In FIG. 12, the comparison of all characters is completed. The common substring length is a cell in which the lower right cell is 0, or a cell in which the lower right cell does not exist, and a value other than 0 is input (in the example of FIG. 12). , "1" in the square where A and A intersect, and "2" in the square where E and E intersect). That is, in the example of FIG. 12, the sum of the intersection string lengths is 3 (the sum of "1" and "2"). Further, the longest common substring length is the largest value (2 in the example of FIG. 12) among the values input to the table.
なお、図7~図12で説明した手法を用いることで、共通部分文字列長を高速に演算することができる。文字列S1と文字列S2の2つの文字列についての比較を行うとする。それぞれの文字列の長さを By using the methods described with reference to FIGS. 7 to 12, the common substring length can be calculated at high speed. It is assumed that two character strings, a character string S1 and a character string S2, are compared. The length of each string
<他の実施形態>
スコア1を算出する際に、共通部分文字列長に制約を設けるようにしもてよい。具体的には、文字列の長さが1である共通部分文字列を排除する。例えば、図7~図12で説明した表(テーブル)において、左上のマスが1以上の値であるマス(かつ、右下のマスが0であるマス、または、右下のマスが存在しないマスであって、0以外の値が入力されたマス)の値を共通部分文字列長とすることで、文字列の長さが1である共通部分文字列を排除することができる。長さが1である共通部分文字列を用いた場合には、共通の1文字が含まれている文字列S1とS2との類似度が高くなってしまう。文字列の長さが1である共通部分文字列を排除することで、単語の入れ替えに特化したスコアを算出することができる。なお、多くの文字列が2~5文字程度の少数の文字から構成されている場合には、長さが1の共通部分文字列も含めたほうが有用である。
<Other embodiments>
When calculating the
[実施例]
<類似文字列検出の精度>
以下、実施例として本実施形態に基づく類似文字列検出の精度について説明する。図13~図15は、類似文字列検出の精度を比較するための図である。従来技術であるレーベンシュタイン距離、ジャロ・ウィンクラー距離、本発明の第1スコア、第2スコアの4つを比較した。
[Example]
<Accuracy of similar character string detection>
Hereinafter, the accuracy of similar character string detection based on this embodiment will be described as an example. 13 to 15 are diagrams for comparing the accuracy of similar character string detection. Four prior arts, the Levenshtein distance, the Jaro-Winkler distance, and the first score and the second score of the present invention were compared.
レーベンシュタイン距離は、値が小さいほど類似した文字列であることを示す。ただし、本比較においては、レーベンシュタイン距離の値を、2つの文字列の長さのうちの長いほうで除算して標準化した値を用いた。 The Levenshtein distance indicates that the smaller the value, the more similar the strings. However, in this comparison, the value of the Levenshtein distance was divided by the longer of the two character strings, and the standardized value was used.
ジャロ・ウィンクラー距離は、値が大きいほど類似した文字列であることを示す。 The Jaro-Winkler distance indicates that the larger the value, the more similar the strings.
上述したように、第1スコアおよび第2スコアは、値が大きいほど類似した文字列であることを示す。 As described above, the larger the value of the first score and the second score, the more similar the character strings.
<<比較1>>
図13は、類似文字列検出の精度の比較1の結果を示す。上段は、文字列1「製品1 評価レシピ(空間は全角スペース)」と文字列2「評価レシピ 製品1(空間は半角スペース)」の類似度を示し、下段は、文字列1「製品1 評価レシピ(空間は全角スペース)」と文字列3「レシピ 製品2(空間は半角スペース)」の類似度を示す。複数の単語の語順が入れ替わっている文字列同士を類似していると判断するためには、文字列1と文字列3よりも、文字列1と文字列2が類似している判断されるべきである。比較1の結果から、第1スコアが適していることが分かる。
<<
FIG. 13 shows the result of
<<比較2>>
図14は、類似文字列検出の精度の比較2の結果を示す。上段は、文字列1「評価レシピ 製品1(空間は半角スペース)」と文字列2「製品1 評価レシピ(空間は全角スペース)」の類似度を示し、下段は、文字列1「評価レシピ 製品1(空間は半角スペース)」と文字列3「レシピ 製品2(空間は半角スペース)」の類似度を示す。複数の単語の語順が入れ替わっている文字列同士を類似していると判断するためには、文字列1と文字列3よりも、文字列1と文字列2が類似している判断されるべきである。比較2の結果から、第1スコアが適していることが分かる。
<<
FIG. 14 shows the result of
<<比較3>>
図15は、類似文字列検出の精度の比較3の結果を示す。上段は、文字列1「製品1 評価レシピ(空間は半角スペース)」と文字列2「品1 評価(空間は半角スペース)」の類似度を示し、下段は、文字列1「製品1 評価レシピ(空間は半角スペース)」と文字列3「製品2 評価レシピ(空間は半角スペース)」の類似度を示す。単語が省略されていない文字列と単語が省略されている文字列を類似していると判断するためには、文字列1と文字列3よりも、文字列1と文字列2が類似している判断されるべきである。比較3の結果から、第2スコアが適していることが分かる。
<< Comparison 3 >>
FIG. 15 shows the result of comparison 3 of the accuracy of similar character string detection. The upper row shows the similarity between the
<効果>
このように、本発明の一実施形態では、複数の単語の語順が入れ替わっている文字列同士を類似していると判断することができるので、元となる文字列から、複数の単語の語順が入れ替わっている文字列を検出することができる。また、本発明の一実施形態では、単語が省略されていない文字列と単語が省略されている文字列を類似していると判断することができるので、元となる文字列から、単語が省略されている文字列(あるいは、単語が省略されていない文字列)を検出することができる。
<Effect>
As described above, in one embodiment of the present invention, it can be determined that the character strings in which the word orders of the plurality of words are exchanged are similar to each other, so that the word order of the plurality of words is changed from the original character string. It is possible to detect the replaced character strings. Further, in one embodiment of the present invention, since it can be determined that the character string in which the word is not omitted and the character string in which the word is omitted are similar, the word is omitted from the original character string. It is possible to detect the character string (or the character string in which the word is not omitted).
<ハードウェア構成>
図16は、本発明の一実施形態に係る類似文字列検出装置10、ユーザ端末20のハードウェア構成図である。類似文字列検出装置10、ユーザ端末20は、CPU(Central Processing Unit)1001、ROM(Read Only Memory)1002、RAM(Random Access Memory)1003を有する。CPU1001、ROM1002、RAM1003は、いわゆるコンピュータを形成する。
<Hardware configuration>
FIG. 16 is a hardware configuration diagram of a similar character
また、類似文字列検出装置10、ユーザ端末20は、補助記憶装置1004、表示装置1005、操作装置1006、I/F(Interface)装置1007、ドライブ装置1008を有することができる。
Further, the similar character
なお、類似文字列検出装置10、ユーザ端末20の各ハードウェアは、バスBを介して相互に接続されている。
The hardware of the similar character
CPU1001は、補助記憶装置1004にインストールされている各種プログラムを実行する演算デバイスである。
The
ROM1002は、不揮発性メモリである。ROM1002は、補助記憶装置1004にインストールされている各種プログラムをCPU1001が実行するために必要な各種プログラム、データ等を格納する主記憶デバイスとして機能する。具体的には、ROM1002は、BIOS(Basic Input/Output System)やEFI(Extensible Firmware Interface)等のブートプログラム等を格納する、主記憶デバイスとして機能する。
RAM1003は、DRAM(Dynamic Random Access Memory)やSRAM(Static Random Access Memory)等の揮発性メモリである。RAM1003は、補助記憶装置1004にインストールされている各種プログラムがCPU1001によって実行される際に展開される作業領域を提供する、主記憶デバイスとして機能する。
The
補助記憶装置1004は、各種プログラムや、各種プログラムが実行される際に用いられる情報を格納する補助記憶デバイスである。
The
表示装置1005は、類似文字列検出装置10、ユーザ端末20の内部状態等を表示する表示デバイスである。
The
操作装置1006は、類似文字列検出装置10、ユーザ端末20を操作する者が類似文字列検出装置10、ユーザ端末20に対して各種指示を入力する入力デバイスである。
The
I/F装置1007は、ネットワークに接続し、他の装置と通信を行うための通信デバイスである。
The I /
ドライブ装置1008は記憶媒体1009をセットするためのデバイスである。ここでいう記憶媒体1009には、CD-ROM、フレキシブルディスク、光磁気ディスク等のように情報を光学的、電気的あるいは磁気的に記録する媒体が含まれる。また、記憶媒体1009には、EPROM (Erasable Programmable Read Only Memory)、フラッシュメモリ等のように情報を電気的に記録する半導体メモリ等が含まれていてもよい。
The
なお、補助記憶装置1004にインストールされる各種プログラムは、例えば、配布された記憶媒体1009がドライブ装置1008にセットされ、該記憶媒体1009に記録された各種プログラムがドライブ装置1008により読み出されることでインストールされる。あるいは、補助記憶装置1004にインストールされる各種プログラムは、I/F装置1007を介して、ネットワークよりダウンロードされることでインストールされてもよい。
The various programs installed in the
以上、本発明の実施例について詳述したが、本発明は上述した特定の実施形態に限定されるものではなく、特許請求の範囲に記載された本発明の要旨の範囲内において、種々の変形・変更が可能である。 Although the embodiments of the present invention have been described in detail above, the present invention is not limited to the above-mentioned specific embodiments, and various modifications are made within the scope of the gist of the present invention described in the claims.・ Can be changed.
1 類似文字列検出システム
10 類似文字列検出装置
20 ユーザ端末
101 文字列群取得部
102 文字列選択部
103 共通部分文字列長演算部
104 第1スコア算出部
105 第2スコア算出部
106 類似文字列検出部
107 出力部
1001 CPU
1002 ROM
1003 RAM
1004 補助記憶装置
1005 表示装置
1006 操作装置
1007 I/F装置
1008 ドライブ装置
1009 記憶媒体
1 Similar character
1002 ROM
1003 RAM
1004
Claims (7)
前記第1のスコアに基づいて、類似している文字列の組み合わせを出力する出力部と
を備えた類似文字列検出装置。 The sum of the lengths of the character strings common between the first character string and the second character string is the sum of the length of the first character string and the length of the second character string. The first score calculation unit that calculates the first score divided by the longer length of
A similar character string detection device including an output unit that outputs a combination of similar character strings based on the first score.
前記出力部は、前記第2のスコアに基づいて、類似している文字列の組み合わせを出力する、請求項1に記載の類似文字列検出装置。 The longest number of characters in the portion common between the first character string and the second character string is the shorter of the length of the first character string and the length of the second character string. Further equipped with a second score calculation unit, which calculates a second score divided by the length of
The similar character string detection device according to claim 1, wherein the output unit outputs a combination of similar character strings based on the second score.
第1の文字列と、第2の文字列と、の間で共通する文字列の各々の長さの和を、前記第1の文字列の長さと前記第2の文字列の長さとのうちの長い方の長さで除算した第1のスコアを算出するステップと、
前記第1のスコアに基づいて、類似している文字列の組み合わせを出力するステップと
を含む方法。 The way the computer does
The sum of the lengths of the character strings common between the first character string and the second character string is the sum of the length of the first character string and the length of the second character string. And the step to calculate the first score divided by the longer of
A method comprising the step of outputting a combination of similar character strings based on the first score.
第1の文字列と、第2の文字列と、の間で共通する文字列の各々の長さの和を、前記第1の文字列の長さと前記第2の文字列の長さとのうちの長い方の長さで除算した第1のスコアを算出する第1スコア算出部、
前記第1のスコアに基づいて、類似している文字列の組み合わせを出力する出力部
として機能させるためのプログラム。 Computer,
The sum of the lengths of the character strings common between the first character string and the second character string is the sum of the length of the first character string and the length of the second character string. 1st score calculation unit, which calculates the 1st score divided by the longer length of
A program for functioning as an output unit that outputs a combination of similar character strings based on the first score.
前記類似文字列検出装置は、
第1の文字列と、第2の文字列と、の間で共通する文字列の各々の長さの和を、前記第1の文字列の長さと前記第2の文字列の長さとのうちの長い方の長さで除算した第1のスコアを算出する第1スコア算出部と、
前記第1のスコアに基づいて、類似している文字列の組み合わせを出力する出力部と、を備え、
前記ユーザ端末は、
前記類似している文字列の組み合わせを表示する、システム。 A system that includes a similar character string detector and a user terminal.
The similar character string detection device is
The sum of the lengths of the character strings common between the first character string and the second character string is the sum of the length of the first character string and the length of the second character string. The first score calculation unit that calculates the first score divided by the longer length of
An output unit that outputs a combination of similar character strings based on the first score is provided.
The user terminal is
A system that displays a combination of similar strings.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2020178242A JP2022069194A (en) | 2020-10-23 | 2020-10-23 | Similar character string detection apparatus, method, program, and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2020178242A JP2022069194A (en) | 2020-10-23 | 2020-10-23 | Similar character string detection apparatus, method, program, and system |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2022069194A true JP2022069194A (en) | 2022-05-11 |
Family
ID=81521914
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2020178242A Pending JP2022069194A (en) | 2020-10-23 | 2020-10-23 | Similar character string detection apparatus, method, program, and system |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2022069194A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DE102023203652A1 (en) | 2022-04-20 | 2023-10-26 | Shin-Etsu Chemical Co., Ltd. | POLYCRYSTALLINE SILICON ROD AND METHOD FOR PRODUCING A POLYCRYSTALLINE SILICON ROD |
-
2020
- 2020-10-23 JP JP2020178242A patent/JP2022069194A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DE102023203652A1 (en) | 2022-04-20 | 2023-10-26 | Shin-Etsu Chemical Co., Ltd. | POLYCRYSTALLINE SILICON ROD AND METHOD FOR PRODUCING A POLYCRYSTALLINE SILICON ROD |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP3672242B2 (en) | PATTERN SEARCH METHOD, PATTERN SEARCH DEVICE, COMPUTER PROGRAM, AND STORAGE MEDIUM | |
WO2021072850A1 (en) | Feature word extraction method and apparatus, text similarity calculation method and apparatus, and device | |
US20140052688A1 (en) | System and Method for Matching Data Using Probabilistic Modeling Techniques | |
US10528662B2 (en) | Automated discovery using textual analysis | |
US7584173B2 (en) | Edit distance string search | |
CN111325030A (en) | Text label construction method and device, computer equipment and storage medium | |
US20070239663A1 (en) | Parallel processing of count distinct values | |
CN105224624A (en) | A kind of method and apparatus realizing down the quick merger of row chain | |
US11907278B2 (en) | Method and apparatus for deriving keywords based on technical document database | |
JP2022069194A (en) | Similar character string detection apparatus, method, program, and system | |
US10216792B2 (en) | Automated join detection | |
JP5324677B2 (en) | Similar document search support device and similar document search support program | |
US9390163B2 (en) | Method, system and software arrangement for detecting or determining similarity regions between datasets | |
US20040044683A1 (en) | Data compiling method | |
CN116226681B (en) | Text similarity judging method and device, computer equipment and storage medium | |
Zhang et al. | SMOTIF: efficient structured pattern and profile motif search | |
US6338060B1 (en) | Data processing apparatus and method for outputting data on the basis of similarity | |
US8745078B2 (en) | Control computer and file search method using the same | |
JP4525224B2 (en) | Document management program, document management method, and document management apparatus | |
US20240134870A1 (en) | Information processing device, and information processing method | |
JP5505207B2 (en) | Information search apparatus, information search method, and information search program | |
JP7327468B2 (en) | Document analysis device and document analysis method | |
JPWO2014168199A1 (en) | Logic operation method and information processing apparatus | |
JP4721344B2 (en) | Word search device, word search method and program | |
JP3019286B2 (en) | Document search device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A711 | Notification of change in applicant |
Free format text: JAPANESE INTERMEDIATE CODE: A712 Effective date: 20230131 |
|
RD03 | Notification of appointment of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7423 Effective date: 20230201 |
|
RD04 | Notification of resignation of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7424 Effective date: 20230307 |
|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20230904 |