NER for same entity

What is the best way to extract same type of entities with different label from text?

For example with below training data,

Transfer money from account 123456 to account 456789

I would like to extract [from account 123456] as (src_accnt) and [to account 456789] as (dst_accnt). So would it work with enough training examples labelled as below?

Transfer money from account 123456 to account 456789

Or is there any better way to do so?

Would be great if experts from this forum answers these questions. Appreciate your help.

Hello @curious,

Can you give this a try:

* transfer_money
- Transfer money from account [123456](src_account) to account [456789](dst_account)
- I need to transfer money from [123456](src_account) to [4567898](dst_account)
- Help me make a transition from [123456](src_account) to [312432](dst_account)

Maybe give it about 10 examples and see how it goes. If the account has a specific format, you can also use regex feature to make it easier for the bot to recognize.

I agree with @fuih. Currently that is your best shot. If the from account is always preceded with a “from” and the to account is always preceded with a “to”, it might actually work. Otherwise it is hard to distinguish between them if the account numbers look the same.

The problem you are describing is called composite entities. We actually have an issue for that (Composite Entities as part of Rasa NLU · Issue #3765 · RasaHQ/rasa · GitHub). We are planning to tackle this end of this/beginning of next year.

Thanks for suggestions. It seems to be working fine with valid regex and few training data.