{
  "openapi": "3.0.1",
  "info": {
    "title": "Japanese Text Normalizer & RAG Chunker",
    "description": "Clean Japanese text before RAG or an LLM: full-width letters, half-width katakana, voiced marks, dashes and long vowels, letter-spaced text, broken PDF line breaks, page numbers and headers. URLs, e-mail addresses and fenced code are kept. Optional sentence-aware chunking with overlap.",
    "version": "0.1",
    "x-build-id": "UtnIwGiOoRDDrHjAY"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/quietworkslab~japanese-text-normalizer/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-quietworkslab-japanese-text-normalizer",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/quietworkslab~japanese-text-normalizer/runs": {
      "post": {
        "operationId": "runs-sync-quietworkslab-japanese-text-normalizer",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/quietworkslab~japanese-text-normalizer/run-sync": {
      "post": {
        "operationId": "run-sync-quietworkslab-japanese-text-normalizer",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "datasetId": {
            "title": "Dataset with your text",
            "type": "string",
            "description": "The dataset to clean, for example the output of a scraper or a PDF text extractor. Leave it empty (and leave Texts empty) to try the Actor on built-in sample documents (free). When this Actor runs after another Actor from its Integrations tab, set it to {{resource.defaultDatasetId}}."
          },
          "texts": {
            "title": "Texts",
            "type": "array",
            "description": "Instead of a dataset, the texts to clean as a JSON list of strings, for example [\"最初の文書です。\", \"次の文書です。\"]. Each string is one document. Use either a dataset or texts, not both. The whole input can be up to about 9 MB (Apify refuses a larger input before the run starts); put more text in a dataset."
          },
          "textFields": {
            "title": "Text fields",
            "type": "array",
            "description": "Fields of the dataset items that hold the text, for example text or markdown. Use dots for nested fields (page.content). With several fields, their texts are joined with a blank line in this order. A field may also hold a list of strings.",
            "default": [
              "text"
            ],
            "items": {
              "type": "string"
            }
          },
          "metadataFields": {
            "title": "Fields to copy into metadata",
            "type": "array",
            "description": "Fields of the dataset items copied unchanged into the metadata of every output record, for example url or title (dots for nested fields). A missing field becomes null. With chunking, the metadata is copied into every chunk, so choose small fields. Empty = no metadata.",
            "items": {
              "type": "string"
            }
          },
          "splitIntoChunks": {
            "title": "Split into chunks",
            "type": "boolean",
            "description": "If checked, each document is split into chunks for RAG: whole sentences (split after 。！？, never inside brackets) up to the maximum length, with an overlap. If not checked, each document becomes one record.",
            "default": false
          },
          "maxChunkChars": {
            "title": "Maximum chunk length",
            "minimum": 200,
            "maximum": 100000,
            "type": "integer",
            "description": "Longest chunk, in characters (Unicode code points), from 200. A single sentence longer than this is cut, preferably after 、 or a space.",
            "default": 500
          },
          "chunkOverlapChars": {
            "title": "Chunk overlap",
            "minimum": 0,
            "maximum": 33333,
            "type": "integer",
            "description": "How much of the end of a chunk is repeated at the start of the next one: the last whole sentences that fit in this many characters. At most a third of the maximum chunk length.",
            "default": 50
          },
          "unicodeNormalization": {
            "title": "Unicode normalization",
            "enum": [
              "nfc",
              "nfkc",
              "none"
            ],
            "type": "string",
            "description": "NFC (default) only joins characters that are the same in every font. NFKC also folds compatibility characters, which changes meaning in Japanese text (① → 1, ㈱ → (株), ～ → ~), so it is optional.",
            "default": "nfc"
          },
          "fullwidthAscii": {
            "title": "Full-width letters and digits",
            "enum": [
              "alphanumeric",
              "all",
              "none"
            ],
            "type": "string",
            "description": "Full-width letters and digits become ASCII. Full-width symbols become ASCII only between ASCII letters or digits (ｅｘａｍｐｌｅ．ｃｏｍ, １，０００, １０：３０), so Japanese punctuation such as （注） or 本当！ stays.",
            "default": "alphanumeric"
          },
          "halfwidthKatakana": {
            "title": "Half-width katakana to full width",
            "type": "boolean",
            "description": "ｶﾞｲﾄﾞ → ガイド, ｡｢｣､ → 。「」、",
            "default": true
          },
          "composeVoicedMarks": {
            "title": "Join voiced sound marks",
            "type": "boolean",
            "description": "か + ゛ → が, は + ゜ → ぱ (also the combining marks left by PDF extraction). A mark that has no combined form stays as it is.",
            "default": true
          },
          "presentationForms": {
            "title": "Vertical text forms to normal forms",
            "type": "boolean",
            "description": "Characters from vertical PDF text and small forms: ﹁ → 「, ︵ → （, ︒ → 。, ﹐ → ，",
            "default": true
          },
          "unifyDashes": {
            "title": "Unify long vowels, hyphens and minus signs",
            "type": "boolean",
            "description": "By context: after katakana a dash look-alike becomes ー (コ−ヒ― → コーヒー); between ASCII letters or digits it becomes - (03−1234, Wi‐Fi); before a number it becomes - (−5℃). Dashes used as punctuation (――) stay. ～ becomes 〜.",
            "default": true
          },
          "removeInvisibleCharacters": {
            "title": "Remove invisible characters",
            "type": "boolean",
            "description": "Zero-width spaces, BOM, soft hyphens, direction marks and control characters. Emoji sequences (👨‍👩‍👧) and variation selectors (葛󠄀) are kept.",
            "default": true
          },
          "normalizeWhitespace": {
            "title": "Clean up spaces and blank lines",
            "type": "boolean",
            "description": "Tabs and special spaces (including the full-width space) become one space; spaces next to Japanese punctuation and brackets are removed (日本語 。 → 日本語。); spaces between English words are kept; extra blank lines are removed. Spaces between Japanese words: see the next option.",
            "default": true
          },
          "spacesBetweenJapanese": {
            "title": "Spaces between Japanese words",
            "enum": [
              "letterSpaced",
              "all",
              "keep"
            ],
            "type": "string",
            "description": "Default: removes spaces only in letter-spaced text, where three or more one-letter words follow each other (日 本 語 の 文 章, often left by PDF extraction). Spaces between longer words stay (山田 太郎, 品名 数量 単価), and so do spaces between only one or two one-letter words (林 修). A list of one-letter words such as 日 月 火 水 is joined too. 'Remove all' also joins longer words.",
            "default": "letterSpaced"
          },
          "removeSpacesBetweenJapaneseAndLatin": {
            "title": "Also remove spaces between Japanese and English",
            "type": "boolean",
            "description": "If checked, Apify の Actor → ApifyのActor. Off by default because many writers put these spaces on purpose.",
            "default": false
          },
          "joinBrokenLines": {
            "title": "Join lines broken by PDF extraction",
            "type": "boolean",
            "description": "Joins a line that was cut in the middle of a sentence (Japanese without a space, English with one). Paragraphs, lists, headings, short lines and lines ending with 。 or ： are kept. A document made only of short lines is not changed.",
            "default": true
          },
          "removePageNumbersAndHeaders": {
            "title": "Remove page numbers and repeated headers",
            "type": "boolean",
            "description": "Removes lines such as - 3 -, Page 3 of 10 or 12ページ, and short lines repeated on 3 or more pages next to a page break (a form feed or a page number line): running headers and footers. Off by default because it is a guess: check the result on your documents first.",
            "default": false
          },
          "punctuationStyle": {
            "title": "Japanese comma and period",
            "enum": [
              "keep",
              "japanese",
              "western"
            ],
            "type": "string",
            "description": "Optional: make the Japanese comma and period the same in all documents.",
            "default": "keep"
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}