SENSEIDX(5WN)

πŸ’– SENSEIDX β€” the WordNetβ„’ sense index, bestie edition πŸ’–

okay so this is senseidx(5WN), one of the WordNetβ„’ file format pages, and honestly? it's giving backstage-pass energy. let's get into it 🫢


✨ NAME ✨

index.sense, sense.idx β€” WordNet's sense index. that's it, that's the name, slay.


🌸 DESCRIPTION 🌸

okay so the WordNet sense index is basically a whole alternate route for getting at synsets and word senses in the WordNet database. it's the moment for apps that wanna pull up synsets or other info tied to one specific sense in WordNet, instead of every single sense of a word or collocation. it also plays nice with tools like grep and Perl when you're tryna find all the senses of a word across one or more parts of speech. and here's the cute part: a specific WordNet sense, encoded as a sense_key, can be used as an index into this file to grab its WordNet sense number, the database byte offset of the synset containing the sense, and the number of times it's been tagged in the semantic concordance texts. three-for-one, no cap πŸ”₯

now, if you take the lemma and lex_sense fields of a semantically tagged word (that's the <wf ... > attribute/value pair vibe) in a semantic concordance file, and you concatenate them using % as the concatenation character, boom β€” you've built the sense_key for that sense. and that key? you can use it to search the sense index file. iconic behaviour πŸ’…

a sense_key is literally the best way to represent a sense in semantic tagging or any other system that refers to WordNet senses. why? because sense_keys are independent of WordNet sense numbers and synset_offsets, which change between versions of the database. so using the sense index plus a sense_key, you can easily get the corresponding synset (via the synset_offset) and the WordNet sense number. a mapping from noun sense_keys in WordNet 1.6 to their corresponding 2.0 sense_keys ships with version 2.0, and it's described over in sensemap(5WN). πŸ“š

also go read wndb(5WN) for the full deep-dive discussion of the WordNet database files, bestie, it's thorough.

πŸ“ File Format πŸ“

the sense index file lists all of the senses in the WordNet database, one sense per line. the file is in alphabetical order, fields are separated by one space, and every line is terminated with a newline character. tidy. organized. we love her.

each line is of the form:

sense_key  synset_offset  sense_number  tag_cnt

sense_key is an encoding of the word sense. programs can construct a sense key in this format and use it as a binary search key into the sense index file. the format of a sense_key is described below. πŸ‘‡

synset_offset is the byte offset where the synset containing the sense lives in the database "data" file corresponding to the part of speech encoded in the sense_key. synset_offset is an 8 digit, zero-filled decimal integer, and you can use it with fseek(3) to read a synset from the data file. and if you pass it to the WordNet library function read_synset() along with the syntactic category, you get back a data structure containing the parsed synset. chef's kiss πŸ˜šπŸ‘Œ

sense_number is a decimal integer indicating the sense number of the word β€” within the part of speech encoded in sense_key β€” in the WordNet database. peep wndb(5WN) for the tea on how sense numbers get assigned.

tag_cnt is the decimal number of times the sense is tagged in various semantic concordance texts. a tag_cnt of 0 means the sense has not been semantically tagged. it's a zero, not a vibe. πŸ’€

πŸ”‘ Sense Key Encoding πŸ”‘

a sense_key is represented as:

lemma%lex_sense

where lex_sense is encoded as:

ss_type:lex_filenum:lex_id:head_word:head_id

let's break down the girlies one by one:

  • lemma β€” the ASCII text of the word or collocation as found in the WordNet database index file corresponding to pos. lemma is in lower case, and collocations are formed by joining individual words with an underscore (_) character.
  • ss_type β€” a one digit decimal integer representing the synset type for the sense. see Synset Type below for the list of numbers and what they mean. πŸ”’
  • lex_filenum β€” a two digit decimal integer representing the name of the lexicographer file containing the synset for the sense. see lexnames(5WN) for the list of lexicographer file names and their matching numbers.
  • lex_id β€” a two digit decimal integer that, when appended onto lemma, uniquely identifies a sense within a lexicographer file. lex_id numbers usually start with 00, and get 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 with 00. heads up though: a value of 00 is the default, which means it's not present in lexicographer files. only non-default lex_id values must be explicitly assigned in lexicographer files. see wninput(5WN) for info on the format of lexicographer files.
  • head_word β€” only present if the sense is in an adjective satellite synset. it's the lemma of the first word of the satellite's head synset.
  • head_id β€” a two digit decimal integer that, when appended onto head_word, uniquely identifies the sense of head_word within a lexicographer file, exactly as described for lex_id. there is a value in this field only if head_word is present. no head_word, no head_id, that's the rule. πŸ™ˆ

🌈 Synset Type 🌈

the synset type is encoded as follows:

1    NOUN
2    VERB
3    ADJECTIVE
4    ADVERB
5    ADJECTIVE SATELLITE

five little numbers, five little identities, all of them valid. πŸ‘‘


πŸ“ NOTES πŸ“

for non-satellite senses, the head_word and head_id fields have no values β€” however, the field separator character (:) is still present. she stays. she's part of the fit. periodt.


🌿 ENVIRONMENT VARIABLES (UNIX) 🌿

  • WNHOME β€” base directory for WordNet. default is /usr/local/WordNet-3.0.
  • WNSEARCHDIR β€” directory in which the WordNet database has been installed. default is WNHOME/dict.

πŸͺŸ REGISTRY (WINDOWS) πŸͺŸ

  • HKEY_LOCAL_MACHINE\SOFTWARE\WordNet\3.0\WNHome β€” base directory for WordNet. default is C:\Program Files\WordNet\3.0.

πŸ—‚οΈ FILES πŸ—‚οΈ

  • index.sense β€” sense index

πŸ‘€ SEE ALSO πŸ‘€

binsrch(3WN), wnsearch(3WN), lexnames(5WN), wnintro(5WN), sensemap(5WN), wndb(5WN), wninput(5WN).


ngl bestie, if you made it this far you're officially a WordNet main character. go tag some senses. πŸ¦‹

WordNet 3.0 Β· Dec 2006 Β· mwah, talk soon πŸ’‹βœ¨