In Named Entity Recognition (NER), does the previous sentence have any influence on the current sentence? Is the result the same if you apply NER on every sentence separately compared to applying NER on articles consisting of multiple sentences?
More specifically, I'm using Spacy NER. This is approach one:
import spacy
nlp = spacy.load('en')
sentences = "My name is Bruce and I come from New York. Pete is my best friend from Amsterdam."
nlp_object = nlp(sentences)
print([(y.text, y.label_) for y in nlp_object.ents])
which yields this result:
[('Bruce', 'PERSON'), ('New York', 'GPE'), ('Pete', 'PERSON'), ('Amsterdam', 'GPE')]
But instead of the last two lines, you could also split the sentences and apply NER on every sentence:
for s in sentences.split("."):
nlp_object = nlp(s)
print([(y.text, y.label_) for y in nlp_object.ents])
Which returns the same result (but instead in two separate lines):
[('Bruce', 'PERSON'), ('New York', 'GPE')]
[('Pete', 'PERSON'), ('Amsterdam', 'GPE')]
In this example, running the code gives the same extracted entities. But how does the underlying model do this? Is there any influence of the previous sentence in NER? And is there any difference between different implementations of NER?