# カスタム辞書を作る

お店のメニュー、クラスメートや先生の名前、専門用語、ゲームのキャラクターなど、内蔵辞書にない言葉は、自分の辞書にしてマダマダに読み込めます。単語リストは 1 行に 1 語のプレーンテキストです。AI に作ってもらうのがいちばん手軽ですが、自分で書くこともできます。

## 読み込むとこう打てます

```text
# ラーメン屋のバイト
店長 | てんちょう | pinyin: dianzhang
ポイントカード | english: point card
エリンギ | chinese: 杏鲍菇 | pinyin: xingbaogu
仕込む | しこむ | pos: v5m
```

- ローマ字の `tenchou`、かなのてんちょう、ピンインの `dianzhang` のどれでも「店長」が出ます。ピンインで打つと、候補の上に読みのてんちょうが表示されます。
- `pointcard` で「ポイントカード」が出ます。
- `xingbaogu` で「エリンギ」が出て、候補の上に「杏鲍菇」が表示されます。
- 「仕込む」を長押しすると、仕込みます、仕込んだなどの活用や敬語を選べます。

読みは正確に書いてください。ピンイン、英語、品詞も、書けるものは書いておくと便利です。

## AI に作ってもらう

```prompt
下の説明に従って、マダマダのカスタム辞書を作ってください。

Madamada Word List: instructions for AI assistants

You are helping someone make a custom dictionary for Madamada (玛嗒玛嗒,
マダマダ), an iOS Japanese keyboard for native Chinese speakers. In Madamada
people type Chinese pinyin to get Japanese kanji, English to get katakana,
and romaji or kana as on any Japanese keyboard. A custom dictionary adds
their own words: the names of people they know, their shop's menu, the terms
of their major, the characters of a game they play.

Your job: talk with them, collect the right words, and deliver one plain-text
word list in the format below. They paste it into the app (词库 > 自定义 >
导入 in Chinese, 辞書 > カスタム > 読み込む in Japanese) and every word works
at once.

Language: talk to the user in the language they write to you in, usually
Chinese or Japanese, for every question and answer. Only the format's keys
(pinyin, english, chinese, pos, priority) stay in English.


== What a word does in the keyboard ==

With this line in the list:

  店長 | てんちょう | pinyin: dianzhang

- typing tenchou in romaji, or てんちょう in kana, offers 店長;
- typing the pinyin dianzhang offers 店長, with its reading てんちょう shown
  above it.

With `english: point card`, typing pointcard offers ポイントカード. With

  エリンギ | chinese: 杏鲍菇 | pinyin: xingbaogu

typing xingbaogu offers エリンギ with 杏鲍菇 shown above it, where the
reading usually goes; the same works for loanwords (チャーシュー with
`chinese: 叉烧 | pinyin: chashao`). With `pos: v1` on a verb, holding the
candidate lets the user pick its conjugations and polite forms. So the
reading must be exactly right, and pinyin, english and pos are worth adding
wherever they apply.


== Steps ==

1. Ask what they need

   Before collecting anything, ask in one short message:
   - the topic, and what they will be typing it for (for example "my
     part-time job at a ramen shop", "my classmates' names", "the terms
     of my major");
   - roughly how many words (suggest 50 to 300) and anything that must be in
     or left out;
   - any material they already have: a list, a menu, a class roster, text
     from a screenshot. Their own material comes first.
   If their first message already answers this, go straight to step 2. Ask
   again later only when something is truly unclear.

2. Collect the words

   - Start from their material, then add what the topic needs. If you can
     search the web, use it for names, product names, place names and
     anything you are not sure of.
   - Every word must be real and used in Japan, in the written form Japanese
     people use. Never invent a word, a reading or a Chinese name. If you
     cannot confirm one, leave it out, or ask.
   - Readings are where mistakes happen. Names often read irregularly
     (東海林 is しょうじ); check each one. If a name has several readings and
     you cannot tell which one they mean, ask, or give one line per reading.
   - Include what they will actually type: the full form and the common short
     form (スマートフォン and スマホ), verbs and adjectives in their dictionary
     form (食べる, not 食べます).

3. Write the list in the format below.

4. Check every line before you answer, and fix what fails:
   - The first line is `# ` and the list's name.
   - Every other line is a word line, a blank line, or a `#` comment.
   - Each reading is the real reading of that word, in hiragana. Read every
     kanji word's reading once more.
   - No value contains `|`, an ASCII comma `,` or a double quote `"`.
   - Each pinyin and english value is letters only, 2 to 40 letters once
     spaces are removed.
   - Each pos is from the table and fits the reading's ending.
   - Each priority is a whole number from 1 to 9999.
   - No line repeats another; every word is one you could confirm.
   If you can run code, write a short script for these checks and run it.

