Welcome to NeoOffice developer notes and announcements
NeoOffice
Developer notes and announcements
 
 

This website is an archive and is no longer active
NeoOffice announcements have moved to the NeoOffice News website


Support
· Forums
· NeoOffice Support
· NeoWiki


Announcements
· Twitter @NeoOffice


Downloads
· Download NeoOffice


  
NeoOffice :: View topic - Adding lists of terms to OSX spell-checker
Adding lists of terms to OSX spell-checker
 
   NeoOffice Forum Index -> NeoOffice Releases
View previous topic :: View next topic  
Author Message
ElishaShemuel
Agent


Joined: Apr 24, 2009
Posts: 18

PostPosted: Wed Jul 08, 2009 1:49 pm    Post subject: Re: Code for standard.dic and others

Use as directed? How? .txt words on one line for a new dictionary to add to my NeoOffice dictionaries.
Markk wrote:
Ok Here is code that takes words on individual lines, words separated by whitespace or words in standard.dic for and outputs a list separated by nulls that can be added to ~Library/Spelling wordlists.

Code:

#/usr/bin/perl -w

use strict;

# This script 'split_to_dict'
# 1. Reads standard input or a list of files specified on the command line
#    line by line in text mode, so it will automatically account for
#    unicode double byte where it (and perl) can.
# 2. It splits the lines into strings based on whitespace or
#    null (zero) characters
# 3. It removes all control characters from the strings and
# 4. Outputs the strings to STDOUT separated by zero (null) characters.
#
# Usage: perl split_to_dict inputfile1 inputfile2 > targetfile
#
# The inputfiles could be standard.dic OSX or Open Office dict or a list
# of words one per line or whitespace separated.
#
# The targetfile is suitable for pasting into ~/Library/Spelling/ dictionaries:
# cat targetfile >> ~/Library/Spelling/targetDictionary
#
# should do it where targetDictionary is "en" or "GB_en" or whatever.
# based on ideas from Cameron Hayne (macdev@hayne.net) June 2005
# version 1 Mark Kaehny March 2009
#
# released under the same license as the standard perl distribution:
# GPL version 2 or later (See the Free Software Foundation Websitei) or
# Artistic license version 2.
#

my $line;
my $word;

while ($line = <>) {
    # split on whitespace or NULL (0 valued) character
    foreach $word (split(/[\s\x00]/, $line)) {
        next if $word =~ /WBSWG6/; # skip standard.dic header
                                   # add manually if needed.
        $word =~ s/[\cA-\cZ]//g; # junk all control chars (i.e. 1-26 ascii)
        print $word, "\x00" if ($word); # add null & skip blank words
    }
}



Copy this and save it somewhere as split_to_dict and use as directed. I tested it with the given standard.dic and it worked for me. I am using early access 3. though. I did need to actually restart to get the words to be active. Clerestory and Colourant. Hmm... have to use those words somewhere.
Back to top
James3359
The Merovingian


Joined: Jul 05, 2005
Posts: 685
Location: North West England

PostPosted: Thu Jul 09, 2009 3:06 am    Post subject:

In a post on the "crash during odt auto saves" thread you attached a file called "custom 08 from office 2004.txt". This made me think that perhaps the dictionary you are wanting to make use of is a MS Word/Office custom dictionary - am I correct? I had thought it was a NeoOffice dictionary from a previous installation.

As NeoOffice uses the native Mac spelling checker it may be best for you to import that dictionary direct into the OS X spelling checker dictionary. I have had a quick Google, but haven't found anything obvious which will help you do that.

There is an OOo macro which according to this page can be used to import a MS custom.dic into OOo, which may also work for NeoOffice. Worth a try, I think. I had to use Unstuffit to get the file to unzip correctly to a .sxw document. If this works then the words will be imported into your NeoOffice user dictionary. NeoOffice will then use this seamlessly alongside the OS X spelling checker to check your documents. If, however, you want these word to be available system wide, then you will need to export the standard.dic file using the instructions on the wiki page I have already referred you to.

Please ask again if you have further questions.
Back to top
ElishaShemuel
Agent


Joined: Apr 24, 2009
Posts: 18

PostPosted: Thu Jul 09, 2009 8:54 am    Post subject: Dictionary's format for NeoOffice

James3359 wrote:
In a post on the "crash during odt auto saves" thread you attached a file called "custom 08 from office 2004.txt". This made me think that perhaps the dictionary you are wanting to make use of is a MS Word/Office custom dictionary - am I correct? I had thought it was a NeoOffice dictionary from a previous installation.

As NeoOffice uses the native Mac spelling checker it may be best for you to import that dictionary direct into the OS X spelling checker dictionary. I have had a quick Google, but haven't found anything obvious which will help you do that.

