How to create the affix and dic files for postgresql text search - postgresql

I wanna use postgresql's text search capability for one of my projects. The language supported gonna be in english and indonesian. Unfortunately, I can't find indonesian config to be used. (example is here https://www.cs.hmc.edu/~geoff/ispell-dictionaries.html)
Looking at https://www.postgresql.org/docs/11/textsearch-dictionaries.html, it seems I can make my own custom stopwords, affix, and dic files. I already found and load the stopwords file (from https://github.com/masdevid/ID-Stopwords), meanwhile for the affix (the rule looks like here http://indodic.com/affixeng.html) I can't seem to find the file, or the way to write the affix/dic file.
Can someone point out to me how, or possibly where can I find some information in more details?

The Ispell link referenced in the PostgreSQL documentation has the following information:
Complete documentation for ispell, including documentation of the affix-file format, comes with the distribution kit in Unix manual-page format. If you have ispell installed on your machine, you should be able to type "man ispell" to view it. For convenience and browsing, the primary manual page for ispell is also available online.
You will have to study that, then you can create an affix file.

Related

Replacing the location of images in Google-Earth

A friend of mine inherited (don't ask about the specifics here) a documentation on Google Earth which incorporates a lot of images. Those where on a server and accessed from there.
Now the server has been shutdown, so the web-links are gone. Nevertheless the images are still available as the server data has been secured. The links in GE are now marked as invalid, and I can see that there are web-links in the form of https://domain.tld/directory/image.jpg in the app.
So I am looking for a solution to extract the data to be able to replace the https://domain.tld/directory-part, replace it with an appropriate local directory (C:\directory\) and then reload it back into the GE.
Or is there any internal function/tool available in GE?
(IT-knowledge to a certain extent to make conversions is available.)
If by "documentation on Google Earth" you mean a KML file, then yes, you should be able to update the URLs relatively easily. a KML file is just an XML text file, so you can open it up with any text editor. If you use a full featured text editor then you can do a find/replace on the "https://domain.tld/directory/" part, and replace it with something that looks like: "file:///C:/directory/".
Where you find the URLs will depend on whether the images are used as ground overlays, icons, content in balloons associated with placemarks, etc.

Import autocorrect library from word to google doc

I'm planning to switch from Microsoft Word to Google Docs since it has better collaboration options. However, I have set up an extensive auto-correct library in Microsoft Word over the course of 3 years. If I switch to Docs now, I'll have to set them up all over again. A rather daunting task.
I found out that all the auto-correct entries in Word are stored in a file called MSO1033.acl, but I can't find anything that would help me import the auto-correct library from it to Google Docs. Any idea?
The question was about Word's AutoCorrect entries, not custom dictionaries. Although the suggestion to use Auto Hotkey or Selenium still applies.
This is obviously a two-step process: 1) export from Word, 2) Import into Google Docs --> Tools --> Preferences.
1) EXPORT:
Earlier versions of MS Office shipped with a support.dot file that contained various macros, including one for backing up and restoring AutoCorrect entries. While it is very old (c. 2000 I think) it still works and is still available from various sources if you search for it.
This will allow you to extract the AutoCorrect entries into a word document, which can then be saved as a .txt file or whatever.
2) IMPORT - The Missing Link!
There does not seem to exist at the moment a script to import new spelling corrections into Docs. So someone needs to write it. As the proud owner of 22,000 Word AutoCorrect entries who is now a Google Docs fan I'd do this myself!
Except that https://developers.google.com/apps-script/reference/document/ doesn't seem to provide an API for Tools-->Preferences, which makes what should be a straightforward task quite tricky.
Custom Dictionaries in Word
Your custom dictionaries are stored by Word in *.dic files. There files are plaintext files where each entry is in a separate row.
The custom dictionaries are stored at various locations within your user profile:
%APPDATA%\Microsoft\Office\15.0\\Proofing\RoamingCustom.dic
%APPDATA%\Microsoft\Spelling\\default.dic
%APPDATA%\Microsoft\UProof\CUSTOM.DIC
You can see all custom dictionaries via File -> Options -> Proofing -> Custom Dictionaries...
Manually Importing to Google Docs
There is no direct way to import a list of Word (i.e. a Microsoft Word custom dictionary) into Google Docs. Google Docs provides an interface for adding single Word to a (single) custom dictionary. To access the interface open a document and select Personal Dictionary... from the Tools menu:
If you only have to add a few entries, manually entering the words is probably the fastest way to transfer your dictionaries.
Automatically Importing to Google Docs
If you have a lot of words in your custom dictionaries, you can automate your browser, e.g. using a tool such as AutoHotKey or Selenium.

Correctly write my files so they can open as text when my app is not installed

My application writes files known as ".nec", which are simply text files. I'd like them to open in my app if it's on the machine, or open in the default text editor if it's not.
There are surprisingly few examples of how to set these things in Apple's documentation. Do I simply set the MIME type to text/plain, or are there other things I should do as well?
Most computers / mobile devices will use the file extension to determine the file type rather than read the file headers so if you are using a custom file extension then the device won't know which application handles that file.
If you want your applications documents to opened by something outside of your application you will need to use a standard format for your file type.
For textual documents the most common are likely to be .txt, .rtf and .doc
If your documents are just plain text without any formatting (like a log file) then you would be best using .txt, you shouldn't need to change much (if anything) to write in this format.
After a quick google of the file extension .nec I found this:
NEC files are Uncommon Files primarily associated with Unknown Apple II File (found on Golden Orchard Apple II CD Rom).
NEC files are also associated with NEC JIS Encoded File, PIMS Notes for Windows CE Audio Record File (Nacetech Co. Ltd.) and FileViewPro.
If one of your files were to be (for example) emailed to a windows user, Windows would not know that this is a simple text file and would likely prompt the user to search online for a program that handles this file extension.
Not an answer as such, but as to date you don't have one here are some things to explore in the hope it is useful.
The old style type and creator of Mac OS have just about gone, first to replaced by just file extensions, and now there are UTIs.
If you read Apple's Uniform Type Identifier Concepts you will see your app can declare a UTI, say com.markowitz.nectext, which conforms to the standard UTI public.text. Now a UTI helps the Finder (Launch Services) locate the app to open a file, you could explore what happens if there is no such app available but the UTI declares it conforms to public.text.
[Just seen your comment on another answer re: right-clicking. At a guess this would be the UTI above.]
Another avenue to explore, getting into the undocumented side of OS X, is how the Finder's "Get Info" handles setting the "Open With" preference on a file. Try setting a plain text file to open in your app, then use the xattr -l <file> in the Terminal to see what was done. You should see an extended attribute com.apple.LaunchServices.OpenWith whose value looks like some form of plist.
Just remember this is undocumented, the API used by the Finder is private, but then its just an extended attribute...
Have fun.

Spotlight Importer in Xcode 6. Up to date documentation?

I need to develop a spotlight importer for a custom data type on Xcode 6
The online apple documentation seems quite comprehensive, and there is also a nice example project here. Only problem is, when I create a new Spotlight Importer project in Xcode 6, the template doesn't look at all like anything described in the official docs. For example, there's no schema.xml file, there is different and obscure terminology like store file uti, external record uti, etc.
It looks like the apple docs are seriously out of date. Can anybody provide some help? A link to some third party tutorial or example project?
The documentation isn't really out of date. It's just that the template in Xcode 6 assumes your application uses Core Data. You can find details in the Core Data Spotlight Integration Programming Guide.
However, you can pretty easily adapt the project created from the Spotlight Importer template so that it lets you create a normal importer. I recently did this in order to write an importer that processed Lua source files so that I could use Spotlight to search for particular functions, etc.
If you were going to create lots of importers, you could create a custom template that has the following fixes applied. But I'm not, so I didn't...
Create a new project using the Spotlight Importer template and then:
Remove MySpotlightImporter.{h, m}
Gut the implementation of GetMetadataForFile() in GetMetadataForFile.m
Add schema.xml and schema.strings using the Empty file template
Edit Info.plist to correctly describe your Exported Type UTIs (if any).
You can find the details on schema.xml in Apple's documentation. Now you just need to implement GetMetadataForFile() so that it behaves appropriately for your custom file format.

Access adobe digital editions from the command line

I'm looking to create a script for my 80-year old grandmother that downloads the books she needs, and converts them using the command-line version of Calibre, to kindle format so she can read them on her kindle. She gets a lot of her books from a service in the form of Adobe .epub books. AFAIK, none of these books have DRM on them prior to being converted, so let me be clear - I'm not asking how to strip DRM from an ebook.
What I am asking is whether there is a way to programmatically (from the command line is fine if Adobe Digital Editions supports CL args) use the ticket file to request a book from the library, and download it, in .epub form, to the local hard drive. I simply don't want my grandmother to have to go through all of the unneeded screens in Adobe Digital Editions' interface - she gets confused easily, and the interface tends to be overwhelming for her. I simply want to write a function (it can be a system() call to a command... that's fine) that will allow her to take a file received from the library or digital service and automatically retrieve the proper .epub file.
I have all of the other steps ready to go... I just can't find any way to retrieve the book from the service without using the DE interface.
Any suggestions?
Check this S.O. posting, I know it will help ;-)
pdf-adobe-digital-edition