# Named Entity Recognition API

## API Server

AllganizeのAPIエンドポイントは[nlu-api.allganize.ai](https://nlu-api.allganize.ai)です。On-premプランのご利用の場合は、ご希望のAPIエンドポイントを使用してください。

## APIキーの取得

すべてのNLU APIは、リクエストを検証するためにAPIキーを使用しています。APIキーは[NLU APIのプロジェクト設定メニュー](https://nlu.allganize.ai/projects)から確認できます。NLU APIダッシュボードのアカウントがない場合は、[こちら](https://nlu.allganize.ai/signup)から生成してください。&#x20;

#### &#x20;Requestヘッダーの`API-KEY` に割り当てられた`API KEY` を入力してください。

## Named Entity Recognition API

<mark style="color:green;">`POST`</mark> `https://nlu-api.allganize.ai/api/inference`

#### Headers

| Name    | Type   | Description                               |
| ------- | ------ | ----------------------------------------- |
| API-KEY | string | 割り当てられたAPIキーです。プロジェクト設定メニュー>一般タブから確認できます。 |

#### Request Body

| Name | Type   | Description                                                                   |
| ---- | ------ | ----------------------------------------------------------------------------- |
| text | string | 分析対象のテキストです。英語、日本語、韓国語、中国語で対応できます。最大2000文字まで入力できます。2000文字以降の内容は自動で入力・分析されません。 |

{% tabs %}
{% tab title="200" %}
Responseにはリクエストのあったテキストに対する分析結果が含まれています。

startIndex: Named entityとして認識された単語の開始位置を意味します。数字で表示されます。

endIndex: Named entityとして認識された単語の終了位置を意味します。数字で表示されます。

tag: 該当のNamed entityのタイプ(カテゴリ)です。タイプの種類はNLU APIのダッシュボードから定義することができます。

token: Named entityとして認識された単語です。

```
{
  "entities": [
    {
      "startIndex": NUMBER,
      "endIndex": NUMBER,
      "tag": STRING,
      "token": STRING
    }, ...
  ]
}
```

{% endtab %}
{% endtabs %}

### Request Example

YOUR API KEYをプロジェクトのAPIキーに変更しなければなりません。[APIキーの取得](https://docs.allganize.ai/v/ja/ner-api#apikno)の項目をご参照ください。

```
curl https://nlu-api.allganize.ai/api/inference \
-d '{"text": "ミュンヘンからパリまでエールフランスのビジネスクラスで旅行中です。"}' \
-H "Content-Type: application/json" \
-H "API-KEY: YOUR_API_KEY"
```

### Response Example

```
{
  "inputText": "ミュンヘンからパリまでエールフランスのビジネスクラスで旅行中です。",
  "entities": [
    {"startIndex": 0, "endIndex": 5, "tag": "DEPARTURE", "token": "ミュンヘン"},
    {"startIndex": 7, "endIndex": 9, "tag": "ARRIVAL", "token": "パリ"},
    {"startIndex": 11, "endIndex": 18, "tag": "AIRLINE", "token": "エールフランス"},
    {"startIndex": 19, "endIndex": 26, "tag": "SEAT_CLASS", "token": "ビジネスクラス"}
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.allganize.ai/api-reference/ja-1/ner-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
