You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fluffychat/lib/pangea/models/lemma.dart

39 lines
965 B
Dart

/// Represents a lemma object
class Lemma {
/// [text] ex "ir" - text of the lemma of the word
final String text;
/// [form] ex "vamos" - conjugated form of the lemma and as it appeared in some original text
final String form;
/// [saveVocab] true - whether to save the lemma to the user's vocabulary
/// vocab that are not saved: emails, urls, numbers, punctuation, etc.
/// server handles this determination
final bool saveVocab;
Lemma({
required this.text,
required this.saveVocab,
required this.form,
});
factory Lemma.fromJson(Map<String, dynamic> json) {
return Lemma(
text: json['text'],
saveVocab: json['save_vocab'] ?? json['saveVocab'] ?? false,
form: json["form"] ?? json['text'],
);
}
toJson() {
return {
'text': text,
'save_vocab': saveVocab,
'form': form,
};
}
static Lemma create(String form) =>
Lemma(text: '', saveVocab: true, form: form);
}