spaCy icon indicating copy to clipboard operation
spaCy copied to clipboard

Can't create a custom model for detecting "Organizations".

Open lakshay1296 opened this issue 8 years ago • 3 comments

I can't create a custom model using Spacy. I have used the code given in the official documentations of Spacy under the Updating the Named Entity Recognizer section. I have used the same code, I have just changed the Training data with mine. While testing the model it is creating tokens but not the entities. Any help will be appriciated.

Your Environment

  • Operating System: Windows 10
  • Python Version Used: python- 2.7 (Anaconda2)
  • spaCy Version Used: 2.0.12
  • Environment Information: Pycharm Community

I have attached the code below. Model.txt

lakshay1296 avatar Sep 21 '18 17:09 lakshay1296

Did you only use those two examples? And did you start with a blank model? The example is only supposed to be a simple demonstration – in a real-world scenario, you definitely need a lot more training data. The pre-trained English models for instance are trained on tens of thousands of examples. So if you show a completely blank model two instances of an ORG entity, it's expected that it won't be able to generalise based on the example. Similarly, by default, the model is also discouraged from simply memorizing the entities, because that's usually not what you want.

If you want to recognise organizations, try starting with the pre-trained en_core_web_sm model that already knows a lot about ORG, and improve it by adding more data specific to your domain. For more details on training, including tips for how to source training data, see this docs page: https://spacy.io/usage/training

ines avatar Sep 25 '18 10:09 ines

Thanks for replying. I get your point. However, shouldn't it produce the same entities, like it did for your example? And can we do modifications to the existing "en_core_web_sm" model? I want the model to just recognize 'ORG' with 'Inc', 'Ltd', 'LLC' etc. The existing model is good, but it is also giving some junk values. For example there is a term 'AGREEMENT' in doc, the model is giving 'AGREEMENT' as 'ORG'. How can I avoid that? I'll be attaching a screenshot for your reference. Thanks for the help. EDIT: In the screenshot, we can see that "Employee Assistance Program" is not an organization. output

lakshay1296 avatar Sep 25 '18 10:09 lakshay1296

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Oct 25 '18 14:10 lock[bot]