Import/Export a model

The import process consists on being able to create entries 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 entry and subentry is defined in a different line.
  • Each line is formatted according to any of the two formats available for the entry/subentry definition:
    • Simple format:
      • Entry:

        form/lemma|aliases \t entry type \t value

      • Subentry:

        \t form/lemma|aliases \t operator context \t condition context \t morphosyntactic condition \t entry type \t value

    • Complete format:
      • Entry:

        form/lemma|aliases \t entry type \t value \t subjectivity \t irony \t dismiss base model \t advanced behavior \t advanced value

      • Subentry:

        \t form/lemma|aliases \t operator context \t condition context \t morphosyntactic condition \t entry type \t value \t subjectivity \t irony \t advanced behavior \t advanced value

    • The symbol \t is a tabulation.

    Important

    Even though the file does not need to have a specific extension, it does need to contain plain text, as otherwise it won't comply with the formats described. This means that extensions such as, for instance, '.docx' won't work correctly.

    These two formats represent how entries and subentries can be created. The first format corresponds to the fact that the only mandatory fields are the form/lemma and the entry type (and its values in the cases it applies). 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.

    The values for each field are the same as the ones that appear in the interface. The only exception to this are the following:

    • For the field subjectivity:
      • Non ironic: NonIronic
      • Ironic (with negative): NonIronicWithNeg
      • Ironic (with positive): NonIronicWithPos
    • For the field dismiss base model entries:
      • Enabled: Dismiss
    • For the field advanced behavior:
      • Do nothing: Nothing

    This is an example of a possible file using the simple format:

    fair dinkum|straight dinkum\t POLARITY \t P

    bogam \t POLARITY \t N

    drongo \t POLARITY \t N+

    bottler \t POLARITY \t P+

    come a gutser \t POLARITY \t N-

    exy \t POLARITY \t N

    grouse \t POLARITY \t P+

    heaps \t MODIFIER \t ++

    Important

    If a field is not included, you still need to keep the position where it would go!

    Did you notice...?

    While you have to insert each term in a new line when editing the entries and subentries, you must use the '|' character to separate terms in the entry aliases and in the context condition when importing 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 sentiment 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 you try to insert an entry with a form/lemma that already exists or when you try to create a subentry for an entry that does not exist.
    • Incorrect field errors, when any of the basic fields does not comply with the limits set (for example, a type with a made up value).

    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 entries 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 entries that haven't been imported before should now appear in the model. Rows that have been added previously won't be affected.

    Did you notice...?

    When a subentry does not have the correct format, the error returned does not show the form/lemma of its parent, just the line where the error was detected.

    Important

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

    There is another error that will occur if the amount of entries and subentries 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 entries and subentries 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 entry and subentry in a new line and fields separated with tabulation characters. The format used in the exportation process will be the complete format, as it saves all the possible information in the model.

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