Can we edit the dictionary which are pre exist

Questions about XML that are not covered by the other forums should go here.
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Can we edit the dictionary which are pre exist

Post by shikhar_472 »

Can we edit the dictionary which is pre exist in dict folder as it is getting auto loaded while re starting the server attaching the image for reference.
Also is it possible to use other dictionary which has some other extension like (.ENG)
image.png
image.png (26.08 KiB) Viewed 2322 times
Attachments
dict.PNG
dict.PNG (20.81 KiB) Viewed 2322 times
image.png
image.png (26.08 KiB) Viewed 2322 times
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: Can we edit the dictionary which are pre exist

Post by shikhar_472 »

Hi Team,
Is there any update on this.
Also as per our requirement we are replacing one the the pre existing editor with oxygen web author so there we are using the dictionary by microsoft which contains .lex file is there any way we can use those dictionary file as part of custom spell check functionality.
Or we can convert .lex file to .dic file

Thanks,
Shikhar.
cristi_talau
Posts: 495
Joined: Thu Sep 04, 2014 4:22 pm

Re: Can we edit the dictionary which are pre exist

Post by cristi_talau »

Hello,

Sorry for the late reply.

You are right - if you delete one of the ".dic" files it will be copied over again when the server restarts. You can workaround this issue by deleting the ".dic" files from the source JAR (located in "tomcat\webapps\oxygen-xml-web-author\WEB-INF\lib\dicts-hunspell.jar".
However, most of our clients that want to customize spellchecking use custom terms lists or custom dictionaries .

For more advanced use-cases, we have a spell-checker API that you can implement in an editor plugin.

Regarding the LEX format, it is not supported and we are not aware of any tool that converts this format to the "dic" format (supported by Hunspell). If you find such a tool, it would be great to update this forum thread to let other users know.

Best,
Cristian
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: Can we edit the dictionary which are pre exist

Post by shikhar_472 »

Thanks Critian,

I want to set the terms dictionary document specific but using this API same dictionary is getting used for other document as well,
Could you please suggest the way to do that.

Thanks,
Shikhar.
cristi_talau
Posts: 495
Joined: Thu Sep 04, 2014 4:22 pm

Re: Can we edit the dictionary which are pre exist

Post by cristi_talau »

Hello,

Your code should look like this:

Code: Select all

authorDocumentModel.getSpellchecker().setTermsDictionary(...)
In this case, the dictionary is set only for the current document. Do you experience a different behavior?

Best,
Cristian
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: Can we edit the dictionary which are pre exist

Post by shikhar_472 »

Hi Cristi,

I have opened a document using one URL and set the word to the custom dictionary "Eitenmiller" so this word is not throwing error here -

http://localhost:8084/oxygen-xml-web-au ... /Document1


Now i have opened the second document using the same URL on different tab "Eitenmiller" here also error is gone for this word-

http://localhost:8084/oxygen-xml-web-au ... /Document2

Requirement-- for the second URL error should not gone for the word "Eitenmiller" terms dictionary which has been set for document1 should not reflect in document2.

Thanks,
Shikhar.
cristi_talau
Posts: 495
Joined: Thu Sep 04, 2014 4:22 pm

Re: Can we edit the dictionary which are pre exist

Post by cristi_talau »

Hello,

I do not fully understand the context of your problem:
  • Did you implement your own plugin?
Your requirement is only possible if you implement our own plugin using the API that I described in a previous post.

Best,
Cristian
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: Can we edit the dictionary which are pre exist

Post by shikhar_472 »

Yes,
we are using our own custom plugin using similar implementation to learn word plugin,
spellchecker.setTermsDictionary(apiDict);

We are setting apiDict on load of the document at EDITOR_LOADED event.

Our use case is to load different custom dictionary(apiDict) for each document.

Also i want to achieve this in web author as we are using webdav URL to load the document

Thanks,
Shikhar.
cristi_talau
Posts: 495
Joined: Thu Sep 04, 2014 4:22 pm

Re: Can we edit the dictionary which are pre exist

Post by cristi_talau »

Hello,

So, you say that the API is behaving unexpectedly? If yes, can you share with us a simple plugin that manifests the problematic behavior?

Best,
Cristian
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: Can we edit the dictionary which are pre exist

Post by shikhar_472 »

content-plugin.zip
(19.8 KiB) Downloaded 300 times
Hi Critian,

Please find the attached plugin i am using.

Thanks,
Shikhar.
mihaela
Posts: 490
Joined: Wed May 20, 2009 2:40 pm

Re: Can we edit the dictionary which are pre exist

Post by mihaela »

Hi,

We tested your plugin and the problem that you encountered is produced by the fact that you use class fields in AddToDictionary operation. The value of "readAllWords" is reused between editors because there is a single instance of AddToDictionary operation that is used for all editors, not one per editor.
Please let us know if you encounter any other problems.

Best Regards,
Mihaela.
Mihaela Calotescu
http://www.oxygenxml.com
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: Can we edit the dictionary which are pre exist

Post by shikhar_472 »

Hi Miheala,
How can we seprate the dictionary for each editor.
Is there any way to do that.
Also is there any method where we can get the document ID so we can update the dictionary on the basis of doc Id in map.

Thanks,
Shikhar.
Last edited by shikhar_472 on Thu Nov 10, 2022 8:30 am, edited 1 time in total.
shikhar_472
Posts: 99
Joined: Fri Jul 01, 2022 12:08 pm

Re: Can we edit the dictionary which are pre exist

Post by shikhar_472 »

Could you please update on this.
mihaela
Posts: 490
Joined: Wed May 20, 2009 2:40 pm

Re: Can we edit the dictionary which are pre exist

Post by mihaela »

Hello,

If you want to save the dictionary for each editor, to update it during the editing, you can use the EditingSessionContext API. To get the editing session context you can use the ro.sync.ecss.extensions.api.access.AuthorEditorAccess.getEditingContext() method.
Please let us know if you need other information.

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
Post Reply