# Clean Japanese text before sending it to an LLM

**Use case:** 

Normalizes messy Japanese text so that an LLM, a search index or an embedding model sees one consistent form: full-width letters and digits become half-width, half-width katakana becomes full-width, dashes and long vowel marks are unified, invisible characters and letter-spaced text are cleaned. URLs, e-mail addresses and fenced code are kept as they are. Paste your texts or choose a dataset.

## Input

```json
{
  "texts": [
    "ＡＩ活用ガイド（２０２６年版）\nｶｽﾀﾏｰｻﾎﾟｰﾄへの問い合わせは前年より１２％増えました。詳細は https://example.com/report をご覧ください。",
    "お 知 ら せ\n新しいプランは 月額 ９８０円―初月無料です。​お申し込みは support@example.com まで。"
  ],
  "textFields": [
    "text"
  ],
  "metadataFields": [
    "url",
    "title"
  ],
  "splitIntoChunks": false,
  "maxChunkChars": 500,
  "chunkOverlapChars": 50,
  "unicodeNormalization": "nfc",
  "fullwidthAscii": "alphanumeric",
  "halfwidthKatakana": true,
  "composeVoicedMarks": true,
  "presentationForms": true,
  "unifyDashes": true,
  "removeInvisibleCharacters": true,
  "normalizeWhitespace": true,
  "spacesBetweenJapanese": "letterSpaced",
  "removeSpacesBetweenJapaneseAndLatin": false,
  "joinBrokenLines": true,
  "removePageNumbersAndHeaders": false,
  "punctuationStyle": "keep"
}
```

## Output

```json
{
  "documentIndex": {
    "label": "Document index",
    "format": "integer"
  },
  "chunkIndex": {
    "label": "Chunk index",
    "format": "integer"
  },
  "charCount": {
    "label": "Characters",
    "format": "integer"
  },
  "text": {
    "label": "Text",
    "format": "string"
  },
  "metadata": {
    "label": "Metadata",
    "format": "object"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The Japanese Text Normalizer & RAG Chunker Actor is ready to run with the inputs already set for "Clean Japanese text before sending it to an LLM". [Sign up or log in](https://console.apify.com/create-task-from-example/HpggH17iCowatVezf) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Clean Japanese text before sending it to an LLM" task

The Japanese Text Normalizer & RAG Chunker Actor will start running based on the input automatically. You can also change all the input fields, like texts, text fields, and more, to match your specific use case.

### 3. Receive the "Clean Japanese text before sending it to an LLM" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as document index, chunk index, characters, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Clean Japanese text before sending it to an LLM" task via API](https://apify.com/quietworkslab/japanese-text-normalizer.md).

## FAQ

### What does the Japanese text cleaning task change?

The Japanese text cleaning task turns full-width letters and digits into half-width and half-width katakana into full-width, unifies dashes and long vowel marks, removes invisible characters and joins letter-spaced words. NFKC is used only if chosen.

### Are URLs and code changed?

No. The Japanese text cleaning task keeps URLs, e-mail addresses and fenced code blocks unchanged, so links and code stay usable.

### How much does it cost to clean Japanese text?

The Japanese Text Normalizer charges $0.0001 per 1,000 characters of input ($0.10 per million), counting each document as at least 100 characters, plus Apify's Actor start event.

## About this Actor

This example demonstrates how to use [Japanese Text Normalizer & RAG Chunker](https://apify.com/quietworkslab/japanese-text-normalizer.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/quietworkslab/japanese-text-normalizer.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/quietworkslab/japanese-text-normalizer.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
