SpellCheck Custom Dictionary.Creation

Posted by: graham on 10 April 2018, 4:52 pm EST

    • Post Options:
    • Link

    Posted 10 April 2018, 4:52 pm EST

    I’m trying to get my Head around the Custom and User Dictionary difference.

    The C1SpellChecker Control has a Property, UserDictionary and the Default for this is, if Enabled = True, Custom.dct File Name.

    Now, with the Dictionary list there is a Dictionary “C1Spell_en-US-medical.dct”.

    Is this the “Custom” Dictionary, or the “User” Dictionary? What is used for the Property “UserDictionary” Filename. Custom.dct or, C1Spell_en-US-medical.dct.

    I have created a Dictionary for the Industry I’m Developing in using the Dictionary Creating tool. It shows the Words relevant for that Industry.

    However, when I compare the resultant file with the C1Spell_en-US-medical.dct, it does not have the en-AU Dictionary words there as does the C1Spell_en-US-medical.dct File.

    So, what is the difference between a “User” Dictionary file and a “Custom” Dictionary file?

    Next question. If a user changes a Word selection, are these words available to be removed from any list at a later tine?

  • Posted 12 April 2018, 7:50 pm EST

    Thank you for your response Ruchir. You are helping me greatly in my dilemma.

    Let’s look at CustomDictionary first please. I used the C1SpellChecker Dictionary Editor,using the New Dictionary button, to create an Industry Specific Dictionary, SalonSpa. The result was a Dct File, C1Spell_en-AU-SalonSpa.

    Now, that’s fine. How it decided to give it an en-AU attribution puzzles me.

    When I compare the resultant file with the file, C1Spell_en-US-Medical, I notice that the latter has the full en-US words, while my C1Spell_en-AU-SalonSpa, does not.

    I have used the Copy/Paste procedure to add the en-AU dictionary words into my C1Spell_en-AU-SalonSpa, which I propose will be added to the VB Project as the MainDictionary. So, what does the C1SpellChecher Property for?

    Am I correct in this procedure?

    Now to the UserDictionary. As I understand it, these are the words that are added by the User, when the MainDictionary alerts a Spell Error and yet the User wants to use this word. Correct?

    Now can I allow the User to Remeove any word that they may have previously approved?

    How can I provide this allowance?

    Thank you for your time Ruchir. I look forward to your response.

    Regards, Graham

  • Posted 12 April 2018, 8:32 pm EST

    Hello Graham,

    UserDictionaries are the Read-Write dictionaries used to store words that are correct but were not part of the main dictionaries i.e., they are the dictionaries that contains words present in MainDictionary plus you can add some words to it using AddWord method, like your CompanyName.

    Whereas, CustomDictionaries are again the Read-Write dictionaries but they are built from scratch by inheriting ISpellDictionary interface. Unlike UserDictionary, Custom dictionaries are not an addition to the words present in a MainDictionary, they are dictionaries that can have any logic for accepting a word, something like all words starting with A would be correct.

    C1Spell_en-US-medical.dct present in the Dictionary list is one of the MainDictionary available. You can choose between the available Main Dictionaries by setting FileName property of C1SpellChecker.MainDictionary to the name of the dictionary. And the property UserDictionary.FileName will still be equal to Custom.dct.

    Re. the dictionary you created, not containing the en-AU words, could you please elaborate a bit further on this. Do you wish to have a Dictionary containing words specific to your industry plus the en-Au words? In this case, you can use C1Spell_en-AU.dct as the MainDictionary, as follows:```

    C1SpellChecker.MainDictionary.FileName=“C1Spell_en-AU.dct”;

    C1SpellChecker.UserDictionary.AddWord(“ANYWORD”);

    Re. [i]If a user changes a Word selection[/i]: Do you mean that once a word has been added, can it be removed later? If this is what you meant then, yes the word can be removed, as follows:```
    C1SpellChecker.UserDictionary.RemoveWord("ANYWORD");
    ```However, if this was not what you needed, we request you to please elaborate a but further
    
    Hope the above information helps.
    
    Regards,
    Ruchir Agarwal
  • Posted 12 April 2018, 9:20 pm EST

    Hi Graham,

    It feels great that the information shared was helpful to you.

    Using the NewDictionary button, the resultant dictionary will have only those words that the creator added manually and the words allowed according to the rule created. Therefore, as you mentioned, that you added industry specific words and copy/pasted words from C1Spell_en-AU dictionary, so this resultant dictionary will contain only your industry words and en-AU words, it will not automatically contain words from en-US, as in C1Spell_en-US-Medical dictionary.

    If you want to have full en_US words then you need to copy/paste words from C1Spell_en-US dictionary. I hope I am able to clarify.

    Also, using the NewDictionary button, at my end it does not give a name by default, rather it sticks to the FileName box until I manually provide a name to it. Please see attached screen-shot. Is the behavior at your end inconsistent to this or Am I missing any step here ?

    Re. the UserDictionary: Yes, you are now absolutely right in understanding it. It is like a SuperSet of MainDictionary, having the manually added words in addition.

    Re. Now can I allow the User to Remove any word that they may have previously approved?: Yes, this can be done. As I mentioned above, the words added in UserDictionary can be removed from the same any moment, for this you just need to call its Remove method once.

    Eg: If I wish to add ‘GrapeCity’ to a dictionary and then later remove it, it can be done as follows:```

    C1SpellChecker.UserDictionary.AddWord(“GrapeCity”);

    C1SpellChecker.UserDictionary.RemoveWord(“GrapeCity”);

    
    Thanks,
    Ruchir Agarwal[img]https://gccontent.blob.core.windows.net/forum-uploads/file-1c6fbb51-4500-4dd9-9d41-7a3481c9fdef.png[/img]
  • Posted 12 April 2018, 10:48 pm EST - Updated 3 October 2022, 5:47 pm EST

    Ruchir,

    I think we are on the “Same Page” here. I’m getting the idea.

    If I Create Custom Dictionaries, they will be language Specific.

    So they will be as you have C1Spell_euUS-Medicaland as I now have C1Spell_eu-AU-SalonSpa. They will contain the MainDictionary AND the Localised, Custom Dictionary.

    Now, I think I can do this using the ISpellDictionary Interface. I will look at this later.

    In the meantime, is there a way of extracting a List of UserDictionary words, so that I can present that to the User to allow Removals?

    As you may have guessed, I’m hugely impressed with C1SpellCheck Control and I want to make all of it’s features available to my International clients, using their Language.

    Attached is a UI for SpellCheck Settup in my App.

    Regards, Graham.

  • Posted 12 April 2018, 10:51 pm EST

    I hope this helps in understanding what I wish to achieve.

    Regards, Graham

  • Posted 13 April 2018, 7:45 pm EST

    Hello Ruchir,

    I think I have answered my own question.

    C1SpellChecker.UserDictionary.AddWord("GrapeCity")
    If C1SpellChecker.UserDictionary.Words.Length > 0 Then
    	' Sort through the List here.
    	C1SpellChecker.UserDictionary.Words(int)	'etc
    End If
    
    
  • Posted 15 April 2018, 5:53 pm EST - Updated 3 October 2022, 5:47 pm EST

    Hello Graham,

    It’s good to hear that you are finding our product & its features worthy and helpful.

    Yes, you are now right in understanding how the CustomDictionaries are created via C1SpellChecker.

    Re. getting the list of words added in CustomDictionary: This can be done accessing the Words collection inside C1SpellChecker.UserDictionary, just like you have already figured.

    Please do let me know, if you have any further questions for me to answer.

    Thanks & Regards,

    Ruchir Agarwal

  • Posted 15 April 2018, 6:54 pm EST - Updated 3 October 2022, 5:47 pm EST

    Now, I have the UserDictionary completely understood. What has been confusing is that the C1SpellChecker Control Properties, list the Property “User Dictionary” to seek the Custom Dictionary Properties. This needs to be corrected to negate further User confusion.

    Attached is my User Dictionary UI.

    Now to the Custom Dictionary please.

    On my previous message I sent an Image of the Spelling Setup in my App. It shows a Custom Dictionary button.

    This button will activate the attached Image file Custom Dictionary Dialog. Parent Center, Top Most..

    Now, is there some Sample Code in VB that shows how you can Add or Remove Words from the Custom Dictionary.? Let me show you what is my CustomDictionary, based on what I assumed was the eu-US-MedicalDictionary. Please see File attached.

    What do I need to do to establish this situation of a MainDictionary for the appropriate Language and a CustomDictionary for the Industry and also allow Additions and Removals from the CustomDictionary?

    C1Spell_en-AU-SalonSpa.dct

    Thank you for your investigation.

    Regards, Graham

  • Posted 18 April 2018, 1:33 am EST

    Hello Graham,

    I am working on your requirement. I will get back to you with the solution soon.

    Regards,

    Ruchir Agarwal

  • Posted 18 April 2018, 5:15 pm EST

    Ruchir,

    Any update on this Custom Dictionary issue for VB available ?

    Regards, Graham.

  • Posted 18 April 2018, 6:19 pm EST - Updated 3 October 2022, 5:47 pm EST

    Hello Graham,

    I have prepared a sample to meet the requirements as you mentioned. Therefore, I request you to please refer the same and let me know, if it needs any modifications.

    Since the application needed various *.dct files, its size exceeds the limit permitted here, so please use the following URL to download the sample: https://www.dropbox.com/s/gde44skt80nl3za/MultiLang_SpellChecker.zip?dl=0

    Hope the sample helps you.

    Best Regards,

    Ruchir Agarwal

  • Posted 20 April 2018, 1:14 pm EST

    Why do you refer to _spell.UserDictionary in the BtnAdd and BtnRemove procedures?

    Shouldn’t that be _spell.CustomDictionary?

    Regards, Graham.

  • Posted 22 April 2018, 1:32 pm EST

    Hello Ruchir Agarwal,

    I realise you have 2 matters going for me at the moment and both are urgent to resolve.

    But with this matter concerning the C1SpellChecker, there appears to be a disconnect.

    My understanding is that C1SpellChecker uses 3 Dictionaries.

    1. MAIN that is selectable by the user from the 21 available with the Control.

    2. CUSTOM that is selectable by the user from anyIndustry words that may not be contained in the Main Dictionary. Examples of this would me Architectural, Engineering, Medical, IT etc.; Dictionary Words in a User Dictionary file (.dct) on their PC.

    3. USER that is created and or added to, when a user selects the Add Word from the word misspelled dialog; that is a correct word, but unknown to the Main Dictionary. Examples of this would be GrapeCity, ComponentOne, WinForms, Sotidi etc.; User Dictionary Words. It appears that the User Dictionary is an inbuilt Dictionary of the C1SpellChecker. There is no way of accessing it from the C1SpellChechker Control Properties. However with Code, you can use the AddWord and RemoveWord to edit the Inbuilt User Dictionary.

    But, what I want to see is a sample of how users can Add or Remove words to and from the selected Custom Dictionary. Whatever that Industry Custom Dictionary is. The words shouldn’t be simply added to the User Dictionary in my opinion. The user should have the opportunity to update their Custom Dictionary.

    Your addressing this issue would be appreciated.

    Regards, Graham.

  • Posted 23 April 2018, 1:14 am EST

    Hello Graham,

    I understand that we are definitely on the same page for MainDictionary. However, there are still few conflicts in Custom and User dictionary.

    CustomDictionary should be thought as a dictionary that contains logic such that any word that meets that logic will be allowed. Whereas, UserDictionary should be taken as a collection of limited words.

    So, if you comprehend now, since CustomDictionary is a logic, so it wouldn’t make sense in adding/removing words to/from it. Whereas, since the UserDictionary is a collection of words, it’s perfectly alright to add/remove words from a specific fields.

    For further information and clarification please refer [though some of them are for WPF, but the information presented applies to WinForms too]:

    http://help.grapecity.com/componentone/NetHelp/c1spellchecker/webframe.html#typesofdictionaryfil.html

    http://help.grapecity.com/componentone/NetHelp/C1SpellCheckerWPF/webframe.html#UserDictionary.html

    http://help.grapecity.com/componentone/NetHelp/C1SpellCheckerWPF/webframe.html#CustomDictionary.html

    Hopefully the above links will help in clarifying.

    Best Regards,

    Ruchir Agarwal

  • Posted 24 April 2018, 10:31 pm EST

    The question I was asking, is how does one ADD or REMOVE Words from the Custom Dictionary, programmatically?

    Your code just Adds or Removes them from the User Dictionary.

    Send me the requested Procedure please.

    Regards, Graham.

  • Posted 25 April 2018, 3:55 pm EST

    Hello Graham,

    CustomDictionary does not consists of any methods for adding/removing. The interface it implements ‘ISpellDictionary’ contains only single method ‘Contains’ that return a Boolean signifying whether the word will be returned as correct/incorrect. So, as I mentioned earlier we can define some logic to allow/disallow words but we cannot add/remove words to/from it.

    For adding/removing words, you need to use UserDictionary’s AddWord and RemoveWord methods, as was shown in sample.

    Regards,

    Ruchir Agarwal

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels