calculate_annotation_position
Calculate character offset and length for Cookidoo recipe-step annotations (TTS, MODE, INGREDIENT, VOLUME), translating JavaScript UTF-16 positions to Python indexes even with emoji.
Instructions
Calculate Cookidoo's offset and length for text inside a recipe step.
Cookidoo uses JavaScript UTF-16 character positions, which differ from normal Python string indexes when text before the marker contains emoji. Use this tool for every TTS, MODE, INGREDIENT, and VOLUME annotation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | ||
| marker | Yes | ||
| occurrence | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |