The import and export processes are batch operations on the classification model. The export process allows you to extract all the categories from a model, while the import process allows you to create or update a classification model in batch, instead of adding categories one by one.
You can access both operations by clicking on the corresponding buttons on the sidebar.
The format for both operations is going to be the same, a tsv file (tab separated values) with UTF-8 encoding. This means that you will be able to edit categories massively: you will only need to export them, modify the necessary information, and then import back the file into the model.
To export a model's categories to a file, just click on the sidebar's Export button and it will create a file with the same format required to import a model.
It's important to know that this action doesn't create an exact backup of the model. Fields of the model such as name, language, description or any other configuration are not saved in the export file.
The file does not need to have a specific extension, the only conditions that it must fulfill are that:
Code\tLabel\tParents\tComments
\tmandatory\tmandatory term
\texcluding\texcluding term
\trelevant\trelevant term
\tirrelevant\tirrelevant term
\ttext\ttraining text
The symbol \t is a tabulation.
This is an example of a possible file:
001\tPlanet Express\t\tPlanet Express employees
002\tProfessor Hubert J. Farnsworth\t001\t
003\tPhilip J. Fry\t001\tThis category is related to Fry
\trelevant\tpizza AND "delivery boy"
\tirrelevant\tbureaucracy
004\tTuranga Leela\t001\t
\trelevant\tcyclops
\trelevant\tpilot
\trelevant\tmutant
005\tHermes Conrad\t001\t
\trelevant\tbureaucracy
\trelevant\tjamaican
006\tZapp Brannigan\t\t
\trelevant\t"democratic order of planets"
007\tBender Bending Rodriguez\t001\tThis category is related to Bender
\trelevant\t"foul mouthed"
\trelevant\t"heavy drinking"
\trelevant\tFlexo
As you can see, each category can have a different format, but if a field does not contain information, you must keep its position in any case.
Training text cannot contain carriage returns, as they would be considered the beginning of another category.
This is the result of importing the file used as an example into an empty model:
Every import process will result in an import report that will detail how many and which items were created, how many and which items were updated, and which ones failed. For the ones that fail, an error message will provide further information for identifying and then resolving the issue.
Initially, all the items will appear grouped by their result; they can be expanded to see the detail by clicking on the plus sign next to them.
If any of the categories in the file is not imported, the import process will return an alert informing that the import process was not completely successful. The import report will show the detail of which categories generated an error.
Errors in the import process can be related either to the format of the data in the file (incorrect number of fields), or its contents (values not valid, model incoherence, etc.)
There can be errors in the import process, mainly of three types:
In the report above we can see that:
relevant
and irrelevant
(line 3).When a new category fails because of the terms included in it, the category will be created empty in order to avoid propagating the error to any of its children (as if it's not created, then the parent of those categories will not exist) and an error on the term that failed will be listed in the failed section of the import report.
Usually, when you import a model from a file and there is any of the above errors, 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.
Unlike the import process in the customization console 1.0, now when you try to import an existing category, the category will be updated.
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.