Skip to content

Commit

Permalink
add spider_chain_reader
Browse files Browse the repository at this point in the history
  • Loading branch information
kinianlo committed Oct 11, 2024
1 parent 3937330 commit e8f5e0f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lambeq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
'bag_of_words_reader',
'cups_reader',
'spiders_reader',
'spider_chain_reader',
'stairs_reader',
'word_sequence_reader',

Expand Down Expand Up @@ -124,7 +125,7 @@
WebParseError, WebParser,
Reader, LinearReader, TreeReader, TreeReaderMode,
bag_of_words_reader, cups_reader, spiders_reader,
stairs_reader, word_sequence_reader)
spider_chain_reader, stairs_reader, word_sequence_reader)
from lambeq.tokeniser import Tokeniser, SpacyTokeniser
from lambeq.training import (Checkpoint, Dataset, Optimizer,
NelderMeadOptimizer, RotosolveOptimizer,
Expand Down
4 changes: 3 additions & 1 deletion lambeq/text2diagram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
'bag_of_words_reader',
'cups_reader',
'spiders_reader',
'spider_chain_reader',
'stairs_reader',
'word_sequence_reader']

Expand All @@ -53,5 +54,6 @@
stairs_reader,
word_sequence_reader)
from lambeq.text2diagram.spiders_reader import (bag_of_words_reader,
spiders_reader)
spiders_reader,
spider_chain_reader)
from lambeq.text2diagram.tree_reader import TreeReader, TreeReaderMode
5 changes: 4 additions & 1 deletion lambeq/text2diagram/spiders_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__all__ = ['SpidersReader', 'bag_of_words_reader', 'spiders_reader']
__all__ = ['SpidersReader', 'bag_of_words_reader',
'spiders_reader', 'spider_chain_reader']

from lambeq.backend.grammar import Diagram, Id, Spider, Word
from lambeq.core.types import AtomicType
from lambeq.core.utils import SentenceType, tokenised_sentence_type_check
from lambeq.text2diagram.base import Reader
from lambeq.text2diagram.linear_reader import LinearReader

S = AtomicType.SENTENCE

Expand Down Expand Up @@ -46,3 +48,4 @@ def sentence2diagram(self,

spiders_reader = SpidersReader()
bag_of_words_reader = spiders_reader
spider_chain_reader = LinearReader(Spider(AtomicType.SENTENCE, 2, 1))

0 comments on commit e8f5e0f

Please sign in to comment.