Entities resolved incorrectly


Using Jovo v4.0.0.

Entities are resolving incorrectly, or am I missing something?

model json:

  "invocation": "my app",
  "version": "4.0",
  "intents": {
    "GetForexRate": {
      "phrases": [
        "exchange rates",
        "conversion rates",
        "convert from {ccyFrom} to {ccyTo}",
        "what is the exchange rate from {ccyFrom} to {ccyTo}",
        "exchange rate for {ccyFrom} to {ccyTo}",
        "what is the rate from {ccyFrom} to {ccyTo}",
        "convert {ccyFrom} to {ccyTo}",
        "how many {ccyFrom} does one {ccyTo} cost",
        "how many {ccyTo} is one {ccyFrom}",
        "how many {ccyTo} are one {ccyFrom}"
      "entities": {
        "ccyFrom": {
          "type": "currency"
        "ccyTo": {
          "type": "currency"
  "entityTypes": {
    "currency": {
      "values": [

When I type ‘USD to INR’, I expect to receive ccyFrom = USD and ccyTo = INR. But I’m getting different values, like below:

this.$input.nlu.entities = {ccyTo: {id: 'INR', ....}}    // only one entry


this.$input.nlu.raw.entities = [     // 2 entries, but alias is incorrect
    {alias: 'ccyTo_0', entity: 'ccyTo', option: 'USD', ...},
    {alias: 'ccyTo_1', entity: 'ccyTo', option: 'INR', ...}

Debug view:


Thank you. We’ll investigate this. cc @Max


Hey there, it looks like an issue of nlpjs based on the information you posted.

I will take a look and get back to you.


@Max Were you able to spot the issue? My observation is only the last slot/entity is resolving.

Because of this issue, slot filling went into an infinite loop. Any help is much appreciated. Thanks


Also, when I enter just one value (ex: USD), it is always resolving for ccyTo, but never to ccyFrom. How to do slot filling properly?

I mean, I need values for slots: ccyFrom and ccyTo.

Scenario #1: User says USD to INR --> system should resolve USD to ccyFrom and INR to ccyTo
Scenario #2: System asks the user for ccyFrom first and then ccyTo. When the system asks for ccyFrom, I’m expecting Jovo to resolve the user said value to ccyFrom instead of ccyTo.

How to achieve this? Thanks


Hello there,

I’ve had time to test this issue and had the same problem. I’ve implemented some improvements for the model conversion but the issue persists. The problem is how Nlpjs handles entities.

For every entity, a rule is added. In your case, you have two rules. When the incoming text looks like that: “USD to EUR” Nlpjs will match USD to ccyFrom as well as ccyTo. The same happens with EUR in that case.

This happens due to both rules being applied after another while disregarding if the previous rule already used some of the text, therefore the rules will be checked for the whole text twice. Now, CurrencyType is used in both entities and therefore it can match both.

I hope this is somewhat understandable.

tl;dr: Nlpjs has some issues with processing the same entity type multiple times due to not knowing the previously matches entities for that text


@Max thanks for this detailed explanation of what’s happening. Is there any workaround to have multiple entities of the same type? Can you please share if you have any plans to fix it? Please let me know if I can be of any help. Thanks


The alias issue was fixed and will be released today: https://github.com/jovotech/jovo-framework/pull/1158

Unfortunately, this is a limitation of NLPjs, not Jovo. The only workaround would be to switch to a different NLU service. We’ve had some good success with Snips NLU: https://www.jovo.tech/marketplace/nlu-snips

You can also change the NLU used by the Debugger: https://www.jovo.tech/docs/debugger#nlu


Thanks @jan @Max for the suggestions. I’ll try as suggested. Thanks


For anyone interested in this, I created an issue in nlpjs repo https://github.com/axa-group/nlp.js/issues/1054

Please comment/:+1: