Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

bf luis:convert wrongly assigns features found on ml entities in the input to intents in the output #874

@AndyCW

Description

@AndyCW

Versions

What CLI version are you using: 4.9.1
What Nodejs version are you using: 12.18.2
What command-line interpreters are you using: bash, powershell
What OS are you using: Windows, Ubuntu

Describe the bug

bf luis:convert does not convert from .lu to .json correctly if the model use machine learned entities that have features. Any features that are attached (separately) to ml entities in the source model, get grouped together and then are attached to all the intents after conversion.

For example:
In the .lu, each child entity of the weather-request ml entity uses a feature:

> # Entity definitions
...
@ ml weather-request
    - @ ml GeographicPoi usesFeature geographyV2
    - @ ml Country usesFeatures geographyV2,CountryPL
    - @ ml ConditionDescription usesFeature ConditionDescriptionPL
    - @ ml ConditionTemperature usesFeature ConditionTemperaturePL
    - @ ml CurrentLocation usesFeature CurrentLocationPL
    - @ ml TimeRange usesFeature datetimeV2
    - @ ml City usesFeature geographyV2
    - @ ml State usesFeature StatesList
    - @ ml SpatialRelation usesFeature SpatialRelationPL
...

After converting to JSON, it should look like this:

{
  "luis_schema_version": "7.0.0",
  "intents": [
    {
      "name": "GetWeather",
      "features": []
    },
    {
      "name": "None",
      "features": []
    }
  ],
  "entities": [
    {
      "name": "weather-request",
      "children": [
        {
          "name": "GeographicPoi",
          "children": [],
          "features": [
            {
              "modelName": "geographyV2",
              "isRequired": false
            }
          ]
        },
        {
          "name": "Country",
          "children": [],
          "features": [
            {
              "modelName": "geographyV2",
              "isRequired": false
            },
            {
              "featureName": "CountryPL",
              "isRequired": false
            }
          ]
        },
...

But after converting to JSON using the bf cli tool, all of those features are erroneously attached to all of the intents:

{
  "intents": [
    {
      "name": "GetWeather",
      "features": [
        {
          "featureName": "ConditionTemperaturePL",
          "isRequired": false
        },
        {
          "featureName": "CurrentLocationPL",
          "isRequired": false
        },
        {
          "featureName": "ConditionDescriptionPL",
          "isRequired": false
        },
        {
          "featureName": "SpatialRelationPL",
          "isRequired": false
        },
        {
          "featureName": "CountryPL",
          "isRequired": false
        }
      ]
    },
    {
      "name": "None",
      "features": [
        {
          "featureName": "ConditionTemperaturePL",
          "isRequired": false
        },
        {
          "featureName": "CurrentLocationPL",
          "isRequired": false
        },
        {
          "featureName": "ConditionDescriptionPL",
          "isRequired": false
        },
        {
          "featureName": "SpatialRelationPL",
          "isRequired": false
        },
        {
          "featureName": "CountryPL",
          "isRequired": false
        }
      ]
    }
  ],
  "entities": [
    {
      "name": "weather-request",
      "roles": [],
      "children": [
        {
          "name": "GeographicPoi",
          "children": [],
          "features": [
            {
              "modelName": "geographyV2",
              "isRequired": false
            }
          ]
        },
        {
          "name": "Country",
          "children": [],
          "features": [
            {
              "modelName": "geographyV2",
              "isRequired": false
            },
            {
              "featureName": "CountryPL",
              "isRequired": false
            }
          ]
        },

To Reproduce

Steps to reproduce the behavior:

  1. Extract the files in the attached zip bf luisconvert Bug.zip
  2. enter bf luis:convert -i WeatherStudy-working.lu -o convertedmodel.json
  3. [the JSON output from this is also in the zip as converted.json]
  4. Examine the JSON output - see how the features that are only added separately to specific ml entities in the source, have now been attached to all the intents, and to all the entities.

Expected behavior

.lu -> .json should result in a functionally equivalent model.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

[bug]

Metadata

Metadata

Assignees

Labels

P0Must Fix. Release-blockerR10Release 10 - August 17th, 2020lunon luis api commands

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions