autocorrect_and_autocomplete_engine 0.0.2 copy "autocorrect_and_autocomplete_engine: ^0.0.2" to clipboard
autocorrect_and_autocomplete_engine: ^0.0.2 copied to clipboard

A simple and efficient autocorrection and autocomplete engine built with Tries for Flutter.

Features #

A simple and efficient autocorrection and autocomplete engine built with Tries for Flutter.

  • Autocomplete a given string
  • Generate a list of Autocomplete suggestions for the given string
  • Autocorrect a given string
  • Generate a list of Autocorrect suggestions for the given string
  • Sort the given list alphabetically

Getting started #

Add the package to your pubsec.yaml

dependencies:
    autocorrect_and_autocomplete_engine:

import the package in a file

import 'package:autocorrect_and_autocomplete_engine/autocorrect_and_autocomplete_engine.dart';

Usage #

Initialization

  • TrieEngine needs a list of string to work with for autocompletion and autocorrection.

    List<String> testData = ["compete","ability","baker","abilities","able"];
    
  • Initializing the TrieEngine with testData

    TrieEngine trieEngine = TrieEngine(src : testData);
    
  • Initialize TrieEngine using the list of words in a file

    TrieEngine trieEngine = TrieEngine(src : File('PATH_TO_FILE').readAsLinesSync());
    

Inserting a new string

trieEngine.insertWord('awesome');

Using Autocomplete

  • Use autoComplete() to Autocomplete the given string based on alpabetic order

    String result = trieEngine.autoComplete('marv');
    print(result); // marvel
    
  • Use autoCompleteSuggestions() to generate a list of suggestions for autocompletion

    List<String> result = trieEngine.autoCompleteSuggestions('marv');
    print(result); // [mar, marathon, marble, marc, march, ...]
    

Using Autocorrect

  • Use autoCorrect() to Autocorrect the given string

    String result = trieEngine.autoCorrect('marxvl');
    print(result); // marvel
    
  • Use autoCorrectSuggestions() to generate a list of suggestions for autocorrection

    List<String> result = trieEngine.autoCorrectSuggestions('marxvl');
    print(result); // [marvel, mar, max, ma, mail, male, mali, mall, marble, marc]
    

Sort the list alphabetically

use toSortedList() to generate a alphabetically sorted list for the given testData

List<String> listToSort = ["compete","ability","baker","abilities","able"];

TrieEngine trieEngine = TrieEngine(src : listToSort);

List<String> sortedList = trieEngine.toSortedList();

print(sortedList); // [abilities, ability, able, baker, compete]
3
likes
130
pub points
51%
popularity

Publisher

verified publishertaars.site

A simple and efficient autocorrection and autocomplete engine built with Tries for Flutter.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on autocorrect_and_autocomplete_engine