सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
AutoTrie एक उच्च प्रदर्शन ऑटो-पूर्ण करने वाला इंजन है जो Dart और Flutter एप्लिकेशन के लिए बनाया गया है, जो एक अनुकूलित Trie डेटा संरचना पर आधारित है। यह त्वरित पूर्वसर्ग-आधारित खोजों का समर्थन करता है, जिससे यह टेक्स्ट इनपुट, सर्च बार और कोड एडिटर में रियल-टाइम सुझाव के लिए आदर्श है। यह पैकेज कम मेमोरी उपयोग और त्वरित खोज के लिए डिज़ाइन किया गया है, जिससे बड़े डेटासेट के साथ भी चलने में चिकनापन बनी रहती है। AutoTrie प्लेटफॉर्म-अनार्सित है, जो Android, iOS, macOS, Windows और Linux का समर्थन करता है। इसकी हल्की प्रकृति और सरल API के कारण इसे मौजूदा प्रोजेक्ट में आसानी से एकीकृत किया जा सकता है।
उपयोग
वास्तविक समय की खोज सुझाव
कोड पूर्ण करने की सुविधा
स्वचालित पूर्ण करने वाले टेक्स्ट फ़ील्ड
डायनामिक ड्रॉपडाउन
इनपुट पूर्वानुमान
मुख्य विशेषताएँ
अनुकूलित ट्राई वास्तुकला
त्वरित पूर्वफिक्स मिलान
कम मेमोरी उपयोग
क्रॉस-प्लेटफ़ॉर्म समर्थन
सरल API एकीकरण
इनके लिए उपयुक्त
स्वचालित पूर्ण करने वाली UI बना रहे विकासक
त्वरित टेक्स्ट फ़िल्टरिंग की आवश्यकता वाले ऐप्स
खोज-भारी एप्लिकेशन
शैक्षिक या कोडिंग टूल्स
उच्च प्रदर्शन इनपुट घटक
विचार योग्य बातें
स्थिर या कम अद्यतन किए गए डेटासेट के लिए सबसे उपयुक्त
गतिशील डेटा के लिए पूर्वप्रसंस्करण की आवश्यकता हो सकती है
पूर्ण-पाठ खोज के लिए आदर्श नहीं
पूर्वसर्ग-आधारित मिलान तक सीमित
स्मृति उपयोग डेटासेट के आकार के साथ बढ़ता है
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
AutoTrie
A versatile library which solves autocompletion in Dart/Flutter. It is based around
a space-efficient implementation of Trie which uses variable-length lists. With this, serving
auto-suggestions is both fast and no-hassle. Suggestions are also sorted by how often
they've been entered and subsorted by recency of entry, for search-engine-like results.
It takes time, effort, and mental power to keep this package updated, useful, and
improving. If you used or are using the package, I'd appreciate it if you could spare a few
dollars to help me continue development.
Usage
A usage example is provided below. Check the API Reference for detailed docs:
import'package:autotrie/autotrie.dart';
voidmain() {
// You are allowed to initialize with a starting databank by passing a `bank` parameter.var engine = AutoComplete(engine: SortEngine.configMulti(Duration(seconds: 1), 15, 0.5, 0.5));
engine.enter('more'); // Enter more thrice.
engine.enter('more');
engine.enter('more');
engine.enter('moody'); // Enter moody twice.
engine.enter('moody');
engine.enter('morose'); // Enter scattered words (with mo).
engine.enter('morty');
engine.enter('moment');
engine.enter('momentum');
engine.enter('sorose'); // Enter scattered words (without mo).
engine.enter('sorty');
engine.delete('morose'); // Delete morose.// Check if morose is deleted.print('Morose deletion check: ${!engine.contains('morose')}');
// Check if engine is empty.print('Engine emptiness check: ${engine.isEmpty}');
// They've been ranked by frequency and recency. Since they're all so similar// in recency, frequency takes priority.print("'mo' suggestions: ${engine.suggest('mo')}");
// Result: [more, moody, momentum, moment, morty]// Get all entries.// They've *not* been sorted.// Use `engine.suggest('')` to get all entries sorted` print('All entries: ${engine.allEntries}');
// Result: [more, moody, sorty, sorose, momentum, moment, morty]
}
Sorting
The AutoComplete constructor takes a SortEngine, which it uses to sort the result of the autocompletion operation.
There are a few different modes it can operate in:
SortEngine.entriesOnly() -> AutoComplete results are only sorted by number of entries in the engine (High to Low)
SortEngine.msOnly() -> AutoComplete results are only sorted by how much time has passed since their last entry (Low to High)
SortEngine.simpleMulti() ->
Sorted using two logistic curves, one for ms and one for entries
The ms curve is set to use 3 years (a LOT) as the upper end of how far back entries could have been entered
The entries curve is set to use 30 entries as the max amount of entries
These values are highly arbitrary and not likely to fit your project; this mode is not recommended unless
you are just playing around.
Takes two weights (one for recency and one for entries) which can be used to balance how heavily each factor
should affect the final sorting.
SortEngine.configMulti() ->
Sorted using two logistic curves, one for ms and one for entries
The ms curve is balanced using a parameter (a Duration) for the max time since entry in this engine.
The entries curve is balanced using a parameter (an int) for the max amount of entries in this engine.
If you know approximately how old and how big this AutoComplete engine is, it is highly recommended that
you use this mode.
Takes two weights (one for recency and one for entries) which can be used to balance how heavily each factor
should affect the final sorting.
Basic File Persistence
AutoComplete is natively capable of writing itself to and reading itself from a file. To do this, persist to a file
using the persist method (it takes a File object):
await engine.persist(myFile);
Then you can rebuild using AutoComplete.fromFile (it takes a File along with the mandatory SortEngine):
var engine = AutoComplete.fromFile(file: myFile, engine: SortEngine.entriesOnly());
This persistence will preserve all the metadata (last insert, number of entries) in the table as well as the
core data (the Strings themselves).
Hive Integration
Hive is a speedy, local, and key-value database for Dart/Flutter. Go check it out if you haven't already!
Hive integration is now available with autotrie:
Our way of integration uses extension methods.
Import Hive and AutoTrie, and create a normal Hive box using Hive.openBox('nameHere').
You can then call searchKeys(String prefix) and searchValues(String prefix) on that box to get auto-suggestions.
There is no sorting options: only entry-level sorting is available.
Features and bugs
Please file feature requests and bugs at the issue tracker.
This library and its contents are subject to the terms of the Mozilla Public License, v. 2.0.