From 058306829bffc928536f8c5d751e1d1eede03c86 Mon Sep 17 00:00:00 2001 From: Dimitri Kartsaklis Date: Tue, 10 Dec 2024 11:42:42 +0000 Subject: [PATCH] Documentation-related changes for new release (docstrings) (#199) --- lambeq/backend/grammar.py | 4 ++-- lambeq/backend/pregroup_tree.py | 32 ++++++++++++++++---------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lambeq/backend/grammar.py b/lambeq/backend/grammar.py index 1d4e3183..7b7b9462 100644 --- a/lambeq/backend/grammar.py +++ b/lambeq/backend/grammar.py @@ -1914,14 +1914,14 @@ class Functor: >>> diag.draw( ... figsize=(2, 2), path='./snake.png') - .. image:: ./_static/images/snake.png + .. image:: ../_static/images/snake.png :align: center >>> F = Functor(grammar, lambda _, ty : ty @ ty) >>> F(diag).draw( ... figsize=(2, 2), path='./snake-2.png') - .. image:: ./_static/images/snake-2.png + .. image:: ../_static/images/snake-2.png :align: center """ diff --git a/lambeq/backend/pregroup_tree.py b/lambeq/backend/pregroup_tree.py index 65b5e4c9..a8ea9938 100644 --- a/lambeq/backend/pregroup_tree.py +++ b/lambeq/backend/pregroup_tree.py @@ -45,28 +45,28 @@ class PregroupTreeNode: and the branches of the tree represent cups identifying input wires (cups) to the parent node. - Example - ------- + Examples + -------- Consider the sentence "John gave Mary a flower", with the following pregroup diagram: - ``` - John gave Mary a flower - ──── ───────────── ──── ───── ────── - n n.r·s·n.l·n.l n n·n.l n - ╰────╯ │ │ ╰────╯ │ ╰─────╯ - │ ╰─────────────╯ - ``` + .. code-block:: console + + John gave Mary a flower + ──── ───────────── ──── ───── ────── + n n.r·s·n.l·n.l n n·n.l n + ╰────╯ │ │ ╰────╯ │ ╰─────╯ + │ ╰─────────────╯ The tree for this diagram becomes: - ``` - gave_1 (s) - ├ John_0 (n) - ├ Mary_2 (n) - └ a_3 (n) - └ flower_4 (n) - ``` + .. code-block:: console + + gave_1 (s) + ├ John_0 (n) + ├ Mary_2 (n) + └ a_3 (n) + └ flower_4 (n) where the numbers after the underscore indicate the order of each word in the sentence. This representation is sufficient for