-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
documentation.lisp
729 lines (520 loc) · 16.4 KB
/
documentation.lisp
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
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
(in-package #:org.shirakumo.oxenfurt)
;;; api.lisp
(docs:define-docs
(variable *api*
"The base endpoint URL of the Oxford dictionary API.")
(variable *app-id*
"Your Oxford dictionary API app ID.
See https://developer.oxforddictionaries.com/admin/applications")
(variable *app-key*
"Your Oxford dictionary API app key.
See https://developer.oxforddictionaries.com/admin/applications")
(type api-call-failed
"Error signalled whenever an API call fails for whatever reason.
See URL
See RESULT
See BODY
See REQUEST")
(function url
"Returns the URL that the request tried to access.
See API-CALL-FAILED")
(function result
"Returns the HTTP return code for the failed access.
See API-CALL-FAILED")
(function body
"Returns the HTTP body as a string.
See API-CALL-FAILED")
(function list-languages
"Returns a list of LANGUAGE-DATASETs that the API supports.
If source-lang is given, only that language is returned.
If source- and target-lang are given, the API only succeeds if a
translation from source to target is possible.
See LANGUAGE-DATASET")
(function list-filters
"Returns a list of possible filters, either for each endpoint, or for a particular one.")
(function list-lexical-categories
"Returns a list of possible lexical categories for the given language or translation.")
(function list-registers
"Returns a list of possible registers for the given language or translation.")
(function list-domains
"Returns a list of possible domains for the given language or translation.")
(function list-regions
"Returns a plist of known regions to their alternate names for the given language.")
(function list-grammatical-features
"Returns a plist of grammatical features to their possible values for the given language.")
(function inflections
"Check whether a given word exists in the dictionary and retrieve its root form.
See WORD")
(function find-word
"Retrieve dictionary information for a given word.
The parameters FILTERS, SYNONYMS/ANTONYMS, TARGET-LANG, and SENTENCES
can only be used one at a time. The API does not support, for instance,
sentences for translations into a target language.
SYNONYMS, ANTONYMS, and SENTENCES are booleans about whether to return
information from the thesaurus or sentence lexicon for the given word.
TARGET-LANG specifies a language for which translations from the given
SOURCE-LANG of the word should be returned.
FILTERS can be a plist of filter keys to lists of filter values.
See LIST-FILTERS for the possible combinations. One additional, special
filter is possible that cannot be combined with other filters: :REGION.
Its value should be a list of available regions to which to constrain
word results. See LIST-REGIONS for possible region names.
See WORD")
(function search-words
"Search the dictionary for matching words.
The query is matched using headwords, lemmatization, and fuzzy matching.
If PREFIX is true, only words starting with the query are considered.
REGIONS can be a list of regions that the words must match.
When TARGET-LANG is given, the translation dictionaries are searched instead.
See MATCH")
(function list-words
"List words matching certain criteria.
FILTERS can be a plist of filter keys to lists of filter values.
See LIST-FILTERS for the possible combinations.
EXCLUDE is the same as FILTERS, but excludes headwords that contain
senses that match the exclude pattern.
EXCLUDE-SENSES is the same as EXCLUDE but excludes matching senses
for headwords.
EXCLUDE-PRIME-SENSES is the same as EXCLUDE but only excludes a
headword if the primary sense matches the pattern.
WORD-LENGTH can either be an integer or a cons of (LOWER . UPPER)
to specify the limits of the word lengths in characters. Both LOWER
and UPPER can be NIL if the limit should only go one way.
PREFIX filters to words that start with the given string.
If EXACT is true, only exact matches are returned.
See WORD")
(function word-frequency
"Returns word usage frequency information.
The LEMMA can either be a single word, or a list of words. In the
latter case, the results are split into the smallest possible units.
CORPUS should always by NMC. Other corpora will require special
support from the Oxford API.
WORDFROM can be the written form of the word to look up, preserving
the capitalisation.
TRUE-CASE can be the written form of the word to look up with
normalised case.
LEXICAL-CATEGORY can be the lexical category to match for the word
to look up. See LIST-LEXICAL-CATEGORIES for available categories.
GRAMMATICAL-FEATURES should be a plist of constraints on the
grammatical features of the specific word to look up.
See LIST-GRAMMATICAL-FEATURES for possible options.
SORT should be one or more fields to sort by. Each field can
either be the name of the field directly, or a cons where the
cdr is one of :ASC or :DSC, denoting the sorting order. The
available fields are :WORDFORM :TRUE-CASE :LEMMA :LEXICAL-CATEGORY
:FREQUENCY :NORMALIZED-FREQUENCY.
FREQUENCY can be a constraint on the allowed frequency. Can be
either a single number for an exact match, or a cons for a lower
and upper bound. Both bounds can be NIL.
NORMALIZED-FREQUENCY can be a constraint on the allowed normalized
frequency. Can be either a single number for an exact match, or a
cons for a lower and upper bound. Both bounds can be NIL.
See FREQUENCY")
(function ngram-frequency
"Returns ngram (multiple word) frequency information.
TOKENS should be either a single list of tokens for one ngram, or
a list of lists. Each sub-list must be the same length.
CORPUS should always by NMC. Other corpora will require special
support from the Oxford API.
CONTAINS can be a list of tokens. If given, only ngrams which
match all of the given tokens. The order of the tokens is
irrelevant.
If PUNCTUATION is true, ngrams that include punctuation are also
included in the results.
FORMAT denotes whether the tokens are returned as a list or as
a single string. For the list, choose :OUP, for a single string,
choose :GOOGLE.
FREQUENCY can be a constraint on the allowed frequency. Can be
either a single number for an exact match, or a cons for a lower
and upper bound. Both bounds can be NIL.
DOCUMENT-FREQUENCY can be a constraint on the required frequency
of the ngram within documents. Can be either a single number for
an exact match, or a cons for a lower and upper bound. Both bounds
can be NIL.
See FREQUENCY"))
;;; objects.lisp
(docs:define-docs
(type antonym
"Represents an antonym of a sense.
See DOMAINS
See ID
See LANGUAGE
See REGIONS
See REGISTERS
See TEXT")
(type cross-reference
"Represents a cross reference between senses.
The KIND shows how the words are related. Can be either
:close-match :related :see-also :variant-spelling :abbreviation
:pre :post.
See ID
See TEXT
See KIND")
(type derivative
"Represents a related entry of a sense.
See DOMAINS
See ID
See LANGUAGE
See REGIONS
See REGISTERS
See TEXT")
(type entry
"A word entry in a lexical entry.
See ETYMOLOGIES
See GRAMMATICAL-FEATURES
See HOMOGRAPH-NUMBER
See NOTES
See PRONUNCIATIONS
See SENSES
See VARIANT-FORMS")
(type example
"Represents an example usage of a word.
See DEFINITIONS
See DOMAINS
See NOTES
See REGIONS
See REGISTERS
See SENSE-IDS
See TEXT
See TRANSLATIONS")
(type frequency
"Container for frequency information of a word or ngram.
In the case of an ngram frequency, only the FREQUENCY and
the TOKENS fields are guaranteed to be set.
See FREQUENCY
See NORMALIZED-FREQUENCY
See LEMMA
See NORMALIZED-LEMMA
See TOKENS
See LEXICAL-CATEGORY
See GRAMMATICAL-FEATURES
See COMPONENTS
See FIRST-MENTION
See TRUE-CASE
See WORDFORM")
(type language-dataset
"Container for information about a language in the API.
See REGION
See SOURCE
See LANGUAGE
See TARGET-LANG
See BILINGUAL-P")
(type lexical-entry
"An entry of lexical information about a word.
This is the primary information container for a word.
See GRAMMATICAL-FEATURES
See INFLECTION-OF
See LANGUAGE
See LEXICAL-CATEGORY
See TEXT
See DERIVATIVE-OF
See DERIVATIVES
See ENTRIES
See NOTES
See PRONUNCIATIONS
See VARIANT-FORMS
See SENTENCES")
(type match
"Represents a match for a word search query.
See ID
See INFLECTION-ID
See MATCH-STRING
See MATCH-TYPE
See REGION
See WORD
See SCORE")
(type note
"A human-readable note about an object.
This usually contains associated, additional information for the
human reader. The KIND is a free-form string that describes what
this note might contain.
See ID
See TEXT
See KIND")
(type pronunciation
"Represents information about the pronunciation of a lexical entry.
See AUDIO-FILE
See DIALECTS
See REGIONS
See PHONETIC-NOTATION
See PHONETIC-SPELLING")
(type sense
"Represents information about a specific sense or meaning of a word.
See ANTONYMS
See CROSS-REFERENCE-MARKERS
See CROSS-REFERENCES
See DEFINITIONS
See DOMAINS
See EXAMPLES
See ID
See NOTES
See PRONUNCIATIONS
See REGIONS
See REGISTERS
See SUBSENSES
See SYNONYMS
See TRANSLATIONS
See VARIANT-FORMS")
(type sentence
"Represents information about an example usage sentence for a word.
See DEFINITIONS
See DOMAINS
See NOTES
See REGIONS
See REGISTERS
See SENSE-IDS
See TEXT
See TRANSLATIONS")
(type synonym
"Represents a synonym of a sense.
See DOMAINS
See ID
See LANGUAGE
See REGIONS
See REGISTERS
See TEXT")
(type translation
"Represents information about a translation of a word into a different language.
See DOMAINS
See GRAMMATICAL-FEATURES
See LANGUAGE
See NOTES
See REGIONS
See REGISTERS
See TEXT")
(type variant-form
"Represents information about an alternate form of a word that can be used interchangeably.
See REGIONS
See TEXT")
(type word
"Represents a specific word in the dictionary.
See ID
See LANGUAGE
See LEXICAL-ENTRIES
See PRONUNCIATIONS
See WORD")
;; Slots
(function antonyms
"Returns the list of antonyms for the sense.
See SENSE")
(function audio-file
"Returns the URL of a sound file for the pronunciation.
See PRONUNCIATION")
(function bilingual-p
"Returns whether the language is bilingual (can be translated).
See LANGUAGE-DATASET")
(function components
"Returns the components of a frequency result.
See FREQUENCY")
(function cross-reference-markers
"Returns a grouping of cross reference notes.
See SENSE")
(function cross-references
"Returns a list of cross-references.
See SENSE")
(function definitions
"Returns a list of definitions for the exact meaning of the object.
See SENSE
See EXAMPLE
See SENTENCE")
(function derivative-of
"Returns a list of other words from which this one derives.
See LEXICAL-ENTRY")
(function derivatives
"Returns a list of other words which derive from this one.
See LEXICAL-ENTRY")
(function dialects
"Returns a list of dialects in which this pronunciation is used.
See PRONUNCIATION")
(function domains
"Returns the name of a subject, discipline, or branch of knowledge related to this object.
See ANTONYM
See SYNONYM
See DERIVATIVE
See SENSE
See EXAMPLE
See TRANSLATION
See SENTENCE")
(function entries
"Returns the list of word entries for this lexical entry.
See LEXICAL-ENTRY")
(function etymologies
"Returns a list of strings describing the etymology of the word.
See ENTRY")
(function examples
"Returns a list of example usages of the word.
See SENSE")
(function first-mention
"Returns a date formatted as a string representing the time this word was first observed.
See FREQUENCY")
(function frequency
"Returns a number representing the usage frequency of the word or ngram.
See FREQUENCY")
(function grammatical-features
"Returns a plist of applicable grammatical features and their values.
See LEXICAL-ENTRY
See FREQUENCY
See TRANSLATION
See ENTRY")
(function homograph-number
"Identifies the homograph grouping.
The last two digits identify different entries of the same homograph.
The first one/two digits identify the homograph number.
See ENTRY")
(function id
"The identifier of the word this object is about.
See ANTONYM
See SYNONYM
See NOTE
See DERIVATIVE
See SENSE
See CROSS-REFERENCE
See MATCH
See WORD")
(function inflection-id
"The identifier for the specific inflection of the word that was matched.
See MATCH")
(function inflection-of
"Returns a list of word IDs for which this lexical entry is an inflection.
See LEXICAL-ENTRY")
(function kind
"Returns an identifier for the kind of data this object carries.
See NOTE
See CROSS-REFERENCE")
(function language
"Returns a language identifier for which this object is meant.
See ANTONYM
See SYNONYM
See DERIVATIVE
See TRANSLATION
See LANGUAGE-DATASET
See LEXICAL-ENTRY
See WORD")
(function lemma
"Returns the lemma for which this frequency applies.
See FREQUENCY")
(function lexical-category
"Returns the linguistic category for which this word qualifies.
Generally the category is defined by the syntactic or morphological
behaviour of the lexical item in question, such as noun or verb.
See FREQUENCY
See LEXICAL-ENTRY")
(function lexical-entries
"Returns a list of lexical entries that this word represents.
See WORD")
(function match-string
"Returns the string that was used to match.
See MATCH")
(function match-type
"Returns the kind of match that occurred.
See MATCH")
(function normalized-frequency
"Returns the normalized frequency number.
This is the frequency per million based on a corpus.
See FREQUENCY")
(function normalized-lemma
"Returns the normalised form of the lemma.
See FREQUENCY")
(function notes
"Returns a list of notes about this object.
See LEXICAL-ENTRY
See ENTRY
See SENSE
See EXAMPLE
See TRANSLATION
See SENTENCE")
(function phonetic-notation
"Returns an identifier for the phonetic notation used to describe the pronunciation.
See PRONUNCIATION")
(function phonetic-spelling
"Returns a string describing how this word should be pronounced in some notation.
See PRONUNCIATION")
(function pronunciations
"Returns a list of possible pronunciations for this object.
See LEXICAL-ENTRY
See ENTRY
See WORD
See SENSE")
(function region
"Returns the name of a region for which this match applies.
See MATCH")
(function regions
"Returns a list of region names to which this object applies.
See ANTONYM
See SYNONYM
See PRONUNCIATION
See DERIVATIVE
See VARIANT-FORM
See SENSE
See EXAMPLE
See TRANSLATION
See SENTENCE")
(function registers
"Returns a list describing the level of language usage, typically with respect to formality.
See ANTONYM
See SYNONYM
See DERIVATIVE
See SENSE
See EXAMPLE
See TRANSLATION
See SENTENCE")
(function score
"Returns a number representing how highly this match scored in the search.
See MATCH")
(function sense-ids
"Returns a list of IDs for senses related to this object.
See EXAMPLE
See SENTENCE")
(function senses
"Returns a list of senses for this entry.
See ENTRY")
(function sentences
"Returns a list of example usage sentences for this lexical entry.
See LEXICAL-ENTRY")
(function source
"Returns a string description of the source of the dictionary.
See LANGUAGE-DATASET")
(function subsenses
"Returns an ordered list of subsenses of a sense.
See SENSE")
(function synonyms
"Returns a list of synonyms for the sense.
See SENSE")
(function target-lang
"Returns a descriptor for the target language of a translation dataset.
See LANGUAGE-DATASET")
(function text
"Returns a full text representation of the object.
See ANTONYM
See SYNONYM
See LEXICAL-ENTRY
See NOTE
See DERIVATIVE
See VARIANT-FORM
See CROSS-REFERENCE
See EXAMPLE
See TRANSLATION
See SENTENCE")
(function tokens
"Returns the ngram tokens for the frequency result.
See FREQUENCY")
(function translations
"Returns a list of translations for the given object.
See SENSE
See EXAMPLE
See SENTENCE")
(function true-case
"Returns a given written realisation of an entry, typically in lower case.
See FREQUENCY")
(function variant-forms
"Returns a list of variant forms for the given object.
See LEXICAL-ENTRY
See ENTRY
See SENSE")
(function word
"Returns a given written or spoken realisation of a an entry, lowercased.
See WORD
See MATCH")
(function wordform
"Returns a given written realisation of an entry, preserving case.
See FREQUENCY"))