Comments (5)
Nothing has changed yet, for now I recommend keeping two dictionaries. One dictionary from file, such as an en-us dictionary, and another dictionary in memory for the user's custom words. Example: https://github.com/aarondandy/WeCantSpell.Hunspell/blob/2c95ea91a1ca40a36b3b5dab219ca38dd613eebb/test/WeCantSpell.Hunspell.Tests/WordListTests.cs
from wecantspell.hunspell.
I designed the implementation/port to be read-only and immutable. There could be thread safety issues with mutating a dictionary after it is loaded and the use case I was targeting at the time was strictly about quickly checking words. Now, lets say for example you wanted to support something such as "Add words to dictionary." The way I would recommend implementing that is to keep a separate dictionary (it doesn't even need to be hunspell) and use that for your other words. If you do want to use this lib for that custom dictionary, for suggestions as an example, it would have to be rebuilt for each new word.
Now if this is to become a feature request, that is a pretty interesting feature but would be very difficult to implement safely I think considering how spaghetti like the code is already 🍝 . I cleaned it up as best I could though, but it definitely feels like a challenging feature.
from wecantspell.hunspell.
I just had a thought, one way this could be practical is based on how I had to create a "query" object to represent each suggestion and check call. I did this initially to move all the global/static variables into there so that queries could be made in parallel. This could be leveraged so that each running query could grab a reference to the immutable internal variables that make up a dictionary and affix structure. A mutation to the entire structure could possibly be done in an atomic way by cleverly swapping references around maybe. 🤔
from wecantspell.hunspell.
@aarondandy is there more information about this question?
I have the same problem that I need to implement custom user dictionaries for spellchecking and suggesting capabilities. I was using .AddWord
and .RemoveWord
when using NHunspell. It added words to something called "Internal dictionary" when using NHunspell package.
It seems it would be problematic if I use this package?
from wecantspell.hunspell.
@aarondandy Just as a side note, if I'm not mistaken, NHunspell dictionaries are also immutable, the words are added/removed to/from the available instance in memory. Once the dictionary is reloaded, the added words are gone and the removed words are back.
from wecantspell.hunspell.
Related Issues (20)
- Pipes, can they help? HOT 2
- Dictionaries are a bad choice for a dictionary HOT 1
- Thank you! HOT 1
- Infix support for Kurdish language HOT 4
- Suggest() method result inconsitent HOT 15
- Strong-Naming The Library HOT 1
- Any suggestion on how to use this library for real-time word suggestions? HOT 5
- Areas for improvement: Infrastructure HOT 1
- Areas for improvement: Affix HOT 1
- Areas for improvement: Word List HOT 1
- Restore disabled test: allcaps.aff
- Future target frameworks HOT 7
- Suggest algorithm optimization: Levenshtein distance HOT 1
- can i use it as dotnet tool as part of msbuild in csproj? HOT 2
- Occasional System.IndexOutOfRangeException for Suggest HOT 6
- How to ignore punctuation symbols HOT 3
- Parsing text for individual words HOT 3
- First algorithm fails on E5-26xx HOT 5
- Get words that start with X HOT 1
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 wecantspell.hunspell.