{% macro tidy(name) -%}
  {{ name.replace('_', ' ')}}
{%- endmacro %}

===Task===
Extract entities and knowledge triplets from the given statement.

===Inputs===
**Chunk Content:** "{{ chunk_content }}"
**Statement:** "{{ statement }}"

===Guidelines===

**Entity Extraction:**
- Extract entities with their types and context-independent descriptions
- Exclude lengthy quotes, calendar dates, temporal ranges, and temporal expressions
- For numeric values: extract as separate entities (instance_of: 'Numeric', name: units, numeric_value: value)
  Example: £30 → name: 'GBP', numeric_value: 30, instance_of: 'Numeric'

**Triplet Extraction:**
- Extract (subject, predicate, object) triplets where:
  - Subject: main entity performing the action or being described
  - Predicate: relationship between entities (e.g., 'is', 'works at', 'believes')
  - Object: entity, value, or concept affected by the predicate
- Exclude all temporal expressions from every field
- Use ONLY the predicates listed in "Predicate Instructions" (uppercase English tokens)
- Do NOT translate predicate tokens
- Do NOT include `statement_id` field (assigned automatically)

**When NOT to extract triplets:**
- Non-propositional utterances (emotions, fillers, onomatopoeia)
- No clear predicate from the given definitions applies
- Standalone noun phrases or checklist items (e.g., "三脚架", "备用电池") → extract as entities only
- Do NOT invent generic predicates (e.g., "IS_DOING", "FEELS", "MENTIONS")

**If no valid triplet exists:** Return triplets: [], extract entities if present, otherwise both arrays empty.
{%- if predicate_instructions -%}

**Predicate Instructions:**
Use ONLY these predicates. If none fits, set triplets to [].
{%- for pred, instruction in predicate_instructions.items() %}
- {{ pred }}: {{ instruction }}
{%- endfor -%}
{%- endif -%}


===Examples===

**Example 1 (English):** "I plan to travel to Paris next week and visit the Louvre."
Output:
{
  "triplets": [
    {
      "subject_name": "I",
      "subject_id": 0,
      "predicate": "PLANS_TO_VISIT",
      "object_name": "Paris",
      "object_id": 1,
      "value": null
    },
    {
      "subject_name": "I",
      "subject_id": 0,
      "predicate": "PLANS_TO_VISIT",
      "object_name": "Louvre",
      "object_id": 2,
      "value": null
    }
  ],
  "entities": [
    {
      "entity_idx": 0,
      "name": "I",
      "type": "Person",
      "description": "The user"
    },
    {
      "entity_idx": 1,
      "name": "Paris",
      "type": "Location",
      "description": "Capital city of France"
    },
    {
      "entity_idx": 2,
      "name": "Louvre",
      "type": "Location",
      "description": "World-famous museum located in Paris"
    }
  ]
}

**Example 2 (English):** "John Smith works at Google and is responsible for AI product development."
Output:
{
  "triplets": [
    {
      "subject_name": "John Smith",
      "subject_id": 0,
      "predicate": "WORKS_AT",
      "object_name": "Google",
      "object_id": 1,
      "value": null
    },
    {
      "subject_name": "John Smith",
      "subject_id": 0,
      "predicate": "RESPONSIBLE_FOR",
      "object_name": "AI product development",
      "object_id": 2,
      "value": null
    }
  ],
  "entities": [
    {
      "entity_idx": 0,
      "name": "John Smith",
      "type": "Person",
      "description": "Individual person name"
    },
    {
      "entity_idx": 1,
      "name": "Google",
      "type": "Organization",
      "description": "American technology company"
    },
    {
      "entity_idx": 2,
      "name": "AI product development",
      "type": "WorkRole",
      "description": "Artificial intelligence product development work"
    }
  ]
}

**Example 3 (Chinese):** "我计划下周去巴黎旅行，参观卢浮宫。"
Output:
{
  "triplets": [
    {
      "subject_name": "我",
      "subject_id": 0,
      "predicate": "PLANS_TO_VISIT",
      "object_name": "巴黎",
      "object_id": 1,
      "value": null
    },
    {
      "subject_name": "我",
      "subject_id": 0,
      "predicate": "PLANS_TO_VISIT",
      "object_name": "卢浮宫",
      "object_id": 2,
      "value": null
    }
  ],
  "entities": [
    {
      "entity_idx": 0,
      "name": "我",
      "type": "Person",
      "description": "用户本人"
    },
    {
      "entity_idx": 1,
      "name": "巴黎",
      "type": "Location",
      "description": "法国首都城市"
    },
    {
      "entity_idx": 2,
      "name": "卢浮宫",
      "type": "Location",
      "description": "位于巴黎的世界著名博物馆"
    }
  ]
}

**Example 4 (Chinese):** "张明在腾讯工作，负责AI产品开发。"
Output:
{
  "triplets": [
    {
      "subject_name": "张明",
      "subject_id": 0,
      "predicate": "WORKS_AT",
      "object_name": "腾讯",
      "object_id": 1,
      "value": null
    },
    {
      "subject_name": "张明",
      "subject_id": 0,
      "predicate": "RESPONSIBLE_FOR",
      "object_name": "AI产品开发",
      "object_id": 2,
      "value": null
    }
  ],
  "entities": [
    {
      "entity_idx": 0,
      "name": "张明",
      "type": "Person",
      "description": "个人姓名"
    },
    {
      "entity_idx": 1,
      "name": "腾讯",
      "type": "Organization",
      "description": "中国科技公司"
    },
    {
      "entity_idx": 2,
      "name": "AI产品开发",
      "type": "WorkRole",
      "description": "人工智能产品研发工作"
    }
  ]
}

**Example 5 (Entity Only):** "Tripod" or "三脚架"
Output:
{
  "triplets": [],
  "entities": [
    {
      "entity_idx": 0,
      "name": "Tripod",
      "type": "Equipment",
      "description": "Photography equipment accessory"
    }
  ]
}

===Output Format===

**JSON Requirements:**
- Use only ASCII double quotes (") for JSON structure
- Never use Chinese quotation marks ("") or Unicode quotes
- Escape quotation marks in text with backslashes (\")
- Ensure proper string closure and comma separation
- No line breaks within JSON string values
- The output language should ALWAYS match the input language
- If input is in English, extract statements in English
- If input is in Chinese, extract statements in Chinese
- Preserve the original language and do not translate

{{ json_schema }}