5. Deliver

   - Put the whole list in ONE code block, with nothing else inside it.
   - After the block, in the user's language: how many words it has, and how
     to import it: copy the block, then in Madamada open 词库 > 自定义 > 导入 >
     粘贴 (辞書 > カスタム > 読み込む > ペースト). A saved .txt file works too:
     导入 > 选择文件 (読み込む > ファイルを選ぶ), or share the file to Madamada.
   - More than about 300 words: if you can create files, offer a .txt file to
     download. Otherwise split the list into parts of about 300 words, each
     a complete list with its own name line (for example "拉面店打工 1",
     "拉面店打工 2"); each part is imported on its own.
   - Then answer their questions and make the changes they ask for, in their
     language, giving the whole updated list again each time.


== Format ==

  # 拉面店打工
  店長 | てんちょう | pinyin: dianzhang
  山田 | やまだ | pinyin: shantian | priority: 9000 | note: 店长
  替え玉 | かえだま
  まかない
  チャーシュー | chinese: 叉烧 | pinyin: chashao
  ポイントカード | english: point card
  仕込む | しこむ | pos: v5m
  濃い | こい | pos: adj-i

The file

- Plain UTF-8 text, one word per line.
- The first line is `# ` and the list's name, in the user's language, at most
  40 characters.
- Blank lines are fine. Any later line starting with `#` is a comment; you
  may use comments as section headings.
- No header row, no line numbers, no quotes around values.
- At most 100,000 words, 1,024 bytes per line and 8 MB. The app keeps up to
  20 custom dictionaries.

A word line

  word | reading | key: value | key: value ...

- Fields are separated by `|`. The first is the word, the second its
  reading; the rest are `key: value` pairs, in any order.
- pinyin and english may appear more than once on a line. A word with two
  readings takes two lines.
- Any other field is ignored, so `note: ...` can carry a short note.

word (required)
  How the word is written, exactly as it should appear. At most 32
  characters. No `|`, ASCII comma or double quote, and it must not start with
  `=`, `+`, `-` or `@`.

reading (required, except for a word written only in kana)
  Its Japanese reading in hiragana; the long vowel mark ー is allowed (らーめん).
  No spaces, romaji or kanji, at most 32 characters. Leave the reading out
  only when the word is written entirely in kana (まかない, チャーシュー);
  the word itself is then the reading. A word with any other character (漢字,
  ・, letters, digits) needs its reading.

pinyin: (optional, may repeat)
  The pinyin a Chinese speaker would type for this word. Give it in two cases:
  - The word is written only in kanji (々 counts), 2 to 6 of them: write the
    Mandarin reading of each character, with Japanese forms turned into their
    simplified Chinese ones: 店長 > 店长 > dianzhang, 駅前 > 驿前 > yiqian,
    新宿 > xinsu. A character with two common readings gets two pinyin
    fields (錦糸町: jinsiding, jinsiting).
  - The line has a `chinese:` name: write that name's pinyin
    (杏鲍菇 > xingbaogu).
  Otherwise leave it out; never write the Japanese reading in romaji here.
  No tones, ü is v (女性 > nvxing). 2 to 40 letters; spaces and tone marks
  are tolerated and removed.

