-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DisCoCirc extension to lambeq #179
Conversation
Co-authored-by: Colin Krawchuk <[email protected]>
Let's do the following before we merge this:
|
|
||
## Installation | ||
|
||
Installing the experimental subpackage requires Python 3.10. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Python 3.10 or higher", right?
reader.text2circuit('Alice likes Bob. Bob likes Alice too.').draw() | ||
``` | ||
|
||
To get DisCoCirc diagrams with frames decomposed into multiple boxes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add a reference here in one of the DisCoCirc papers that mentions Sandwich functor.
@@ -0,0 +1,30 @@ | |||
# DisCoCirc extension for lambeq | |||
|
|||
Functionality to convert text into DisCoCirc string diagrams, using lambeq's grammar backend. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reference to original paper.
This PR adds the DisCoCirc reader as an addon to lambeq.
The new functionality is included in the
lambeq.experimental.discocirc
subpackage.New features include:
DisCoCircReader
, which provides atext2circuit
method to parse text into disco-circuits.CoreferenceResolver
abstract class which returns tokenised text, and associated coref information.SpacyCoreferenceResolver
implementation of the above.TreeRewriteRule
s, which implementic semantic modification of trees made ofPregroupTreeNode
.The
DisCoCircReader
works by getting thePregroupTreeNode
tree for each sentence in a given text, and recursively converting it into a circuital diagram, in a single postorder traversal over the tree.