This is a list of ship types. When adding new ship types, do not be too specific: 'aircraft carrier' but not 'light aircraft carrier'  
To add to this list the form is:
['ship type'] = true,
the trailing comma is important. At the time of this writing, a ship type may be one to four words, almost always lowercase.
Please insert ship types in alphabetical order.  
local ship_type_list =
{
['armoured cruiser'] = true,
['aircraft carrier'] = true,
['amphibious assault ship'] = true,
['Army ship'] = true, -- should be capitalized
['auxiliary cruiser'] = true,
['auxiliary raider'] = true,
['auxiliary'] = true,
['aviso'] = true,
['barge'] = true,
['barque'] = true,
['barquentine'] = true,
['battlecruiser'] = true,
['battleship'] = true,
['boat'] = true,
['brig sloop'] = true,
['brig-sloop'] = true,
['brig'] = true,
['brigantine'] = true,
['carrack'] = true,
['clipper'] = true,
['coast defense ship'] = true,
['coastal defence ship'] = true,
['coastal defense ship'] = true,
['communications ship'] = true,
['corvette'] = true,
['cruiser'] = true,
['cutter'] = true,
['deep submergence rescue vehicle'] = true,
['destroyer leader'] = true,
['destroyer'] = true,
['dragger'] = true,
['dredge'] = true,
['East Indiaman'] = true, -- should be capitalized
['escort ship'] = true,
['escort'] = true,
['ferry'] = true,
['ferryboat'] = true,
['fireboat'] = true,
['fleet oiler'] = true,
['floating battery'] = true,
['floating crane'] = true,
['fluyt'] = true,
['food supply ship'] = true,
['freighter'] = true,
['frigate'] = true,
['galleon'] = true,
['galley'] = true,
['gunboat'] = true,
['helicopter carrier'] = true,
['hospital ship'] = true,
['hovercraft'] = true,
['hydrofoil'] = true,
['icebreaker'] = true,
['Indiaman'] = true, -- should be capitalized
['ironclad'] = true,
['ketch'] = true,
['landing ship medium'] = true,
['lifeboat'] = true,
['lightship'] = true,
['log canoe'] = true,
['lugger'] = true,
['merchant cruiser'] = true,
['minehunter'] = true,
['minelayer'] = true,
['minelaying cruiser'] = true,
['minesweeper'] = true,
['missile boat'] = true,
['monitor'] = true,
['munition ship'] = true,
['naval ship'] = true,
['night fighter direction vessel'] = true,
['ocean liner'] = true,
['oiler'] = true,
['paddle steamer'] = true,
['patrol boat'] = true,
['patrol gunboat'] = true,
['patrol vessel'] = true,
['pinnace'] = true,
['pollution control vessel'] = true,
['privateer'] = true,
['protected cruiser'] = true,
['pusher'] = true,
['rescue ship'] = true,
['riverboat'] = true,
['ROV'] = true,
['sailboat'] = true,
['schooner'] = true,
['seaplane carrier'] = true,
['seaplane tender'] = true,
['ship of the line'] = true,
['ship'] = true,
['shipwreck'] = true,
['shore establishment'] = true, -- use stone frigate instead?
['showboat'] = true,
['sidewheeler'] = true,
['skipjack'] = true,
['sloop-of-war'] = true,
['sloop'] = true,
['smack'] = true,
['snagboat'] = true,
['speedboat'] = true,
['steam frigate'] = true,
['steam warship'] = true,
['steamboat'] = true,
['steamer'] = true,
['steamship'] = true,
['sternwheeler'] = true,
['stores lighter'] = true,
['submarine chaser'] = true,
['submarine rescue vehicle'] = true,
['submarine tender'] = true,
['submarine'] = true,
['submersible'] = true,
['supertanker'] = true,
['support ship'] = true,
['survey ship'] = true,
['tanker'] = true,
['target ship'] = true,
['tender'] = true,
['torpedo boat'] = true,
['torpedo gunboat'] = true,
['towboat'] = true,
['training cruiser'] = true,
['training ship'] = true,
['transport'] = true,
['trawler'] = true,
['trireme'] = true,
['tug'] = true,
['tugboat'] = true,
['vessel'] = true,
['warship'] = true,
['weather ship'] = true,
['whaler'] = true,
['whaleship'] = true,
['wherry'] = true,
['yacht'] = true,
['yawl'] = true,
}  
----------------------------< I S _ S E T >------------------------------------------------------------------  
Returns true if argument is set; false otherwise. Argument is 'set' when it exists (not nil) or when it is not an empty string.  
local function is_set( var )
return not (var == nil or var == '');
end  
----------------------------< S I Z E O F _ S H I P _ T Y P E >----------------------------------------------  
Returns the size in words of ship type. Inputs are the fragment table, the number of elements in the fragment table,
and the number of words that make up nationality.  
The number of fragments (words) in a ship name dictate the possible sizes of ship type. If nationality takes one fragment,
and ship type takes four fragments, then the minimum number of fragments in a composite ship name is:
5 = 1 (nationality) + 3 (ship type) + 1 (ship name) (same as 4 fragments (words) after nationality)  
This function starts at the longest possible series of fragments that might be ship type. This order is important becuase
some ship types might begin with similar fragments: 'ship' and 'ship of the line'. Starting with the least possible
series of fragments (1) would find 'ship' and make 'of the line' part of the italicized name.  
Returns 0 if there is no recognizable ship type.  
local function sizeof_ship_type (frag, frag_len, nat_len)
local ship_type;  
if 5 <= (frag_len - nat_len) then -- must have at least five fragments after nationality for four-word ship type
ship_type = table.concat (frag, ' ', nat_len+1, nat_len+4); -- four-word ship type
if ship_type_list [ship_type] then
return 4;
end
end
if 4 <= (frag_len - nat_len) then -- must have at least four fragments after nationality for three-word ship type
ship_type = table.concat (frag, ' ', nat_len+1, nat_len+3); -- three-word ship type
if ship_type_list [ship_type] then
return 3;
end
end
if 3 <= (frag_len - nat_len) then -- must have at least three fragments after nationality for two-word ship type
ship_type = table.concat (frag, ' ', nat_len+1, nat_len+2); -- two-word ship type
if ship_type_list [ship_type] then
return 2;
end
end
if 2 <= (frag_len - nat_len) then -- must have at least two fragments after nationality for one-word ship type
if ship_type_list [frag[nat_len+1]] then -- one-word ship type
return 1;
end
end
return 0; -- no recognizable ship type
end  
----------------------------< S I Z E O F _ N A T I O N A L I T Y >------------------------------------------  
This function the size (in words) of the nationality from the fragments table. Nationality may be one or two
words that occupy the first one or two positions in the table.  
Returns the number of words that identify the nationality:
1 for French or German, etc.
2 for United States;
0 when table doesn't have a recognizable nationality  
local function sizeof_nationality (frag, frag_len)
local nat = '';  
if not nationality_list [frag[1]] then -- if not a one-word nationality
if 2 <= frag_len - 2 then -- must have at least two fragments after nationality for minimal ship type and name
nat = table.concat (frag, ' ', 1, 2);
if nationality_list [nat] then -- is it a two-word nationality?
return 2; -- yes
else
return 0; -- no
end
end
return 0; -- not one-word and not enough fragments for two-word
end
return 1; -- one-word nationality
end  
--[[-------------------------< S H I P _ N A M E _ F O R M A T >-----------------------------------------------  
This function applies correct styling to ship and ship-class names. These names are, for example, ship-article titles
used by templates , , where the article title is to be rendered with proper
styling.  
This function requires one argument:
|name= (required): a name is required; if missing or empty, this function returns an error message (may or may not be visible depending on where it is used)
used in to provide a value for and to provide a value for |infobox caption=  
Optional arguments to support :
|dab= – displays ship name without parenthetical disambiguator; use when |infobox caption=nodab
|sclass=2 – for ship classes only; displays class name without italics (parameter name is loosely similar to which does the same thing); use when |infobox caption=class