english: (optional, may repeat)
  An English word or phrase that should also bring up this word. Give it for
  katakana words borrowed from English, as their English source
  (ポイントカード: point card, アイスクリーム: ice cream). Leave it out for
  loanwords from other languages (アルバイト), made-in-Japan English
  (サラリーマン) and words whose sense you are unsure of. 2 to 40 letters once
  spaces, hyphens and other marks are removed.

chinese: (optional, once per line)
  The usual Simplified Chinese name of the same thing, shown above the
  candidate when the user typed its pinyin. Give it when the Japanese is
  written in a way a Chinese reader would not recognise: katakana names and
  loanwords (ニューヨーク: 纽约, チャーシュー: 叉烧), or kanji that mean
  something else in Chinese. For a character, work or place from anime,
  games or books, use the name of the mainland Chinese release, or else the
  name Chinese fans most commonly use. Only a name you are sure of; with it,
  give its pinyin. A thing with two common Chinese names takes one line per
  name, each with its own pinyin (マグロ: 金枪鱼 jinqiangyu, and 吞拿鱼
  tunnayu). Same character rules as word.

pos: (optional, once per line)
  The part of speech. Leave it out for nouns, names and phrases. Give it for
  verbs and adjectives so their conjugations work; the reading must end as
  the table says, or the line is rejected.

  v1      ichidan verb: reading ends in る after an い- or え-row kana
          (食べる, 起きる)
  v5k v5g v5s v5t v5n v5b v5m v5r v5u
          godan verb ending in く ぐ す つ ぬ ぶ む る う (書く: v5k, 仕込む: v5m)
  vk      来る and verbs ending in くる
  vs      a noun that takes する, written without する (勉強)
  adj-i   い-adjective: reading ends in い (濃い)
  adj-na  な-adjective, written without な (静か)
  adv     adverb
  prt     particle
  other   interjections, set phrases, anything else
  n       noun (the default)

priority: (optional, once per line)
  1 to 9999, default 5000; higher comes first among words read the same way.
  9000 or more puts the word before common words with its reading (the
  user's own name, their shop's name); below 5000 puts it after them.
```

- [ChatGPT を開く](https://chatgpt.com/)

## 読み込む

AI はどんな辞書を作るかを聞いてから、言葉を集めて整え、1 行ずつチェックして、単語リストをコードブロックで返します。単語リストをコピーし、App の「辞書 › カスタム」で「読み込む › ペースト」をタップします。AI が .txt ファイルをくれたときは「読み込む › ファイルを選ぶ」をタップするか、ほかの App からマダマダに共有します。

## 単語リストの形式

```text
# ラーメン屋のバイト
店長 | てんちょう | pinyin: dianzhang
山田 | やまだ | pinyin: shantian | priority: 9000 | note: 店長
替え玉 | かえだま
まかない
チャーシュー | chinese: 叉烧 | pinyin: chashao
ポイントカード | english: point card
仕込む | しこむ | pos: v5m
濃い | こい | pos: adj-i
```

- UTF-8 のプレーンテキストで、1 行に 1 語です。最大 10 万語、1 行 1,024 バイト、ファイル全体で 8 MB までです。
- 1 行目は `# ` と辞書の名前で、40 文字までです。2 行目以降の `#` で始まる行はコメントで、小見出しにも使えます。空行があってもかまいません。
- 列名の行や行番号は入れず、値を引用符で囲みません。
- 各行は `|` で区切り、単語、ひらがなの読みの順に書いて、そのあとに `キー: 値` を好きな順で続けます。全角の `｜` と `：` でも読み込めます。対応していないキーは無視されるので、`note:` でメモを残せます。
- 読みが 2 つある言葉は 2 行に分けます。`pinyin` と `english` は 1 行に何度でも書けますが、`chinese`、`pos`、`priority` は 1 行に 1 回だけです。

| 項目 | 書くこと |
| --- | --- |
| 単語（必須） | 確定したときに出したいとおりの書き方。32 文字まで |
| 読み | ひらがな。長音符ーも使えます（らーめん）。32 文字まで。かなだけで書く単語は省略できます |
| `pinyin:` | 中国語ネイティブが打つピンイン。下で説明します |
| `english:` | 元の英語。下で説明します |
| `chinese:` | 簡体字の中国語名。ピンインで出したとき候補の上に表示されます |
| `pos:` | 品詞。下で説明します |
| `priority:` | 優先度。1 から 9999、省略すると 5000 |

単語と中国語名は 32 文字までで、`|`、半角カンマ、ダブルクォートは入れられず、`=`、`+`、`-`、`@` で始めることもできません。読みにはスペース、ローマ字、漢字を入れられません。かな以外の文字（漢字、・、アルファベット、数字）が 1 つでも入る単語には読みが必要です。

## ピンインの書き方

`pinyin:` を書くのは次の 2 つの場合です。

- 単語が漢字だけ（々を含む）で 2 から 6 文字のとき。1 文字ずつ中国語（普通話）の読みで書き、日本の字体は簡体字に直して読みます。店長 → 店长 → `dianzhang`、駅前 → 驿前 → `yiqian`、新宿 → `xinsu`。よく使う読みが 2 つある字は `pinyin:` を 2 つ書きます。錦糸町なら `jinsiding` と `jinsiting` です。
- その行に `chinese:` があるとき。中国語名のピンインを書きます。杏鲍菇 → `xingbaogu`。

それ以外は書きません。日本語の読みをローマ字にして入れることもしません。声調はつけず、ü は v と書きます（女性 → `nvxing`）。アルファベット 2 から 40 文字で、スペースと声調記号は自動で取り除かれます。

## 英語と中国語名

`english:` は英語から来たカタカナ語にだけ、元の英語を書きます。ポイントカードなら `point card`、アイスクリームなら `ice cream`。英語以外から来た外来語（アルバイト）、和製英語（サラリーマン）、意味に自信のない言葉には書きません。アルファベットとスペースだけで書き、スペースを除いて 2 から 40 文字にします。

`chinese:` には、それを中国語でふつう何と呼ぶかを簡体字で書きます。ピンインで出したとき、ふだん読みが出る候補の上に表示されます。日本語の書き方では中国語話者にわからないときに使います。カタカナの人名、地名、外来語（ニューヨーク：纽约、チャーシュー：叉烧）や、中国語では意味が違う漢字の言葉です。アニメ、ゲーム、本のキャラクター、作品、地名は、中国大陸の公式訳名を使い、なければ中国語圏のファンにいちばん通じる呼び方にします。

確かな名前だけを書き、書いたらそのピンインも添えます。よく使う中国語名が 2 つあれば 1 行ずつ分けて、それぞれにピンインをつけます。マグロなら金枪鱼 `jinqiangyu` と吞拿鱼 `tunnayu` の 2 行です。

## 品詞

動詞、形容詞、「する」がつく名詞に `pos:` を書くと、長押しで活用や敬語を選べます。ふつうの名詞、人名、フレーズには書きません。読みの終わりが品詞と合わない行は読み込まれません。

| pos | 使う言葉 |
| --- | --- |
| `v1` | 一段動詞。読みがい段・え段のかなと「る」で終わる：食べる、起きる |
| `v5k` `v5g` `v5s` `v5t` `v5n` `v5b` `v5m` `v5r` `v5u` | 五段動詞。読みがそれぞれ「く」「ぐ」「す」「つ」「ぬ」「ぶ」「む」「る」「う」で終わる：書くは `v5k`、仕込むは `v5m` |
| `vk` | 来る、「くる」で終わる動詞 |
| `vs` | 「する」がつく名詞。「する」は書かない：勉強 |
| `adj-i` | い形容詞。読みが「い」で終わる：濃い |
| `adj-na` | な形容詞。「な」は書かない：静か |
| `adv` | 副詞 |
| `prt` | 助詞 |
| `other` | 感動詞、決まり文句など |
| `n` | 名詞。書かなければこれになります |

## 優先度

