Tutorial - How to Edit a Lightroom Keyword List
The first thing to do is to make a copy of your Master Keyword List, and keep that safe in case of errors created whilst editing.
That done, we are now ready to open the file. The good news is that all you need to do this is a Text Editor program. You might already have a favorite one that you are used to. The essential requirements for a suitable Text Editor program are:
- Saves its files in the UTF-8 format
- Visualizes hidden characters, such as TAB and SPACE
Other useful functions are:
- Global and selective sorting
- Box selection
- Spell checking
- Case changing and Capitalizing
- Search and Replace
Won't a Word Processor program do just as well? You might be quite familiar with your favorite Word Processor program, and quite like the way it works. Unfortunately, Word Processors, whilst trying to be helpful, ordered, and pretty, save more than just the basic text information. Font height and color, paragraphs and page footers: none of these are useful in a Photo Keyword List if we then wish to import it into LightRoom.
My suggestion for a suitable Text Editor program is 'PSPad'. Its free to download and use, (though they do ask for a donation), and is just the thing to get you started.
NB: When you start PSPad for the first time, click 'Settings > Program Settings > Editor (part 2)'. You should then check the box marked 'Real Tabs', and set the 'Tab Width' to 6 or more. I'd also recommend that you click 'Format > Font' and choose a fixed-width font, like Courier New.
Here we see a screen capture of a simple Keyword List displayed in 'PSPad'. I've clicked 'View > Special Characters' to get the program to display the characters that are normally hidden. TAB is indicated by the little '>>' symbol. SPACE is indicated by a dot or period. CARRIAGE RETURN/LINE FEED is indicated by backwards-P at the end of each line. The top-level categories in the Keyword List (Mammal, and Natural World) are positioned to the left of their respective lines, with no preceding characters. The next level down in the keyword hierarchy has a TAB character in front of it. Each subsequent level down in the keyword hierarchy has one more TAB character in front of it than the line above. It is thus quite easy to visualize the hierarchical structure when you look at the text file. When that file is imported into Lightroom, it looks like this:
Keyword List Editing Rules
- There are a number of special characters that you must not include in your Keyword Lists. Obviously your Keywords should not include the TAB character, as this is used to layout the list. You should also avoid the use of commas, semicolons, greater-than (>) and less-than (<) characters, and the pipe character ( | ). If you are Copying-And-Pasting to your list, its easy to miss these characters, so ALWAYS do a search for them before finalizing your list.
- I'd also suggest that you don't use the query or question mark (?) in your lists. It is not an illegal character like the other ones, but its presence often indicates a transliteration or change of character encoding error, so it is best to avoid it.
- None-ASCII characters should be avoided, as they cause an error in many image management and storage programs. Safe ASCII characters are defined as those within the range 000-127, which is 00-7F in HEX. The ones that you want to avoid, so-called 'Non-ASCII characters', are those within the range 128-255, or 80-FF in HEX. Unfortunately this forbidden range includes all of the foreign accented letters, so you will need to transliterate those to their approximate safe equivalents.
- It is not possible to use Comments in a LightRoom keyword list.
- If extra tabs are included, the category won't show i.e. in this example, Category2 won't show:
TAB Category1
TAB TAB TAB Category2
- Empty lines (TAB carriage-return) cause an error.
- LightRoom automatically puts entries on the same tab-level into alphabetical order. Where entries MUST be kept in a specific order, they can be prefixed with a number or ~ symbol.
- Keywords can also be classed as Categories or Synonyms. For a full description of these, and the characters that are used to create them, see the Keyword List Format page.
Editing the Keyword List
It is quite OK to remove sections of the Keyword List is you feel they cover an area outside of your interest. The important thing is to remember the Keyword List Building Rules above, especially where empty lines and extra TABs are concerned. If you edit the list, import it, and find that a section, though still in the list, is not showing in Lightroom, the most usual causes of this are unwanted TAB characters.
Using the above image as an example, lets say we wish to delete the entire Angola section. If so, we need to delete every character in the section highlighted with red. If we missed the last line, with its 4 TAB characters and its 2 words, that entry would tag itself on the Algeria section, and appear as a new Algerian province. Any TAB characters left behind would add themselves to the start of the Benin section, which would then disappear. Another thing to be check for: make sure you don't leave an empty blank line where the data was. Editing is easy, as long as you are methodical, and always keep the 'View > Special Characters' turned on, so you can quickly spot an errant TAB, space, or Carriage Return.
If you want to use the list in Lightroom or Photo Mechanic then you can also use both synonym and excluded category header options (the words in the {CURLY} and [SQUARE] brackets). If you want to use the list in Bridge then you can use the excluded category header options (the words in the [SQUARE] brackets) but not the synonym options (the words in the {CURLY} brackets). If you want to use the list in Aperture, BreezeBrowser, FotoStation, etc. then you can't use either synonym (the words in the {CURLY} brackets) or excluded category header options (the words in the [SQUARE] brackets).
Beware of Pasting Errors
When pasting-in data from other sources, especially data copied from the web or from PDF documents, you should be especially careful to ensure that all the characters are within the range of acceptable and safe ASCII characters (000-127 in decimal and 00-7F in HEX are OK, but 128-255 in decimal and 7F-FF in HEX are not). There are a number of different dashes and inverted commas that are common 'Gotchas' and quite hard to spot. Accented foreign letters are also outside the safe range. You should always check that your text is free from them. My How to search for Non-ASCII characters in a Tab-Indented List page will show you how to spot them, or you can read the next paragraph to see how to do this automatically.
Sorting the Keyword List
When it comes to sorting a tab-indented keyword list, things get a bit more complicated. PSPad and many other text editors come with basic sort capabilities - with PSPad you would select the lines you wish to sort, and click 'Edit > Sort'. This can be very useful if you wish to sort a range of keywords that are all indented with the same number of TABs, as is shown in the example below.
But how do you sort multiple sections in one go, and how do you sort the parent categories that contain them? The obvious answer is to sort each section separately then re-arrange the parents by copying from one window to another, but this is a tedious task and can take a very long time. There are commercial software packages available, usually linked to popular spreadsheets, that will sort a tab-indented list but they don't do error-checking. When I started to research the problem, I soon discovered that there was nothing specifically designed for keyword lists and the unique features they contain, so I set about writing a suitable tool of my own: its called 'Tab-List Tools'.
Advanced Keyword List Building
A text-editor is fine to start with, but what happens if you want to sort your list, spot errors, identify duplicates, search and replace, visualize the list, and other functions? Surprisingly, there are remarkably few programs designed to work with tab-indented lists. I used to create my own tools to build my own lists, as there was nothing else that did what I needed. Eventually I put all of the tools together, added a raft of new features, and now sell the program from this website - see my Tab-List Tools page.
Re-Importing the Keyword List
Finished editing your keyword list? You are now ready to re-import it into your photo-processing program. How this is done depends on the program that you are using: