Bulk import of words into the User dictionary

Apologies if this is covered elsewhere, but a search found nothing.

I have embarked on a new project, having imported an RTF file from MS Word. It contains a huge number of ‘new’ recurring words [place names] which will need to be added to the dictionary.

Is there a way of importing correct new words? Using the manual ‘Learn Spelling’ mode really isn’t a preferred option for such a large number!

Many thanks for reading this!

For general background, see the following link and also do a search in the forums on the word “aspell”.
viewtopic.php?f=30&t=25897&start=0&hilit=aspell

DANGER DANGER DANGER

My sense is that the practical way for a non-tech wizard to do what you want to do would be add your additional words to this plain text file (YOURUSERNAME being your user name on your PC)…
C:\Users\YOURUSERNAME\AppData\Local\Scrivener\Scrivener\wordlists.ini

Here’s what a short version of such an existing file might look like (mine, due to using some Portuguese/Brasilian words in English fiction).

[General]
personal=favelas, Pastchado, portuguesa, Brasil, Cordilheira, morros

The key thing to note is that this is a plain text file (same as .txt format) that contains no formatting and, equally important, contains no line breaks (enter, line feed, carriage return, etc.) in the “personal=” line. Essentially, it is a two line text file (with a possibly very long wrapped “personal=” line). Adding an additional word would involve adding a comma, a space, then the word, to the end of the existing line… and never breaking the line, no matter how long it gets (depending on the editor you use, it may wrap the line for readability, but NEVER BREAK THE LINE yourself).

Text editors (i.e. non-formatting editors) for doing that include NotePad (comes with Windows), NotePad++ (free off Internet), UltraEdit (free time limited eval copy available off the Internet).

Here’s a possible procedure.
DANGER
USE AT YOUR OWN RISK.

  • Prepare the list of new words,
    as a plain text file
    in the format
    “, worda, wordb, wordc”
    with all the words in a single line, regardless of line length or wrap,
    each word preceeded by a comma and space.
    If you start with a list where each word is on a separate line,
    replace each line break with a comma and space (i.e. ", ")
    and make sure the first word begins with such
    and there is no such after the last word.

  • Make sure Scrivener is not running.

  • Make one or more safety copies of the wordlists.ini file.
    In Windows Explorer folder/file tree view, find the file,
    right click on it, select “copy”,
    then elsewhere (perhaps on desktop),
    point at empty area, right click, select “paste”.
    Probably worth doing this more than once,
    to more than one location, so have multiple safety backup copies.

  • Use a text editor to edit the wordlists.ini file,
    adding the words to the end of the “personal=” line.
    This would involve copy/pasting the additional new words
    from the file discussed earlier onto the end of the line.
    Text editors (i.e. non-formatting editors) for doing that include
    NotePad (comes with Windows), NotePad++ (free off Internet),
    UltraEdit (free time limited eval copy available off the Internet).

Here’s what the file might look like before…

[General]
personal=favelas, Pastchado, portuguesa, Brasil, Cordilheira, morros

Here’s what the file might look like after…

[General]
personal=favelas, Pastchado, portuguesa, Brasil, Cordilheira, morros, worda, wordb, wordc, wordd, worde, wordf, wordg, wordh, wordi, wordj, wordk, wordl, wordm, wordn, wordo, wordp, wordq, wordr

  • restart Scrivener and see if it works.

Worst case, if it doesn’t, exit Scrivener, replace the edited file with one of the backup copies, then restart Scrivener and you should be back in business.

Alternate procedure… probably slower, but also safer…

Have list of additional words up in a text editor, so that can select and copy them, one word at a time.

In Scrivener, Tools > Options > Corrections > View Personal Word List and then proceed to add the words, one at a time via:

  • click “+” button
  • select and copy word from above text editor
    (make sure select just the word,
    not anything else like space or line break)
  • paste it into empty Add Word field
  • clicking OK
  • repeating the above process for next word

Hi SpringfieldMH,

Thank you SO much for taking the time to post such a comprehensive reply!

I am pleased to report the success of updating the wordlists.ini file - after making the vital/obligatory safety backup!

This is so much better than manually adding each word one by one, for the prospect of adding every place-name in the whole of the UK & Ireland fills me with dread - I might not get any further than ‘D’ before I die!

Hi. By coincidence, I asked the same question just yesterday, over in this thread:
viewtopic.php?f=30&t=26252

The directions work perfectly. Thank you so much!

The warnings and cautions are always worth noting when messing with ini and other system files. Fortunately in this case, the risks are relatively low.

The easiest and fastest way to prepare the Word custom.dic for copying into Scrivener’s wordlist.ini is to – believe it or not – open it directly (or otherwise get it into) Word itself. (Word doesn’t object to your opening this file, even when Word is running, though making a copy first is never a bad idea.)

Inside Word, you’ll find an alphabetical list of words, one word per line/paragraph.

Then you can do a simple search and replace, where you:
– Search for ^p (that’s a carrot symbol followed immediately by a lowercase p) which is the search code for paragraphs,
– Replace that with a comma followed directly by a space.

Click Replace All, and the list will instantly be turned into a long, wrapped, single “line” (actually a single paragraph) with the words still in alphabetical order.

Then delete the comma and space after the very last word in this long line.

At this point, as described by SpringfieldMH, you can copy this directly into wordlist.ini, which can be opened in any plain text editor like Notepad or Notepad++. (The text copied from Word is “clean” and can be copied into the text editor without any problem. I suspect – though I haven’t tried this – that you could even open the wordlist.ini file directly in Word, paste in the new words, and as long as you save that file in its original text format – using the same .ini extension, and you don’t violate the “comma-space” after each word - – it would work just fine.)

It’s best to save wordlist.ini when Scrivener isn’t running, though here too it doesn’t seem to mind if that file is played with while running. But you WILL need to exit Scrivener and then run it again so that it can read in the new wordlist.ini file.

Strangely, when you add additional words to wordlist.ini using one of the standard in-program methods, then reopen the file, Scrivener will have re-sorted the list of words in a way that appears random. This concerned me at first, but everything seems to be working fine.