`priority:` は 1 から 9999 の整数で、省略すると 5000 です。読みが同じ言葉では、数字の大きいほうが先に出ます。9000 以上なら同じ読みのよく使う言葉より前に出るので、自分の名前やお店の名前に向いています。5000 未満なら、よく使う言葉のあとになります。

## AI の手順

AI は次の手順で作ります。やりとりはすべてユーザーの言語で行い、形式のキー名（pinyin、english、chinese、pos、priority）だけは英語のままにします。

1. 集める前に、短いメッセージ 1 通で聞きます。何に使うか（「ラーメン屋のバイト」「クラスメートの名前」「専攻の用語」など）、だいたい何語か（50 から 300 語がおすすめ）、必ず入れたい言葉や外したい言葉、手元の資料（名簿、メニュー、スクリーンショットの文字など）。最初のメッセージでわかっていればすぐに集め始め、そのあとは本当にわからないときだけ聞きます。
2. ユーザーの資料から始め、テーマに必要な言葉を足します。ウェブ検索ができるなら、人名、商品名、地名、自信のない言葉を調べます。どの言葉も日本で実際に使われているもので、日本で使われている書き方にします。言葉、読み、中国語名を作り出さず、確かめられないものは入れないか、ユーザーに聞きます。人名の読みは不規則なことが多い（東海林はしょうじ）ので、1 つずつ確かめます。読みが複数あってどれかわからないときは、聞くか、読みごとに 1 行ずつ書きます。正式な形とよく使う略語の両方（スマートフォンとスマホ）を入れ、動詞とい形容詞は辞書形（食べますではなく食べる）にし、「する」がつく名詞は「する」を、な形容詞は「な」を外します（勉強、静か）。
3. 上の形式で単語リストを書きます。辞書の名前はユーザーの言語にします。
4. 返す前に 1 行ずつ確かめ、合わないものは直します。
   - 1 行目は `# ` と辞書の名前。
   - それ以外の行は、単語の行、空行、`#` のコメントのどれか。
   - 読みを書いた行では、読みがその言葉の本当の読みで、ひらがな。漢字の言葉はもう一度読みを確かめる。
   - 値に `|`、半角カンマ、ダブルクォートがない。
   - `pinyin` と `english` は、スペースを除いて 2 から 40 文字のアルファベット。
   - `pos` は上の表にあるもので、読みの終わりと合っている。
   - `priority` は 1 から 9999 の整数。
   - 同じ行が重複していない。どの言葉も確かめたもの。

   コードを実行できるなら、これを確かめる短いスクリプトを書いて実行します。
5. 1 つの単語リストを 1 つのコードブロックに入れ、ブロックの中にはほかのものを入れません。ブロックのあとに、何語あるかと読み込み方をユーザーの言語で書きます。ブロックをコピーし、マダマダの「辞書 › カスタム」で「読み込む › ペースト」をタップすれば読み込めます（中国語の画面では「词库 › 自定义 › 导入 › 粘贴」）。.txt ファイルなら「読み込む › ファイルを選ぶ」（「导入 › 选择文件」）で選ぶか、ほかの App からマダマダに共有します。300 語を超えるときは、ファイルを作れるなら .txt ファイルを渡します。作れなければ 300 語ほどずつに分け、それぞれを名前の行のある完全なリスト（「ラーメン屋のバイト 1」「ラーメン屋のバイト 2」など）にして別々のコードブロックに入れ、1 つずつコピーして読み込んでもらいます。そのあとは頼まれた修正をして、毎回リスト全体を出し直します。

## よくある質問

**読み込むと「スキップ」と出た**
問題のある行は読み込まれず、何行目がなぜ読み込めなかったかが表示されます。その表示を AI に送って直してもらうか、自分で直して読み込み直してください。

**単語リストを直したい**
直したいところを AI に伝えると、リスト全体を出し直してくれます。読み込み直すと辞書が 1 つ増えるので、古いほうは削除してください。

**友だちと共有できますか？**
単語リストはただのテキストです。そのまま送って、マダマダで読み込んでもらえば使えます。

---

マダマダ ヘルプセンター：https://madamada.catchingnow.com/ja/help/
