> ## 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.

# Engine オブジェクトの TrainUserPattern メソッド

> ABBYY FineReader Engine API の Engine オブジェクトの TrainUserPattern メソッド。指定したユーザーパターンファイルに新しい画像と文字のペアを追加して、パターン学習を実行します。

このメソッドでは、パターン学習を実行できます。指定したパターンに、「文字画像—対応する文字」の新しいペアを追加します。

<div id="syntax">
  ## 構文
</div>

<div id="c">
  ### C++
</div>

```cpp theme={null}
HRESULT TrainUserPattern(
  BSTR                       FileName,
  ITrainingImagesCollection* TrainingImages,
  BSTR                       CharacterOrLigature,
  int                        Flags,
  TextTypeEnum               TextType
);
```

### C\#

```csharp theme={null}
void TrainUserPattern(
  string                   FileName,
  ITrainingImagesCollection TrainingImages,
  string                   CharacterOrLigature,
  int                      Flags,
  TextTypeEnum             TextType
);
```

<div id="visual-basic-net">
  ### Visual Basic .NET
</div>

```vb theme={null}
Sub TrainUserPattern( _
  FileName As String, _
  TrainingImages As ITrainingImagesCollection, _
  CharacterOrLigature As String, _
  Flags As Integer, _
  TextType As TextTypeEnum _
)
```

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

FileName

\[in] この変数は、ユーザーパターンファイルへのパスを指定します。

TrainingImages

\[in] この変数は、文字画像のコレクションを格納する [TrainingImagesCollection](/ja/fine-reader/engine/api-reference/image-related-objects/trainingimagescollection) オブジェクトを参照します。

CharacterOrLigature

\[in] この変数は、画像のコレクションで表される文字を指定します。

Flags

\[in] このパラメーターには、文字属性を指定する [UPTF\_](/ja/fine-reader/engine/api-reference/enumerations/userpatternstrainingflags) 接頭辞付きフラグのビット単位 OR の組み合わせが含まれます。

TextType

\[in] このパラメーターは、[TextTypeEnum](/ja/fine-reader/engine/api-reference/enumerations/texttypeenum) 列挙定数を使用して文字のテキスト型を指定します。

<div id="return-values">
  ## 戻り値
</div>

このメソッドに固有の戻り値はありません。返されるのは、[ABBYY FineReader Engine 関数の標準的な戻り値](/ja/fine-reader/engine/api-reference/return-codes)です。

<div id="see-also">
  ## 関連項目
</div>

[Engine](/ja/fine-reader/engine/api-reference/engine-object-iengine-interface/supplementary-methods)

[トレーニングを用いた認識](/ja/fine-reader/engine/guided-tour/advanced-techniques/using-gui-elements/recognizing-with-training)
