Skip to content

KeyError: Ty('p') #62

Answered by nikhilkhatri
FernandoFS18 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Ferchu18
It would be useful to see the code snippet which raises this error.
My guess is that for your dataset, the parser produces diagrams which contain the PREPOSITIONAL_PHRASE type, denoted by 'p'.
When parameterising a string diagram using an ansatz, it is necessary to provide a map from all the types in the string diagram to the target representation (number of qubits in the quantum case.)

The tutorial docs here demonstrate how to parameterise string diagrams containing only noun and sentence types.
For a dataset containing the preposition phrase type, this can be modified as follows:

# Define atomic types
N = AtomicType.NOUN
S = AtomicType.SENTENCE
P = AtomicType.PREPOSITIONAL_…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@FernandoFS18
Comment options

Answer selected by dimkart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants