GM-Consult-Pty-Ltd / dictosaurus

Extensions on String that provides dictionary and thesaurus functions
Other
4 stars 0 forks source link

GM Consult Pty Ltd

Dictionary, thesaurus and term expansion utilities used in natural language processing (NLP).

Contents

Overview

The dictosaurus package provides natural language processing (NLP) utilities used in information retrieval systems. It includes dictionary, thesaurus and term expansion utilities and is intended for information retrieval system applications.

Refer to the references to learn more about information retrieval systems.

(back to top)

Usage

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  dictosaurus: <latest_version>

In your code file add the following import:

// import the core interfaces, classes and mixins of the `dictosaurus` library 
import 'package:dictosaurus/dictosaurus.dart';

// import the typedefs library to use types defined in the `dictosaurus` package.
import 'package:dictosaurus/type_definitions.dart';

Use of the Dictosaurus is demonstrated below.

  // define a term with incorrect spelling.
  final misspeltTerm = 'appel';

  // define a correctly spelled term.
  final term = 'swim';

  // get a Dictosaurus instance from an implementation class (not shown here)
  final dictoSaurus = await getDictoSaurus();

  // get spelling correction suggestions
  final corrections = await dictoSaurus.suggestionsFor(misspeltTerm, 5);

  // expand the term
  final expansions = await dictoSaurus.expandTerm(term, 5);

  // get a dictionary entry properties
  final entry = await dictoSaurus.getEntry(term);

  // get the defintions
  final definitions = entry.synonymsOf();

  // get the synonyms when used as a verb
  final synonyms = entry.synonymsOf(PartOfSpeech.verb);

  // get the antonyms
  final antonyms = entry.antonymsOf();

  // get the inflections
  final inflections = entry.inflectionsOf();

  // get the phrases
  final phrases = entry.phrasesWith();

(back to top)

API

Please refer to the API documentation.

The DictionaryEntry interface is an object model for a term or word with immutable properties (term, stem, lemma, language). The DictionaryEntry interface also enumerates variants of the term with different values for part-of-speech, definition, etymology, pronunciation, synonyms, antonyms and inflections, each with one or more example phrases.

Three interfaces provide dictionary, thesaurus and term expansion functions:

The DictoSaurus interface implements the Dictionary and AutoCorrect interfaces.

The DictoSaurus interface also exposes the expandTerm method that performs term-expansion, returning a list of terms in descending order of relevance (best match first). The (expanded) list of terms includes the term, its synonyms (if any) and spelling correction suggestions.

We use an interface > implementation mixin > base-class > implementation class pattern:

(back to top)

Definitions

The following definitions are used throughout the documentation:

(back to top)

References

(back to top)

Issues

If you find a bug please fill an issue.

This project is a supporting package for a revenue project that has priority call on resources, so please be patient if we don't respond immediately to issues or pull requests.

(back to top)