Import/Export a model

The import process consists on being able to create categories for a model using a file to define them. This process can be carried out either during the creation, or later on from the model view.

The file does not need to have a specific extension, the only conditions that it must fulfill are that:

  • Each category is defined in a different line.
  • Each line is formatted according to any of the two formats available for the category definition:

    Code\tLabel

    Code\tLabel\tDescription\tPositive terms\tNegative terms\tRelevant terms\tIrrelevant terms\tTraining text

    The symbol \t is a tabulation.

These two formats represent how categories can be created. The first format corresponds to the fact that the only two mandatory fields are the code and the label. If you need to include other fields, then you have to use the second format, leaving empty those that you are not defining at the moment.

This is an example of a possible file:

001\tProfessor Hubert J. Farnsworth

002\tPhilip J. Fry\tThis category is related to Fry\t\t\tpizza_delivery+boy\tbureaucracy\t

003\tTuranga Leela\t\t\t\tcyclops|pilot\tmutant\t

004\tHermes Conrad

005\tZapp Brannigan

006\tBender Bending Rodriguez\tThis category is related to Bender\t\t\tfoul+mouthed|heavy+drinking\tFlexo\t

As you can see, each category can have a different format, and if a field is not included, you still need to keep the position where it would go.

Important

Training text cannot contain carriage returns, as they would be considered the beginning of another category.

Did you notice...?

While you have to insert each term in a new line when editing the model from the category editing view, you must use the '|' character to separate terms in the category rules when importing a file. This has to do with the need to separate categories in new lines when importing them from a file.

This is the result of importing the file used as an example:

Import result

Did you notice...?

When there are more than two models in your dashboard, you can choose to show them all or just the most recent ones by clicking on Hide or Show all that appears at the bottom.

There can be errors in the import process, mainly of four types:

  • Format errors, errors in the format of the import file, such as when a line does not have the right number of fields.
  • Model coherence errors, when we try to insert a category with a code that already exists.
  • Incorrect field errors, when any of the basic fields does not comply with the limits set (for example, a code with more than 64 characters).
  • Build errors, associated to the coherence of the rules defined for categories.

When a line in the file gives any of these errors, it will be ignored. The result of the import process will be specified by a message in the model view, detailing the categories that have generated an error.

Import errors

Usually, when you import a model from a file and there is any of the above errors in any row, you may want to correct it and finish importing the model.

A possible way to do it is to correct the affected rows in the import file (shown in the error message) and try to import it again. If everything is correct, the categories that haven't been imported before should now appear in the model. Rows that have been added previously won't be affected.

Important

Note that when you try to import an existing category and the code already exists in the model, it will cause an error and the category won't be overwritten. If you want to update an existing category, you won't be able to do it importing an updated file. You should update it from the edit category view.

There is another error that will occur if the amount of categories of your model after the import process exceeds your plan limit. If the import results in this error, other possible errors of the file won’t be shown.

Plan limit error

To export a model's categories to a file, you only have to click on the sidebar's Export button. It will create a file with the same format required to import a model, featuring each category in a new line and fields separated with tabulation characters.

It's important to know that this action doesn't create an exact backup of the model. It only exports categories. Other fields of the model like name and description, or settings like relevances are not saved in the export file.