Giter VIP home page Giter VIP logo

Comments (5)

aarondandy avatar aarondandy commented on May 29, 2024 1

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.

aarondandy avatar aarondandy commented on May 29, 2024

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.

aarondandy avatar aarondandy commented on May 29, 2024

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.

shell avatar shell commented on May 29, 2024

@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.

funex avatar funex commented on May 29, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.