MORPH(3WN)
π MORPH(3WN) β the WordNetβ’ morphological processor girlies π
okay bestie so this is the WordNetβ’ Library Functions page for the morphology squad: morphinit, re_morphinit, morphstr, morphword. Morphy is the little engine that finds base forms, and she's serving. π§β¨
π¦ NAME
morphinit, re_morphinit, morphstr, morphword β the WordNet morphological processor functions. that's the whole friend group. no cap. π
πΈ SYNOPSIS
#include "wn.h"
int morphinit(void);
int re_morphinit(void);
char *morphstr(char *origstr, int pos);
char *morphword(char *word, int pos);
β¨ DESCRIPTION
The WordNet morphological processor, Morphy, is accessed through these functions, and she is literally the moment:
morphinit()β used to open the exception list files. returns0if successful,-1otherwise. bestie, the exception list files must be opened beforemorphstr()ormorphword()are called. do not skip this step, i am begging. π«Άre_morphinit()β used to close the exception list files and reopen them, and it is used exclusively for WordNet development. return codes are as described above (so0good,-1not good). this one is for the devs only, iykyk. π₯morphstr()β the basic user interface to Morphy, the main character fr. it tries to find the base form (lemma) of the word or collocationorigstrin the specifiedpos. the first call (withorigstrspecified) returns a pointer to the first base form found. subsequent calls requesting base forms of the same string must be made with the first argument ofNULL. when no more base forms fororigstrcan be found,NULLis returned. β¨
π¨ okay so listen:morphstr()returns a pointer to a static character buffer. a subsequent call tomorphstr()with a new string (instead ofNULL) will overwrite the string pointed to by a previous call. so users should copy the returned string into a local buffer, or use the C library functionstrdupto duplicate the returned string into amalloc'd buffer. do NOT get caught holding that pointer, she's not yours. π
morphword()β tries to find the base form ofwordin the specifiedpos. this function is called bymorphstr()for each individual word in a collocation. and yeah, same warning energy:morphword()returns a pointer to a static character buffer. a subsequent call tomorphword()will overwrite the string pointed to by a previous call. users should copy the returned string into a local buffer, or use the C library functionstrdupto duplicate the returned string into amalloc'd buffer. copy her or lose her. π
π NOTES
morphinit()is called bywninit()and is not intended to be called directly by an application. applications wishing to use WordNet and/or the morphological functions must callwninit()at the start of the program. seewnutil(3WN)for more information. letwninit()do her thing, she's got it. πorigstrmay be either a word or a collocation formed by joining individual words with underscore characters (_). underscores are the glue, periodt. π- usually only
morphstr()is called from applications, as it works on both words and collocations. she's the versatile one. π posmust be one of the following:
1 NOUN
2 VERB
3 ADJECTIVE
4 ADVERB
5 ADJECTIVE_SATELLITE
- if
ADJECTIVE_SATELLITEis passed, it is treated bymorphstr()asADJECTIVE. same vibe, different label. β
π SEE ALSO
wnintro(3WN), wnsearch(3WN), wndb(5WN), morphy(7WN). go read the whole friend group, they're all iconic. π
β οΈ WARNINGS
π passing an invalid part of speech will result in a core dump. not the cute kind of crash. pick a real pos bestie, i'm serious.
π₯ the WordNet database files must be open to usemorphstr()ormorphword(). no database, no service.
π BUGS
Morphy will allow non-words to be converted to words, if they follow one of the rules described above. for example, it will happily convert plantes to plants. she's unbothered, she's thriving, she does not fact-check. π
that's the whole page, bestie! mwah! πβ¨π
this has been WordNet 3.0, dated Dec 2006, from your girl MORPH(3WN) β stay morphological, stay iconic, and always copy that static buffer. π¦ππ
π¦ where this page comes from
- debian bookworm: wordnet-dev 1:3.0-37 Β· WordNet3.0
- debian trixie: wordnet-dev 1:3.0-39 Β· WordNet3.0
- ubuntu jammy: wordnet-dev 1:3.0-37 Β· WordNet3.0
- ubuntu noble: wordnet-dev 1:3.0-37 Β· WordNet3.0
- ubuntu questing: wordnet-dev 1:3.0-40
- ubuntu resolute: wordnet-dev 1:3.0-41 Β· WordNet3.0
- ubuntu stonking: wordnet-dev 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