There is an OOo macro which according to this page can be used to import a MS custom.dic into OOo, which may also work for NeoOffice. Worth a try, I think. I had to use Unstuffit to get the file to unzip correctly to a .sxw document. If this works then the words will be imported into your NeoOffice user dictionary. NeoOffice will then use this seamlessly alongside the OS X spelling checker to check your documents. If, however, you want these word to be available system wide, then you will need to export the standard.dic file using the instructions on the wiki page I have already referred you to.

Please ask again if you have further questions.


So I will try that route to import to Osx then you say it will be noticed also in NeoOffice? I will try that now.

The dictionary file called "custom 08 from office 2004.txt" was originally an .dic formated office dictionary, yet until recently from the other thread you suggested I remove the preferences this was my NeoOffice dictionary until I removed the preferences. I suspect this .dic now .txt to view it, or one of my other templates may have been causing the crash. I wanted to clean this file up and then use again as the custom dictionary.
the original file above was a .dic file then after making it a .txt doc so I could look at the format and see if any words were not being found when in NeoOffice .dic format.

Another option:
I do not need to do that if we have no way of knowing the format for a .dic file for neo office to desplay correctly every word and ever all capital word. I found a list or KJB version old english style Bible dictionary list that I need basically the same as the above hand made laboriously made file, and can cut and paste it into any format. I will keep up hope that I do not have to lose all my hard work and labor in making these custom word dictionaries.
Back to top
ElishaShemuel
Agent


Joined: Apr 24, 2009
Posts: 18

PostPosted: Thu Jul 09, 2009 9:14 am    Post subject: Re: Code for standard.dic and others

ElishaShemuel wrote:
Use as directed? How? .txt words on one line for a new dictionary to add to my NeoOffice dictionaries.
Markk wrote:
Ok Here is code that takes words on individual lines, words separated by whitespace or words in standard.dic for and outputs a list separated by nulls that can be added to ~Library/Spelling wordlists.

Code:

#/usr/bin/perl -w

use strict;

# This script 'split_to_dict'
# 1. Reads standard input or a list of files specified on the command line
#    line by line in text mode, so it will automatically account for
#    unicode double byte where it (and perl) can.
# 2. It splits the lines into strings based on whitespace or
#    null (zero) characters
# 3. It removes all control characters from the strings and
# 4. Outputs the strings to STDOUT separated by zero (null) characters.
#
# Usage: perl split_to_dict inputfile1 inputfile2 > targetfile
#
# The inputfiles could be standard.dic OSX or Open Office dict or a list
# of words one per line or whitespace separated.
#
# The targetfile is suitable for pasting into ~/Library/Spelling/ dictionaries:
# cat targetfile >> ~/Library/Spelling/targetDictionary
#
# should do it where targetDictionary is "en" or "GB_en" or whatever.
# based on ideas from Cameron Hayne (macdev@hayne.net) June 2005
# version 1 Mark Kaehny March 2009
#
# released under the same license as the standard perl distribution:
# GPL version 2 or later (See the Free Software Foundation Websitei) or
# Artistic license version 2.
#

my $line;
my $word;

while ($line = <>) {
    # split on whitespace or NULL (0 valued) character
    foreach $word (split(/[\s\x00]/, $line)) {
        next if $word =~ /WBSWG6/; # skip standard.dic header
                                   # add manually if needed.
        $word =~ s/[\cA-\cZ]//g; # junk all control chars (i.e. 1-26 ascii)
        print $word, "\x00" if ($word); # add null & skip blank words
    }
}



Copy this and save it somewhere as split_to_dict and use as directed. I tested it with the given standard.dic and it worked for me. I am using early access 3. though. I did need to actually restart to get the words to be active. Clerestory and Colourant. Hmm... have to use those words somewhere.


How do I use this code above to place a list of words into a usable custom dictionary for NeoOffice? It is with a simple list of words in a txt, or doc, or odt, or ...

Or what syntax or language does neo office dictionary use so I can reproduce it and make up my own dictionaries from my own lists.

