Skip to content

Equals TypeError #13057

@TristynAlxander

Description

@TristynAlxander

How to reproduce the behaviour

nlp = spacy.load("en_core_web_lg")
text = "The quick brown fox jumps over the lazy dog"
doc = nlp(text)
token = doc[0]
span = doc[0:1]
print(span == token)

Actual Result: TypeError: Argument 'other' has incorrect type (expected spacy.tokens.span.Span, got spacy.tokens.token.Token)

Expected Result: True or False

Info about spaCy

  • spaCy version: 3.6.1
  • Platform: Linux-6.2.0-34-generic-x86_64-with-glibc2.35
  • Python version: 3.10.10
  • Pipelines: en_core_web_lg (3.6.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBugs and behaviour differing from documentationfeat / docFeature: Doc, Span and Token objects

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions