Author Topic: search word in main and custom dictionary  (Read 975 times)

0 Members and 1 Guest are viewing this topic.

vincent.r

  • Newt
  • Posts: 101
search word in main and custom dictionary
« on: March 01, 2023, 01:21:24 AM »
Is there any function to search a word in main and custom dictionary ?

Input
(search_word_in_main_&_custom_dictionary "rwong")
Output
Nil

Input
(search_in_main_&_custom_dictionary "wrong")
Output
T


dexus

  • Bull Frog
  • Posts: 207
Re: search word in main and custom dictionary
« Reply #1 on: March 01, 2023, 03:12:43 AM »
You can make a list of all the dictionaries and then search through that.
Here is a list of all the dictionaries:
Code - Auto/Visual Lisp: [Select]
  1.   (if (vlax-property-available-p dicts 'Name)
  2.     (setq rtn (cons (cons (vlax-get dicts 'Name) dicts) rtn))
  3.   )
  4. )
  5. (reverse rtn)
Code was mostly copied from: https://www.theswamp.org/index.php?topic=58094.msg613243#msg613243

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8698
  • AKA Daniel
Re: search word in main and custom dictionary
« Reply #2 on: March 01, 2023, 03:19:32 AM »
You can make a list of all the dictionaries and then search through that.
Here is a list of all the dictionaries:
Code - Auto/Visual Lisp: [Select]
  1.   (if (vlax-property-available-p dicts 'Name)
  2.     (setq rtn (cons (cons (vlax-get dicts 'Name) dicts) rtn))
  3.   )
  4. )
  5. (reverse rtn)
Code was mostly copied from: https://www.theswamp.org/index.php?topic=58094.msg613243#msg613243

I think its the dictionary used for spelling

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8698
  • AKA Daniel
Re: search word in main and custom dictionary
« Reply #3 on: March 01, 2023, 03:58:45 AM »
As far as I know, you can’t edit the main dictionary with lisp. But I think the custom dictionary is just a text file.
you might be able to find an app to edit main dictionaries, start here http://hunspell.github.io/

vincent.r

  • Newt
  • Posts: 101
Re: search word in main and custom dictionary
« Reply #4 on: March 01, 2023, 04:15:35 AM »
You can make a list of all the dictionaries and then search through that.
Here is a list of all the dictionaries:
Code - Auto/Visual Lisp: [Select]
  1.   (if (vlax-property-available-p dicts 'Name)
  2.     (setq rtn (cons (cons (vlax-get dicts 'Name) dicts) rtn))
  3.   )
  4. )
  5. (reverse rtn)
Code was mostly copied from: https://www.theswamp.org/index.php?topic=58094.msg613243#msg613243

I think its the dictionary used for spelling

Correct Thanos. Want to check spellings through AutoLisp.

vincent.r

  • Newt
  • Posts: 101
Re: search word in main and custom dictionary
« Reply #5 on: March 01, 2023, 04:42:10 AM »
As far as I know, you can’t edit the main dictionary with lisp. But I think the custom dictionary is just a text file.
you might be able to find an app to edit main dictionaries, start here http://hunspell.github.io/

Ohh..Thanks Thanos. I dont want to edit main dictionary. I just want to read it to check whether given word is available in main dictionary or not. If it is not in main directory, I can add it in custom dictionary (Sample.cus).

hmspe

  • Bull Frog
  • Posts: 362
Re: search word in main and custom dictionary
« Reply #6 on: March 01, 2023, 09:07:06 AM »
It looks like the main dictionary uses the ASPELL system.  en_US.dic is clear text but has modifiers attached that give variants (like adding 'ing' or 'ion' to the root word).  The modifiers are defined in en_US.aff, which is also clear text.  There is a version of ASPELL for Windows.  ASPELL is well documented.

I did not research it but there is supposed to be an easy way to convert an ASPELL dictionary file to an LSPELL file, which is a complete word list with all the variants included. 
 


   
"Science is the belief in the ignorance of experts." - Richard Feynman

BIGAL

  • Swamp Rat
  • Posts: 1411
  • 40 + years of using Autocad
Re: search word in main and custom dictionary
« Reply #7 on: March 01, 2023, 07:28:14 PM »
A little bit of DOS inside Windows is a function FINDSTR so you can look inside a txt file for a string, could be called from lisp I did it manually.

Go bottom left of windows type CMD

C:\Program Files\Bricsys\Bricscad V20 en_us\support

findstr enable en_us.dic
alienable/IU
enabler/M
enable/SRDZG
tenableness/M
tenable/P
untenable

Could possibly push result into a file and have a look.
findstr enable en_us.dic >d:\acadtemp\findstr.txt
A man who never made a mistake never made anything