JP2015170130A - recognition device, recognition method and program - Google Patents
recognition device, recognition method and program Download PDFInfo
- Publication number
- JP2015170130A JP2015170130A JP2014044342A JP2014044342A JP2015170130A JP 2015170130 A JP2015170130 A JP 2015170130A JP 2014044342 A JP2014044342 A JP 2014044342A JP 2014044342 A JP2014044342 A JP 2014044342A JP 2015170130 A JP2015170130 A JP 2015170130A
- Authority
- JP
- Japan
- Prior art keywords
- character
- candidate
- recognition
- collation
- unit
- 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.)
- Granted
Links
Images
Landscapes
- Character Discrimination (AREA)
Abstract
Description
本発明の実施形態は、認識装置、認識方法およびプログラムに関する。 Embodiments described herein relate generally to a recognition apparatus, a recognition method, and a program.
文字認識における知識処理を行う方法として、認識対象の文字列をモデル化して知識辞書に格納し、モデルに合致する文字列を知識辞書の結果とする方法が知られている。例えば、照合したい単語を登録した単語辞書部と単語辞書部に登録された単語を受理する有限オートマトンを有する単語照合部を備え、有限オートマトンが受理した単語を知識処理の結果として出力するシステムが知られている(例えば、特許文献1参照)。また、文脈自由文法で記述した地名表記と文字認識候補を照合することで知識処理を行う技術が知られている(例えば、特許文献2参照)。 As a method for performing knowledge processing in character recognition, a method is known in which a character string to be recognized is modeled and stored in a knowledge dictionary, and a character string matching the model is used as a result of the knowledge dictionary. For example, a system is known that includes a word dictionary unit that registers words to be collated and a word collation unit that has a finite automaton that accepts words registered in the word dictionary unit, and outputs the words received by the finite automaton as a result of knowledge processing. (For example, refer to Patent Document 1). In addition, a technique for performing knowledge processing by collating a place name notation described in a context-free grammar with a character recognition candidate is known (see, for example, Patent Document 2).
しかしながら、従来の技術では、文字列と文字列との間のスペースを検出し、スペースの検出結果を照合のスコアに反映させる等の知識処理とは異なる処理を、知識処理と同期させて実行させることが困難であった。 However, in the conventional technology, a process different from the knowledge process such as detecting a space between character strings and reflecting the space detection result on the matching score is executed in synchronization with the knowledge process. It was difficult.
本発明が解決しようとする課題は、知識辞書を用いて文字認識をするとともに、照合処理に同期させて照合処理とは異なる処理を実行することにある。 The problem to be solved by the present invention is to perform character recognition using a knowledge dictionary and execute a process different from the collation process in synchronization with the collation process.
実施形態に係る認識装置は、入力画像から、文字を含むと推測される画素の集合である文字候補を検出する候補検出部と、前記文字候補のそれぞれを認識して、認識結果の候補の文字である少なくとも1つの認識候補を生成する認識部と、前記少なくとも1つの認識候補のそれぞれを、認識対象の文字列をモデル化した知識辞書と照合して、前記入力画像に含まれると推測される文字列と知識辞書を照合して得られる照合結果を生成する照合部と、与えられた命令を実行する命令処理部と、を備え、前記知識辞書は、有限オートマトンであって、文字を表す実文字コードおよび命令を指定する仮想文字コードのいずれか一方がエッジに割り当てられ、前記照合部は、前記仮想文字コードが割り当てられたエッジに従って前記知識辞書の状態を遷移させる場合、当該エッジに割り当てられた前記仮想文字コードにより指定された命令を前記命令処理部に与える。 The recognition apparatus according to the embodiment recognizes each of the character candidates from a candidate detection unit that detects a character candidate that is a set of pixels estimated to include a character from the input image, and recognizes each of the character candidates. A recognition unit that generates at least one recognition candidate, and each of the at least one recognition candidate is compared with a knowledge dictionary that models a character string to be recognized, and is estimated to be included in the input image. A collation unit that generates a collation result obtained by collating the character string with the knowledge dictionary, and an instruction processing unit that executes a given command. The knowledge dictionary is a finite automaton, and represents an actual character. Either one of the character code and the virtual character code designating the instruction is assigned to the edge, and the collation unit determines the state of the knowledge dictionary according to the edge to which the virtual character code is assigned. When causing the transfer, giving the specified instruction by the virtual character code allocated to the edge to the instruction processing unit.
図1は、実施形態に係る認識装置10の構成を示す図である。認識装置10は、例えばスキャナ等により読み取られた入力画像に含まれる文字列を認識し、認識した文字列を出力する。
FIG. 1 is a diagram illustrating a configuration of a
認識装置10は、入力部30と、入力画像記憶部32と、様式データ記憶部34と、候補検出部36と、候補記憶部38と、文字認識辞書記憶部40と、認識部42と、知識辞書記憶部44と、照合部46と、照合結果記憶部48と、命令処理部51と、結果抽出部54と、出力部56を備える。
The
入力部30は、スキャナ等により取り込まれた入力画像を入力する。入力部30は、ネットワーク等を介して他のコンピュータから入力画像を入力してもよい。入力画像記憶部32は、入力部30により入力された入力画像を記憶する。
The
様式データ記憶部34は、入力画像における文字列が記載された領域を特定する様式データを記憶する。
The form
候補検出部36は、様式データ記憶部34に記憶された様式データに基づいて、入力画像から、文字候補を検出する。それぞれの文字候補は、1つの文字を含むと推測される画素の集合である。候補検出部36は、検出した文字候補を候補記憶部38に書き込む。
The
候補記憶部38は、文字候補を記憶する。さらに、候補記憶部38は、文字候補のそれぞれに対応させて、その文字候補の認識結果の候補の文字である認識候補を記憶する。
The
文字認識辞書記憶部40は、文字認識辞書を記憶する。文字認識辞書は、認識対象の画像と、予め登録された文字のそれぞれとの類似度を算出するための情報を格納する。
The character recognition
認識部42は、文字認識辞書記憶部40に記憶された文字認識辞書に基づいて、候補記憶部38に記憶された文字候補のそれぞれを認識する。そして、認識部42は、1つの文字候補に対して、認識結果の候補の文字である表す少なくとも1つの認識候補を生成する。認識部42は、生成した少なくとも1つの認識候補を、文字候補に対応付けて候補記憶部38に書き込む。
The recognition unit 42 recognizes each of the character candidates stored in the
知識辞書記憶部44は、認識対象の文字列をモデル化した知識辞書を記憶する。本実施形態においては、知識辞書は、認識対象の文字列をモデル化した決定性有限オートマトンである。知識辞書は、エッジに、文字を表す実文字コードおよび、命令を指定する仮想文字コードのいずれか一方が割り当てられている。
The knowledge
照合部46は、少なくとも1つの認識候補のそれぞれを知識辞書と照合して、入力画像に含まれると推測される文字列と知識辞書を照合して得られる照合結果を生成する。この過程において、照合部46は、認識候補が割り当てられたエッジに従って知識辞書の状態を順次に遷移させることにより、照合を行う。また、照合部46は、対応する文字列の尤もらしさを表すスコアを含む照合結果を生成する。そして、照合部46は、生成した照合結果を照合結果記憶部48に書き込む。
The
さらに、照合部46は、仮想文字コードが割り当てられたエッジに従って知識辞書の状態を遷移させる場合、当該エッジに割り当てられた仮想文字コードにより指定された命令を命令処理部51に与える。
Furthermore, when the state of the knowledge dictionary is changed according to the edge to which the virtual character code is assigned, the matching
照合結果記憶部48は、照合部46により生成された照合結果を記憶する。照合結果記憶部48は、文字候補の認識候補を並べて得られる文字列を先頭から知識辞書と照合していく過程における開始時点、途中段階および完了時点での照合結果を記憶する。なお、照合部46は、照合の途中段階において、記憶領域を節約することを目的として、スコアの低い照合結果を削除してもよい。
The verification
命令処理部51は、照合部46から与えられた命令を実行する。命令処理部51は、一例として、スコアに指定された値を加算する処理または文字間のスペースを確認する処理等を実行する。
The
結果抽出部54は、照合部46による照合および命令処理部51による処理が全て完了した後において、照合結果記憶部48に記憶された照合結果からスコアに基づき1個以上の照合結果を選択し、選択した1個以上の照合結果により特定される文字列を抽出する。結果抽出部54は、一例として、スコアが最も良い照合結果により特定される文字列を抽出する。
The
出力部56は、結果抽出部54により抽出された文字列を外部へと出力する。
The
図2は、実施形態に係る認識装置10の処理を示すフロー図である。まず、ステップS1において、認識装置10は、入力画像を入力する。
FIG. 2 is a flowchart showing processing of the
続いて、ステップS2において、認識装置10は、入力画像から、1つの文字を含むと推測される画素の集合である文字候補を検出する。続いて、ステップS3において、認識装置10は、文字認識辞書に基づいて、文字候補のそれぞれを認識して、認識結果の候補の文字である少なくとも1つの認識候補を生成する。
Subsequently, in step S <b> 2, the
続いて、ステップS4において、認識装置10は、少なくとも1つの認識候補のそれぞれを知識辞書と照合して、入力画像に含まれると推測される文字列と知識辞書を照合して得られる照合結果を生成する。これとともに、ステップS4において、認識装置10は、仮想文字コードが割り当てられたエッジに従って知識辞書の状態を遷移させる場合、当該エッジに割り当てられた仮想文字コードにより指定された命令を実行する。
Subsequently, in step S4, the
続いて、ステップS5において、認識装置10は、照合処理が全て完了した後において、照合結果からスコアに基づき1つの照合結果を選択し、選択した照合結果により特定される文字列を抽出し、認識結果の文字列とする。文字候補の個数が0個の場合、すなわち入力画像上に文字が含まれない場合、ステップS5において選択すべき照合結果が生成されないが、この場合は認識結果の文字列を空文字列とする。最後に、ステップS6において、認識装置10は、認識結果の文字列を出力する。
Subsequently, in step S5, the
図3は、入力画像の一例を示す図である。本実施形態において、入力画像は、図3に示すように、商品を発注するための注文書をスキャナ等により取り込んで得られた画像データである。入力画像の予め定められた記入枠の内側には、発注者の名前が記入されている。本実施形態において、認識装置10は、予め定められた記入枠の内側に記入された日本語の名前の文字列を認識し、認識した文字列を表すテキストデータを出力する。
FIG. 3 is a diagram illustrating an example of an input image. In the present embodiment, as shown in FIG. 3, the input image is image data obtained by taking an order form for ordering a product with a scanner or the like. The name of the orderer is entered inside a predetermined entry frame of the input image. In the present embodiment, the
図4は、様式データの構成を示す図である。様式データ記憶部34は、予め作成された様式データを記憶する。
FIG. 4 is a diagram showing the configuration of style data. The form
様式データは、図4に示すように、入力画像に含まれる記入枠の個数を示す値と、記入枠の個数分の記入枠レコードを格納する配列を含む。本例において、配列の最初のエントリのインデックスは、0である。すなわち、配列は、0オリジンである。なお、本実施形態で用いる他の配列も、特別の記載が無い限り0オリジンである。記入枠レコードのそれぞれは、入力画像に含まれるそれぞれの記入枠に一対一で対応する。 As shown in FIG. 4, the format data includes a value indicating the number of entry frames included in the input image and an array for storing entry frame records for the number of entry frames. In this example, the index of the first entry in the array is zero. That is, the sequence is 0 origin. Other sequences used in this embodiment are also 0 origin unless otherwise specified. Each entry frame record corresponds to each entry frame included in the input image on a one-to-one basis.
それぞれの記入枠レコードは、入力画像内における、対応する記入枠の位置を示す情報を含む。本例において、記入枠の位置を示す情報は、対応する記入枠の左右の端のX座標(横方向の座標)および上下の端のY座標(縦方向の座標)である。 Each entry frame record includes information indicating the position of the corresponding entry frame in the input image. In this example, the information indicating the position of the entry frame is the X coordinate (horizontal coordinate) of the left and right ends and the Y coordinate (vertical coordinate) of the upper and lower ends of the corresponding entry frame.
図5は、入力画像から一連の文字候補を生成する処理を示す図である。候補検出部36は、記入枠レコードに示された情報に基づいて記入枠の領域を特定し(例えば図5中の点線で囲まれた領域)、特定した領域から部分領域画像を抽出する。続いて、候補検出部36は、抽出した部分領域画像を二値化して二値画像を生成する。続いて、候補検出部36は、二値画像上で黒画素の連結成分を抽出し、それぞれの連結成分に対してラベリングを行う。ラベリングしたそれぞれの連結成分は、文字を構成する要素であり、断片と呼ぶ。続いて、候補検出部36は、連続して並んだ1個以上の断片を組み合わせて、文字候補を生成する。文字候補は、1個の文字を表していると推測される画素の集合である。
FIG. 5 is a diagram illustrating a process for generating a series of character candidates from an input image. The
図6は、断片データの構成を示す図である。候補記憶部38は、断片を表す断片データを記憶する。断片データは、図6に示すように、断片の個数を示す値と、断片の個数分の断片レコードを格納する配列を含む。断片レコードのそれぞれは、それぞれの断片と一対一で対応する。
FIG. 6 is a diagram showing the structure of fragment data. The
それぞれの断片レコードは、対応する断片の位置を示す情報と、断片の形状を示す二値画像を含む。本例において、断片の位置を示す情報は、対応する断片の左右の端のX座標および上下の端のY座標であり、当該断片の外接矩形を示す。断片の形状を示す二値画像は、当該断片の外接矩形内で当該連結成分上の画素を黒画素とし、残りを白画素とした画像である。 Each fragment record includes information indicating the position of the corresponding fragment and a binary image indicating the shape of the fragment. In this example, the information indicating the position of the fragment is the X coordinate of the left and right ends of the corresponding fragment and the Y coordinate of the upper and lower ends, and indicates the circumscribed rectangle of the fragment. A binary image indicating the shape of a fragment is an image in which pixels on the connected component are black pixels and the rest are white pixels in a circumscribed rectangle of the fragment.
候補検出部36は、それぞれの断片について、中心のX座標と、中心のY座標を算出する。中心のX座標は、左右の端のX座標の平均値である。中心のY座標は、上下の端のY座標の平均値である。そして、候補検出部36は、配列内の複数の断片レコードを、中心のX座標の昇順に整列する。これにより、候補検出部36は、配列内の複数の断片レコードを、記入枠における文字記入方向(本例では左から右に向かう方向)に整列することができる。
The
図7は、断片番号の一例を示す図である。それぞれの断片レコードは、配列のインデックスにより識別される。断片レコードを文字記入方向に整列した後のインデックスを、断片番号と呼ぶ。従って、それぞれの断片には、図7に示すように断片番号が対応付けられる。 FIG. 7 is a diagram illustrating an example of a fragment number. Each fragment record is identified by an array index. The index after the fragment records are arranged in the character entry direction is called a fragment number. Therefore, each fragment is associated with a fragment number as shown in FIG.
図8は、文字候補データの構成を示す図である。候補検出部36は、連続して並んだ1個以上の断片を組み合わせて、文字候補を生成する。この過程において、候補検出部36は、外接の矩形の横幅Lが予め定められた長さ(Lmax)以下となる全てのパターンで1個以上の断片を組み合わせて、文字候補を生成する。
FIG. 8 is a diagram illustrating a configuration of character candidate data. The
候補記憶部38は、文字候補を表す文字候補データを記憶する。文字候補データは、図8に示すように、生成した文字候補の個数を示す値と、文字候補マトリクス(詳細後述)と、文字候補の個数分の文字候補レコードを格納する配列を含む。文字候補レコードのそれぞれは、それぞれの文字候補と一対一で対応する。
The
それぞれの文字候補レコードは、対応する文字候補の位置を示す情報と、対応する文字候補の始点番号および終点番号(詳細後述)と、文字候補の形状を示す二値画像と、認識候補エントリを含む認識候補の配列(詳細後述)を含む。本例において、文字候補の位置を示す情報は、対応する文字候補の左右の端のX座標および上下の端のY座標であり、二値画像上での当該文字候補の外接矩形を示す。文字候補の形状を示す二値画像は、当該文字候補の外接矩形内で当該文字候補上の画素を黒画素とし、残りを白画素とした画像である。認識候補エントリは、認識部42により値が設定され、候補検出部36では値は設定されない。
Each character candidate record includes information indicating the position of the corresponding character candidate, a start point number and an end point number (described later in detail) of the corresponding character candidate, a binary image indicating the shape of the character candidate, and a recognition candidate entry. Includes recognition candidate sequences (described in detail below). In this example, the information indicating the position of the character candidate is the X coordinate of the left and right ends and the Y coordinate of the upper and lower ends of the corresponding character candidate, and indicates the circumscribed rectangle of the character candidate on the binary image. A binary image showing the shape of a character candidate is an image in which the pixels on the character candidate are black pixels and the rest are white pixels in the circumscribed rectangle of the character candidate. A value of the recognition candidate entry is set by the recognition unit 42, and no value is set by the
図9は、文字候補番号の一例を示す図である。それぞれの文字候補レコードは、配列のインデックスにより識別される。文字候補レコードのインデックスを、文字候補番号と呼ぶ。従って、それぞれの文字候補には、図9に示すように文字候補番号が対応付けられる。 FIG. 9 is a diagram illustrating an example of character candidate numbers. Each character candidate record is identified by an array index. The index of the character candidate record is called a character candidate number. Therefore, a character candidate number is associated with each character candidate as shown in FIG.
図10は、文字候補の始点番号および終点番号の一例を示す図である。文字候補は、連続して並んだ1個以上の断片を組み合わせて生成される。このため文字候補は、元となった1個以上の断片の並びのうちの先頭の断片に対する断片番号と、最後の断片に対する断片番号に1を加算した値とのセットで、一意に識別することができる。 FIG. 10 is a diagram illustrating an example of the start point number and end point number of a character candidate. Character candidates are generated by combining one or more pieces arranged in series. For this reason, character candidates are uniquely identified by a set of a fragment number for the first fragment in the sequence of one or more fragments as a source and a value obtained by adding 1 to the fragment number for the last fragment. Can do.
本実施形態では、先頭の断片に対する断片番号を、その文字候補の始点番号と呼び、最後の断片に対する断片番号に1を加算した値を、その文字候補の終点番号と呼ぶ。従って、それぞれの文字候補には、図10に示すように、始点番号および終点番号が対応付けられる。なお、始点番号および終点番号は、文字候補の区切り位置を表すことから、始点番号および終点番号の両者をまとめて位置番号とも呼ぶ。 In this embodiment, the fragment number for the first fragment is called the start point number of the character candidate, and the value obtained by adding 1 to the fragment number for the last fragment is called the end point number of the character candidate. Accordingly, each character candidate is associated with a start point number and an end point number as shown in FIG. Note that the start point number and the end point number represent character character delimiter positions, and thus both the start point number and the end point number are collectively referred to as position numbers.
図11は、文字候補マトリクスの一例を示す図である。文字候補マトリクスは、図11に示すように、始点番号を第1インデックス、終点番号を第2インデックスとする文字候補番号の二次元配列である。文字候補マトリクスは、文字候補レコードの生成の開始前に、全てのエントリを−1に設定することで初期化される。そして、候補検出部36は、文字候補を作成する毎に、文字候補マトリクスの対応するエントリに文字候補番号を書き込む。
FIG. 11 is a diagram illustrating an example of a character candidate matrix. As shown in FIG. 11, the character candidate matrix is a two-dimensional array of character candidate numbers having a start point number as a first index and an end point number as a second index. The character candidate matrix is initialized by setting all entries to -1 before starting the generation of character candidate records. Each time the
図12は、文字認識辞書の構成を示す図である。文字認識辞書記憶部40は、予め作成された文字認識辞書を記憶する。文字認識辞書は、図12に示すように、辞書エントリの個数を示す値と、辞書エントリを格納する配列を含む。
FIG. 12 is a diagram showing the configuration of the character recognition dictionary. The character recognition
それぞれの辞書エントリは、文字コードと、予め定められたDsub個の基底ベクトルを含む。基底ベクトルは、文字コードに対応する文字を表す部分空間の特徴ベクトルである。特徴ベクトルは、一例として、対応する文字の二値画像を縦方向および横方向に予め任意に定めた個数で分割し、分割した領域のそれぞれの黒画素の個数の比率を求め、求めた一連の比率を特徴ベクトルの要素とすることで算出される。 Each dictionary entry includes a character code and predetermined D sub basis vectors. A base vector is a feature vector of a subspace representing a character corresponding to a character code. As an example, the feature vector is obtained by dividing a binary image of a corresponding character by a predetermined number in the vertical direction and the horizontal direction, obtaining a ratio of the number of black pixels in each divided area, It is calculated by using the ratio as an element of the feature vector.
図13は、認識候補の配列の構成を示す図である。文字候補レコードに格納される認識候補の配列は、図13に示すように、予め定められたNcand個の認識候補エントリを含む。それぞれの認識候補エントリは、文字コードと、類似度を含む。 FIG. 13 is a diagram showing the configuration of recognition candidate sequences. The recognition candidate array stored in the character candidate record includes predetermined N cand recognition candidate entries as shown in FIG. Each recognition candidate entry includes a character code and a similarity.
認識部42は、文字候補のそれぞれに対して文字認識をして、認識結果の候補の文字である少なくとも1つの認識候補を生成する。本実施形態においては、認識部42は、それぞれの文字候補レコードに対して、予め定められたNcand個の認識候補エントリを生成して、認識候補の配列に書き込む。 The recognition unit 42 performs character recognition for each of the character candidates, and generates at least one recognition candidate that is a candidate character of the recognition result. In the present embodiment, the recognition unit 42 generates N cand recognition candidate entries determined in advance for each character candidate record, and writes them in the recognition candidate array.
より具体的には、認識部42は、対応する文字候補レコードに含まれる二値画像から特徴ベクトルを抽出し、文字認識辞書のそれぞれの辞書エントリに格納された基底ベクトルと部分空間法により照合して類似度を算出する。認識部42は、類似度が上位Ncand個の辞書エントリのそれぞれについて、その辞書エントリに格納された文字コードを抽出し、抽出した文字コードと算出した類似度を含む認識候補エントリを生成する。そして、認識部42は、生成したNcand個の認識候補エントリを対応する文字候補レコードの認識候補の配列に書き込む。さらに、認識部42は、それぞれの文字候補レコードの認識候補の配列に含まれる認識候補エントリを、類似度の降順で整列する。 More specifically, the recognition unit 42 extracts a feature vector from a binary image included in the corresponding character candidate record, and collates it with a base vector stored in each dictionary entry of the character recognition dictionary by a subspace method. To calculate the similarity. The recognizing unit 42 extracts the character code stored in the dictionary entry for each of the top N cand dictionary entries having the similarity, and generates a recognition candidate entry including the extracted character code and the calculated similarity. Then, the recognition unit 42 writes the generated N cand recognition candidate entries in the recognition candidate array of the corresponding character candidate record. Furthermore, the recognition unit 42 arranges the recognition candidate entries included in the recognition candidate arrays of the respective character candidate records in descending order of similarity.
図14は、知識辞書の構成を示す図である。知識辞書記憶部44は、設計者等が予め作成した知識辞書を記憶する。
FIG. 14 is a diagram illustrating a configuration of the knowledge dictionary. The knowledge
本実施形態において、知識辞書は、認識対象の文字列をモデル化した決定性有限オートマトンである。本実施形態では、決定性有限オートマトンである知識辞書を、DFAαとも呼ぶ。DFAαは、例えば、設計者が認識対象の文字列を正規表現で記述し、その正規表現を決定性有限オートマトンに変換することで生成される。正規表現から非決定性有限オートマトンまたは決定性有限オートマトンを生成する方法、非決定性有限オートマトンから決定性有限オートマトンを生成する方法は、例えば、A.V.エイホ,R.セシィ,J.D.ウルマン著、原田健一訳、コンパイラI,初版 1986、pp.134−172等に記載されている。 In the present embodiment, the knowledge dictionary is a deterministic finite automaton that models a character string to be recognized. In the present embodiment, a knowledge dictionary that is a deterministic finite automaton is also referred to as DFAα. For example, DFAα is generated by a designer describing a character string to be recognized in a regular expression and converting the regular expression into a deterministic finite automaton. A method for generating a nondeterministic finite automaton or a deterministic finite automaton from a regular expression, and a method for generating a deterministic finite automaton from a nondeterministic finite automaton are disclosed in, for example, A. V. Aiho, R.A. Cessie, J.H. D. Written by Ullman, translated by Kenichi Harada, Compiler I, first edition 1986, pp. 134-172 and the like.
DFAαは、図14に示すように、状態数を示す値と、状態の数分の状態レコードを格納する状態配列と、エッジの数分のエッジレコードを格納するエッジ配列を含む。 As shown in FIG. 14, DFAα includes a value indicating the number of states, a state array for storing state records for the number of states, and an edge array for storing edge records for the number of edges.
それぞれの状態レコードは、DFAαに含まれるそれぞれの状態と一対一に対応し、状態は状態レコードの番号すなわち状態番号で一意に識別される。なお、状態配列は0オリジンであり、従って状態番号が0の状態は開始状態である。それぞれの状態レコードは、受理状態フラグと、エッジ配列内のエッジレコードへのポインタと、エッジレコードの要素数を含む。
Each state record has a one-to-one correspondence with each state included in DFAα, and the state is uniquely identified by the number of the state record, that is, the state number. It should be noted that the state array is 0 origin, and therefore the state with the
受理状態フラグは、当該状態が受理状態であるか否かを示す。受理状態フラグは、一例として、1の場合に受理状態であることを示し、0の場合に受理状態ではないことを示す。 The acceptance state flag indicates whether or not the state is an acceptance state. As an example, the acceptance status flag indicates that it is in an acceptance state when it is 1, and indicates that it is not in an acceptance state when it is 0.
エッジレコードへのポインタは、エッジ配列内における、当該状態から出て行くエッジの集合の格納位置を示す。エッジレコードの要素数は、当該状態から出て行くエッジの個数を表す。エッジレコードへのポインタおよび要素数により、当該状態から出て行く全てのエッジに対応するエッジレコードを特定することができる。 The pointer to the edge record indicates the storage position of the set of edges that exit from the state in the edge array. The number of elements in the edge record represents the number of edges that exit from the state. The edge record corresponding to all the edges going out from the state can be specified by the pointer to the edge record and the number of elements.
それぞれのエッジレコードは、DFAαに含まれるそれぞれのエッジと一対一に対応する。それぞれのエッジレコードは、遷移先の状態番号と、コードを含む。 Each edge record has a one-to-one correspondence with each edge included in DFAα. Each edge record includes a transition destination state number and a code.
遷移先の状態番号は、当該エッジによる遷移先の状態を特定する状態番号を表す。なお、状態番号が0の状態は、開始状態である。 The state number of the transition destination represents a state number that specifies the state of the transition destination by the edge. Note that the state having a state number of 0 is a start state.
コードは、当該エッジにより表される遷移を起こす入力記号を表す。本実施形態においては、コードには、文字を表す実文字コードまたは、命令を指定する仮想文字コードが格納される。DFAαでは、エッジに実文字コードが割り当てられている場合には、認識候補の文字を表す文字コードにより、そのエッジに従ってある状態から他の状態への遷移が起きる。また、DFAαでは、エッジに仮想文字コードが割り当てられている場合には、認識候補の文字に関わらず、そのエッジに従ってある状態から他の状態へと遷移が起きるとともに、仮想文字コードにより指定された命令コードが出力される。 The code represents the input symbol that causes the transition represented by the edge. In the present embodiment, the code stores a real character code representing a character or a virtual character code designating an instruction. In DFAα, when an actual character code is assigned to an edge, a transition from one state to another state occurs according to the edge by a character code representing a recognition candidate character. In addition, in DFAα, when a virtual character code is assigned to an edge, a transition occurs from one state to another state according to the edge regardless of the recognition candidate character, and the virtual character code is designated. The instruction code is output.
図15は、コードの符号化方法の一例を示す図である。知識辞書のエッジレコードに含まれるコードは、一例として、先頭のビットが符号ビットを表し、2番目のビットが実文字コードか仮想文字コードかの区別を表す。例えば、2番目のビットが0の場合には、実文字コードを表し、2番目のビットが1の場合には仮想文字コードを表し、当該コードにより後述の命令コードが指定される。 FIG. 15 is a diagram illustrating an example of a code encoding method. As an example, the code included in the edge record of the knowledge dictionary represents the distinction between the first bit representing a sign bit and the second bit representing a real character code or a virtual character code. For example, when the second bit is 0, it represents an actual character code, and when the second bit is 1, it represents a virtual character code, and an instruction code described later is designated by the code.
図16は、命令データの一例を示す図である。命令処理部51は、コマンドインタプリタを実行し、仮想文字コードにより指定された命令コードを解釈して、命令コードで定義された処理を実行する。命令データは、例えば、文字列の配列で定義され、仮想文字コードの上位2ビットを0で置き換えた番号を配列の要素の番号とすることで指定される。例えば、図16の命令コード#0は「ADD_SCORE 300」と文字列で記述されており、後述するスコアに指定された値300を加算する加算命令である。また、例えば、図16の命令コード#1は「CHEK_SPACE 5mm」と文字列で記述されており、文字間のスペースが5mm以上であるかを確認する間隔確認命令である。
FIG. 16 is a diagram illustrating an example of instruction data. The
図17は、照合結果データの構成を示す図である。照合部46は、文字候補に含まれる認識候補のそれぞれを、先頭から順次に知識辞書と照合して、入力画像の記入枠内に記載されていると推測される文字列と知識辞書を照合して得られる照合結果を生成する。そして、照合部46は、生成した照合結果を、照合結果記憶部48に書き込む。
FIG. 17 is a diagram illustrating a configuration of the collation result data. The
照合結果記憶部48は、照合結果データを記憶する。照合結果データは、それぞれの位置番号毎に、照合結果の個数と、照合結果の配列含む。
The verification
照合結果の個数は、当該位置番号に関連付けられた照合結果の個数を表す。照合結果の配列は、当該位置番号に関連付けられた照合結果を格納する。それぞれの照合結果は、状態番号αと、スコアと、コードと、位置番号および照合結果の番号のペア含む。また、それぞれの照合結果は、格納先の配列が関連付けられた位置番号および、格納先の配列内での配列要素としての番号のペアで一意に識別される。以降では、照合結果の格納先の配列が関連付けられた位置番号を「照合結果が関連付けられた位置番号」、照合結果の格納先の配列内での配列要素としての番号を「照合結果の番号」と呼称する。 The number of matching results represents the number of matching results associated with the position number. The collation result array stores the collation result associated with the position number. Each collation result includes a pair of a state number α, a score, a code, a position number, and a collation result number. Each collation result is uniquely identified by a pair of a position number associated with the storage destination array and a number as an array element in the storage destination array. From now on, the position number associated with the collation result storage array is referred to as "position number associated with the collation result", and the number as the array element in the collation result storage array is referred to as "collation result number". It is called.
状態番号αは、知識辞書(DFAα)の状態を表す。すなわち、状態番号αは、先頭の認識候補から当該位置の認識候補までのそれぞれの文字に応じて、DFAαを開始状態から順次に遷移させた場合に到達する状態を示す。 The state number α represents the state of the knowledge dictionary (DFAα). That is, the state number α indicates a state reached when DFAα is sequentially shifted from the start state in accordance with each character from the first recognition candidate to the recognition candidate at the position.
スコアは、先頭の認識候補から当該位置の認識候補までのそれぞれに対応付けられた類似度を累積した値を表す。すなわち、スコアは、先頭の認識候補から当該位置の認識候補までの文字列の尤もらしさを表す。コードは、当該位置の認識候補の文字を表す文字コードである。 The score represents a value obtained by accumulating the degrees of similarity associated with the recognition candidates at the head to the recognition candidates at the position. That is, the score represents the likelihood of the character string from the first recognition candidate to the recognition candidate at the position. The code is a character code representing a recognition candidate character at the position.
位置番号および照合結果の番号のペアは、先頭から当該位置まで1個ずつ文字候補をたどりながら文字候補の認識候補を入力記号としてDFAαを遷移させながら照合結果を生成していく過程における、直前の照合結果が関連付けられた位置番号および、直前の照合結果の番号を表す。位置番号および照合結果の番号のペアは、結果抽出部54が認識結果の文字列を抽出する際に参照される。
The pair of the position number and the number of the matching result is obtained immediately after the character candidate is traced one by one from the head to the corresponding position while the matching result is generated while the DFAα is transitioned using the character candidate recognition candidate as the input symbol. It represents the position number associated with the collation result and the number of the previous collation result. The pair of the position number and the collation result number is referred to when the
図18は、照合処理を示すフロー図である。図2のステップS4に示した照合処理の詳細について図18を参照して説明する。 FIG. 18 is a flowchart showing the matching process. Details of the collation process shown in step S4 of FIG. 2 will be described with reference to FIG.
まず、ステップS11において、照合部46は、照合結果データを初期化する。具体的には、照合部46は、照合結果データの全ての位置番号について、照合結果の個数を0に設定するとともに、照合結果の配列を空にする。
First, in step S11, the
続いて、ステップS12において、照合部46は、位置番号0に関連付けて、新たな1つの照合結果を生成する。新たな1つの照合結果は、状態番号αが0に、スコアが0に、位置番号および照合結果の番号が−1に、コードが−1に設定される。続いて、ステップS13において、照合部46は、位置番号0に関連付けられた照合結果の個数を1に設定する。続いて、ステップS14において、照合部46は、位置番号を表す変数Pstに0を代入する。
Subsequently, in step S12, the
続いて、ステップS15において、照合部46は、Pstが、Pstmax以下であるか否かを判断する。Pstmaxは、最後の位置番号Pedから1を減じた値である。照合部46は、PstがPstmax以下である場合(ステップS15の真)、処理をステップS16に進める。
Subsequently, in step S15, the
ステップS16において、照合部46は、対応する状態から出て行くエッジに、仮想文字コードが割り当てられたエッジが存在するかを判断する。そして、照合部46は、仮想文字コードが割り当てられたエッジが存在する場合には、状態を遷移させるとともに、仮想文字コードにより指定された命令コードを命令処理部51に与えて、命令を実行させる。なお、命令の実行処理の詳細については、図21および図22を参照して後述する。
In step S <b> 16, the
続いて、ステップS17において、照合部46は、Pstに関連付けられた照合結果を、スコアが最上位からNpr番目までに絞り込む。すなわち、照合部46は、スコアがNpr番目より低い照合結果を削除する。
Subsequently, in step S <b> 17, the matching
続いて、ステップS18において、照合部46は、Pstに関連付けられたそれぞれの照合結果に対して、知識辞書を用いて知識辞書探索処理を実行する。これにより、照合部46は、Pstより後ろの位置番号に関連付けた新たな照合結果を生成することができる。なお、知識辞書探索処理については、図19および図20を参照して後述する。
Subsequently, in step S18, the
続いて、ステップS19において、照合部46は、Pstに1を加算する。照合部46は、ステップS19を終了すると、処理をステップS15に戻す。そして、照合部46は、PstがPstmaxを超えるまで、ステップS16からステップS19の処理を繰り返す。
Subsequently, in step S19, the
PstがPstmax以下ではなくなった場合(ステップS15の偽)、照合部46は、処理をステップS20に進める。ステップS20において、照合部46は、最後の位置番号Pedに関連付けられたそれぞれの照合結果について、ステップS16と同様の処理を実行する。そして、照合部46は、ステップS20の処理を終えると、本フローを終了する。
When Pst is no longer equal to or less than Pstmax (No in step S15), the
図19は、知識辞書探索処理を示すフローチャートである。図20は、知識辞書探索処理でのデータアクセスの流れの一例を示す。 FIG. 19 is a flowchart showing the knowledge dictionary search process. FIG. 20 shows an example of the flow of data access in the knowledge dictionary search process.
図19および図20を参照しながら、図18のステップS18の知識辞書探索処理を説明する。まず、ステップS31において、照合部46は、照合結果データを参照し、Pstに関連付けられた全ての照合結果を列挙する。
The knowledge dictionary search process in step S18 of FIG. 18 will be described with reference to FIGS. First, in step S31, the
続いて、ステップS32において、照合部46は、文字候補データの配列内の文字候補レコードを参照し、Pstを始点位置とする全ての文字候補を、文字候補データの配列内の列挙する。照合部46は、文字候補マトリクスにおける始点番号がPstに一致する全てのエントリを走査し、−1以外の文字候補の番号を収集することで、Pstを始点位置とする全ての文字候補を列挙することができる。
Subsequently, in step S32, the
続いて、照合部46は、ステップS32で列挙した全ての文字候補レコードのそれぞれに対して、ステップS34〜ステップS48の処理を実行する(ステップS33とステップS49との間のループ処理)。以降ではこのループ処理における処理対象の文字候補レコードに対応する文字候補を「文字候補Cc」と称する。
Subsequently, the
ステップS34において、照合部46は、文字候補Ccに対応する文字候補レコードの認識候補の配列を参照し、当該文字候補の全ての認識候補エントリを列挙する。
In step S34, the
続いて、照合部46は、ステップS34で列挙した全ての認識候補エントリのそれぞれに対して、ステップS36〜ステップS47の処理を実行する(ステップS35とステップS48との間のループ処理)。以降ではこのループ処理における処理対象の認識候補エントリに対応する認識候補を「認識候補Cr」と称する。
Subsequently, the
続いて、照合部46は、ステップS31で列挙した、Pstに関連付けられた全ての照合結果のそれぞれに対して、ステップS37〜ステップS46の処理を実行する(ステップS36とステップS47との間のループ処理)。以降ではこのループ処理における処理対象の照合結果を「照合結果Mp」と称する。
Subsequently, the
ステップS37において、照合部46は、知識辞書(DFAα)を参照して、処理対象の照合結果Mpに含まれる状態番号αに対応する状態レコードを列挙する。
In step S37, the
続いて、ステップS38において、照合部46は、ステップS37で列挙した状態レコードに含まれるエッジレコードへのポインタおよびエッジレコードの要素数により、状態番号αの状態から出て行くエッジを表すエッジレコードの格納された範囲を特定することで、状態番号αの状態から出て行くエッジを表す全てのエッジレコードを列挙する。
Subsequently, in step S38, the
続いて、照合部46は、ステップS38で列挙した全てのエッジレコードのそれぞれに対して、ステップS40〜ステップS45の処理を実行する(ステップS39とステップS46との間のループ処理)。以降ではこのループ処理における処理対象のエッジレコードを「エッジレコードEr」と称する。
Subsequently, the
ステップS40において、照合部46は、認識候補Crの認識候補エントリに設定された文字コードと、エッジレコードErに設定された文字コードとが一致するか否かを判断する。一致しない場合(ステップS40のNo)、照合部46は、次のエッジレコードに処理を移し、ステップS40からの処理を繰り返す。一致する場合(ステップS40のYes)、照合部46は、処理をステップS41に進める。
In step S40, the
ステップS41において、照合部46は、文字候補Ccの文字候補レコードの終点位置に関連付けて新しい照合結果Mnを生成して、照合結果データに書き込む。
In step S41, the
続いて、ステップS42において、照合部46は、新しい照合結果Mnに状態番号αにとして、エッジレコードErに設定された状態番号(遷移先の状態番号)を設定する。
Subsequently, in step S42, the
続いて、ステップS43において、照合部46は、新しい照合結果Mnにコードとして、認識候補Crの認識候補エントリに設定された文字コードを設定する。
Subsequently, in step S43, the
続いて、ステップS44において、照合部46は、新しい照合結果Mnに位置番号として、照合結果Mpが関連付けられた位置番号Pstを設定する。また、照合部46は、新しい照合結果Mnに照合結果の番号として、処理対象の照合結果Mpの番号を格納する。
Subsequently, in step S44, the
続いて、ステップS45において、照合部46は、新しい照合結果Mnにスコアとして、処理対象の照合結果Mpに格納されたスコアと、認識候補Crの認識候補エントリに格納された類似度加算した値を設定する。
Subsequently, in step S45, the
ステップS46において、照合部46は、全てのエッジレコードについて、ステップS40〜ステップS45の処理を終えると、ループを抜けて処理をステップS47に進める。
In step S46, the
ステップS47において、照合部46は、Pstに関連付けられた全ての照合結果について、ステップS37〜ステップS46の処理を終えると、ループを抜けて処理をステップS48に進める。
In step S47, the
ステップS48において、照合部46は、文字候補Ccに対応する全ての認識候補エントリについて、ステップS36〜ステップS47の処理を終えると、ループを抜けて処理をステップS49に進める。
In step S48, the
そして、ステップS49において、照合部46は、全ての文字候補レコードについて、ステップS34〜ステップS48の処理を終えると、ループを抜けて、本フローを終了する。
In step S49, the
このように照合部46は、第1の文字候補の照合結果に、照合により到達した知識辞書(DFAα)の状態を示す番号(状態番号α)を書き込む。そして、照合部46は、第1の文字候補に続く第2の文字候補を知識辞書(DFAα)と照合する際、第1の文字候補の照合結果に書き込まれた番号(状態番号α)に示される状態から第2の文字候補の認識候補による状態遷移に対応するエッジを辿ることで第2の文字候補を照合する。
As described above, the
図21は、命令実行処理を示すフローチャートである。図22は、命令実行処理でのデータの流れを示す。図23は、文字間のスペースの確認の様子を示す図である。 FIG. 21 is a flowchart showing instruction execution processing. FIG. 22 shows a data flow in the instruction execution process. FIG. 23 is a diagram showing how to check the space between characters.
図21および図22を参照しながら、図18のステップS16の命令実行処理を説明する。まず、ステップS51において、照合部46は、照合結果データを参照し、Pstに関連付けられた全ての照合結果を列挙する。
The instruction execution process in step S16 in FIG. 18 will be described with reference to FIGS. First, in step S51, the
続いて、照合部46は、ステップS51で列挙した、Pstに関連付けられた全ての照合結果のそれぞれに対して、ステップS53〜ステップS61の処理を実行する(ステップS52とステップS62との間のループ処理)。以降ではこのループ処理における処理対象の照合結果を「照合結果Mp」と称する。
Subsequently, the
ステップS53において、照合部46は、知識辞書(DFAα)を参照して、処理対象の照合結果Mpに設定された状態番号αに対応する状態レコードを列挙する。
In step S53, the
続いて、ステップS54において、照合部46は、ステップS53で列挙した状態レコードに設定されたエッジレコードへのポインタおよびエッジレコードの要素数を参照して、状態番号αの状態から出て行くエッジを表す全てのエッジレコードを列挙する。
Subsequently, in step S54, the
続いて、照合部46は、ステップS54で列挙した全てのエッジレコードのそれぞれに対して、ステップS56〜ステップS60の処理を実行する(ステップS55とステップS61との間のループ処理)。以降ではこのループ処理における処理対象のエッジレコードを「エッジレコードEr」と称する。
Subsequently, the
ステップS56において、照合部46は、エッジレコードErのコードが、仮想文字コードであるか否かを判断する。照合部46は、一例として、コードの先頭から2ビット目を検出して、仮想文字コードであるか否かを判断する。仮想文字コードではない場合(ステップS56のNo)、照合部46は、次のエッジレコードに処理を移し、ステップS56からの処理を繰り返す。仮想文字コードである場合(ステップS56のYes)、照合部46は、処理をステップS57に進める。
In step S56, the
ステップS57において、照合部46は、Pstに関連付けて新しい照合結果Mnを生成して、照合結果データに書き込む。
In step S57, the
続いて、ステップS58において、照合部46は、新しい照合結果Mnに状態番号αとして、エッジレコードErに設定された状態番号(遷移先の状態番号)を設定する。
Subsequently, in step S58, the
続いて、ステップS59において、照合部46は、新しい照合結果Mnに状態番号α以外の要素(スコア、コード、位置番号および照合結果の番号)として、照合結果Mpの対応する値を複写する。これにより、照合部46は、仮想文字コードが割り当てられたエッジに従って、状態を遷移させることができる。
Subsequently, in step S59, the
続いて、ステップS60において、照合部46は、命令処理部51を呼び出して、仮想文字コードにより指定された命令コードを与えて、命令を実行させる。命令処理部51は、コマンドインタプリタを実装しており、与えられた命令コードを解釈して、当該命令コードで定義された処理を実行する。
Subsequently, in step S60, the
例えば、命令処理部51は、加算命令「ADD_SCORE」が与えられた場合には、引数で指定された値を対応する照合結果のスコアに加算する。これにより、命令処理部51は、予め定められた条件の場合にスコアに重みを加えて、文字列の尤もらしさの評価を操作することができる。
For example, when the addition instruction “ADD_SCORE” is given, the
また、例えば、図21のステップS60において位置番号Pstに関連付けられた照合結果Mpの処理中に、仮想文字コードにより間隔確認命令「CHECK_SPACE」を含む命令コードが実行された場合、図23に示すように、命令処理部51は、位置番号Pstの直前の断片と直後の断片の間隔を確認することで、位置番号Mpの前後の文字間のスペースを確認する。そして、命令処理部51は、間隔が指定された距離以下の場合には、照合結果Mpを削除する。これにより、命令処理部51は、例えば、性と名との間の区切りのスペースを確認し、予め定められた距離より長いスペースが検出されない場合に照合結果を削除することができる。
Further, for example, when an instruction code including an interval check instruction “CHECK_SPACE” is executed by a virtual character code during the processing of the matching result Mp associated with the position number Pst in step S60 of FIG. 21, as shown in FIG. In addition, the
続いて、ステップS61において、照合部46は、全てのエッジレコードについて、ステップS56〜ステップS60の処理を終えると、ループを抜けて処理をステップS62に進める。
Subsequently, in step S61, the
ステップS62において、照合部46は、Pstに関連付けられた全ての照合結果について、ステップS53〜ステップS61の処理を終えると、ループを抜けて、本フローを終了する。
In step S62, the
このように照合部46は、第1の文字候補の照合結果に、照合により到達した知識辞書(DFAα)の状態を示す番号(状態番号α)を書き込む。そして、照合部46は、第1の文字候補に続く第2の文字候補を知識辞書(DFAα)と照合する際、第1の文字候補の照合結果に書き込まれた番号(状態番号α)に示される状態から第2の文字候補の認識候補による状態遷移に対応するエッジを辿ることで第2の文字候補を照合し、第2の文字候補の照合結果を生成する。
As described above, the
さらに、照合部46は、仮想文字コードが割り当てられたエッジが検出された場合には、そのエッジに従って状態を遷移させるとともに、仮想文字コードにより指定された命令コードを命令処理部51に与えて、命令を実行させることができる。
Furthermore, when an edge to which a virtual character code is assigned is detected, the matching
図24は、結果抽出部で行われる文字列の抽出の処理の流れを示すフロー図である。図25は、結果抽出において参照されるデータとスタック上に積まれる文字コードの様子を示す図である。 FIG. 24 is a flowchart showing the flow of character string extraction processing performed by the result extraction unit. FIG. 25 is a diagram illustrating data referred to in the result extraction and a state of character codes stacked on the stack.
図2のステップS5に示した結果抽出は結果抽出部54で行われる。以降では、結果抽出の詳細について図24および図25を参照して説明する。まず、ステップS70において結果抽出部54は、文字候補の個数が0であるか否か確認し、文字候補の個数が0の場合はステップS84において認識結果の文字列を空文字列として本フローを終了する。文字候補の個数が0でない場合は、ステップS71において、結果抽出部54は、最後の位置番号Pedに関連付けられた全ての照合結果を列挙した上でステップS72以降の処理を実行する。
The result extraction shown in step S5 of FIG. Hereinafter, details of the result extraction will be described with reference to FIGS. 24 and 25. First, in step S70, the
続いて、ステップS72において、結果抽出部54は、ステップS71において列挙した照合結果のそれぞれについて、知識辞書(DFAα)から状態番号αに対応する状態レコードを取得して、受理状態フラグを確認する。
Subsequently, in step S72, the
続いて、ステップS73において、結果抽出部54は、状態番号αに対応する状態が受理状態の照合結果があるかを判断する。以降では、状態番号αに対応する状態が受理状態の照合結果を「DFAαで受理状態の照合結果」と称する。DFAαで受理状態の照合結果がある場合には(ステップS73のYes)、ステップS74において、結果抽出部54は、DFAαで受理状態の照合結果のうち、スコアが最大の照合結果を照合結果Mxとして選択する。DFAαで受理状態の照合結果が無い場合には(ステップS73のNo)、ステップS75において、結果抽出部54は、列挙した全ての照合結果のうち、スコアが最大の照合結果を照合結果Mxとして選択する。
Subsequently, in step S73, the
ステップS74またはステップS75の処理に続いて、ステップS76において、結果抽出部54は、位置番号を表す変数pに、選択した照合結果Mxが関連付けられた位置番号pxを代入する。また、結果抽出部54は、照合結果の番号を表す変数mに、選択した照合結果Mxの番号mxを代入する。
Subsequent to step S74 or step S75, in step S76, the
続いて、ステップS77において、結果抽出部54は、FILO(First In Last Out)メモリであるスタックを空にする。
Subsequently, in step S77, the
続いて、ステップS78において、pとmとが指す照合結果のコードが−1であるかを判断する。pとmとが指す照合結果のコードが−1ではない場合(ステップS78の偽)、結果抽出部54は、処理をステップS79に進める。
Subsequently, in step S78, it is determined whether the collation result code indicated by p and m is -1. When the code of the collation result indicated by p and m is not −1 (false in step S78), the
ステップS79において、結果抽出部54は、pとmとが指す照合結果に格納されているコードをスタックに積む。続いて、ステップS80において、結果抽出部54は、pにpとmとが指す照合結果に格納された位置番号を、mにpとmとが指す照合結果に格納された照合結果の番号を代入する。
In step S79, the
そして、結果抽出部54は、ステップS80の処理を終えると、処理をステップS78に戻して、pとmとが指す照合結果に格納されたコードが−1となるまで、ステップS79とステップS80の処理を繰り返す。これにより、結果抽出部54は、図25に示すように、文字列の末尾から順に文字コードを選択して、スタックに積み上げていくことができる。
And the
pとmとが指す照合結果のコードが−1である場合(ステップS78の真)、すなわち、位置番号が0に関連付けられた照合結果を指す場合には、結果抽出部54は、処理をステップS81に進める。ステップS81において、結果抽出部54は、メモリに格納された認識結果の文字列を空文字列に初期化する。
When the code of the matching result pointed to by p and m is −1 (true in step S78), that is, when the position number indicates the matching result associated with 0, the
続いて、ステップS82において、スタックが空であるかを判断する。スタックが空ではない場合(ステップS82の偽)、結果抽出部54は、ステップS83において、スタックのトップからコードを1つ取り出して、メモリに格納された認識結果の文字列の末尾に追加する。
Subsequently, in step S82, it is determined whether the stack is empty. If the stack is not empty (false in step S82), the
ステップS83の処理を終えると、結果抽出部54は、処理をステップS82に戻して、スタックが空になるまで、ステップS83の処理を繰り返す。これにより、結果抽出部54は、文字列の先頭から末尾までを生成することができる。
When the process of step S83 is completed, the
そして、結果抽出部54は、スタックが空となった場合(ステップS82の真)、本フローの処理を終了する。
Then, when the stack becomes empty (true in step S82), the
以上のように、本実施形態に係る認識装置10は、知識辞書を用いて文字認識をするとともに、照合処理に同期させて照合処理とは異なる処理を実行することができる。
As described above, the
図26は、実施形態に係る認識装置10のハードウェア構成を示す図である。
FIG. 26 is a diagram illustrating a hardware configuration of the
認識装置10は、プログラムを実行可能な一般的なコンピュータシステムにより実現することができる。認識装置10は、一例として、ディスプレイ110と、キーボード112と、スキャナ114と、外部記憶装置116と、通信装置118と、コンピュータ120備える。
The
ディスプレイ110は、表示装置であり、認識した文字列等を表示する。キーボード112は、入力装置であり、ユーザからの操作を受け付けて情報を入力する。スキャナ114は、用紙等に記載された情報を読み取って入力画像等を取得する。外部記憶装置116は、ハードディスクドライブまたは光ディスクドライブ等であり、各種の情報を記憶する。通信装置118は、インターネット等を介して外部のコンピュータ等と情報を入出力し、例えば入力画像を外部から取得したり、文字列を外部へと出力したりする。
The
コンピュータ120は、一例として、CPU122と、入出力制御部124と、記憶装置126有する。CPU122、入出力制御部124および記憶装置126は、バス128により接続される。
As an example, the
CPU122は、プログラムを実行して認識装置10の全体の制御をする。入出力制御部124は、ディスプレイ110、キーボード112、スキャナ114、外部記憶装置116および通信装置118等とのインターフェイスである。また、入出力制御部124は、バス128を介したデータ転送等も制御する。
The CPU 122 executes a program to control the
記憶装置126は、ROM、RAMまたはハードディスクドライブ等を含む。記憶装置126では、同一のアドレス空間により、ROM、RAMまたはハードディスクドライブ等の何れのデバイスに対してもアクセスが可能である。記憶装置126は、プログラム、入力画像、様式データ、辞書データ(文字認識辞書および知識辞書)、作業データ(文字候補および照合結果)、および、命令データ等を記憶する。これらのデータは、記憶装置を構成する何れのデバイス(ROM、RAMおよびハードディスクドライブ)に記憶されていてもよい。また、これらのデータは、一部または全部が、外部記憶装置116、または、通信装置118を介してアクセスされるサーバ等に記憶されていてもよい。
The
本実施形態の認識装置10で実行されるプログラムは、インストール可能な形式又は実行可能な形式のファイルでCD−ROM、フレキシブルディスク(FD)、CD−R、DVD等のコンピュータで読み取り可能な記録媒体に記録されて提供される。また、本実施形態の認識装置10で実行されるプログラムを、インターネット等のネットワークに接続されたコンピュータ上に格納し、ネットワーク経由でダウンロードさせることにより提供するように構成してもよい。また、本実施形態の認識装置10で実行されるプログラムをインターネット等のネットワーク経由で提供または配布するように構成してもよい。
The program executed by the
本実施形態の認識装置10で実行されるプログラムは、上述した各部(入力部30、候補検出部36、認識部42、照合部46、命令処理部51、結果抽出部54および出力部56)を含むモジュール構成となっており、実際のハードウェアとしてはCPU(プロセッサ)が上記記憶媒体からプログラムを読み出して実行することにより上記各部が主記憶装置上にロードされ、入力部30、候補検出部36、認識部42、照合部46、命令処理部51、結果抽出部54および出力部56が記憶装置126上に生成されるようになっている。なお、入力部30、候補検出部36、認識部42、照合部46、命令処理部51、結果抽出部54および出力部56は、一部または全部がハードウェアで構成されていてもよい。
The program executed by the
本発明のいくつかの実施形態を説明したが、これらの実施形態は、例として提示したものであり、発明の範囲を限定することは意図していない。これら新規な実施形態は、その他の様々な形態で実施されることが可能であり、発明の要旨を逸脱しない範囲で、種々の省略、置き換え、変更を行うことができる。これら実施形態やその変形は、発明の範囲や要旨に含まれるとともに、請求の範囲に記載された発明とその均等の範囲に含まれる。 Although several embodiments of the present invention have been described, these embodiments are presented by way of example and are not intended to limit the scope of the invention. These novel embodiments can be implemented in various other forms, and various omissions, replacements, and changes can be made without departing from the scope of the invention. These embodiments and modifications thereof are included in the scope and gist of the invention, and are included in the invention described in the claims and the equivalents thereof.
10 認識装置
30 入力部
32 入力画像記憶部
34 様式データ記憶部
36 候補検出部
38 候補記憶部
40 文字認識辞書記憶部
42 認識部
44 知識辞書記憶部
46 照合部
48 照合結果記憶部
51 命令処理部
54 結果抽出部
56 出力部
110 ディスプレイ
112 キーボード
114 スキャナ
116 外部記憶装置
118 通信装置
120 コンピュータ
122 CPU
124 入出力制御部
126 記憶装置
128 バス
DESCRIPTION OF
124 I /
Claims (8)
前記文字候補のそれぞれを認識して、認識結果の候補の文字である少なくとも1つの認識候補を生成する認識部と、
前記少なくとも1つの認識候補のそれぞれを、認識対象の文字列をモデル化した知識辞書と照合して、前記入力画像に含まれると推測される文字列と知識辞書を照合して得られる照合結果を生成する照合部と、
与えられた命令を実行する命令処理部と、
を備え、
前記知識辞書は、有限オートマトンであって、文字を表す実文字コードおよび命令を指定する仮想文字コードのいずれか一方がエッジに割り当てられ、
前記照合部は、前記仮想文字コードが割り当てられたエッジに従って前記知識辞書の状態を遷移させる場合、当該エッジに割り当てられた前記仮想文字コードにより指定された命令を前記命令処理部に与える
認識装置。 A candidate detection unit that detects a character candidate that is a set of pixels estimated to include a character from the input image;
A recognition unit that recognizes each of the character candidates and generates at least one recognition candidate that is a candidate character of a recognition result;
Each of the at least one recognition candidate is collated with a knowledge dictionary obtained by modeling a character string to be recognized, and a collation result obtained by collating a character string estimated to be included in the input image with a knowledge dictionary is obtained. A verification unit to be generated;
An instruction processing unit for executing a given instruction;
With
The knowledge dictionary is a finite automaton, and either one of a real character code representing a character and a virtual character code designating an instruction is assigned to an edge,
The verification unit, when transitioning the state of the knowledge dictionary according to an edge to which the virtual character code is assigned, gives an instruction specified by the virtual character code assigned to the edge to the instruction processing unit.
前記認識装置は、前記照合結果から前記スコアに基づき1つの照合結果を選択し、選択した照合結果により特定される文字列を抽出する結果抽出部をさらに備える
請求項1に記載の認識装置。 The matching unit generates a matching result including a score representing the likelihood of the corresponding character string,
The recognition apparatus according to claim 1, further comprising: a result extraction unit that selects one matching result based on the score from the matching result and extracts a character string specified by the selected matching result.
請求項2に記載の認識装置。 The recognition apparatus according to claim 2, wherein the instruction processing unit processes an addition instruction for adding a designated value to a score of a corresponding matching result.
請求項2に記載の認識装置。 The instruction processing unit checks a space between characters before and after a position associated with a collation result, and processes an interval confirmation command for deleting a corresponding collation result when the distance is equal to or less than a specified distance. The recognition device according to claim 2.
前記照合部は、
第1の文字候補の照合結果に、照合により到達した前記決定性有限オートマトンの状態を示す番号を書き込み、
前記第1の文字候補に続く第2の文字候補を前記決定性有限オートマトンと照合する際、前記第1の文字候補の照合結果に書き込まれた番号に示される状態から第2の文字候補の認識候補による状態遷移に対応するエッジを辿ることで第2の文字候補を照合する
請求項2に記載の認識装置。 The knowledge dictionary is a deterministic finite automaton;
The collation unit
Write a number indicating the state of the deterministic finite automaton reached by collation in the collation result of the first character candidate,
When the second character candidate following the first character candidate is collated with the deterministic finite automaton, the second character candidate recognition candidate from the state indicated by the number written in the collation result of the first character candidate The recognition apparatus according to claim 2, wherein the second character candidate is collated by following an edge corresponding to the state transition by.
前記文字候補のそれぞれを認識して、認識結果の候補の文字である少なくとも1つの認識候補を生成する認識部と、
前記少なくとも1つの認識候補のそれぞれを、認識対象の文字列をモデル化した知識辞書と照合して、前記入力画像に含まれると推測される文字列と知識辞書を照合して得られる照合結果を生成する照合部と、
与えられた命令を実行する命令処理部と、
を備え、
前記知識辞書は、決定性有限オートマトンであって、文字コードがエッジに割り当てられ、
前記照合部は、第1の文字候補の照合結果に、照合により到達した前記決定性有限オートマトンの状態を示す番号を書き込み、前記第1の文字候補に続く第2の文字候補を前記決定性有限オートマトンと照合する際、前記第1の文字候補の照合結果に書き込まれた番号に示される状態から第2の文字候補の認識候補による状態遷移に対応するエッジを辿ることで第2の文字候補を照合し、第2の文字候補の照合結果を生成する
認識装置。 A candidate detection unit that detects a character candidate that is a set of pixels estimated to include a character from the input image;
A recognition unit that recognizes each of the character candidates and generates at least one recognition candidate that is a candidate character of a recognition result;
Each of the at least one recognition candidate is collated with a knowledge dictionary obtained by modeling a character string to be recognized, and a collation result obtained by collating a character string estimated to be included in the input image with a knowledge dictionary is obtained. A verification unit to be generated;
An instruction processing unit for executing a given instruction;
With
The knowledge dictionary is a deterministic finite automaton, character codes are assigned to edges,
The collation unit writes a number indicating the state of the deterministic finite automaton reached by collation to the collation result of the first character candidate, and sets the second character candidate following the first character candidate as the deterministic finite automaton. When collating, the second character candidate is collated by following the edge corresponding to the state transition by the recognition candidate of the second character candidate from the state indicated by the number written in the collation result of the first character candidate. A recognition device for generating a collation result of the second character candidate.
前記文字候補のそれぞれを認識して、認識結果の候補の文字である少なくとも1つの認識候補を生成する認識ステップと、
前記少なくとも1つの認識候補のそれぞれを、認識対象の文字列をモデル化した知識辞書と照合して、前記入力画像に含まれると推測される文字列と知識辞書を照合して得られる照合結果を生成する照合ステップと、
与えられた命令を実行する命令処理ステップと、
を含み、
前記知識辞書は、有限オートマトンであって、文字を表す実文字コードおよび命令を含む仮想文字コードのいずれか一方がエッジに割り当てられ、
前記照合ステップでは、前記仮想文字コードが割り当てられたエッジに従って前記知識辞書の状態を遷移させる場合、当該エッジに割り当てられた前記仮想文字コードに含まれる命令を実行する
認識方法。 A candidate detection step of detecting a character candidate that is a set of pixels presumed to include a character from the input image;
A recognition step of recognizing each of the character candidates and generating at least one recognition candidate that is a candidate character of a recognition result;
Each of the at least one recognition candidate is collated with a knowledge dictionary obtained by modeling a character string to be recognized, and a collation result obtained by collating a character string estimated to be included in the input image with a knowledge dictionary is obtained. A matching step to generate,
An instruction processing step for executing a given instruction;
Including
The knowledge dictionary is a finite automaton, and one of a real character code representing a character and a virtual character code including an instruction is assigned to an edge,
In the collating step, when the state of the knowledge dictionary is changed according to an edge to which the virtual character code is assigned, a command included in the virtual character code assigned to the edge is executed.
前記コンピュータに、
入力画像から、文字を含むと推測される画素の集合である文字候補を検出する候補検出ステップと、
前記文字候補のそれぞれを認識して、認識結果の候補の文字である表す少なくとも1つの認識候補を生成する認識ステップと、
前記少なくとも1つの認識候補のそれぞれを、認識対象の文字列をモデル化した知識辞書と照合して、前記入力画像に含まれると推測される文字列と知識辞書を照合して得られる照合結果を生成する照合ステップと、
与えられた命令を実行する命令処理ステップと、
を実行させ、
前記知識辞書は、有限オートマトンであって、文字を表す実文字コードおよび命令を指定する仮想文字コードのいずれか一方がエッジに割り当てられ、
前記照合ステップでは、前記仮想文字コードが割り当てられたエッジに従って前記知識辞書の状態を遷移させる場合、当該エッジに割り当てられた前記仮想文字コードにより指定された命令を実行させる
プログラム。 A program for causing a computer to function as a recognition device,
In the computer,
A candidate detection step of detecting a character candidate that is a set of pixels presumed to include a character from the input image;
A recognition step of recognizing each of said character candidates and generating at least one recognition candidate representing a candidate character of a recognition result;
Each of the at least one recognition candidate is collated with a knowledge dictionary obtained by modeling a character string to be recognized, and a collation result obtained by collating a character string estimated to be included in the input image with a knowledge dictionary is obtained. A matching step to generate,
An instruction processing step for executing a given instruction;
And execute
The knowledge dictionary is a finite automaton, and either one of a real character code representing a character and a virtual character code designating an instruction is assigned to an edge,
In the collation step, when the state of the knowledge dictionary is changed according to an edge to which the virtual character code is assigned, a program for executing an instruction specified by the virtual character code assigned to the edge.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014044342A JP6334209B2 (en) | 2014-03-06 | 2014-03-06 | Recognition device, recognition method and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014044342A JP6334209B2 (en) | 2014-03-06 | 2014-03-06 | Recognition device, recognition method and program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2015170130A true JP2015170130A (en) | 2015-09-28 |
JP6334209B2 JP6334209B2 (en) | 2018-05-30 |
Family
ID=54202818
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2014044342A Active JP6334209B2 (en) | 2014-03-06 | 2014-03-06 | Recognition device, recognition method and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP6334209B2 (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH09185681A (en) * | 1996-01-08 | 1997-07-15 | Hitachi Ltd | Address reading method |
JPH11143893A (en) * | 1997-11-07 | 1999-05-28 | Matsushita Electric Ind Co Ltd | Word collating device |
JP2000148906A (en) * | 1998-11-10 | 2000-05-30 | Hitachi Ltd | Document recognition device and mail divider |
-
2014
- 2014-03-06 JP JP2014044342A patent/JP6334209B2/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH09185681A (en) * | 1996-01-08 | 1997-07-15 | Hitachi Ltd | Address reading method |
JPH11143893A (en) * | 1997-11-07 | 1999-05-28 | Matsushita Electric Ind Co Ltd | Word collating device |
JP2000148906A (en) * | 1998-11-10 | 2000-05-30 | Hitachi Ltd | Document recognition device and mail divider |
Also Published As
Publication number | Publication date |
---|---|
JP6334209B2 (en) | 2018-05-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
TWI321294B (en) | Method and device for determining at least one recognition candidate for a handwritten pattern | |
JP5125573B2 (en) | Region extraction program, character recognition program, and character recognition device | |
CN110114776B (en) | System and method for character recognition using a fully convolutional neural network | |
KR102293538B1 (en) | Method and apparatus for recognising music symbols | |
JP6003705B2 (en) | Information processing apparatus and information processing program | |
US10438097B2 (en) | Recognition device, recognition method, and computer program product | |
JP2001175811A (en) | Device and method for word rough classification, and recording medium with recorded control program thereof | |
CN112784581B (en) | Text error correction method, device, medium and electronic equipment | |
JP2009539181A (en) | Combiner for improving handwriting recognition | |
JP4991407B2 (en) | Information processing apparatus, control program thereof, computer-readable recording medium storing the control program, and control method | |
JP2019204214A (en) | Learning device, learning method, program and estimation device | |
JP5942361B2 (en) | Image processing apparatus and image processing program | |
JP6320089B2 (en) | Recognition device, recognition method and program | |
JP2009093305A (en) | Business form recognition system | |
JP2009129253A (en) | Pattern recognition apparatus, pattern recognition program and pattern recognition method | |
JP6334209B2 (en) | Recognition device, recognition method and program | |
JP5238034B2 (en) | Approximate collation device, approximate collation method, program, and recording medium | |
WO2016181458A1 (en) | Recognition device, recognition method and program | |
JP2008186056A (en) | Hand-written character input apparatus and hand-written character input program | |
JP2012098905A (en) | Character recognition device, character recognition method and program | |
JP2010237909A (en) | Knowledge correction program, knowledge correcting device and knowledge correction method | |
JP7322468B2 (en) | Information processing device, information processing method and program | |
US20230005282A1 (en) | Information processing apparatus, information processing method, computer program product, and recording medium | |
JP4936635B2 (en) | Character string search device, character string search method, and program for causing computer to execute the method | |
JP2023002091A (en) | Information processing system, method and program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
RD01 | Notification of change of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7421 Effective date: 20151102 |
|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20160923 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20170817 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20170829 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20171023 |
|
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: 20180403 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20180426 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 6334209 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |