parse_wiktionary_cs/lib.rs
1// Copyright 2018 Fredrik Portström <https://portstrom.com>
2// This is free software distributed under the terms specified in
3// the file LICENSE at the top-level directory of this distribution.
4
5//! Parse dictionary pages from the Czech language edition of Wiktionary into structured data.
6//!
7//! For general information about Parse Wiktionary, see the readme file.
8//!
9//! # Examples
10//!
11//! This example prints all definitions found in an article, together with the language and part of speech of the entry.
12//!
13//! ```
14//! # extern crate parse_wiki_text;
15//! # extern crate parse_wiktionary_cs;
16//! #
17//! let wiki_text = concat!(
18//! "==čeština==\n",
19//! "===sloveso===\n",
20//! "====význam====\n",
21//! "#Protestovat proti absurdnímu příkazu nebo povinnosti prostřednictvím ",
22//! "jestě absurdněji puntičkářského a nadšeného chování"
23//! );
24//! let configuration = parse_wiktionary_cs::create_configuration();
25//! let parsed_wiki_text = configuration.parse(wiki_text);
26//! let parsed_article = parse_wiktionary_cs::parse(wiki_text, &parsed_wiki_text.nodes);
27//! # let mut found = false;
28//! for language_entry in parsed_article.language_entries {
29//! for pos_entry in language_entry.pos_entries {
30//! for definition in pos_entry.definitions {
31//! println!(
32//! "The word 'švejkovat' of language {language:?} and part of speech {pos:?} has the definition: {definition}",
33//! language = language_entry.language,
34//! pos = pos_entry.pos,
35//! definition = &definition.definition.iter().map(|node| match node {
36//! parse_wiktionary_cs::Flowing::Text { value } => value,
37//! _ => ""
38//! }).collect::<String>()
39//! );
40//! # found = true;
41//! }
42//! }
43//! }
44//! # assert!(found);
45//! ```
46
47#![forbid(unsafe_code)]
48#![warn(missing_docs)]
49
50extern crate parse_wiki_text;
51extern crate serde;
52#[macro_use]
53extern crate serde_derive;
54
55mod configuration;
56mod definition;
57mod details;
58mod etymology;
59mod external_links;
60mod hyphenation;
61pub mod inflection;
62mod inflection_field;
63mod language;
64mod languages;
65mod pos;
66mod pronunciation;
67mod related_terms;
68mod section;
69mod templates;
70mod translations;
71mod util;
72
73pub use configuration::create_configuration;
74pub use languages::Language;
75use parse_wiki_text::{ListItem, Node, Parameter};
76use section::*;
77use std::{borrow::Cow, collections::HashMap};
78use util::*;
79
80/// Audio sample.
81#[derive(Debug, Deserialize, Serialize)]
82pub struct Audio<'a> {
83 /// The file name referred to.
84 pub file_name: Cow<'a, str>,
85
86 /// The label to display for the audio sample.
87 pub label: Cow<'a, str>,
88}
89
90/// A single definition from a list of definitions of an entry.
91///
92/// Parsed from a single list item in the section `význam`.
93#[derive(Debug, Deserialize, Serialize)]
94pub struct Definition<'a> {
95 /// A series of elements to display as the definition.
96 #[serde(default, skip_serializing_if = "Vec::is_empty")]
97 pub definition: Vec<Flowing<'a>>,
98
99 /// List of example sentences belonging to the definition, from the template [`Příklad`](https://cs.wiktionary.org/wiki/%C5%A0ablona:P%C5%99%C3%ADklad).
100 #[serde(default, skip_serializing_if = "Vec::is_empty")]
101 pub examples: Vec<Cow<'a, str>>,
102
103 /// List of labels, from the template [`Příznaky`](https://cs.wiktionary.org/wiki/%C5%A0ablona:P%C5%99%C3%ADznaky).
104 ///
105 /// Duplicate labels are not allowed.
106 #[serde(default, skip_serializing_if = "Vec::is_empty")]
107 pub labels: Vec<Cow<'a, str>>,
108
109 /// A text to display as a phrase, if any, from the template [`Vazba`](https://cs.wiktionary.org/wiki/%C5%A0ablona:Vazba).
110 #[serde(skip_serializing_if = "Option::is_none")]
111 pub phrase: Option<Cow<'a, str>>,
112}
113
114/// External link.
115#[derive(Debug, Deserialize, Serialize)]
116pub struct ExternalLink<'a> {
117 /// The kind of page the link refers to.
118 ///
119 /// Parsed from the name of the parameter that has as its value the title of the page the link refers to. Different kinds are allowed for each wiki. For example links to Wikipedia allow the kinds `kategorie` (category), `portál` (portal), `rozcestník` (disambiguation page) and `článek` (article).
120 pub kind: Cow<'a, str>,
121
122 /// The wiki the link refers to.
123 pub type_: ExternalLinkType,
124
125 /// The title of the page the link refers to.
126 pub value: Cow<'a, str>,
127}
128
129/// Identifier for a site as a target of an external link.
130#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
131#[serde(rename_all = "snake_case")]
132pub enum ExternalLinkType {
133 /// Wikimedia Commons.
134 Commons,
135
136 /// Wikibooks.
137 Wikibooks,
138
139 /// Wikinews.
140 Wikinews,
141
142 /// Wikipedia.
143 Wikipedia,
144
145 /// Wikiquote.
146 Wikiquote,
147
148 /// Wikisource.
149 Wikisource,
150
151 /// Wikispecies.
152 Wikispecies,
153
154 /// Wikiversity.
155 Wikiversity,
156
157 /// Wikivoyage.
158 Wikivoyage,
159}
160
161/// An element in a sequence that allows different kinds of elements.
162#[derive(Debug, Deserialize, Serialize)]
163#[serde(rename_all = "snake_case", tag = "type")]
164pub enum Flowing<'a> {
165 /// Toggle italic.
166 ///
167 /// Parsed from the wiki text `''`.
168 Italic,
169
170 /// List of labels, from the template [`Příznak2`](https://cs.wiktionary.org/wiki/%C5%A0ablona:P%C5%99%C3%ADznak2).
171 ///
172 /// Duplicate labels are not allowed.
173 Labels {
174 /// The labels.
175 #[serde(default, skip_serializing_if = "Vec::is_empty")]
176 labels: Vec<Cow<'a, str>>,
177 },
178
179 /// Link.
180 ///
181 /// Parsed from wiki text starting with `[[`.
182 Link {
183 /// The target the link refers to.
184 target: Cow<'a, str>,
185
186 /// The text to display for the link.
187 text: Cow<'a, str>,
188 },
189
190 /// Indication that something is a plural, from the template [`množ`](https://cs.wiktionary.org/wiki/%C5%A0ablona:mno%C5%BE).
191 Plural,
192
193 /// Qualifier, from the template [`Upřesnění`](https://cs.wiktionary.org/wiki/%C5%A0ablona:Up%C5%99esn%C4%9Bn%C3%AD).
194 Qualifier {
195 /// The text to display.
196 value: Cow<'a, str>,
197 },
198
199 /// Chunk of plain text.
200 Text {
201 /// The text to display.
202 value: Cow<'a, str>,
203 },
204
205 /// Link to a foreign word in translations, from the template [`P`](https://cs.wiktionary.org/wiki/%C5%A0ablona:P).
206 Translation {
207 /// The gender of the term the link refers to, if specified, otherwise empty.
208 #[serde(skip_serializing_if = "Option::is_none")]
209 gender: Option<Cow<'a, str>>,
210
211 /// The term the link refers to.
212 term: Cow<'a, str>,
213 },
214
215 /// Element that could not be recognized.
216 Unknown {
217 /// The wiki text of the element.
218 value: Cow<'a, str>,
219 },
220}
221
222/// Pattern of inflection.
223#[derive(Debug, Deserialize, Serialize)]
224#[serde(rename_all = "snake_case", tag = "type")]
225pub enum Inflection<'a> {
226 /// From the template [`Adjektivum (cs)`](https://cs.wiktionary.org/wiki/%C5%A0ablona:Adjektivum_(cs)).
227 AdjectiveDeclensionBasic(inflection::AdjectiveDeclensionBasic<'a>),
228
229 /// From the template [`Stupňování (cs)`](https://cs.wiktionary.org/wiki/%C5%A0ablona:Stup%C5%88ov%C3%A1n%C3%AD_(cs)).
230 Comparison(inflection::Comparison<'a>),
231
232 /// From the template [`Sloveso (cs)`](https://cs.wiktionary.org/wiki/%C5%A0ablona:Sloveso_(cs)).
233 Conjugation(inflection::Conjugation<'a>),
234
235 /// From the template [`Substantivum (cs)`](https://cs.wiktionary.org/wiki/%C5%A0ablona:Substantivum_(cs)).
236 Indeclinable,
237
238 /// From the template [`Substantivum (cs)`](https://cs.wiktionary.org/wiki/%C5%A0ablona:Substantivum_(cs)).
239 NounDeclensionBasic(inflection::NounDeclensionBasic<'a>),
240
241 /// From the template [`Číslovka adj (cs)`](https://cs.wiktionary.org/wiki/%C5%A0ablona:%C4%8C%C3%ADslovka_adj_(cs)).
242 NumeralDeclensionAdjective(inflection::AdjectiveDeclensionBasic<'a>),
243
244 /// From the template [`Číslovka (cs)`](https://cs.wiktionary.org/wiki/%C5%A0ablona:%C4%8C%C3%ADslovka_(cs)).
245 NumeralDeclensionBasic(inflection::NumeralDeclensionBasic<'a>),
246
247 /// From the template [`Číslovka (cs)`](https://cs.wiktionary.org/wiki/%C5%A0ablona:%C4%8C%C3%ADslovka_(cs)).
248 NumeralDeclensionSgPl(inflection::NumeralDeclensionSgPl<'a>),
249
250 /// From the template [`Zájmeno adj (cs)`](https://cs.wiktionary.org/wiki/%C5%A0ablona:Z%C3%A1jmeno_adj_(cs)).
251 PronounDeclensionAdjective(inflection::PronounDeclensionAdjective<'a>),
252
253 /// From the template [`Zájmeno (cs)`](https://cs.wiktionary.org/wiki/%C5%A0ablona:Z%C3%A1jmeno_(cs)).
254 PronounDeclensionBasic(inflection::PronounDeclensionBasic<'a>),
255}
256
257/// Information about one pattern of inflection for an entry.
258#[derive(Debug, Deserialize, Serialize)]
259pub struct InflectionEntry<'a> {
260 /// Various details about the entry.
261 ///
262 /// Parsed from the unordered list in the section.
263 #[serde(default, skip_serializing_if = "Vec::is_empty")]
264 pub details: Vec<Vec<Flowing<'a>>>,
265
266 /// The inflection itself.
267 #[serde(skip_serializing_if = "Option::is_none")]
268 pub inflection: Option<Inflection<'a>>,
269}
270
271/// Dictionary entry for a single language.
272#[derive(Debug, Deserialize, Serialize)]
273pub struct LanguageEntry<'a> {
274 /// List of audio samples for the entry.
275 #[serde(default, skip_serializing_if = "Vec::is_empty")]
276 pub audio: Vec<Audio<'a>>,
277
278 /// Etymology of the entry.
279 #[serde(default, skip_serializing_if = "Vec::is_empty")]
280 pub etymology: Vec<Flowing<'a>>,
281
282 /// Homophones of the entry.
283 #[serde(default, skip_serializing_if = "Vec::is_empty")]
284 pub homophones: Vec<Vec<Flowing<'a>>>,
285
286 /// Hyphenation of the entry, if any.
287 #[serde(skip_serializing_if = "Option::is_none")]
288 pub hyphenation: Option<Cow<'a, str>>,
289
290 /// List of pronunciations of the entry written in IPA.
291 #[serde(default, skip_serializing_if = "Vec::is_empty")]
292 pub ipa: Vec<Cow<'a, str>>,
293
294 /// The language of the entry.
295 pub language: Language,
296
297 /// Entries for parts of speech for this language.
298 ///
299 /// Parsed from the sections with the part of speech as their heading.
300 #[serde(default, skip_serializing_if = "Vec::is_empty")]
301 pub pos_entries: Vec<PosEntry<'a>>,
302
303 /// Variants for the entry.
304 ///
305 /// Parsed from the section `varianty`.
306 #[serde(default, skip_serializing_if = "Vec::is_empty")]
307 pub variants: Vec<Vec<Flowing<'a>>>,
308}
309
310/// Output of parsing a page.
311#[derive(Debug, Deserialize, Serialize)]
312pub struct Output<'a> {
313 /// External links.
314 ///
315 /// Parsed from the section “externí odkazy”.
316 #[serde(default, skip_serializing_if = "Vec::is_empty")]
317 pub external_links: Vec<ExternalLink<'a>>,
318
319 /// The dictionary entries by language.
320 ///
321 /// Parsed from the sections with the name of the language as their heading.
322 #[serde(default, skip_serializing_if = "Vec::is_empty")]
323 pub language_entries: Vec<LanguageEntry<'a>>,
324
325 /// Warnings from the parser telling that something is not well-formed.
326 #[serde(default, skip_serializing_if = "Vec::is_empty")]
327 pub warnings: Vec<Warning>,
328}
329
330/// Part of speech.
331#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
332#[serde(rename_all = "snake_case")]
333pub enum Pos {
334 /// Abbreviation.
335 ///
336 /// Parsed from the section `zkratka` and similar numbered sections.
337 Abbreviation,
338
339 /// Adjective.
340 ///
341 /// Parsed from the section `přídavné jméno` and similar numbered sections.
342 Adjective,
343
344 /// Adverb.
345 ///
346 /// Parsed from the section `příslovce` and similar numbered sections.
347 Adverb,
348
349 /// Compound word.
350 ///
351 /// Parsed from the section `slovní spojení` and similar numbered sections.
352 CompoundWord,
353
354 /// Conjunction.
355 ///
356 /// Parsed from the section `spojka` and similar numbered sections.
357 Conjunction,
358
359 /// Idiom.
360 ///
361 /// Parsed from the section `idiom` and similar numbered sections.
362 Idiom,
363
364 /// Interjection.
365 ///
366 /// Parsed from the section `citoslovce` and similar numbered sections.
367 Interjection,
368
369 /// Noun.
370 ///
371 /// Parsed from the section `podstatné jméno` and similar numbered sections.
372 Noun,
373
374 /// Numeral.
375 ///
376 /// Parsed from the section `číslovka` and similar numbered sections.
377 Numeral,
378
379 /// Particle.
380 ///
381 /// Parsed from the section `částice` and similar numbered sections.
382 Particle,
383
384 /// Prefix.
385 ///
386 /// Parsed from the section `předpona` and similar numbered sections.
387 Prefix,
388
389 /// Preposition.
390 ///
391 /// Parsed from the section `předložka` and similar numbered sections.
392 Preposition,
393
394 /// Pronoun.
395 ///
396 /// Parsed from the section `zájmeno` and similar numbered sections.
397 Pronoun,
398
399 /// Proverb.
400 ///
401 /// Parsed from the sections `přísloví` and `rčení` and similar numbered sections.
402 Proverb,
403
404 /// Suffix.
405 ///
406 /// Parsed from the section `přípona` and similar numbered sections.
407 Suffix,
408
409 /// Verb.
410 ///
411 /// Parsed from the section `sloveso` and similar numbered sections.
412 Verb,
413}
414
415/// The entry for a part of speech within the entry for a language.
416#[derive(Debug, Deserialize, Serialize)]
417pub struct PosEntry<'a> {
418 /// Antonyms for the entry.
419 ///
420 /// Parsed from the section `antonyma`.
421 #[serde(default, skip_serializing_if = "Vec::is_empty")]
422 pub antonyms: Vec<Vec<Flowing<'a>>>,
423
424 /// Compound words for the entry.
425 ///
426 /// Parsed from the section `slovní spojení`.
427 #[serde(default, skip_serializing_if = "Vec::is_empty")]
428 pub compound_words: Vec<Vec<Flowing<'a>>>,
429
430 /// Definitions of the entry.
431 ///
432 /// Parsed from the section `význam`.
433 #[serde(default, skip_serializing_if = "Vec::is_empty")]
434 pub definitions: Vec<Definition<'a>>,
435
436 /// Various details about the entry.
437 ///
438 /// Parsed from the unordered list between the POS heading and the next heading
439 #[serde(default, skip_serializing_if = "Vec::is_empty")]
440 pub details: Vec<Vec<Flowing<'a>>>,
441
442 /// Etymology of the entry.
443 #[serde(default, skip_serializing_if = "Vec::is_empty")]
444 pub etymology: Vec<Flowing<'a>>,
445
446 /// Inflection of the entry, from the sections `časování`, `skloňování`, `skloňování (1)`, `skloňování (2)` and `stupňování`.
447 #[serde(default, skip_serializing_if = "Vec::is_empty")]
448 pub inflection: Vec<InflectionEntry<'a>>,
449
450 /// Phrases and idioms for the entry.
451 ///
452 /// Parsed from the section `fráze a idiomy`.
453 #[serde(default, skip_serializing_if = "Vec::is_empty")]
454 pub phrases_and_idioms: Vec<Vec<Flowing<'a>>>,
455
456 /// Part of speech of the entry.
457 ///
458 /// Some parts of speech hold additional information.
459 pub pos: Pos,
460
461 /// Proverbs for the entry.
462 ///
463 /// Parsed from the section `přísloví, úsloví a pořekadla`.
464 #[serde(default, skip_serializing_if = "Vec::is_empty")]
465 pub proverbs: Vec<Cow<'a, str>>,
466
467 /// Related terms for the entry.
468 ///
469 /// Parsed from the section `související`.
470 #[serde(default, skip_serializing_if = "Vec::is_empty")]
471 pub related_terms: Vec<Vec<Flowing<'a>>>,
472
473 /// Synonyms for the entry.
474 ///
475 /// Parsed from the section `synonyma`.
476 #[serde(default, skip_serializing_if = "Vec::is_empty")]
477 pub synonyms: Vec<Vec<Flowing<'a>>>,
478
479 /// Translations for each definition of the entry.
480 ///
481 /// Parsed from the section 'překlady'.
482 #[serde(default, skip_serializing_if = "Vec::is_empty")]
483 pub translations: Vec<Translations<'a>>,
484
485 /// Variants for the entry.
486 ///
487 /// Parsed from the section `varianty`.
488 #[serde(default, skip_serializing_if = "Vec::is_empty")]
489 pub variants: Vec<Vec<Flowing<'a>>>,
490}
491
492/// The translations for a single definition.
493///
494/// Parsed from the template [Překlady](https://cs.wiktionary.org/wiki/%C5%A0ablona:P%C5%99eklady).
495#[derive(Debug, Deserialize, Serialize)]
496pub struct Translations<'a> {
497 /// The gloss of the definition the translations relate to.
498 #[serde(skip_serializing_if = "Option::is_none")]
499 pub gloss: Option<Cow<'a, str>>,
500
501 /// The translations by language.
502 #[serde(default, skip_serializing_if = "HashMap::is_empty")]
503 pub translations: HashMap<Language, Vec<Flowing<'a>>>,
504}
505
506/// Warning from the parser telling that something is not well-formed.
507///
508/// When a warning occurs, it's not guaranteed that the text near the warning is parsed correctly. Usually the data that could not be unambiguously parsed due to the warning is excluded from the output, to make sure the output doesn't contain incorrectly parsed data.
509#[derive(Debug, Deserialize, Serialize)]
510pub struct Warning {
511 /// The byte position in the wiki text where the warning ends.
512 pub end: usize,
513
514 /// The language of the language section in which the warning occurred, if any.
515 #[serde(skip_serializing_if = "Option::is_none")]
516 pub language: Option<Language>,
517
518 /// An identifier for the kind of warning.
519 pub message: WarningMessage,
520
521 /// The byte position in the wiki text where the warning starts.
522 pub start: usize,
523}
524
525/// Identifier for a kind of warning from the parser.
526#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]
527#[serde(rename_all = "snake_case")]
528pub enum WarningMessage {
529 /// The element is a duplicate of something that comes before it.
530 ///
531 /// This may be a heading that contains the same text as a previous heading in the same section, or a parameter that has the same name as a previous parameter to the same template.
532 Duplicate,
533
534 /// The element is missing some required content.
535 Empty,
536
537 /// The section following the heading is missing some required content.
538 SectionEmpty,
539
540 /// The element is recognized but not represented in the output.
541 ///
542 /// The element conveys meaningful information, but this information has not been parsed and is not represented in the output. This applies for example to the templates `Doplnit` and `Viz` and the extension tag `ref`. In contrast to other warnings, this warning does not indicate there is anything wrong with the wiki text. It just indicates that the wiki text contains additional information that is not represented in the output. The element is recognized as valid in the position it occurs, but its content is not parsed, and nothing can be said about whether the content is valid.
543 Supplementary,
544
545 /// The element is not recognized.
546 ///
547 /// This may be because of the type of the element itself or because of anything inside it.
548 Unrecognized,
549
550 /// The value of the element conflicts with information occurring before it.
551 ///
552 /// This can mean for example that a specified language within a section doesn't match the language specified for the section as a whole.
553 ValueConflicting,
554
555 /// The element is recognized, but its value is not.
556 ///
557 /// On lists it means that a list with this kind is valid in this position, but something about the list items contained in the list is not recognized.
558 ///
559 /// On templates it means that a template with this name is valid in this position, but something about the parameters of the template is not recognized.
560 ///
561 /// On template parameters it means that a parameter with this name (or lack of name) is valid in this position, but something about the value of the parameter is not recognized.
562 ValueUnrecognized,
563}
564
565/// Parses an article from the Czech language version of Wiktionary into structured data.
566///
567/// `wiki_text` is the wiki text of the article. `nodes` is the sequence of nodes obtained by parsing the wiki text with the crate [Parse Wiki Text](https://github.com/portstrom/parse_wiki_text).
568#[must_use]
569pub fn parse<'a>(wiki_text: &'a str, nodes: &[Node<'a>]) -> Output<'a> {
570 let mut context = Context {
571 language: None,
572 warnings: vec![],
573 wiki_text,
574 };
575 let mut external_links = None;
576 let mut language_entries = vec![];
577 let mut node_index = 0;
578 let node_limit = nodes.len()
579 - nodes
580 .iter()
581 .rev()
582 .take_while(|node| match node {
583 Node::Category { .. } | Node::ParagraphBreak { .. } => true,
584 ::Node::Text { value, .. } => value.trim_left().is_empty(),
585 _ => false,
586 })
587 .count();
588 let nodes = &nodes[0..node_limit];
589 while let Some(node) = nodes.get(node_index) {
590 node_index += 1;
591 match node {
592 Node::Category { .. } => {}
593 Node::Heading {
594 level,
595 nodes: title,
596 ..
597 } => if *level < 3 {
598 if *level < 2 {
599 add_warning(&mut context, node, WarningMessage::Unrecognized);
600 break;
601 }
602 if let Some(title) = parse_text(title) {
603 if let Some(language) = Language::from_name(&title) {
604 node_index += language::parse_language(
605 &mut context,
606 node,
607 &nodes[node_index..],
608 &mut language_entries,
609 language,
610 );
611 continue;
612 }
613 match &title as _ {
614 "externí odkazy" => {
615 node_index += external_links::parse_external_links(
616 &mut context,
617 node,
618 &nodes[node_index..],
619 &mut external_links,
620 );
621 continue;
622 }
623 "poznámky" => while let Some(node) = nodes.get(node_index) {
624 match node {
625 Node::Heading { .. } => break,
626 Node::UnorderedList { .. } => {
627 add_warning(&mut context, node, WarningMessage::Supplementary)
628 }
629 Node::Tag { name, nodes, .. } => if name != "references" {
630 add_warning(&mut context, node, WarningMessage::Unrecognized);
631 } else if !nodes.is_empty() {
632 add_warning(
633 &mut context,
634 node,
635 WarningMessage::ValueUnrecognized,
636 );
637 },
638 _ => unrecognized_unless_ignored(&mut context, node),
639 }
640 node_index += 1;
641 },
642 _ => {}
643 }
644 }
645 },
646 Node::Template { name, .. } => add_warning(
647 &mut context,
648 node,
649 if text_equals(name, "Viz") {
650 WarningMessage::Supplementary
651 } else {
652 WarningMessage::Unrecognized
653 },
654 ),
655 ::Node::Text { value, .. } => if !value.trim_left().is_empty() {
656 add_warning(&mut context, node, WarningMessage::Unrecognized);
657 },
658 _ => add_warning(&mut context, node, WarningMessage::Unrecognized),
659 }
660 }
661 Output {
662 external_links: external_links.unwrap_or_default().unwrap_or_default(),
663 language_entries,
664 warnings: context.warnings,
665 }
666}