Debian Codegraph @

docs/api/wn.taxonomy.rst

raw
1
2 wn.taxonomy
3 ===========
4
5 .. automodule:: wn.taxonomy
6
7
8 Overview
9 --------
10
11 Among the valid synset relations for wordnets (see
12 :data:`wn.constants.SYNSET_RELATIONS`), those used for describing
13 *is-a* `taxonomies <https://en.wikipedia.org/wiki/Taxonomy>`_ are
14 given special treatment and they are generally the most
15 well-developed relations in any wordnet. Typically these are the
16 ``hypernym`` and ``hyponym`` relations, which encode *is-a-type-of*
17 relationships (e.g., a *hermit crab* is a type of *decapod*, which is
18 a type of *crustacean*, etc.). They also include ``instance_hypernym``
19 and ``instance_hyponym``, which encode *is-an-instance-of*
20 relationships (e.g., *Oregon* is an instance of *American state*).
21
22 The taxonomy forms a multiply-inheriting hierarchy with the synsets as
23 nodes. In the English wordnets, such as the Princeton WordNet and its
24 derivatives, nearly all nominal synsets form such a hierarchy with
25 single root node, while verbal synsets form many smaller hierarchies
26 without a common root. Other wordnets may have different properties,
27 but as many are based off of the Princeton WordNet, they tend to
28 follow this structure.
29
30 Functions to find paths within the taxonomies form the basis of all
31 :mod:`wordnet similarity measures <wn.similarity>`. For instance, the
32 :ref:`leacock-chodorow-similarity` measure uses both
33 :func:`shortest_path` and (indirectly) :func:`taxonomy_depth`.
34
35
36 Wordnet-level Functions
37 -----------------------
38
39 Root and leaf synsets in the taxonomy are those with no ancestors
40 (``hypernym``, ``instance_hypernym``, etc.) or hyponyms (``hyponym``,
41 ``instance_hyponym``, etc.), respectively.
42
43 Finding root and leaf synsets
44 '''''''''''''''''''''''''''''
45
46 .. autofunction:: roots
47 .. autofunction:: leaves
48
49 Computing the taxonomy depth
50 ''''''''''''''''''''''''''''
51
52 The taxonomy depth is the maximum depth from a root node to a leaf
53 node within synsets for a particular part of speech.
54
55 .. autofunction:: taxonomy_depth
56
57
58 Synset-level Functions
59 ----------------------
60
61 .. autofunction:: hypernym_paths
62 .. autofunction:: min_depth
63 .. autofunction:: max_depth
64 .. autofunction:: shortest_path
65 .. autofunction:: common_hypernyms
66 .. autofunction:: lowest_common_hypernyms