WNDB(5WN)
π WNDB(5WN) β WordNetβ’ File Formats π
okay bestie, sit down, hydrate, because this is THE page about the actual WordNet database files and it's a lot but we're gonna get through it together π
π NAME π
The database files themselves, the whole squad:
index.noun,data.noun,index.verb,data.verb,index.adj,data.adj,index.adv,data.advβ the WordNet database files, the main characters β¨noun.exc,verb.exc. adj.exc adv.excβ the morphology exception lists π¦sentidx.vrb,sents.vrbβ files used by search code to display sentences illustrating the use of some specific verbs π
πΈ DESCRIPTION πΈ
So for each syntactic category you need two files to hold the whole WordNet database β index.pos and data.pos, where pos is noun, verb, adj and adv. That's the core four, times two. π
The other auxiliary files are the ones the WordNet library's searching functions use, and you need them to run the various WordNet browsers. No cap.
Every index file is an alphabetized list of all the words found in WordNet in that corresponding part of speech. On each line, right after the word, you get a list of byte offsets (synset_offsets) into the corresponding data file β one for each synset containing that word. Words in the index file are lower case only, no matter how they were entered in the lexicographer files. This folds all the different orthographic representations of a word into one single line, which is literally the whole reason database searches can be case insensitive. π If you want the detailed description of the lexicographer files, go see wninput(5WN).
A data file for a syntactic category contains information corresponding to the synsets that were specified in the lexicographer files, with relational pointers resolved to synset_offsets. Each line corresponds to a synset. π₯ Pointers are followed and hierarchies traversed by moving from one synset to another via the synset_offsets. It's giving graph traversal, honestly.
The exception list files, pos.exc, are used to help the morphological processor find base forms from irregular inflections. π§
The files sentidx.vrb and sents.vrb contain sentences illustrating the use of specific senses of some verbs. These files are used by the searching software in response to a request for verb sentence frames. Generic sentence frames are displayed when an illustrative sentence is not present. The fallback is real π
The various database files are in ASCII formats that are easily read by both humans and machines β iconic, accessible, bilingual in the human/computer sense π. All fields, unless otherwise noted, are separated by one space character, and all lines are terminated by a newline character. Fields enclosed in italicized square brackets may not be present. (Yes, optional fields, they're the shy ones.)
See wngloss(7WN) for a glossary of WordNet terminology and a discussion of the database's content and logical organization. π
β¨ Index File Format β¨
Every index file kicks off with several lines containing a copyright notice, version number and license agreement. These lines all begin with two spaces and the line number, so they do not interfere with the binary search algorithm that's used to look up entries in the index files. Bestie that's so smart. π§ β¨
All other lines are in the following format. And in the field descriptions below, number always refers to a decimal integer unless otherwise defined. k?
lemma pos synset_cnt p_cnt [ptr_symbol...] sense_cnt tagsense_cnt synset_offset [synset_offset...]
lemmaβ lower case ASCII text of word or collocation. Collocations are formed by joining individual words with an underscore (_) character.posβ Syntactic category:nfor noun files,vfor verb files,afor adjective files,rfor adverb files.- All remaining fields are with respect to senses of lemma in pos. π
synset_cntβ Number of synsets that lemma is in. This is the number of senses of the word in WordNet. See Sense Numbers below for a discussion of how sense numbers are assigned and the order ofsynset_offsets in the index files.p_cntβ Number of different pointers that lemma has in all synsets containing it.ptr_symbolβ A space separated list ofp_cntdifferent types of pointers that lemma has in all synsets containing it. Seewninput(5WN)for a list ofpointer_symbols. If all senses of lemma have no pointers, this field is omitted andp_cntis0. π«₯sense_cntβ Same assense_cntabove. This is redundant, but the field was preserved for compatibility reasons. (Legacy code said "keep me" and everyone said okay π)tagsense_cntβ Number of senses of lemma that are ranked according to their frequency of occurrence in semantic concordance texts. πsynset_offsetβ Byte offset indata.posfile of a synset containing lemma. Eachsynset_offsetin the list corresponds to a different sense of lemma in WordNet.synset_offsetis an 8 digit, zero-filled decimal integer that can be used withfseek(3)to read a synset from the data file. When passed toread_synset(3WN)along with the syntactic category, a data structure containing the parsed synset is returned. πβ¨
π¦ Data File Format π¦
Each data file begins with several lines containing a copyright notice, version number and license agreement. These lines all begin with two spaces and the line number. All other lines are in the following format. Integer fields are of fixed length, and are zero-filled. Very demure, very padded π
synset_offset lex_filenum ss_type w_cnt word lex_id [word lex_id...] p_cnt [ptr...] [frames...] | gloss
synset_offsetβ Current byte offset in the file represented as an 8 digit decimal integer.lex_filenumβ Two digit decimal integer corresponding to the lexicographer file name containing the synset. Seelexnames(5WN)for the list of filenames and their corresponding numbers. πss_typeβ One character code indicating the synset type:nβ NOUNvβ VERBaβ ADJECTIVEsβ ADJECTIVE SATELLITErβ ADVERB
w_cntβ Two digit hexadecimal integer indicating the number of words in the synset.wordβ ASCII form of a word as entered in the synset by the lexicographer, with spaces replaced by underscore characters (_). The text of the word is case sensitive, in contrast to its form in the correspondingindex.posfile, that contains only lower-case forms. Indata.adj, a word is followed by a syntactic marker if one was specified in the lexicographer file. A syntactic marker is appended, in parentheses, onto word without any intervening spaces. Seewninput(5WN)for a list of the syntactic markers for adjectives. πlex_idβ One digit hexadecimal integer that, when appended onto lemma, uniquely identifies a sense within a lexicographer file.lex_idnumbers usually start with0, and are incremented as additional senses of the word are added to the same file, although there is no requirement that the numbers be consecutive or begin with0. Note that a value of0is the default, and therefore is not present in lexicographer files. π«Άp_cntβ Three digit decimal integer indicating the number of pointers from this synset to other synsets. Ifp_cntis000the synset has no pointers. π«ptrβ A pointer from this synset to another.ptris of the form:
pointer_symbol synset_offset pos source/target
where synset_offset is the byte offset of the target synset in the data file corresponding to pos.
The source/target field distinguishes lexical and semantic pointers. It is a four byte field, containing two two-digit hexadecimal integers. The first two digits indicate the word number in the current (source) synset, the last two digits indicate the word number in the target synset. A value of 0000 means that pointer_symbol represents a semantic relation between the current (source) synset and the target synset indicated by synset_offset.
A lexical relation between two words in different synsets is represented by non-zero values in the source and target word numbers. The first and last two bytes of this field indicate the word numbers in the source and target synsets, respectively, between which the relation holds. Word numbers are assigned to the word fields in a synset, from left to right, beginning with 1. π’
See wninput(5WN) for a list of pointer_symbols, and semantic and lexical pointer classifications.
framesβ Indata.verbonly, a list of numbers corresponding to the generic verb sentence frames for words in the synset.framesis of the form:
f_cnt + f_num w_num [ + f_num w_num...]
where f_cnt is a two digit decimal integer indicating the number of generic frames listed, f_num is a two digit decimal integer frame number, and w_num is a two digit hexadecimal integer indicating the word in the synset that the frame applies to. As with pointers, if this number is 00, f_num applies to all words in the synset. If non-zero, it is applicable only to the word indicated. Word numbers are assigned as described for pointers. Each f_num w_num pair is preceded by a +. See wninput(5WN) for the text of the generic sentence frames. π
glossβ Each synset contains a gloss. A gloss is represented as a vertical bar (|), followed by a text string that continues until the end of the line. The gloss may contain a definition, one or more example sentences, or both. π
π Sense Numbers π
Senses in WordNet are generally ordered from most to least frequently used, with the most common sense numbered 1. Frequency of use is determined by the number of times a sense is tagged in the various semantic concordance texts. Senses that are not semantically tagged follow the ordered senses. The tagsense_cnt field for each entry in the index.pos files indicates how many of the senses in the list have been tagged. πβ¨
(yes bestie, the vibe check on "which sense is THE sense" is literally just tag counts. iconic.)
okay so the cntlist(5WN) file that comes bundled with the database? it's literally a running tally of how many times each sense got tagged in the semantic concordances π
and grind(1WN) is the one who eats that data to sort out the sense order for every single word. when the index.pos files get generated, the synset_offsets come out in sense number order β sense 1 sitting pretty at the top of the list, always. and when two senses have the exact same number of semantic tags? they get unique but consecutive sense numbers, so nobody's fighting over a spot π«Ά. then the WordNet OVERVIEW search rolls up and shows you all the senses of the word you asked about, in every syntactic category, and tells you which of those senses are actually represented in the semantically tagged texts. iconic.
πΈ Exception List File Format πΈ
Exception lists are alphabetized lists of inflected forms of words plus their base forms, bestie. the first field on each line is an inflected form, and after that comes a space separated list of one or more base forms of that word. and yes β there's one exception list file for each syntactic category π.
real talk: the noun and verb exception lists were generated automatically from a machine-readable dictionary, so they contain a lot of words that aren't in WordNet at all. and for tons of those inflected forms, the base form could've been derived super easily using the standard rules of detachment that are programmed into Morphy (peep morph(7WN) for that). these anomalies are just... allowed to stay in the exception list files, because honestly? they do no harm. live and let live β¨.
π¦ Verb Example Sentences π¦
for some verb senses, you can actually display example sentences that show off how that verb sense gets used π.
each line of the file sentidx.vrb has a sense_key followed by a space and then a comma separated list of example sentence template numbers, in decimal. and the file sents.vrb lists all of the example sentence templates β every line starts with the template number followed by a space, and the rest of the line is the text of a template example sentence, with %s chillin' there as a placeholder for the verb π.
both files are sorted alphabetically so that the sense_key and the template sentence number can be used as indices, via binsrch(3WN), into the appropriate file. efficient queen.
so when a request for FRAMES comes in, the WordNet search code goes looking for the sense in sentidx.vrb. found it? the sentence template(s) listed get retrieved from sents.vrb, and that %s gets swapped out for the verb π₯. not found? then the applicable generic sentence frame(s) listed in frames get displayed instead. either way you're getting something, no dead ends here π.
π NOTES π
the info in the data.pos and index.pos files represents all of the word senses and synsets in the WordNet database, periodt. the word, lex_id, and lex_filenum fields together uniquely identify each word sense in WordNet β and they can be encoded into a sense_key, exactly as described in senseidx(5WN) π«Ά.
every synset in the database can be uniquely identified by combining the synset_offset for that synset with a code for the syntactic category β and yeah, you need that category code, because it's totally possible for synsets in different data.pos files to have the same synset_offset π.
the WordNet system provides both command line and window-based browser interfaces to the database, and both of them utilize a common library of search and morphology code π§. the source code for the library and the interfaces is included in the WordNet package. see wnintro(3WN) for an overview of the WordNet source code β.
π ENVIRONMENT VARIABLES (UNIX) π
WNHOMEβ base directory for WordNet. the default is/usr/local/WordNet-3.0.WNSEARCHDIRβ the directory where the WordNet database has been installed. the default isWNHOME/dict.
π REGISTRY (WINDOWS) π
HKEY_LOCAL_MACHINE\SOFTWARE\WordNet\3.0\WNHomeβ base directory for WordNet. the default isC:\Program Files\WordNet\3.0.
π FILES π
index.posβ database index filesdata.posβ database data files*.vrbβ files of sentences illustrating the use of verbspos.excβ morphology exception lists
β¨ SEE ALSO β¨
grind(1WN), wn(1WN), wnb(1WN), wnintro(3WN), binsrch(3WN), wnintro(5WN), cntlist(5WN), lexnames(5WN), senseidx(5WN), wninput(5WN), morphy(7WN), wngloss(7WN), wngroups(7WN), wnstats(7WN).
and that's a wrap bestie π«Ά this whole thing is WordNet 3.0, dated Dec 2006, and you're reading the WNDB(5WN) page β go forth and slay π
πΈ
π¦ where this page comes from
- debian bookworm: wordnet-base 1:3.0-37 Β· WordNet3.0
- debian trixie: wordnet-base 1:3.0-39 Β· WordNet3.0
- ubuntu jammy: wordnet-base 1:3.0-37 Β· WordNet3.0
- ubuntu noble: wordnet-base 1:3.0-37 Β· WordNet3.0
- ubuntu questing: wordnet-base 1:3.0-40
- ubuntu resolute: wordnet-base 1:3.0-41 Β· WordNet3.0
- ubuntu stonking: wordnet-base 1:3.0-41 Β· WordNet3.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms