google_mlkit_entity_extraction 0.3.0 google_mlkit_entity_extraction: ^0.3.0 copied to clipboard
A Flutter plugin to use Google's ML Kit Entity Extractor API to recognize specific entities within static text.
Google's ML Kit Entity Extraction API for Flutter #
A Flutter plugin to use Google's ML Kit Entity Extractor API to recognize specific entities within static text.
Getting Started #
Before you get started read about the requirements and known issues of this plugin here.
Supported languages #
Entity extraction supports the following languages:
- Arabic
- Portuguese
- English (US, UK)
- Dutch
- French
- German
- Italian
- Japanese
- Korean
- Polish
- Russian
- Chinese (Simplified, Traditional)
- Spanish
- Thai
- Turkish
Usage #
Entity Extraction #
Create an instance of EntityExtractor
final entityExtractor = EntityExtractor(language: EntityExtractorOptions.english);
Process text
final List<EntityAnnotation> annotations = await entityExtractor.annotateText(text);
for (final annotation in annotations) {
annotation.start
annotation.end
annotation.text
for (final entity in annotation.entities) {
entity.type
entity.rawValue
}
}
Make sure you download the language model before annotating any text.
Release resources with close()
entityExtractor.close();
Managing remote models #
Create an instance of model manager
final modelManager = EntityExtractorModelManager();
Check if model is downloaded
final bool response = await modelManager.isModelDownloaded(model);
Download model
final bool response = await modelManager.downloadModel(model);
Delete model
final bool response = await modelManager.deleteModel(model);
Example app #
Find the example app here.
Contributing #
Contributions are welcome. In case of any problems look at existing issues, if you cannot find anything related to your problem then open an issue. Create an issue before opening a pull request for non trivial fixes. In case of trivial fixes open a pull request directly.