xref: /freebsd/contrib/file/magic/Magdir/ispell (revision 7af41682a96bf7058b82665c33bb9b1bfa079c17)
1
2#------------------------------------------------------------------------------
3# $File: ispell,v 1.11 2026/04/16 18:06:17 christos Exp $
4# ispell:  file(1) magic for ispell, MySpell, Hunspell and aspell
5#
6# Ispell 3.0 has a magic of 0x9601 and ispell 3.1 has 0x9602.  This magic
7# will match 0x9600 through 0x9603 in *both* little endian and big endian.
8# (No other current magic entries collide.)
9#
10# Updated by Daniel Quinlan (quinlan@yggdrasil.com)
11#
120	leshort&0xFFFC	0x9600		little endian ispell
13>0	byte		0		hash file (?),
14>0	byte		1		3.0 hash file,
15>0	byte		2		3.1 hash file,
16>0	byte		3		hash file (?),
17>2	leshort		0x00		8-bit, no capitalization, 26 flags
18>2	leshort		0x01		7-bit, no capitalization, 26 flags
19>2	leshort		0x02		8-bit, capitalization, 26 flags
20>2	leshort		0x03		7-bit, capitalization, 26 flags
21>2	leshort		0x04		8-bit, no capitalization, 52 flags
22>2	leshort		0x05		7-bit, no capitalization, 52 flags
23>2	leshort		0x06		8-bit, capitalization, 52 flags
24>2	leshort		0x07		7-bit, capitalization, 52 flags
25>2	leshort		0x08		8-bit, no capitalization, 128 flags
26>2	leshort		0x09		7-bit, no capitalization, 128 flags
27>2	leshort		0x0A		8-bit, capitalization, 128 flags
28>2	leshort		0x0B		7-bit, capitalization, 128 flags
29>2	leshort		0x0C		8-bit, no capitalization, 256 flags
30>2	leshort		0x0D		7-bit, no capitalization, 256 flags
31>2	leshort		0x0E		8-bit, capitalization, 256 flags
32>2	leshort		0x0F		7-bit, capitalization, 256 flags
33>4	leshort		>0		and %d string characters
340	beshort&0xFFFC	0x9600		big endian ispell
35>1	byte		0		hash file (?),
36>1	byte		1		3.0 hash file,
37>1	byte		2		3.1 hash file,
38>1	byte		3		hash file (?),
39>2	beshort		0x00		8-bit, no capitalization, 26 flags
40>2	beshort		0x01		7-bit, no capitalization, 26 flags
41>2	beshort		0x02		8-bit, capitalization, 26 flags
42>2	beshort		0x03		7-bit, capitalization, 26 flags
43>2	beshort		0x04		8-bit, no capitalization, 52 flags
44>2	beshort		0x05		7-bit, no capitalization, 52 flags
45>2	beshort		0x06		8-bit, capitalization, 52 flags
46>2	beshort		0x07		7-bit, capitalization, 52 flags
47>2	beshort		0x08		8-bit, no capitalization, 128 flags
48>2	beshort		0x09		7-bit, no capitalization, 128 flags
49>2	beshort		0x0A		8-bit, capitalization, 128 flags
50>2	beshort		0x0B		7-bit, capitalization, 128 flags
51>2	beshort		0x0C		8-bit, no capitalization, 256 flags
52>2	beshort		0x0D		7-bit, no capitalization, 256 flags
53>2	beshort		0x0E		8-bit, capitalization, 256 flags
54>2	beshort		0x0F		7-bit, capitalization, 256 flags
55>4	beshort		>0		and %d string characters
56# ispell 4.0 hash files  kromJx <kromJx@crosswinds.net>
57# Ispell 4.0
580       string          ISPL            ispell
59>4      long            x               hash file version %d,
60>8      long            x               lexletters %d,
61>12     long            x               lexsize %d,
62>16     long            x               hashsize %d,
63>20     long            x               stblsize %d
64
65# Summary:	affixes defition text files for Ispell/MySpell/Hunspell
66# From:		Joerg Jenderek
67# URL:		https://www.openoffice.org/lingucomponent/affix.readme
68#		https://man.archlinux.org/man/hunspell.5.en
69# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/a/affix.trid.xml
70# Note:		called "Affix file" by TrID
71# variant starting with comment character
720		ubyte		0x23
73# look for SET character command followed by whitespace (seems to be often 1 space character) like in:
74# /usr/share/calibre/dictionaries/en-GB/en-GB.aff
75>0		search/60459	SET\040
76# skip scripts like /bin/affixcompress /bin/setupcon /bin/imdbpy2sql.py by checking for valid character SET argument
77# character SET argument like: UTF-8
78>>&0		string		UTF-8
79>>>0		use					spell-aff
80# character SET argument like: ISO8859-1 - ISO8859-10 ISO8859-13 - ISO8859-15
81>>&0		string		ISO8859-
82>>>0		use				spell-aff
83# character SET argument for Russian with Cyrillic alphabet like: KOI8-R KOI8-U
84# no russian support until war against ukraine
85>>&0		string		KOI8-
86#>>>0		use				spell-aff
87# character SET argument for languages with Cyrillic alphabet like: cp1251
88# no cyrillic support until russia war against ukraine
89>>&0		string		cp1251
90#>>>0		use				spell-aff
91# character SET argument for Indian Script Code for Information Interchange (ISCII) like: ISCII-DEVANAGARI
92>>&0		string		ISCII-
93# no example found
94>>>0		use				spell-aff
95# not "real" affix rule files but found as tests unit inside thunderbird sources like:
96# 1463589.aff 1695964.aff 2970240.aff
97>0		default		x
98# look for suffix SFX command followed by whitespace like in:
99# 1695964.aff
100>>0		search/164	SFX\040
101>>>0		use				spell-aff
102# if not real Hunspell/MySpell affix look for ispell variant
103>>0		default		x
104# URL:		https://manpages.debian.org/testing/ispell/ispell.5.en.html
105# look for ispell declaration like in: /usr/lib/ispell/espanol.aff
106>>>0		search/8251	defstringtype
107# defstringtype declaration start with unique name (like "list" "lat" "utf8" "iso" "nroff" often like formatter name)
108# followed by formatter name (like "nroff" "tex")
109# followed by suffix list (like ".mm" ".ms" ".me" ".man" ".NeXT" ".txt" ".list")
110#>>>>&1		string		x		DECLARATION=%s
111>>>>0		use				spell-aff
112# ispell variant without declaration like in: /usr/lib/ispell/bulgarian.aff /usr/lib/ispell/russian.aff
113# XXX: too weak
114#>>>0		default		x
115# skip /etc/nilfs_cleanerd.conf by looking for ispell suffix section
116#>>>>0		search/3233	suffixes\n
117#>>>>>0		use				spell-aff
118# variant starting with empty line and comment character at the beginning of 2nd line like in: /usr/lib/ispell/polish.aff
1190		ubeshort	0x0a23
120# skip /etc/discover-modprobe.conf by looking for ispell declaration
121>2		search/3118	defstringtype
122>>0		use				spell-aff
123# starting with UTF-8 Byte Order Mark (BOM) https://en.wikipedia.org/wiki/Byte_order_mark
1240		string		\xEF\xBB\xBF
125# starting with UTF-8 Byte Order Mark (BOM) followed by comment starting character
126>3		string		\x23
127# starting with UTF-8 BOM and with SET character command followed by whitespace
128# like in: /opt/Wolfram/WolframEngine/13.1/SystemFiles/Components/SpellingData/SpellingDictionaries/lt.aff
129# look for character SET command used in MySpell and Hunspell
130>3		search/9883	SET\040
131>>0		use				spell-aff
132# look for FLAG type command used in MySpell and Hunspell
1330		string		FLAG
134# followed by space character like in
135# /opt/Wolfram/WolframEngine/13.1/SystemFiles/Components/SpellingData/SpellingDictionaries/en_US.aff
136>4		ubyte		0x20
137>>0		use				spell-aff
138# or followed by tabulator character like in
139# /opt/Wolfram/WolframEngine/13.1/SystemFiles/Components/SpellingData/SpellingDictionaries/ar.aff
140>4		ubyte		0x09
141>>0		use				spell-aff
142# starting with character SET command used in MySpell and Hunspell like in: org/languagetool/resource/sv/hunspell/sv_SE.aff
1430		string		SET\040
144>0		use				spell-aff
145# starting with language code LANG used in MySpell and Hunspell like in: /usr/share/hunspell/tr_TR.aff
1460		string		LANG\040
147>0		use				spell-aff
148# starting with affix flag command AF used in MySpell and Hunspell like in: /usr/lib/thunderbird/extensions/langpack-hu@thunderbird.mozilla.org/dictionaries/hu.aff
1490		string		AF\040
150# look for number of flag vector aliases
151>3		regex		[0-9]{1,4}
152>>0		use				spell-aff
153#	display information (encoding,language,...) about affixes rules text for Ispell/MySpell/Hunspell
1540		name				spell-aff
155>1		ubeshort	x		affix definition
156#!:mime		text/plain
157!:mime		text/x-affix
158!:ext		aff
159# GRR: need extra test so that default clause works
160>0		ubyte		x
161# look for ispell declaration
162>>0		search/8251	defstringtype	for Ispell
163# ispell variant without declaration
164>>0		default		x
165# look for ispell suffixes command
166>>>0		search/3233	suffixes
167# skip "suffixes used to create first part of a compound" by checking for flag argument like in: languagetool\resource\sv\hunspell\sv_SE.aff
168>>>>&0		search/2	flag		for Ispell
169>>>>&0		default		x		for MySpell/Hunspell
170# without suffixes keyword
171>>>0		default		x		for MySpell/Hunspell
172# look for language code command used in MySpell and Hunspell
173# like in: /usr/share/hunspell/de_AT.aff /usr/share/hunspell/it_IT.aff /usr/share/hunspell/tr_TR.aff /usr/lib/firefox/browser/extensions/langpack-hu@firefox.mozilla.org/dictionaries/hu.aff
174>>0		search/1117643	LANG\040	\b, language
175# language code argument like: de_DE hu_HU it_IT mn_MN tr_TR
176>>>&0		string		x		%s
177# look for character SET command used in MySpell and Hunspell
178>>0		search/1117729	SET
179# skip SETTINGS like in /usr/lib/ispell/ngerman.aff
180# SET command followed often by space character (0x20) or tabulator (0x09) like in
181# /opt/Wolfram/WolframEngine/13.1/SystemFiles/Components/SpellingData/SpellingDictionaries/ar.aff
182>>>&0	ubyte&0xD6	=0x00
183# skip SSET	#     schosS in /usr/lib/ispell/ogerman.aff
184>>>>&0		ubyte		>0x48		\b,
185# character SET argument like: cp1251 ISCII-DEVANAGAR ISO8859-1 - ISO8859-10 ISO8859-13 - ISO8859-15 KOI8-R KOI8-U UTF-8
186>>>>>&-1	string	x			"%s" encoded
187# for control reasons show first non empty lines for ASCII or ISO-8859 text variant
188>1		ubeshort	!0xBBBF
189# 1st line starting with 0x0A like in /usr/src/dicts/sjp-ispell-pl-20140213/polish.aff
190>>0		ubyte		=0x0A
191>>>1		ubyte		!0x0A		\b, 2nd line
192>>>>&-1		string		x		"%s"
193# 3rd line starting with 0x0A like in polish.aff
194>>>>>&1		ubyte		=0x0A
195>>>>>>&0	string		x		\b, 4th line "%s"
196# 1st line starting with ASCII text like:
197# this is the affix file of the de_DE Hunspell dictionary
198>>0		ubyte		!0x0A
199>>>0		string		x		\b, 1st line "%s"
200>>>>&1		ubyte		>0x1F		\b, 2nd line
201>>>>>&-1	string		x		"%s"
202# 2nd line starting with 0x0A like in /usr/lib/ispell/bulgarian.aff
203>>>>&1		ubyte		=0x0A		\b, 3rd line
204>>>>>&0		string		x		"%s"
205# for control reasons show first lines for variant starting with ByteOrderMark (BOM=\xEF\xBB\xBF)
206>1		ubeshort	=0xBBBF	   	\b, with BOM
207>>3		string		x		\b, 1st line "%s"
208>>>&1		ubyte		>0x1F		\b, 2nd line
209>>>>&-1		string		x		"%s"
210
211# From:		Joerg Jenderek
212# URL:		https://en.wikipedia.org/wiki/GNU_Aspell
213#		https://manpages.ubuntu.com/manpages/trusty/en/man8/aspell-autobuildhash.8.html
214# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/r/rws-aspell.trid.xml
215#		https://ftp.gnu.org/gnu/aspell/aspell-0.60.8.tar.gz
216#		aspell-0.60.8/modules/speller/default/data.cpp
217#		aspell-0.60.8/modules/speller/default/readonly_ws.cpp
218# Note:		called "aspell dictionary" by TrID
2190	string	aspell\040default\040speller\040rowl	aspell dictionary
220#!:mime	application/octet-stream
221!:mime	application/x-aspell-dictionary
222!:ext	rws
223# version like: 1.10 1.4
224>28	string	x					\b, version %s
225# u32int endian_check; 12345678=00BC614Eh
226#>64	ulelong	x					\b, endian_check=%u
227>>64	ulelong	12345678				\b, little endian
228# not tested
229>>64	ubelong	12345678				\b, big endian
230# older aspell version not like 0.60.8
231>>64	default	x					\b, old
232# URL:		https://en.wikipedia.org/wiki/GNU_Aspell
233# Reference	http://aspell.net/man-html/Format-of-the-Personal-and-Replacement-Dictionaries.html
234# personal_ws-1.1 lang num [encoding]
2350	string	personal_				aspell personal
236# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/p/pws-aspell.trid.xml
237# Note:		called "aspell Personal dictionary" by TrID
238>9	string	ws-					dictionary
239#!:mime	text/plain
240!:mime	text/x-aspell-dictionary
241# like: ~/.aspell.en.pws ~/.aspell.de_DE.pws ~/.aspell.it.pws
242!:ext	pws
243# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/p/prepl-aspell.trid.xml
244# Note:		called "aspell Personal Replacement dictionary" by TrID
245# personal_repl-1.1 lang num [encoding]
246>9	string	repl-					replacement dictionary
247#!:mime	text/plain
248!:mime	text/x-aspell-dictionary
249# like: ~/.aspell.en.prepl ~/.aspell.de_DE.prepl ~/.aspell.it.prepl
250!:ext	prepl
251