# Fix broken line breaks in text copied from Japanese PDFs

**Use case:** 

Text extracted from Japanese PDFs often breaks in the middle of sentences and carries page numbers such as － 1 － and the same header on every page. This task joins the broken lines back into sentences, removes page numbers and headers repeated near page breaks, and normalizes the characters; paragraphs and lists stay separate. Joining and header removal are guesses: check the result.

## Input

```json
{
  "texts": [
    "２０２６年度　事業報告書\n当社は今年度、新しい会員向けサービスを開始し、会員数は前年より\n約２割増えました。来年度は、地方の拠点を増やし、より多くの地\n域でサービスを提供する予定です。\n\n－ 1 －\n２０２６年度　事業報告書\n主な取り組みは次のとおりです。\n・会員向けアプリの改善\n・問い合わせ窓口の時間延長\n\n－ 2 －\n２０２６年度　事業報告書\n来年度の課題は、問い合わせへの回答までの時間を短くすることと、\n新しい地域での認知を高めることです。\n\n－ 3 －"
  ],
  "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": true,
  "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 "Fix broken line breaks in text copied from Japanese PDFs". [Sign up or log in](https://console.apify.com/create-task-from-example/WLMSDWfwRYErOx3uR) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Fix broken line breaks in text copied from Japanese PDFs" 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 "Fix broken line breaks in text copied from Japanese PDFs" 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 "Fix broken line breaks in text copied from Japanese PDFs" task via API](https://apify.com/quietworkslab/japanese-text-normalizer.md).

## FAQ

### How does the PDF line break task know which lines to join?

The PDF line break task joins a line with the next one when the sentence continues. It never joins after 。 or ：, before a list item or heading, or after a short line, and it needs at least one long line in the document.

### Which page numbers and headers are removed?

The PDF line break task removes lines that are only a page number, such as － 3 －, and short lines that repeat at least 3 times near page breaks, such as a running header. This step is off by default in the Actor and on in this task.

### Does the task extract text from PDF files?

No. The PDF line break task cleans text that was already extracted, for example by a PDF text extraction Actor whose output dataset you choose as the input.

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