2
$\begingroup$

I am Creating a Custom NER (named entity recognition ) Model using bi directional LSTM and CRF.

During Study on Ner i see all example includes Multiple entities per sentence. For eample this sentence includes 2 entities

(jhon lives in Us) jhon = S-Per , US=S-Country

Question 1:

Can we Create a model using (bi lstm crf) where we only want to predict 1 entity.?

Question 2:

In CRF States of the neighbors affect the current prediction so predicting 1 entity per sentence seems difficult specially with CRF?

Question 3 :

if i Cannot achieve this with CRF can I use Bert to train a model having 1 entity per model?

Thanks In advance.

$\endgroup$
2
$\begingroup$

Can we Create a model using (bi lstm crf) where we only want to predict 1 entity.?

[edited] Yes, the trick I would use is to train a regular model and predict the top 10 most likely predictions for each sentence. This will give you the different possible labelings ordered by probability. The idea is to select the first labeling which contains a single entity, i.e. the most likely option after eliminating the predictions with several entities.

In CRF States of the neighbors affect the current prediction so predicting 1 entity per sentence seems difficult specially with CRF?

There's a confusion here: this is true but the "neighbors" are not other entities, they are the other words of the sentence. This means that if a word belongs to an entity then the next word is more likely to belong to an entity as well (i.e. to be part of the same entity). So using CRF doesn't increase the probability to find several distinct entities in a sentence. However if all the target entities are single words then CRFs might not be needed (I'm not sure whether there would any better alternative though).

if i Cannot achieve this with CRF can I use Bert to train a model having 1 entity per model?

I don't know the answer to this one but I doubt it's needed.

|improve this answer|||||
$\endgroup$
  • $\begingroup$ HI, My all confusions are removed Thanks for your answer its help me alot Now i just have 2 question </br> Sir How my data look likes: Sentence#1: Prod_Name cleaing is a cleaing product is mostly used in house . Labels for S#1 S-Prod_Name 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 S#2 Axaa1234112311aaa. Labels for S#2 S-code S#3 https://www.amazon.com/ Labels S#3 S-InfoSource $\endgroup$ – Programmer99 Jan 7 at 5:33
  • $\begingroup$ I want to predict three entities S-Prod_Name S-barcode S-InfoSource but its contains only 1 entity per sentence. Question #1 When you says predict 1 sentence 10 times but only select an output having single entity . its means predition per sentence may have FPs and predicting 10 times and selection 1 sentence slove our problem ? Question#2: I am using Character embedding (UNK ) can we predict Urls and barcode using LSTM? Research Paper [arxiv.org/pdf/1603.01360.pdf] Code link [github.com/guillaumegenthial/tf_ner] Thanks in advance. $\endgroup$ – Programmer99 Jan 7 at 5:52
  • 1
    $\begingroup$ @Programmer99 it's not clear from your example how structured is your text/entities. In some cases pattern matching is a much more efficient option than NER: for instance if all the S-barcode have a fixed format it's easier to catch them with regular expressions. (1) by default a CRF gives you the most likely sequence of labels for the sentence, but there is usually an option to return the top 10 most likely answers instead -> you would design your system to select the top answer with a single NE. to some extent you can see this as excluding known FPs but anyway you will get some FPs. $\endgroup$ – Erwan Jan 7 at 13:12
  • $\begingroup$ (2) I don't know much about LSTM but it seems an overkill to me: normally urls and barcodes can be captured with regular expressions more efficiently than with NER, because they have a very specific format. $\endgroup$ – Erwan Jan 7 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.