IBM / zshot

Zero and Few shot named entity & relationships recognition
https://ibm.github.io/zshot
MIT License
350 stars 20 forks source link

[Bug] TypeError when printing DatasetWithEntities #3

Closed marmg closed 2 years ago

marmg commented 2 years ago

Summary

TypeError raises when printing a DatasetWithEntities.

Describe the bug When printing, displaying or representing a DatasetWithEntities next error raises:

TypeError: 'Entity' object is not subscriptable

To Reproduce

from zshot.evaluation.dataset import load_ontonotes

dataset = load_ontonotes()
print(dataset)

Expected behavior The result should print a summary of the DatasetDict with the splits, columns and number of rows per split.

r121196 commented 2 years ago

Type error raised when importing evaluate

Describe the bug when importing function zshot.evaluation

TypeError: 'type' object is not subscriptable

To Reproduce

import zshot.evaluation

marmg commented 2 years ago

Hi! Thank you for your comment.

Unfortunately, I'm unable to reproduce the error, when I do import zshot.evaluation it works without any problem. Could you please provide information about the version of Zshot you are using?

marmg commented 2 years ago

Related StackOverflow post

It seems next typing fails with Python < 3.9: def load_medmentions() -> DatasetDict[DatasetWithEntities]:

This is due to the class DatasetDict of datasets extending dict. dict is a type, and it's not subscriptable in Python<3.9 (for typing it's used Dict, not dict)