rpaka-farmSupport

Writing dictionaries

How to write glossaries, books of quotations, timelines and more in the MyCodex dictionary XML.

Overall structure

The dictionary XML is a format for any collection of entries, not only word dictionaries. Each dictionary declares how its entries are sorted, how they are grouped and what fields they have.

<?xml version="1.0" encoding="UTF-8"?>
<Dictionary version="1" id="lawterms" title="My Legal Glossary" lang="en">
  <Kinds>
    <Kind id="term">Legal term</Kind>
  </Kinds>
  <Collections>
    <Collection id="civil">Civil Code</Collection>
  </Collections>
  <Fields>
    <Field id="importance" label="Importance" type="number" sortable="true" listVisible="true"/>
  </Fields>
  <Sorts>
    <Sort id="headword" label="A to Z" key="headword"/>
    <Sort id="importance" label="Most Important" key="field:importance" asc="false"/>
  </Sorts>
  <Browse group="collection"/>
  <Layout kind="headwordPrimary"/>
  <Entry> … </Entry>
  <Entry> … </Entry>
</Dictionary>

Everything except the entries (<Entry>) is optional, as long as there is at least one entry. The smallest dictionary is just <Entry> elements inside <Dictionary>.

<Kinds>, <Collections>, <Fields> and <Sorts> must always be written with their outer element. A <Kind> written directly under <Dictionary> is not read.

About the dictionary

The attributes of <Dictionary>:

AttributeMeaning
versionFormat version. Currently 1. If omitted, it is read as 1
idDictionary ID. Other dictionaries link to it with this ID
titleDictionary name. If omitted, it is shown as "Dictionary"
langLanguage: ja or en. The marks added to the text, such as quotation marks around examples, follow this language

Types and tags

A type is a category such as a part of speech; each entry has one. Tags (collections) can be added to an entry as many as you like.

<Kinds>
  <Kind id="term">Legal term</Kind>
</Kinds>
<Collections>
  <Collection id="civil">Civil Code</Collection>
  <Collection id="frequent">Common</Collection>
</Collections>

If you leave out id, the label itself becomes the ID.

The following parts of speech can be used by ID without being declared. Declare the same ID to change its label; in an English dictionary, declare the ones you use to give them English labels.

noun / properNoun / pronoun / verb / adjective / adjectivalNoun / adverb / adnominal / conjunction / interjection / particle / auxiliary / prefix / suffix / counter / phrase

Fields of your own

Add fields of your own, such as importance, year or speaker, with <Field>.

AttributeMeaning
idField ID
labelLabel
typeKind of value: text (default) or number. Use number for fields you sort by number
sortableMarks a field used for sorting. The sort options themselves are made with <Sort>
groupableIf true, entries can be grouped by this field
searchableIf true, the field is searched
listVisibleIf true, the value is shown in the entry list

You can write 1 / 0 instead of true / false. Write a value inside an entry, as in <Field id="importance">5</Field>.

Sorting and grouping

Sorting: list <Sort> elements in <Sorts>. The first <Sort> is the order used when the dictionary opens. If there are none, entries are sorted by reading.

key valueOrder
readingBy reading (<Reading>). Entries without a reading are sorted by headword
headwordBy headword
field:field IDBy the value of a field of your own. To sort by number, set the field's type to number

Add asc="false" to reverse the order (largest or newest first).

Grouping: choose one with <Browse group="…"/>.

group valueGrouping
noneNo grouping (default)
kanaRowBy the rows of the Japanese syllabary (あ, か, …)
kindBy type
collectionBy tag
field:field IDBy the value of a field of your own

Layout

Choose how an opened entry looks with <Layout kind="…"/>.

Entries

<Entry id="goodfaith" kind="phrase" collections="civil frequent">
  <Headword>good faith</Headword>
  <Variant>bona fide</Variant>
  <Field id="importance">5</Field>
  <Sense>
    <Definition>Being <Em>unaware</Em> of a particular fact. The opposite of <Ref entry="badfaith">bad faith</Ref>.</Definition>
    <Example>A third party in good faith is protected. <Source law="129AC0000000089" anchor="art_94_p2">Civil Code, Article 94(2)</Source></Example>
    <Note label="Note">It involves no moral judgment.</Note>
  </Sense>
  <Sense>
    <Definition>Honesty and fairness in dealing with others.</Definition>
  </Sense>
  <Etymology>From the Latin bona fides.</Etymology>
</Entry>
Element or attributeMeaning
idEntry ID. Other entries link to it with this ID
kindType. Only one
collectionsTags, separated by spaces or commas
<Headword>Headword
<Reading>Reading. Used for sorting by reading and grouping by syllabary row
<Variant>Another spelling. You can write as many as you like, and they are searched
<Sense>A sense. You can write as many as you like; with two or more, they are numbered ①, ② and so on
<Definition>What the sense means
<Example>An example, shown in quotation marks
<Note>A note. Write its heading, such as "Note", in label
<Etymology>Etymology
<Source>Source. You can write it inside a sense or directly under the entry

The text is shown in this order: senses, etymology, then the entry's source, regardless of the order in the XML.

Text decorations

You can use these decorations in the text.

MarkupDisplay
<Em>emphasis</Em>Bold
<Em style="dots">dots</Em>Emphasis dots over the characters
<Foreign>culpa</Foreign>Foreign term (italic)
<Ruby>漢字<Rt>かんじ</Rt></Ruby>Ruby (reading aid)
<Sup>up</Sup> / <Sub>down</Sub>Superscript / subscript
<Line style="dotted">text</Line>Side line. style takes solid (default), dotted, double or none

For any other element, the tags are ignored and the text inside is shown.

With <Ref> and <Source>, you can link to other entries, dictionaries, laws and web pages. Both take the same attributes.

DestinationMarkup
An entry in the same dictionary<Ref entry="entry ID">…</Ref>
Another dictionary<Ref dict="dictionary ID">…</Ref>
An entry in another dictionary<Ref dict="dictionary ID" entry="entry ID">…</Ref>
A law on e-Gov<Source law="law ID">…</Source>
An article, paragraph or item of a law<Source law="law ID" anchor="art_94_p2">…</Source>
A web page<Ref url="https://…">…</Ref>

The law ID is the ID used on e-Gov Laws Search (the Civil Code is 129AC0000000089).

anchor points to an article, paragraph or item. Article 94 is art_94, Article 38-3 is art_38_3, Article 94, paragraph (2) is art_94_p2, and Article 94, paragraph (2), item (i) is art_94_p2_i1. You can also use the form at the end of e-Gov Laws Search URLs, such as Mp-At_94-Pr_2, as it is. Supplementary provisions and chapters cannot be targeted; the law opens at the beginning.

If you write more than one destination, the first of url, law, dict and entry is used.

Tips

Back to support home