From 6f61df969fb65376fa88f043dbd1d314b757e6cc Mon Sep 17 00:00:00 2001 From: 0xflotus <0xflotus@gmail.com> Date: Wed, 13 Oct 2021 10:42:52 +0200 Subject: [PATCH 1/2] fixed Readme --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 9dcc870..e363e23 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -#Word Graphs +# Word Graphs Word graph is a NodeJs/Browser Typescript friendly library providing fast implementations of the trie and Minimal word graph (AKA DAWG, DAFSA) while also trying to provide you with an easy to use API for querying data from the graphs. @@ -7,7 +7,7 @@ while also trying to provide you with an easy to use API for querying data from * [Installation](#Installation) * [TS or any es6 modules](#typescript-or-es-6-modules) * [Script tag](#script-tag) -* [Preformance](#preformance) +* [Performance](#performance) * [On my pc](#on-my-pc) * [Running the tests](#running-the-tests) * [Usage](#usage) @@ -54,9 +54,9 @@ trie.add('Example'); console.log(trie.containsAny(['mp'])); // Will print ['Simple', 'Example'] ``` -## Preformance +## Performance ### On my pc -Some simple performance tests for the librery, ran on 0.5Mil words. +Some simple performance tests for the library, ran on 0.5Mil words. My PC (i5-6600, 16GB ram windows 10 64bit). ``` Add 0.5Mil words to trie: toke 1160.777 Ms or 1.160777 Sec @@ -82,7 +82,7 @@ But a DAWG is much smaller then a trie. ``` As you can see a DAWG may be a bit faster then a trie. ``` - Minimize trie, affectivly transforming it to a dawg.: toke 2428.354 Ms or 2.4283539999999997 Sec + Minimize trie, effectively transforming it to a dawg.: toke 2428.354 Ms or 2.4283539999999997 Sec ``` This is not linear and will take MUCH more time as the size grows. ``` @@ -143,14 +143,14 @@ MinimalWordGraph or DAGW needs words to be inserted in ascending alphabetical or mwg.lookup('cat') // false, graphs are case insensitive (Option will be added in future). ``` ####Making the DAGW immutable -It is highly recommanded that after you have finished building the dawg you call +It is highly recommended that after you have finished building the dawg you call ```javascript mwg.makeImmutable(); ``` This will: * Make the dawg immutable - calling the `add()` method will result in an exception. * Free up unneeded resources. -* Allow the size of the dawg to be callculated once and saved thus making calls to `size()` O(1). +* Allow the size of the dawg to be calculated once and saved thus making calls to `size()` O(1). # Edit distance [Edit distance](https://en.wikipedia.org/wiki/Edit_distance) is an algorithm that helps us determine the amount of operations we need to make to transform a word A into word B. @@ -159,7 +159,7 @@ I have extended the algorithm linked above to take advantage of that fact we are Using the edit distance feature of wordGraphs is just as simple as the rest of tha api: ``` // Lets say we have a word graph: graph and we want to search for words like 'banna' in hope to find 'banana' - graph.similarTo('banna'); // In my dictionery we get ['Ban', 'Bana', 'Banat', 'Banba', 'Banco', 'Banda', 'Bandana'] + 4030 more items.... + graph.similarTo('banna'); // In my dictionary we get ['Ban', 'Bana', 'Banat', 'Banba', 'Banco', 'Banda', 'Bandana'] + 4030 more items.... // To many results ? What if we want to change the maximus error amount or max results? graph.similarTo('banna', {maxDistance:1, maxResults : 5}); // [ 'banana', 'Canna', 'Danna', 'Hanna', 'Janna' ] From fb4ca439db95597ea6dff08c2f103c811cad2e5d Mon Sep 17 00:00:00 2001 From: 0xflotus <0xflotus@gmail.com> Date: Wed, 13 Oct 2021 20:32:21 +0200 Subject: [PATCH 2/2] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Miquel Àngel R. C. <45353144+mrctrifork@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e363e23..57eee35 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,7 @@ MinimalWordGraph or DAGW needs words to be inserted in ascending alphabetical or mwg.lookup('Human') // false mwg.lookup('cat') // false, graphs are case insensitive (Option will be added in future). ``` -####Making the DAGW immutable +#### Making the DAGW immutable It is highly recommended that after you have finished building the dawg you call ```javascript mwg.makeImmutable();