- français
- English
File Format
Since multiple modules will have to communicate, we need to have some common format to represent words, definitions and crosswords. This page describes what choices were available and which one we have selected.
Formats available
We have compared XML with JSON. Both are able to represent a mapping between keys and attribute. We have kept JSON mainly because it is less verbose.
As a JSON parser, we are currently using the one included with the Play Framework. Some good documentation can be found here and here.
Another common (proprietary) file format for crosswords is PUZ (reversed-engineered documentation can be found here, a viewer here). It is composed of:
- a header containing, in particular, the width and height.
- the solution and the current state of the crossword.
- other string arguments, including the clues.
We have made a parser from the PUZ to our internal format, but we do not plan to use this format internally because it's quite cumbersome to manipulate. Instead, we will use JSON.
JSON Format specification
In what follows, arguments in bold are mandatory, those in italic are optional. Any additional attribute is accepted, but we should avoid useless informations and try to have some homogeneity.
Crossword
- "words": (Array of WordClue) the actual content of this grid
- "title": (String) the title of the crossword
- "url": (String) the link to the source page
- "source": (String) the origin of this grid
- "categories": (Array of String) the categories associated. Only some major keywords are accepted (cryptic, ...)
- "author": (String) the author of the grid
- "difficulty": (Int between 0 and 10 with 0 = easiest and 10 = hardest) the difficulty of this grid
- "date": (String) a date formatted as yyyy-mm-dd
- "language": (String) a language indicated by any of these codes
Clue
- "word": (String) the word
- "clue": (String) the clue associated with this word
- "x": (Int) and "y": (Int) the position of the first character, with (0, 0) on at upper left corner
- "direction": (String) direction of the word, it has to be "West", "North", "East" or "South"
Here is an example of a crossword grid:
...
}
Definition
- "word": the word which is defined
- "equivalents": an array of equivalent terms (alternative spelling, acronyms...)
- "associated": an array of close terms (synonyms, antonyms...)
- "definitions": an array of definitions (sentences that explain the word)
- "examples": an array of related sentences (where the word appear, but does not necessary explain it).
Here is an example of a definition :