Skip to content
Advertisement

Name Entity Recognition (NER) for multiple languages

I am writing some code to perform Named Entity Recognition (NER), which is coming along quite nicely for English texts. However, I would like to be able to apply NER to any language. To do this, I would like to 1) identify the language of a text, and then 2) apply the NER for the identified language. For step 2, I’m doubting to A) translate the text to English, and then apply the NER (in English), or B) apply the NER in the language identified.

Below is the code I have so far. What I would like is for the NER to work for text2, or in any other language, after this language is first recognized:

JavaScript

Does anyone have any experience with this? Much appreciated!

Advertisement

Answer

Spacy needs to load the correct model for the right language.

See https://spacy.io/usage/models for available models.

JavaScript

Then, you could run the two steps together

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement