Exporting the Word List from a User Dictionary

From NeoWiki

Revision as of 17:58, 18 March 2009 by Sardisson (Talk | contribs)
Jump to: navigation, search

You may wish to export the contents of your NeoOffice user dictionary at some point, for instance to sync the contents of this dictionary with your Mac OS X user dictionary.

“Exporting” the User Dictionary

When spell-checking a document, you have the option of adding unrecognized words to a user dictionary. The default user dictionary is standard.dic. If you want to export these words, you can do so as follows:

  1. Locate the dictionary file. It can be found at the following path (where ~ represents your home folder):
    • NeoOffice 2.2.x: ~/Library/Preferences/NeoOffice-2.2/user/wordbook/standard.dic
    • NeoOffice 3.x: ~/Library/Preferences/NeoOffice-3.0/user/wordbook/standard.dic
  2. Copy this file to the Desktop or another location
  3. Edit the name of this file (the copy) so that the extension reads .txt
  4. Open this .txt file in NeoOffice (if asked which filter to use, chose UTF).
  5. You will see a list of words separated by # characters. You can use a global search and replace to format the file as you need to.
  6. You may also need to remove some hard page returns.

Importing Words into the Mac OS X User Dictionary

  1. Follow the steps above to create a list of words from the NeoOffice user dictionary.
  2. Save the list of words (e.g. as a text file)
  3. Open the file in TextEdit
  4. Spell-check the file in TextEdit and learn the words.

Alternate Methods of Adding Large Word Lists to the Mac OS X User Dictionary

Instead of manually spell-checking the list of words exported from NeoOffice, tools like Dictionary Editor, Dictionary Cleaner, or custom scripts may also be useful for transferring words into the Mac OS X dictionary.

has pointed out a Perl script that will take a text file of one-word-per-line as input and turn it into a format that you can paste straight into your ~/Library/Spelling/<language code> file.

After a restart, all those new terms will be recognised by the spell-checker alongside the ones you've already added.

To use, paste the script into a new plain text file, save it as dictify, and run it from the command line, e.g. ./dictify input.file > output.file (where input.file is the one-word-per-line file).

#!/usr/bin/perl -w

# This script reads a list of strings (one per line) from STDIN
# or from the files supplied as command-line arguments
# and outputs those strings to STDOUT separated by zeros.
# Cameron Hayne (macdev@hayne.net) June 2005

# cl format is ./dictify input.file > output.file where input.file has one word per line
# paste contents of output.file into ~/Library/Spelling/en_GB - TextWrangler etc. show the invisibles

my $zerobyte = pack("B8", 0);
while (<>)
{
chomp();
print "$_$zerobyte";
}
Personal tools