forked from languagetool-org/languagetool
/
rules.xsd
416 lines (393 loc) · 14.8 KB
/
rules.xsd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!--
* LanguageTool, a natural language style checker
* Copyright (c) Marcin Miłkowski, 2014 (http://www.languagetool.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
* USA
Schema for rule files
-->
<xs:include schemaLocation="pattern.xsd"/>
<xs:annotation>
<xs:documentation xml:lang="en">Main element</xs:documentation>
</xs:annotation>
<xs:element name="rules">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="unification" />
<xs:element ref="phrases"/>
<xs:element ref="category"/>
</xs:choice>
<xs:attribute name="lang" type="xs:language" use="required" />
<xs:attribute name="idprefix" type="xs:string" />
<xs:attribute name="premium" type="binaryYesNo" default="no"/>
<xs:attribute name="integrate">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="replace"/>
<xs:enumeration value="add"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:annotation>
<xs:documentation xml:lang="en">Use the category element to group rules/rulegroups.</xs:documentation>
<xs:documentation xml:lang="en">The attribute name shows the category use, e.g. 'Grammar', 'Spelling', 'Style' etc.</xs:documentation>
</xs:annotation>
<xs:element name="category">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element ref="rule" />
<xs:element ref="rulegroup" />
</xs:choice>
<xs:attribute name="default">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="off" />
<xs:enumeration value="on" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute ref="name" use="required" />
<xs:attribute name="id" type="xs:ID" use="required" />
<xs:attribute name="premium" type="binaryYesNo"/>
<xs:attribute ref="type" />
<xs:attribute name="external" type="binaryYesNo" />
<xs:attribute name="tab" />
<xs:attribute ref="tags" />
<xs:attribute ref="tone_tags" />
<xs:attribute name="is_goal_specific" type="xs:boolean"/>
<xs:attribute name="prio" type="xs:integer" default="0"/>
</xs:complexType>
</xs:element>
<xs:annotation>
<xs:documentation xml:lang="en"> Defines a group of rules
to display several rules as one in the configuration user interface. A group has a unique ID.
The whole rule group can be switched by default off using the attribute 'default'.</xs:documentation>
</xs:annotation>
<xs:element name="rulegroup">
<xs:complexType>
<xs:sequence minOccurs="1">
<xs:element ref="url" minOccurs="0" maxOccurs="1" />
<xs:element ref="short" minOccurs="0" maxOccurs="1" />
<xs:element ref="antipattern" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="rule" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="default">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="off" />
<xs:enumeration value="temp_off" />
<xs:enumeration value="on" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute ref="name" use="required" />
<xs:attribute name="premium" type="binaryYesNo"/>
<xs:attribute name="id" type="xs:ID" use="required" />
<xs:attribute ref="type" />
<xs:attribute ref="tags" />
<xs:attribute ref="tone_tags" />
<xs:attribute name="is_goal_specific" type="xs:boolean"/>
<xs:attribute name="min_prev_matches" use="optional">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="1" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="distance_tokens" use="optional">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="1" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="prio" type="xs:integer" default="0"/>
</xs:complexType>
</xs:element>
<xs:attribute name="type">
<xs:annotation>
<xs:documentation xml:lang="en">
Localization Quality Issue Type, according to Internationalization Tag Set (ITS) Version 2.0,
see http://www.w3.org/International/multilingualweb/lt/drafts/its20/its20.html#lqissue-typevalues
(added in LanguageTool 2.0)
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="terminology" />
<xs:enumeration value="mistranslation" />
<xs:enumeration value="omission" />
<xs:enumeration value="untranslated" />
<xs:enumeration value="addition" />
<xs:enumeration value="duplication" />
<xs:enumeration value="inconsistency" />
<xs:enumeration value="grammar" />
<xs:enumeration value="legal" />
<xs:enumeration value="register" />
<xs:enumeration value="locale-specific-content" />
<xs:enumeration value="locale-violation" />
<xs:enumeration value="style" />
<xs:enumeration value="characters" />
<xs:enumeration value="misspelling" />
<xs:enumeration value="typographical" />
<xs:enumeration value="formatting" />
<xs:enumeration value="inconsistent-entities" />
<xs:enumeration value="numbers" />
<xs:enumeration value="markup" />
<xs:enumeration value="pattern-problem" />
<xs:enumeration value="whitespace" />
<xs:enumeration value="internationalization" />
<xs:enumeration value="length" />
<xs:enumeration value="non-conformance" />
<xs:enumeration value="uncategorized" />
<xs:enumeration value="other" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="tags">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="default" />
<xs:enumeration value="picky" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="tone_tags">
<xs:simpleType>
<xs:list>
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="clarity" />
<xs:enumeration value="formal" />
<xs:enumeration value="professional" />
<xs:enumeration value="confident" />
<xs:enumeration value="academic" />
<xs:enumeration value="povrem" />
<xs:enumeration value="scientific" />
<xs:enumeration value="objective" />
<xs:enumeration value="persuasive" />
<xs:enumeration value="informal" />
<xs:enumeration value="povadd" />
<xs:enumeration value="positive" />
<xs:enumeration value="general" />
</xs:restriction>
</xs:simpleType>
</xs:list>
</xs:simpleType>
</xs:attribute>
<xs:annotation>
<xs:documentation xml:lang="en"> The rule element. The
unique ID is required only if the rule is not contained in a rule group.
The rule can be switched by default off (using the default attribute).
</xs:documentation>
</xs:annotation>
<xs:element name="rule">
<xs:complexType>
<xs:sequence>
<xs:element ref="antipattern" minOccurs="0" maxOccurs="unbounded"/>
<xs:choice>
<xs:element ref="pattern" />
<xs:element ref="regexp" />
</xs:choice>
<xs:element ref="filter" minOccurs="0" maxOccurs="1" />
<xs:element ref="message" />
<xs:element ref="suggestion" minOccurs="0" maxOccurs="15" />
<xs:element ref="url" minOccurs="0" maxOccurs="1" />
<xs:element ref="short" minOccurs="0" />
<xs:element ref="example" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="default">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="off" />
<xs:enumeration value="temp_off" />
<xs:enumeration value="on" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="premium" type="binaryYesNo"/>
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="id" type="xs:ID" />
<xs:attribute ref="type" />
<xs:attribute ref="tags" />
<xs:attribute ref="tone_tags" />
<xs:attribute name="is_goal_specific" type="xs:boolean"/>
<xs:attribute name="min_prev_matches" use="optional">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="1" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="distance_tokens" use="optional">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="1" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="prio" type="xs:integer" default="0"/>
</xs:complexType>
</xs:element>
<xs:element name="pattern">
<xs:complexType>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element ref="token" />
<xs:element ref="phraseref" />
<xs:element ref="and" />
<xs:element ref="or" />
<xs:element ref="unify" />
<xs:element ref="marker" maxOccurs="1"/>
</xs:choice>
<xs:attribute name="case_sensitive" type="binaryYesNo" />
<xs:attribute name="raw_pos" type="binaryYesNo" />
</xs:complexType>
</xs:element>
<xs:element name="regexp">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="case_sensitive" type="binaryYesNo"/>
<xs:attribute name="type" default="smart">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="smart" />
<xs:enumeration value="exact" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="mark">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="1" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:annotation>
<xs:documentation xml:lang="en">A negative-matching pattern used to
mark up complex exceptions in rules. Note: it does not support
phrases and OR operations for simplicity.
</xs:documentation>
</xs:annotation>
<xs:element name="antipattern">
<xs:complexType>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element ref="token" />
<xs:element ref="and" />
<xs:element ref="unify" />
<xs:element ref="marker" />
<xs:element ref="example" minOccurs="0" maxOccurs="unbounded" /><!-- we don't require that, but this element should appear at the end -->
</xs:choice>
<xs:attribute name="case_sensitive" type="binaryYesNo" />
</xs:complexType>
</xs:element>
<xs:annotation>
<xs:documentation xml:lang="en">A short description of
the error detected by this rule displayed on the
context menu in LibreOffice/OpenOffice.org.</xs:documentation>
</xs:annotation>
<xs:element name="short" type="xs:token" />
<xs:annotation>
<xs:documentation xml:lang="en">Message shown to the user if a rule matches.</xs:documentation>
</xs:annotation>
<xs:element name="message" xml:space="preserve">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="suggestion" />
<xs:element ref="match" />
</xs:choice>
<xs:attribute name="suppress_misspelled" type="binaryYesNo"/>
</xs:complexType>
</xs:element>
<xs:element name="filter">
<xs:complexType>
<xs:attribute name="class" type="xs:string" use="required">
<xs:annotation>
<xs:documentation xml:lang="en">A fully qualified Java class that extends the RuleFilter class</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="args" type="xs:string" use="required">
<xs:annotation>
<xs:documentation xml:lang="en">Arguments given to the Java code: a space-separated list with
elements in the form of 'key:\x', where key is the parameter name and x is a number
that refers to the pattern's token. Number and parameter names depend on the Java code.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:annotation>
<xs:documentation xml:lang="en">URL with further information
about the linguistic rule behind this error.</xs:documentation>
</xs:annotation>
<xs:element name="url" type="xs:anyURI" />
<xs:annotation>
<xs:documentation xml:lang="en">Suggestion displayed to the user.</xs:documentation>
</xs:annotation>
<xs:element name="suggestion">
<xs:complexType mixed="true">
<xs:sequence minOccurs='0' maxOccurs='unbounded'>
<xs:element ref="match" />
</xs:sequence>
<xs:attribute name="suppress_misspelled" type="binaryYesNo"/>
</xs:complexType>
</xs:element>
<xs:annotation>
<xs:documentation xml:lang="en">Specifies examples used
in JUnit tests and as documentation.
The attribute 'correction' is used to check if the suggested correction
is correct; multiple suggestions are joined with "|".
The attribute triggers_error is not used by the software.
</xs:documentation>
</xs:annotation>
<xs:element name="example" xml:space="preserve">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="marker">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string"/>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:choice>
<xs:attribute name="correction" type="xs:string" />
<xs:attribute name="type">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="correct" />
<xs:enumeration value="incorrect" />
<xs:enumeration value="triggers_error" />
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="reason" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:attribute name="name">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:schema>