# WNUT2017

## 概述

WNUT2017 数据集收集了来自 Twitter 和 YouTube 等多个社交媒体平台的用户生成文本，专门用于命名实体识别（NER）任务，重点关注新兴和非常规实体。

## 任务描述

- **任务类型**：新兴实体命名实体识别（NER）
- **输入**：用户生成的社交媒体文本
- **输出**：带类型的已识别实体片段
- **领域**：社交媒体、新兴实体

## 主要特点

- 来自多个平台的用户生成文本
- 聚焦于新兴和非常规命名实体
- 包含六种实体类型，覆盖多样
- 非正式文本处理具有挑战性
- 源自 WNUT 2017 共享任务

## 评估说明

- 默认配置使用 **5-shot** 评估
- 评估指标：精确率（Precision）、召回率（Recall）、F1 分数（F1-Score）、准确率（Accuracy）
- 实体类型：CORPORATION（公司）、CREATIVE-WORK（创意作品）、GROUP（群体）、LOCATION（地点）、PERSON（人物）、PRODUCT（产品）

## 属性

| 属性 | 值 |
|----------|-------|
| **基准测试名称** | `wnut2017` |
| **数据集ID** | [extraordinarylab/wnut2017](https://modelscope.cn/datasets/extraordinarylab/wnut2017/summary) |
| **论文** | N/A |
| **标签** | `Knowledge`, `NER` |
| **指标** | `precision`, `recall`, `f1_score`, `accuracy` |
| **默认样本数** | 5-shot |
| **评估划分** | `test` |
| **训练划分** | `train` |

## 数据统计

| 指标 | 值 |
|--------|-------|
| 总样本数 | 1,287 |
| 提示词长度（平均） | 2665.65 字符 |
| 提示词长度（最小/最大） | 2570 / 3093 字符 |

## 样例示例

**子集**: `default`

```json
{
  "input": [
    {
      "id": "f1e6b117",
      "content": "Here are some examples of named entity recognition:\n\nInput:\n@paulwalk It 's the view from where I 'm living for two weeks . Empire State Building = ESB . Pretty bad storm here last evening .\n\nOutput:\n<response>@paulwalk It 's the view from wh ... [TRUNCATED] ... he most specific entity type.\n7. Ensure every opening tag has a matching closing tag.\n\nText to process:\n& gt ; * The soldier was killed when another avalanche hit an army barracks in the northern area of Sonmarg , said a military spokesman .\n"
    }
  ],
  "target": "<response>& gt ; * The soldier was killed when another avalanche hit an army barracks in the northern area of <location>Sonmarg</location> , said a military spokesman .</response>",
  "id": 0,
  "group_id": 0,
  "metadata": {
    "tokens": [
      "&",
      "gt",
      ";",
      "*",
      "The",
      "soldier",
      "was",
      "killed",
      "when",
      "another",
      "avalanche",
      "hit",
      "an",
      "army",
      "barracks",
      "in",
      "the",
      "northern",
      "area",
      "of",
      "Sonmarg",
      ",",
      "said",
      "a",
      "military",
      "spokesman",
      "."
    ],
    "ner_tags": [
      "O",
      "O",
      "O",
      "O",
      "O",
      "O",
      "O",
      "O",
      "O",
      "O",
      "O",
      "O",
      "O",
      "O",
      "O",
      "O",
      "O",
      "O",
      "O",
      "O",
      "B-LOCATION",
      "O",
      "O",
      "O",
      "O",
      "O",
      "O"
    ]
  }
}
```

*注：部分内容为显示目的已被截断。*

## 提示模板

**提示模板：**
```text
You are a named entity recognition system that identifies the following entity types:
{entities}

Process the provided text and mark all named entities with XML-style tags.

For example:
<person>John Smith</person> works at <organization>Google</organization> in <location>Mountain View</location>.

Available entity tags: {entity_list}

INSTRUCTIONS:
1. Wrap your entire response in <response>...</response> tags.
2. Inside these tags, include the original text with entity tags inserted.
3. Do not change the original text in any way (preserve spacing, punctuation, case, etc.).
4. Tag ALL entities you can identify using the exact tag names provided.
5. Do not include explanations, just the tagged text.
6. If entity spans overlap, choose the most specific entity type.
7. Ensure every opening tag has a matching closing tag.

Text to process:
{text}

```

<details>
<summary>少样本（Few-shot）模板</summary>

```text
Here are some examples of named entity recognition:

{fewshot}

You are a named entity recognition system that identifies the following entity types:
{entities}

Process the provided text and mark all named entities with XML-style tags.

For example:
<person>John Smith</person> works at <organization>Google</organization> in <location>Mountain View</location>.

Available entity tags: {entity_list}

INSTRUCTIONS:
1. Wrap your entire response in <response>...</response> tags.
2. Inside these tags, include the original text with entity tags inserted.
3. Do not change the original text in any way (preserve spacing, punctuation, case, etc.).
4. Tag ALL entities you can identify using the exact tag names provided.
5. Do not include explanations, just the tagged text.
6. If entity spans overlap, choose the most specific entity type.
7. Ensure every opening tag has a matching closing tag.

Text to process:
{text}

```

</details>

## 使用方法

### 使用命令行（CLI）

```bash
evalscope eval \
    --model YOUR_MODEL \
    --api-url OPENAI_API_COMPAT_URL \
    --api-key EMPTY_TOKEN \
    --datasets wnut2017 \
    --limit 10  # 正式评估时请删除此行
```

### 使用 Python

```python
from evalscope import run_task
from evalscope.config import TaskConfig

task_cfg = TaskConfig(
    model='YOUR_MODEL',
    api_url='OPENAI_API_COMPAT_URL',
    api_key='EMPTY_TOKEN',
    datasets=['wnut2017'],
    limit=10,  # 正式评估时请删除此行
)

run_task(task_cfg=task_cfg)
```