MORPH(3)
π MORPH(3) β WordNetβ’ Library Functions π
okay bestie, so this is the manual page for the WordNet morphological processor functions, part of the WordNetβ’ Library Functions. It's MORPH(3), she's iconic, she's literally the group chat of C functions that figure out what a word's base form is. Let's go π¦
β¨ NAME β¨
morphinit, re_morphinit, morphstr, morphword β the WordNet morphological processor functions. Yes queen, four of them, and they all live in the same little friend group π
πΈ 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 honestly? She's doing a lot. Let's break it down:
morphinit()β this one is the door-opener. It opens the exception list files. Returns0if it slays (successful),-1otherwise. Heads up bestie: the exception list files must be opened beforemorphstr()ormorphword()get called, or it's giving chaos πre_morphinit()β closes the exception list files and then reopens them. It's used exclusively for WordNet development, so unless you're doing dev work, this one's not your moment. Return codes are exactly as described above (0= good,-1= not good).morphstr()β the main character, the basic user interface to Morphy. It tries to find the base form (lemma) of the word or collocationorigstrin the specifiedpos.- The first call (with
origstrspecified) returns a pointer to the first base form found. - Subsequent calls asking for base forms of the same string must be made with the first argument as
NULL. Periodt. - When there are no more base forms for
origstrto find,NULLis returned. That's your cue that she's done π - > π¨ IMPORTANT:
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 copy the returned string into a local buffer, or use the C library functionstrdupto duplicate the returned string into amalloc'd buffer. Do not skip this, I am begging π
- The first call (with
morphword()β tries to find the base form ofwordin the specifiedpos. This function is called bymorphstr()for each individual word in a collocation. Same vibe warning as above, fr fr:morphword()returns a pointer to a static character buffer, and a subsequent call tomorphword()will overwrite the string pointed to by a previous call. Copy the returned string into a local buffer, or use the C library functionstrdupto duplicate the returned string into amalloc'd buffer. β¨
π 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(3)for more information π«Άorigstrmay be either a word or a collocation formed by joining individual words with underscore characters (_). That's the glue, bestie.- Usually only
morphstr()is called from applications, because it works on both words and collocations. She does it all π 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 energy, different label π
π₯ SEE ALSO π₯
wnintro(3), wnsearch(3), wndb(5), morphy(7).
β οΈ WARNINGS β οΈ
π Passing an invalid part of speech will result in a core dump. Not a vibe. Not the moment. Check your pos.
π The WordNet database files must be open to usemorphstr()ormorphword().
π 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 confident like that, and honestly? We love the self-belief, but be aware π
WordNet 3.0 Β· Dec 2006 β that's the version and date from the original footer, bestie. Made with love, static buffers, and a whole lot of Morphy magic. Stay safe, copy your strings, and call wninit() first πβ¨ππ¦
π¦ where this page comes from
- fedora 43: wordnet-devel 3.0-48.fc42 Β· MIT and GPL-2.0-or-later
- fedora 43: wordnet-devel 3.0-48.fc42 Β· MIT and GPL-2.0-or-later
- fedora 44: wordnet-devel 3.0-48.fc42 Β· MIT and GPL-2.0-or-later
- fedora 44: wordnet-devel 3.0-48.fc42 Β· MIT and GPL-2.0-or-later
- opensuse-leap 16.0: wordnet-devel 3.0-bp160.1.11 Β· MIT
- opensuse-leap 16.0: wordnet-devel 3.0-bp160.1.11 Β· MIT
- opensuse-leap 16.0: wordnet-devel 3.0-bp160.1.11 Β· MIT
- opensuse-leap 16.0: wordnet-devel 3.0-bp160.1.11 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms