Comments (4)
From my experience, and knowledge implementing suggestions, is that they’re always very slow.
Thus, the simplest would be to cap the amount of words you find suggestions for: for example, at 10.
Showing if a word is misspelt or not is a much cheaper operation, so you can still show wrongly spelt words at pretty okay speed.
Another thing is to add a cache: often the same words are misspelt over and over, and there’s no need to look up suggestions for the same word multiple times.
from nodehun.
@wooorm I thank you for your rapid response
I do indeed use optimizations for the latter thing you mentioned - filter out the same words. For the specific thing I'm trying to make, I don't need suggestions, only to have the word be checked against a .dic/.aff dictionary, and figure out if the word is in the dictionary or not, I've tried using both suggest and isCorrect methods, since I assume the isCorrect method should work much faster, since it doesn't return suggestions, which might explain why it takes more time, since the method itself on the inside does more operations I assume
Why I'm asking all this is I've tried using PHP's spellchecker before and I've gotten up to 2000 requests per 5 seconds by simply caching the dictionary file into memory, so this is why I'm curious if I'm doing anything wrong here?
Thank you again for taking time to read and respond to my questions, cheers
from nodehun.
What’s your code? What dictionary do you use in PHP, and what in Node?
from nodehun.
I've managed to figure it out, thanks a million, I've been doing it wrongly, instead of caching the physical files themselves (dictionaries), if you cache the nodehun objects, that's how you get MUCH faster response times.
My bad, thank you so much nonetheless!
from nodehun.
Related Issues (20)
- Does not work from ESM HOT 1
- nodehun with VSCode and Webpack HOT 6
- Not working with Hungarian dictionary HOT 1
- While running unit test cases getting Nodehun module not found error
- Help for adding word to dictionary. HOT 1
- node-v12.13.0 error HOT 17
- Publish Nodehun v3
- Suggestions for emojis
- Segfault on suggestion HOT 1
- Nodehun and Hunspell produce different results HOT 2
- [ERROR] TypeError: cannot use a string pattern on a bytes-like object HOT 1
- nodehun fails to build
- Chrome extension: Nodehun in webpack HOT 6
- Dumping all known words HOT 1
- Hunspell GPL license HOT 2
- nodehun with electron jenkins build error HOT 2
- React app can´t find module HOT 2
- What version of Hunspell is used here? HOT 6
- Library don't works inside docker container
- App crashes in docker container HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nodehun.