View Single Post
Old 07-22-2015, 12:38 PM   #3
CalibUser
Addict
CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.CalibUser goes to eleven.
 
Posts: 202
Karma: 62362
Join Date: Jul 2015
Device: Sony
Thanks for your response. I want to write plugin that will remove hyphens from words that should not be hyphenated. To do this the plugin will scan through the epub and when it finds a hyphenated word it will remove the hyphen and then see if the word without the hyphen exists in the dictionary. If it does, then it will remove the hyphen from the word in the ePub.

I've decided to use the python "ctypes" calls to do this job and I found a helpful site at http://thispageintentionally.blogspo...-hunspell.html.

This site uses the following code to load the library:

<code>
import os
# set up path strings to a dictionary
dpath = '/Users/dcortes1/Desktop/scratch'
daff = os.path.join(dpath, 'en_US.aff')
ddic = os.path.join(dpath, 'en_US.dic')
print( os.access(daff,os.R_OK), os.access(ddic,os.R_OK) )
# Find the library -- I know it is in /usr/local/lib but let's use
# the platform-independent way.
import ctypes.util as CU
libpath = CU.find_library( 'hunspell-1.3.0' )
# Get an object that represents the library
import ctypes as C
hunlib = C.CDLL( libpath )
</code>

Unfortunately this produces the error when I run it in a Sigil plugin:

Error: bad argument type for built-in operation

Where is the error in this code?

Thanks
CalibUser is offline   Reply With Quote