# Japanese Text Toolkit — Furigana, Romaji & Wakachigaki (`asuka-muse/japanese-text-toolkit`) Actor

Annotate Japanese text with furigana readings, convert it to Hepburn romaji, and segment it into words (wakachigaki) using morphological analysis. Runs fully offline inside the container — no external APIs, no data retention.

- **URL**: https://apify.com/asuka-muse/japanese-text-toolkit.md
- **Developed by:** [Asuka Muse](https://apify.com/asuka-muse) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

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 examples already wired to this Actor's own input schema, see the [API](#api) section below.

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`).

# README

## Japanese Text Toolkit — Furigana, Romaji & Wakachigaki

Convert Japanese text into learner- and machine-friendly forms with morphological analysis (kuromoji / IPADIC):

- **Furigana** — kanji words annotated with their hiragana reading: `東京（とうきょう）`
- **Reading** — the whole text rewritten in hiragana
- **Romaji** — Hepburn-style romanization built from the actual readings (particles は → *wa*, へ → *e*)
- **Wakachigaki** — word segmentation: the text split into words with spaces

Everything runs **fully offline inside the container**. No external APIs are called, no text is sent anywhere, and input text is never stored or logged — it is processed in memory and returned as dataset items.

### Who is it for?

- **Japanese learners & teachers** — generate reading aids and study material in bulk
- **Translators & localizers** — pre-process Japanese source text, check readings before translation
- **Developers** — TTS pre-processing, search indexing, NLP pipelines, furigana rendering for apps
- **AI agents** — a deterministic Japanese text-normalization step callable via the Apify API / MCP

### Usage

Provide either a single text or a list of texts, and pick a conversion mode.

#### Input

| Field | Type | Description |
|---|---|---|
| `text` | string | A single Japanese text to process |
| `texts` | string\[] | Multiple texts, processed in one run (takes precedence over `text`) |
| `mode` | string | `all` (default), `furigana`, `romaji`, or `wakachi` |
| `includeTokens` | boolean | Also output the morphological token list (surface, reading, part of speech). Default `false` |

```json
{
  "texts": ["東京特許許可局に行きます。", "私は日本語を勉強しています。"],
  "mode": "all"
}
```

#### Output

One dataset item per input text:

```json
{
  "input": "東京特許許可局に行きます。",
  "furigana": "東京（とうきょう）特許（とっきょ）許可（きょか）局（きょく）に行き（いき）ます。",
  "reading": "とうきょうとっきょきょかきょくにいきます。",
  "romaji": "Toukyou tokkyo kyoka kyoku ni iki masu.",
  "wakachi": "東京 特許 許可 局 に 行き ます 。"
}
```

More examples:

| Input | Furigana | Romaji |
|---|---|---|
| 今日は良い天気ですね。 | 今日（きょう）は良い（よい）天気（てんき）ですね。 | Kyou wa yoi tenki desu ne. |
| 彼は明日、飛行機で北海道へ行くと言った。 | 彼（かれ）は明日（あした）、飛行機（ひこうき）で北海道（ほっかいどう）へ行く（いく）と言っ（いっ）た。 | Kare wa ashita, hikouki de hokkaidou e iku to i ta. |
| すもももももももものうち | （all kana — no annotation needed） | Sumomo mo momo mo momo no uchi |

### Pricing

Pay-per-event: **$0.002–$0.005 per processed text** (one `result` event per input text). No platform-external costs — the analyzer and dictionary are bundled with the Actor.

> Maintainer note: the pay-per-event event is named `result` and is charged from the code via `Actor.charge()`. The matching event must be defined in the Actor's monetization settings in Apify Console for billing to take effect.

### Accuracy notes (please read)

Readings come from a statistical morphological analyzer (IPADIC dictionary), not a human. Known limitations:

- **Context-dependent readings can be wrong.** Words with multiple readings (e.g. 人気 = にんき/ひとけ, 一日 = ついたち/いちにち, proper nouns and place names) are resolved statistically and may occasionally miss.
- **Romaji style:** long vowels are written as vowel sequences (`とうきょう` → `toukyou`, not `tōkyō`); ん is always `n` (しんぶん → `shinbun`, not `shimbun`). Auxiliary verbs follow token boundaries (`しています` → `shi te i masu`).
- **Very new slang, rare kanji, and unusual names** may be split or read incorrectly.
- The dictionary loads once at startup (~2 seconds); subsequent texts in the same run are processed in milliseconds.

For learner-facing or publication use, spot-check important readings.

### Privacy

Your input text is processed in memory inside the Actor container and written only to your own run's dataset. The Actor makes **no network calls** and keeps no copies.

### Technical details

- Node.js 22, [kuromoji](https://github.com/takuyaa/kuromoji.js) (IPADIC) for morphological analysis, [wanakana](https://github.com/WaniKani/WanaKana) for kana→romaji conversion
- Dictionary bundled in the image (~17 MB compressed) — startup and results are deterministic

# Actor input Schema

## `includeTokens` (type: `boolean`):

If true, each result also includes the morphological token list (surface, reading, part of speech) used for the conversion.

## `mode` (type: `string`):

Which conversions to run: 'all' (furigana + romaji + wakachi), or a single one: 'furigana', 'romaji', 'wakachi'.

## `text` (type: `string`):

A single Japanese text to process. Use this OR the 'Texts' field below.

## `texts` (type: `array`):

A list of Japanese texts to process in one run. Takes precedence over the single 'Text' field when both are given.

## Actor input object example

```json
{
  "includeTokens": false,
  "mode": "all",
  "text": "東京特許許可局に行きます。",
  "texts": [
    "東京特許許可局",
    "日本語を勉強しています。"
  ]
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset containing all results

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("asuka-muse/japanese-text-toolkit").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("asuka-muse/japanese-text-toolkit").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call asuka-muse/japanese-text-toolkit --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,asuka-muse/japanese-text-toolkit"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/2yuMKRFSXWq3c5Mi4/builds/xxOY7p4IwGv5woPqD/openapi.json
