Error in get_spans()

#2
by cristina-fdez - opened

Hello,
First of all, thank you for sharing your model. I've obtained an error after copy-pasting your code (it is everything the same as yours). The error is this:
TypeError Traceback (most recent call last)
in <cell line: 24>()
22 # print predicted borrowing spans
23 print('The following borrowing were found:')
---> 24 for entity in sentence.get_spans():
25 print(entity)

TypeError: Sentence.get_spans() missing 1 required positional argument: 'type'

Thank you in advance :)

Hi, Cristina!
It seems they made some changes to the Flair library, and the get_spans() function now requires the label of the span you are interested in getting. If you change the code to this it should do the trick:

for entity in sentence.get_spans("ENG"):
      print(entity)

Or if you are interested in borrowings that do not come from English:

for entity in sentence.get_spans("OTHER"):
      print(entity)

Let me know if that helped :)

Thank you so much for your help! :)

Sign up or log in to comment