I can see some of the code syntax I do not remember the wording I am trying to say; It looks like this works for part of the code.
"OneOneOntoOnOffOnOf" all the words are in alphabetical order, some all caps words are with one caps words haveing a large space or small space I do not know if one or the other is needed. I noticed also some words have no caps and have 2 spaces to separate them for the code to read it correctly. The reader code understands a cap means a new word, or a 2 space means a new word, or tab space means a new word (have not verified this and have not had great results trying to reproduce a pure from scratch .dic yet. Can you understand what I am trying to find out now?

one capital letter makes a separation for the reading code to read the list of words for Neooffice spell checking (see below example file).

below is part of the 2008 office 2004 dic file that is partially displaying almost all the words when moved or pasted into the Neo Office wordbook Dictionary preferences section.
Is there a syntax for this code or a system that I can reproduce for NeoOffice to recognize as a dictionary file.
This displays most of all (not all listed here) words but not all. This is part of the file I think made my crash. So I need to clean this up, I am hoping.

WBSWG6ˇ
Back to top
ElishaShemuel
Agent


Joined: Apr 24, 2009
Posts: 18

PostPosted: Thu Jul 09, 2009 9:24 am    Post subject: This is the file truncated from my last post

below is part of the 2008 office 2004 dic file that is partially displaying almost all the words when moved or pasted into the Neo Office wordbook Dictionary preferences section.
Is there a syntax for this code or a system that I can reproduce for NeoOffice to recognize as a dictionary file.
This displays most of all (not all listed here) words but not all. This is part of the file I think made my crash. So I need to clean this up, I am hoping.

WBSWG6ˇ
Back to top
James3359
The Merovingian


Joined: Jul 05, 2005
Posts: 685
Location: North West England

PostPosted: Thu Jul 09, 2009 9:47 am    Post subject:

You've posted a lot here, and I need time to think about how to help. There may be other volunteers around who are willing to have a try as well. I will respond when I've had a chance to look through what you have posted.
Back to top
ElishaShemuel
Agent


Joined: Apr 24, 2009
Posts: 18

PostPosted: Thu Jul 09, 2009 10:27 am    Post subject: Cannot download the .zip to a .sxw doc or anything

James3359 wrote:
In a post on the "crash during odt auto saves" thread you attached a file called "custom 08 from office 2004.txt". This made me think that perhaps the dictionary you are wanting to make use of is a MS Word/Office custom dictionary - am I correct? I had thought it was a NeoOffice dictionary from a previous installation.

As NeoOffice uses the native Mac spelling checker it may be best for you to import that dictionary direct into the OS X spelling checker dictionary. I have had a quick Google, but haven't found anything obvious which will help you do that.

There is an OOo macro which according to this page can be used to import a MS .dic into OOo, which may also work for NeoOffice. Worth a try, I think. I had to use Unstuffit to get the file to unzip correctly to a .sxw document. If this works then the words will be imported into your NeoOffice user dictionary. NeoOffice will then use this seamlessly alongside the OS X spelling checker to check your documents. If, however, you want these word to be available system wide, then you will need to export the standard.dic file using the instructions on the wiki page I have already referred you to.

Please ask again if you have further questions.


I am working at getting the file it will not download the file:///projects/ooomacros/files/OOo%20FBTools/OOoFBTools-1.0.5.1.zip/download. I was working at going this route but cannot proceed. I have to get some work done now. I will try something later. Thank you so much for all your help everyone. God bless you all today.
Back to top
ElishaShemuel
Agent


Joined: Apr 24, 2009
Posts: 18

PostPosted: Thu Jul 09, 2009 10:43 am    Post subject: Import Export Word Dic looks like the best way now.

I have a new downloaded KJV.dic for word. I was trying to go this route but cannot download the macro file to see if this will work or not. Here is the KJV. dic file attatched. This is better than all the other ways of trying to clean up old NeoOffice .dic files or preferences that may or may not be corrupted causing my crashes. Thank you again.
Back to top
James3359
The Merovingian


Joined: Jul 05, 2005
Posts: 685
Location: North West England

PostPosted: Fri Jul 10, 2009 5:05 am    Post subject:

OK, first the warning. For me this is at the very limits of my comfort zone. For your own safety and peace of mind I strongly recommend that where you are altering any files you first make a copy of the originals so that it will be easy to restore things back to where they were if something goes wrong. I have noted this in the instructions which follow. I have tested this on my machine (iBook 1.33 GHz 512 MB PowerPC G4, OS X 10.4.11) and it has worked - but beyond that I am not offering any guarantees!

The macro I linked to doesn't seem to work in NeoOffice 3 I don't know how to fix it so I think you will need to use NeoOffice 2.2.5 to achieve your end. If you haven't got NeoOffice 2.2.5 you will need to download and install it. Please note these instructions about installng more than one version of NeoOffice.

If you already have NeoOffice 2.2.5 with a user dictionary which you don't want to alter then you will need to move it somewhere else for safekeeping. It is located in the folder [username]/Library/Preferences/NeoOffice-2.2/user/wordbook. The file is called 'standard.dic'.

Download ImportExportDictionary1-1.zip from here (you will need to scroll down the page to find it and click the [+] disclosure button to reveal the download link) and unzip it. You should end up with a document called ImportExportDictionary1-1.sxw. (I had to use StuffIt Expander to do the unzipping as the native unzip on my machine simply turned the zip file into a folder)

Open ImportExportDictionary1-1.sxw in NeoOffice 2.2.5 and follow the instructions to import your dictionary of choice (KJV.dic in your case) into your NeoOffice standard.dic.

Open TextEdit and copy the split_to_dict script from the NeoWiki into a new document. Choose Format::Make Plain Text, and then save the document without the .txt extension onto your desktop.

The next step will make changes to your OS X System user spelling dictionary, so you ought to make a copy of the original just in case. You will find it in [username]/Library/Spelling on my British English system it is called en_GB. Put the copy on your desktop or some other safe place.

Next copy the Example script from the NeoWiki and paste somewhere you can edit it e.g. TextEdit or a Sticky. Edit the script so that the filename at the end of the last line of the script is the name of the user dictionary you are wanting to alter. In my case I needed to replace 'en' with 'en_GB'

Next open Terminal and paste the edited script into the Terminal window and it will run, executing the split_to_dict script, copying the result into a file on your Desktop called neo-words and then pasting it into your OS user dictionary.

I then restarted my computer to ensure that the new user dictionary was recognised. The neo-words file can be deleted.

Does this work for you?
Back to top
ElishaShemuel
Agent


Joined: Apr 24, 2009
Posts: 18

PostPosted: Fri Jul 10, 2009 12:38 pm    Post subject: Dictionary's formated for Osx and NeoOffice reply

James3359 wrote:
OK, first the warning. For me this is at the very limits of my comfort zone. For your own safety and peace of mind I strongly recommend that where you are altering any files you first make a copy of the originals so that it will be easy to restore things back to where they were if something goes wrong. I have noted this in the instructions which follow. I have tested this on my machine (iBook 1.33 GHz 512 MB PowerPC G4, OS X 10.4.11) and it has worked - but beyond that I am not offering any guarantees!

The macro I linked to doesn't seem to work in NeoOffice 3 I don't know how to fix it so I think you will need to use NeoOffice 2.2.5 to achieve your end. If you haven't got NeoOffice 2.2.5 you will need to download and install it. Please note these instructions about installng more than one version of NeoOffice.

If you already have NeoOffice 2.2.5 with a user dictionary which you don't want to alter then you will need to move it somewhere else for safekeeping. It is located in the folder [username]/Library/Preferences/NeoOffice-2.2/user/wordbook. The file is called 'standard.dic'.

Download ImportExportDictionary1-1.zip from here (you will need to scroll down the page to find it and click the [+] disclosure button to reveal the download link) and unzip it. You should end up with a document called ImportExportDictionary1-1.sxw. (I had to use StuffIt Expander to do the unzipping as the native unzip on my machine simply turned the zip file into a folder)

Open ImportExportDictionary1-1.sxw in NeoOffice 2.2.5 and follow the instructions to import your dictionary of choice (KJV.dic in your case) into your NeoOffice standard.dic.

Open TextEdit and copy the split_to_dict script from the NeoWiki into a new document. Choose Format::Make Plain Text, and then save the document without the .txt extension onto your desktop.

The next step will make changes to your OS X System user spelling dictionary, so you ought to make a copy of the original just in case. You will find it in [username]/Library/Spelling on my British English system it is called en_GB. Put the copy on your desktop or some other safe place.

Next copy the Example script from the NeoWiki and paste somewhere you can edit it e.g. TextEdit or a Sticky. Edit the script so that the filename at the end of the last line of the script is the name of the user dictionary you are wanting to alter. In my case I needed to replace 'en' with 'en_GB'

Next open Terminal and paste the edited script into the Terminal window and it will run, executing the split_to_dict script, copying the result into a file on your Desktop called neo-words and then pasting it into your OS user dictionary.

I then restarted my computer to ensure that the new user dictionary was recognised. The neo-words file can be deleted.

Does this work for you?


Ok will give it a go, need some time to work all this in. Thank you, the making copies of the existing dictionaries for Osx and Neo may be the best advise so I can use them and back them up for future use when something like this happens again, as it seems I have lost my dictionaries many times with great time invested in them. I just found this KJV.dic should make it all easier now. Thank you for your help.
Back to top
Display posts from previous:   
   NeoOffice Forum Index -> NeoOffice Releases All times are GMT - 7 Hours
Goto page Previous  1, 2
Page 2 of 2

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Powered by phpBB © 2001, 2005 phpBB Group

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © Planamesa Inc.
NeoOffice is a registered trademark of Planamesa Inc. and may not be used without permission.
PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.