> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# マッチング前

> Before matching スクリプトを使って、各ページでどのセクションや Document Definitions をマッチングするかを制御し、マッチングを高速化して認識をスキップできます。

<div id="what-it-does">
  ## 何をするか
</div>

このイベントのハンドラーでは、後続の各ページでどのセクションまたは Document Definitions をマッチングするかを制御し、マッチングの順序を指定できます。

このスクリプトを使用すると、マッチング対象のセクションが事前にわかっている場合、Document Definition のマッチングを高速化できます。たとえば、次のような場合です。

* バッチの最初のページにのみ Document Definition "Contents" が存在し得ることがわかっている。
* 対象のページが特定のセクション型に属することがわかっている。
* ドキュメント内のセクションの順序がわかっている。

このスクリプトでは、Document Definition がマッチングされた後、そのドキュメントの認識を無効にできます。そのためには、**IMatchingInfo.NeedRecognition** パラメーターを **false** に設定します。これは、field values を手動で入力する想定の場合に役立ちます。

また、認識が不要なページを別紙ページとしてマークすることもできます。その場合は、空のセクションリストを指定し、**IMatchingInfo.ForceMatch** パラメーターを **true** に設定する必要があります。

<div id="when-it-is-launched">
  ## 実行されるタイミング
</div>

このスクリプトは、後続の各ページでセクションのマッチングが行われる前に実行されます。

<div id="parameters">
  ## パラメーター
</div>

| **Name**  | **型**                                                             | **アクセス**                                                                                                   | **説明**                           |
| --------- | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | -------------------------------- |
| Document  | [IDocument](/ja/flexi-capture/appendix/scripts/idocument)         | 読み取り専用。バッチ 文書およびページの内部[\*](/ja/flexi-capture/appendix/scripts/before-matching#asterisk) field にはアクセスできません。 | 解析対象ページを含む文書                     |
| Matching  | [IMatchingInfo](/ja/flexi-capture/appendix/scripts/imatchinginfo) | 読み取り/書き込み                                                                                                  | マッチング parameters の一部を指定する object |
| PageIndex | int                                                               | 読み取り専用。バッチ 文書およびページの内部[\*](/ja/flexi-capture/appendix/scripts/before-matching#asterisk) field にはアクセスできません。 | 解析対象の文書ページの index                |

<a id="asterisk" />\* - 内部 field にアクセスするには、object をメモリにロードする必要があります。

<Note>
  名前付き registration parameters を使用して、マッチング対象の Document Definitions とセクションを指定することもできます。詳細については、[Registration Parameters](/ja/flexi-capture/project-settings/reg-params) を参照してください。
</Note>
