Last updated:
0 purchases
quick dictionary
quick_dictionary #
A simple and easy-to-use dictionary to be embedded anywhere.
Usage #
Here's a simple usage example:
import 'package:quick_dictionary/quick_dictionary.dart';
void main() {
var language = Language('English Intl.', 'en', SoundCodecLatin());
print('$language\n');
var dictionaryDB = QuickDictionaryDataBaseMemory(language);
dictionaryDB.addWordDefinition(WordDefinition('the', WordType.article,
'used before nouns to refer to particular things or people.'));
dictionaryDB.addWordDefinition(WordDefinition('cat', WordType.noun,
'a small animal with fur, four legs, a tail, and claws, usually kept as a pet.'));
dictionaryDB.addWordDefinition(WordDefinition('caught', WordType.verb,
'the past tense and past participle of catch verb.'));
dictionaryDB.addWordDefinition(WordDefinition('orange', WordType.adjective,
'a round sweet fruit that has a thick orange skin and an orange centre.'));
dictionaryDB.addWordDefinition(WordDefinition('mouse', WordType.noun,
'a small mammal with short fur, a pointed face, and a long tail.'));
var wordCat = dictionaryDB.findByWordText('cat');
_showWord(wordCat);
var wordCatTypo = dictionaryDB.findByWordTextSounds('caatt');
_showWord(wordCatTypo);
print('--------------------------------------------------------------');
for (var wordText in dictionaryDB.wordsTexts) {
var word = dictionaryDB.findByWordText(wordText)!;
_showWord(word);
}
}
void _showWord(Word? word) {
if (word == null) return;
print(word);
for (var d in word.definitions) {
print('-- $d');
}
print('');
}
copied to clipboard
Output:
Language{name: English Intl., code: en, soundCodec: SoundCodecLatin{latin}}
Word<cat>{language: en, types: [noun], sounds: ca_t}
-- WordDefinition<cat>{type: noun, description: a small animal with fur, four legs, a tail, and claws, usually kept as a pet.}
Word<cat>{language: en, types: [noun], sounds: ca_t}
-- WordDefinition<cat>{type: noun, description: a small animal with fur, four legs, a tail, and claws, usually kept as a pet.}
--------------------------------------------------------------
Word<the>{language: en, types: [article], sounds: the}
-- WordDefinition<the>{type: article, description: used before nouns to refer to particular things or people.}
Word<cat>{language: en, types: [noun], sounds: ca_t}
-- WordDefinition<cat>{type: noun, description: a small animal with fur, four legs, a tail, and claws, usually kept as a pet.}
Word<caught>{language: en, types: [verb], sounds: cau_ght}
-- WordDefinition<caught>{type: verb, description: the past tense and past participle of catch verb.}
Word<orange>{language: en, types: [adjective], sounds: o_ra_nge}
-- WordDefinition<orange>{type: adjective, description: a round sweet fruit that has a thick orange skin and an orange centre.}
Word<mouse>{language: en, types: [noun], sounds: mou_se}
-- WordDefinition<mouse>{type: noun, description: a small mammal with short fur, a pointed face, and a long tail.}
copied to clipboard
Features and bugs #
Please file feature requests and bugs at the issue tracker.
Author #
Graciliano M. Passos: gmpassos@GitHub.
License #
Apache License - Version 2.0
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.