{
  "openapi": "3.0.0",
  "info": {
    "title": "Обзор",
    "version": "4.8.0.0",
    "description": "В этом справочнике описываются веб-методы RESTful для взаимодействия с API Tisane с использованием стандартных протоколов HTTP и JSON."
  },
  "servers": [
    {
      "url": "https://api.tisane.ai",
      "description": "Публичное облако Tisane"
    }
  ],
  "tags": [
    {
      "name": "NLU / NLP Methods",
      "description": "Это методы, которые фактически выполняют анализ и преобразование входного текста."
    },
    {
      "name": "Language Model Direct Access",
      "description": "Методы извлечения и проверки записей из языковых моделей."
    }
  ],
  "components": {
    "schemas": {
      "Feature": {
        "type": "object",
        "required": [
          "index",
          "value"
        ],
        "properties": {
          "type": {
            "type": "string",
            "description": "Тип признака. Если не указано: грамматика",
            "enum": [
              "Grammar",
              "Semantics",
              "Style"
            ]
          },
          "index": {
            "type": "integer",
            "description": "Индекс признаков (в пределах своего типа)"
          },
          "value": {
            "type": "string",
            "description": "Идентификатор значения признака"
          }
        }
      },
      "FeatureArray": {
        "type": "array",
        "items": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "$ref": "#/components/schemas/Feature"
            }
          ]
        }
      },
      "Memory": {
        "type": "object",
        "properties": {
          "flags": {
            "$ref": "#/components/schemas/FeatureArray",
            "description": "Набор флагов и семантических признаков."
          },
          "antecedents": {
            "type": "array",
            "description": "Ранее упомянутые элементы, которые следует использовать для разрешения кореферентности.",
            "items": {
              "type": "object",
              "properties": {
                "family": {
                  "type": "integer",
                  "description": "Идентификатор семейства предшественника."
                },
                "features": {
                  "$ref": "#/components/schemas/FeatureArray"
                }
              }
            }
          },
          "assign": {
            "type": "array",
            "description": "Условные назначения, которые должны быть выполнены при синтаксическом анализе.",
            "items": {
              "type": "object",
              "required": [
                "if",
                "then"
              ],
              "properties": {
                "if": {
                  "type": "object",
                  "description": "Условия для соответствия (все условия должны совпадать).",
                  "properties": {
                    "family": {
                      "type": "integer",
                      "description": "Идентификатор семейства целевой лексемы."
                    },
                    "hypernym": {
                      "type": "integer",
                      "description": "Идентификатор семейства гиперонима целевой лексемы."
                    },
                    "features": {
                      "description": "Соответствующие характеристики.",
                      "$ref": "#/components/schemas/FeatureArray"
                    },
                    "regex": {
                      "type": "string",
                      "description": "Регулярное выражение для сопоставления."
                    }
                  }
                },
                "then": {
                  "type": "object",
                  "description": "Значения атрибутов для назначения.",
                  "properties": {
                    "family": {
                      "type": "integer",
                      "description": "Идентификатор семейства для назначения."
                    },
                    "hypernym": {
                      "type": "integer",
                      "description": "Идентификатор семейства гипернима для назначения."
                    },
                    "features": {
                      "description": "Возможности назначения.",
                      "$ref": "#/components/schemas/FeatureArray"
                    },
                    "attribution": {
                      "type": "boolean",
                      "description": "Отмечает цель как атрибуцию."
                    }
                  }
                }
              }
            }
          }
        }
      },
      "Phrase": {
        "type": "object",
        "required": [
          "type",
          "family",
          "offset",
          "length",
          "text"
        ],
        "properties": {
          "type": {
            "type": "string",
            "description": "Тип фразы (NP/VP/ADJP/ADVP/S)."
          },
          "family": {
            "type": "integer",
            "description": "Идентификатор семейства фразы."
          },
          "offset": {
            "type": "integer",
            "description": "Смещение, с которого начинается фраза."
          },
          "length": {
            "type": "integer",
            "description": "Длина строки фразы."
          },
          "text": {
            "type": "string",
            "description": "Текст фразы, в которой члены разделены вертикальными чертами, а внутренние фразы заключены в скобки. Например, *Я|(люблю|Люси)*."
          },
          "role": {
            "type": "string",
            "description": "Семантическая роль фразы в предложении."
          },
          "children": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Phrase"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "Tisane-API-Key": {
        "type": "apiKey",
        "in": "header",
        "name": "Ocp-Apim-Subscription-Key",
        "description": "Ключ подписки API (первичный или вторичный) с [портала разработчиков Tisane](https://dev.tisane.ai/profile)"
      }
    }
  },
  "paths": {
    "/parse": {
      "post": {
        "operationId": "parse",
        "security": [
          {
            "Tisane-API-Key": []
          }
        ],
        "tags": [
          "NLU / NLP Methods"
        ],
        "summary": "Анализ текста",
        "description": "Метод анализирует входные данные и обнаруживает проблемный контент, фрагменты тональности, сущности, темы, структуру фраз, части речи, стоп-слова и многое другое.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "language",
                  "content"
                ],
                "properties": {
                  "language": {
                    "type": "string"
                  },
                  "content": {
                    "type": "string"
                  },
                  "settings": {
                    "type": "object"
                  }
                }
              },
              "examples": {
                "Hello Tisane": {
                  "value": {
                    "language": "en",
                    "content": "Hello Tisane API!!"
                  }
                },
                "Abuse detection": {
                  "value": {
                    "language": "en",
                    "content": "Babylonians should stay away from our country. We are full.",
                    "settings": {
                      "snippets": true
                    }
                  }
                },
                "Extract topics (native standard)": {
                  "value": {
                    "language": "en",
                    "content": "An inertial force is a force that resists a change in velocity of an object."
                  }
                },
                "Extract topics (IAB standard)": {
                  "value": {
                    "language": "en",
                    "content": "moon, Jupiter and Mars",
                    "settings": {
                      "topic_standard": "iab_description",
                      "entities": false
                    }
                  }
                },
                "Adverse media monitoring in fintech": {
                  "value": {
                    "language": "en",
                    "content": "HSBC has been accused of money laundering recently",
                    "settings": {
                      "snippets": true,
                      "sentiment_analysis_type": "entity"
                    }
                  }
                },
                "Parse alias w/ sentence structure": {
                  "value": {
                    "language": "en",
                    "content": "anxiousgayhorseonketamine",
                    "settings": {
                      "parses": true,
                      "subscope": true,
                      "sentiment": false,
                      "format": "alias"
                    }
                  }
                },
                "Parse hashtag and output words": {
                  "value": {
                    "language": "en",
                    "content": "deathtodishonestpeople",
                    "settings": {
                      "words": true,
                      "subscope": true,
                      "sentiment": false,
                      "fetch_definitions": true
                    }
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "example": "application/json"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "text"
                  ],
                  "properties": {
                    "text": {
                      "type": "string",
                      "description": "Введите текст."
                    },
                    "language": {
                      "type": "string",
                      "description": "Код языка, если используется идентификация языка."
                    },
                    "memory": {
                      "$ref": "#/components/schemas/Memory",
                      "description": "Состояние после анализа. Может использоваться для установки состояния будущих анализов. (Установите для `state` значение `true` для отображения)."
                    },
                    "topics": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "object",
                            "required": [
                              "topic",
                              "coverage"
                            ],
                            "properties": {
                              "topic": {
                                "type": "string"
                              },
                              "coverage": {
                                "type": "number"
                              }
                            }
                          }
                        ]
                      }
                    },
                    "abuse": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "offset",
                          "length",
                          "sentence_index",
                          "type",
                          "severity"
                        ],
                        "properties": {
                          "offset": {
                            "type": "integer",
                            "description": "Местоположение в предложении, основанное на 0"
                          },
                          "length": {
                            "type": "integer",
                            "description": "Длина фрагмента"
                          },
                          "sentence_index": {
                            "type": "integer",
                            "description": "Индекс предложения, в котором находится фрагмент"
                          },
                          "type": {
                            "type": "string",
                            "description": "Тип проблемного контента",
                            "enum": [
                              "personal_attack",
                              "bigotry",
                              "external_contact",
                              "profanity",
                              "sexual_advances",
                              "criminal_activity",
                              "adult_only",
                              "mental_issues",
                              "contentious",
                              "spam",
                              "social_hierarchy",
                              "no_meaningful_content",
                              "generic"
                            ]
                          },
                          "severity": {
                            "type": "string",
                            "description": "Насколько серьезна проблема",
                            "enum": [
                              "low",
                              "medium",
                              "high",
                              "extreme"
                            ]
                          },
                          "tags": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "text": {
                            "type": "string",
                            "description": "Сам фрагмент (для `snippets` должно быть установлено значение `true`)"
                          },
                          "explanation": {
                            "type": "string",
                            "description": "Понятное объяснение причины пометки"
                          }
                        }
                      }
                    },
                    "sentence_list": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "offset",
                          "text",
                          "words",
                          "parse_tree"
                        ],
                        "properties": {
                          "offset": {
                            "type": "integer",
                            "description": "Смещение, с которого начинается предложение."
                          },
                          "text": {
                            "type": "string",
                            "description": "Само предложение."
                          },
                          "words": {
                            "type": "array",
                            "description": "Токенизированный массив лексических единиц/лексических фрагментов (не обязательно пробелами или знаками препинания). Для отображения необходимо установить для `words` значение `true`.",
                            "items": {
                              "type": "object",
                              "required": [
                                "offset",
                                "length",
                                "type",
                                "text"
                              ],
                              "properties": {
                                "offset": {
                                  "type": "integer",
                                  "description": "Смещение, с которого начинается лексический фрагмент."
                                },
                                "length": {
                                  "type": "integer",
                                  "description": "Длина лексического фрагмента."
                                },
                                "type": {
                                  "type": "string",
                                  "description": "Тип лексического фрагмента.",
                                  "enum": [
                                    "word",
                                    "numeral",
                                    "punctuation"
                                  ]
                                },
                                "text": {
                                  "type": "string",
                                  "description": "Строка лексического фрагмента."
                                },
                                "stopword": {
                                  "type": "boolean",
                                  "description": "Является ли это стоп-словом."
                                },
                                "role": {
                                  "type": "string",
                                  "description": "Семантическая роль слова, если она назначена.",
                                  "enum": [
                                    "agent",
                                    "patient",
                                    "complement",
                                    "circumstance",
                                    "beneficiary",
                                    "verb",
                                    "surname",
                                    "list_item",
                                    "given_name",
                                    "social_role",
                                    "title",
                                    "street_name",
                                    "street_type",
                                    "nickname",
                                    "country",
                                    "settlement",
                                    "state",
                                    "zipcode"
                                  ]
                                },
                                "description": {
                                  "type": "string",
                                  "description": "Описание неоднозначного смысла в текущем контексте (всегда на английском языке)."
                                },
                                "definition": {
                                  "type": "string",
                                  "description": "Словарное определение неоднозначного значения в текущем контексте (всегда на английском языке)."
                                },
                                "wikidata": {
                                  "type": "string",
                                  "description": "Идентификатор Wikidata текущего значения слова, если существует."
                                },
                                "lexeme": {
                                  "type": "integer",
                                  "description": "Уникальный идентификатор лексемы."
                                },
                                "family": {
                                  "type": "integer",
                                  "description": "Идентификатор семейства."
                                },
                                "grammar": {
                                  "$ref": "#/components/schemas/FeatureArray"
                                }
                              }
                            }
                          },
                          "parse_tree": {
                            "type": "object",
                            "description": "Иерархически организованный граф фраз, обнаруженных в предложении. Для `parses` необходимо установить значение `true`.",
                            "required": [
                              "id",
                              "phrases"
                            ],
                            "properties": {
                              "id": {
                                "type": "integer",
                                "description": "Внутренний идентификатор времени выполнения интерпретации синтаксического анализа предложения."
                              },
                              "phrases": {
                                "type": "array",
                                "description": "Граф фраз, на верхнем уровне которого находятся корневые фразы.",
                                "items": {
                                  "$ref": "#/components/schemas/Phrase"
                                }
                              }
                            }
                          },
                          "corrected_text": {
                            "type": "string",
                            "description": "Текст предложения, исправленный встроенной проверкой орфографии."
                          }
                        }
                      }
                    },
                    "entities_summary": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "type",
                          "name",
                          "mentions"
                        ],
                        "properties": {
                          "type": {
                            "description": "Тип или типы сущности.",
                            "oneOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            ]
                          },
                          "name": {
                            "type": "string",
                            "description": "Стандартное имя сущности."
                          },
                          "subtypes": {
                            "type": "array",
                            "description": "Подтипы сущности.",
                            "items": {
                              "type": "string"
                            }
                          },
                          "subtype": {
                            "type": "string",
                            "description": "Основной подтип сущности."
                          },
                          "wikidata": {
                            "type": "string",
                            "description": "Идентификатор Wikidata, если существует."
                          },
                          "relations": {
                            "type": "array",
                            "description": "Связи сущностей с другими обнаруженными сущностями.",
                            "items": {
                              "type": "object",
                              "required": [
                                "to"
                              ],
                              "properties": {
                                "to": {
                                  "type": "string",
                                  "description": "Сущность, с которой есть связь."
                                },
                                "links": {
                                  "type": "array",
                                  "description": "Как связаны сущности.",
                                  "items": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          },
                          "mentions": {
                            "type": "array",
                            "description": "Упоминания сущности, найденные во входном тексте.",
                            "items": {
                              "type": "object",
                              "required": [
                                "offset",
                                "length",
                                "sentence_index"
                              ],
                              "properties": {
                                "offset": {
                                  "type": "integer",
                                  "description": "Местоположение в предложении, основанное на 0"
                                },
                                "length": {
                                  "type": "integer",
                                  "description": "Длина фрагмента"
                                },
                                "sentence_index": {
                                  "type": "integer",
                                  "description": "Индекс предложения, в котором находится фрагмент"
                                },
                                "text": {
                                  "type": "string",
                                  "description": "Сам фрагмент (для `snippets` должно быть установлено значениев `true`)"
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "sentiment_expressions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "offset",
                          "length",
                          "sentence_index",
                          "polarity"
                        ],
                        "properties": {
                          "polarity": {
                            "type": "string",
                            "description": "Полярность тона",
                            "enum": [
                              "positive",
                              "negative",
                              "mixed",
                              "neutral"
                            ]
                          },
                          "offset": {
                            "type": "integer",
                            "description": "Местоположение в предложении, основанное на 0"
                          },
                          "length": {
                            "type": "integer",
                            "description": "Длина фрагмента"
                          },
                          "sentence_index": {
                            "type": "integer",
                            "description": "Индекс предложения, в котором находится фрагмент"
                          },
                          "targets": {
                            "type": "array",
                            "description": "Цели аспектов (для анализа тональности на основе аспектов).",
                            "items": {
                              "type": "string"
                            }
                          },
                          "reasons": {
                            "type": "array",
                            "description": "Теги причин (для анализа тональности на основе аспектов).",
                            "items": {
                              "type": "string"
                            }
                          },
                          "text": {
                            "type": "string",
                            "description": "Сам фрагмент (для `snippets` должно быть установлено значениев `true`)"
                          },
                          "explanation": {
                            "type": "string",
                            "description": "Понятное объяснение причины пометки"
                          }
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "Hello Tisane": {
                    "value": {
                      "text": "Hello Tisane API!",
                      "entities_summary": [
                        {
                          "type": "software",
                          "name": "Tisane API",
                          "mentions": [
                            {
                              "sentence_index": 0,
                              "offset": 6,
                              "length": 10
                            }
                          ]
                        }
                      ]
                    }
                  },
                  "Abuse detection": {
                    "value": {
                      "text": "Babylonians should stay away from our country. We are full.",
                      "abuse": [
                        {
                          "sentence_index": 0,
                          "offset": 0,
                          "length": 45,
                          "text": "Babylonians should stay away from our country",
                          "type": "bigotry",
                          "severity": "low"
                        }
                      ],
                      "sentiment_expressions": [
                        {
                          "sentence_index": 0,
                          "offset": 0,
                          "length": 45,
                          "text": "Babylonians should stay away from our country",
                          "polarity": "negative"
                        }
                      ]
                    }
                  },
                  "Extract topics (native standard)": {
                    "value": {
                      "text": "An inertial force is a force that resists a change in velocity of an object.",
                      "topics": [
                        "physics"
                      ]
                    }
                  },
                  "Extract topics (IAB standard)": {
                    "value": {
                      "text": "moon, Jupiter and Mars",
                      "topics": [
                        "Space and Astronomy"
                      ]
                    }
                  },
                  "Adverse media monitoring in fintech": {
                    "value": {
                      "text": "HSBC has been accused of money laundering recently",
                      "topics": [
                        "laws"
                      ],
                      "sentiment_expressions": [
                        {
                          "sentence_index": 0,
                          "offset": 0,
                          "length": 41,
                          "text": "HSBC has been accused of money laundering",
                          "polarity": "negative",
                          "reasons": [
                            "compliance",
                            "misconduct"
                          ]
                        }
                      ],
                      "entities_summary": [
                        {
                          "type": "organization",
                          "name": "HSBC",
                          "mentions": [
                            {
                              "sentence_index": 0,
                              "offset": 0,
                              "length": 4,
                              "text": "HSBC"
                            }
                          ]
                        }
                      ]
                    }
                  },
                  "Parse alias w/ sentence structure": {
                    "value": {
                      "text": "anxiousgayhorseonketamine",
                      "topics": [],
                      "abuse": [
                        {
                          "sentence_index": 0,
                          "offset": 17,
                          "length": 8,
                          "type": "adult_only",
                          "severity": "high",
                          "tags": [
                            "hallucinogen"
                          ]
                        }
                      ]
                    }
                  },
                  "Parse hashtag and output words": {
                    "value": {
                      "text": "#deathtodishonestpeople",
                      "topics": [
                        "crime"
                      ],
                      "abuse": [
                        {
                          "sentence_index": 0,
                          "offset": 1,
                          "length": 22,
                          "type": "criminal_activity",
                          "severity": "extreme",
                          "tags": [
                            "call_for_violence",
                            "death"
                          ]
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Неверный запрос — неверный JSON или код языка."
          },
          "401": {
            "description": "Неавторизованный — неверный ключ API или превышена квота."
          },
          "500": {
            "description": "Внутренняя ошибка сервера"
          }
        }
      }
    },
    "/languages": {
      "get": {
        "operationId": "languages",
        "security": [
          {
            "Tisane-API-Key": []
          }
        ],
        "tags": [
          "NLU / NLP Methods"
        ],
        "summary": "Список всех доступных языков",
        "description": "Получить список поддерживаемых языков.\nОтвет включает в себя следующие атрибуты:\n* `id` — идентификатор языка.\n* `name` — нативное имя.\n* `englishName` — английское имя.\n* `nativeEncoding` — кодировка языка.\n* `preferredFont` — рекомендуемый шрифт для отображения.\n* `latin` — использует ли язык латиницу.\n* `rightToLeft` — используется ли в языке письмо справа налево (например, арабский, иврит, персидский).",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "example": "application/json"
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "isoCode": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "englishName": {
                        "type": "string"
                      },
                      "nativeEncoding": {
                        "type": "string"
                      },
                      "fontFace": {
                        "type": "string"
                      },
                      "latin": {
                        "type": "boolean"
                      },
                      "rightToLeft": {
                        "type": "boolean"
                      }
                    }
                  }
                },
                "example": [
                  {
                    "isoCode": "ar",
                    "name": "العربية",
                    "englishName": "Arabic",
                    "nativeEncoding": "iso-8859-6",
                    "fontFace": "Arial",
                    "latin": false,
                    "rightToLeft": true
                  },
                  {
                    "isoCode": "en",
                    "name": "English",
                    "englishName": "English",
                    "nativeEncoding": "iso-8859-1",
                    "fontFace": "Arial",
                    "latin": true
                  },
                  {
                    "isoCode": "zh-CN",
                    "name": "简体中文",
                    "englishName": "Chinese, Simplified",
                    "nativeEncoding": "gb18030",
                    "fontFace": "NSimSun",
                    "latin": false
                  },
                  {
                    "isoCode": "zh-TW",
                    "name": "繁體中文",
                    "englishName": "Chinese, Traditional",
                    "nativeEncoding": "iso-8859-1",
                    "fontFace": "Arial Unicode MS",
                    "latin": false
                  },
                  {
                    "isoCode": "ja",
                    "name": "日本語",
                    "englishName": "Japanese",
                    "nativeEncoding": "ISO-2022",
                    "fontFace": "MS Mincho",
                    "latin": false
                  },
                  {
                    "isoCode": "ru",
                    "name": "русский",
                    "englishName": "Russian",
                    "nativeEncoding": "iso-8859-1",
                    "fontFace": "Arial",
                    "latin": false
                  }
                ]
              }
            }
          }
        }
      }
    },
    "/helper/extract_text": {
      "post": {
        "operationId": "extract_text",
        "security": [
          {
            "Tisane-API-Key": []
          }
        ],
        "tags": [
          "NLU / NLP Methods"
        ],
        "summary": "Очистка текста",
        "description": "Служебный метод удаления JavaScript, CSS-тегов, JSON и другой разметки, возвращающий чистый декодированный текст. Тело запроса включает содержимое разметки, из которого будет извлечен текст. **Note: **Примечание: этот метод не обрабатывает двоичный контент.**",
        "requestBody": {
          "required": true,
          "content": {
            "text/plain": {
              "schema": {
                "type": "string"
              },
              "example": "<p>Clean me up</p> <style>/* Styles are unnecessary for text analysis */</style>"
            }
          }
        },
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                },
                "example": "Clean me up"
              }
            }
          }
        }
      }
    },
    "/compare/entities": {
      "post": {
        "operationId": "compareEntities",
        "security": [
          {
            "Tisane-API-Key": []
          }
        ],
        "tags": [
          "NLU / NLP Methods"
        ],
        "summary": "Сравнение именованных сущностей",
        "description": "Сравнивает две составные именованные сущности и выявляет различия.\nТекст запроса должен включать:\n* `language1` (строка) — тег IETF для языка первой сущности.\n* `entity1` (строка) — первая сущность.\n* `language2` (строка) — тег IETF для языка второй сущности.\n* `entity2` (строка) - вторая сущность.\n* `type` (строка) — тип сущности (в настоящее время поддерживается только _person_).\n\nДополнительная информация: [Именованные сущности в руководстве по ответам API Tisane](./tisane-api-response-guide.md#named-entities)\nОтвет содержит:\n* `result` (строка) — результат сравнения:\n* `no_single_entity` — одна или обе сущности недействительны.\n* `same` — сущности идентичны (порядок имен может отличаться).\n* `different` — сущности различаются, подробности приводятся в `differs`.\n* `differences` (массив строк) — выводит список обнаруженных различий:\n\n  * `given_name` - другое имя\n\n  * `surname` - другая фамилия\n\n  * `title` (например, господин, госпожа) - другое звание (или титул)\n\n  * `social_role` (например, ученые степени) - другая общественная роль\n\n  * `suffix` - другая приставка (например, старший, младший)\n\n  * `variation` - различия в правописании или стиле\n  ",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "language1": "en",
                "entity1": "Gary Youngman MD",
                "language2": "en",
                "entity2": "Gary Oldman",
                "type": "person"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "example": "application/json"
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "result": "different",
                  "differences": [
                    "surname",
                    "social_role"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/similarity": {
      "post": {
        "operationId": "similarity",
        "security": [
          {
            "Tisane-API-Key": []
          }
        ],
        "tags": [
          "NLU / NLP Methods"
        ],
        "summary": "Семантическое сходство",
        "description": "Рассчитать семантическое сходство между двумя фрагментами текста, как на одном языке, так и на разных языках.\n\nТекст запроса должен содержать:\n* `content1` (строка) - первый фрагмент текста.\n* `language1` (строка) — код языка IETF для `content1`.\n* `content2` (строка) - второй фрагмент текста для сравнения.\n* `language2` (строка) — код языка IETF для `content2`.\n* `settings` (объект) - дополнительные настройки согласно спецификациям. Дополнительная информация: [Руководство по настройке и настройке API Tisane](./tisane-api-configuration.md).\n\nОтвет представляет собой число от 0 до 1, обозначающее степень схожести представленных фрагментов текста.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "language1": "en",
                "content1": "Franz Ferdinand was assassinated by a Serbian revolutionary",
                "language2": "en",
                "content2": "A Yugoslav radical assassinated Franz Ferdinand",
                "settings": {}
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "example": "application/json"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "number"
                },
                "example": 0.6190476190476191
              }
            }
          }
        }
      }
    },
    "/detectLanguage": {
      "post": {
        "operationId": "detectLanguage",
        "security": [
          {
            "Tisane-API-Key": []
          }
        ],
        "tags": [
          "NLU / NLP Methods"
        ],
        "summary": "Определить язык",
        "description": "Определяет языки, используемые в предоставленном текстовом фрагменте, и возвращает разбивку по смещениям.\n\nТекст запроса должен включать:\n* `content` (строка) - фрагмент текста для анализа.\n* `languages` (строка, необязательно) — разделенный вертикальной чертой список кодов языков для использования в качестве подсказок.\n* `delimiter` (строка, необязательно) - регулярное выражение для сегментации фрагмента; по умолчанию фрагмент не сегментируется.\n\nОтвет представляет собой структуру JSON, содержащую `languages`, которая обеспечивает разбивку кодов языков.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "content": {
                    "type": "string",
                    "description": "Фрагмент текста для анализа."
                  },
                  "languages": {
                    "type": "string",
                    "description": "Список языковых кодов, разделенных вертикальной чертой, для использования в качестве подсказок."
                  },
                  "delimiter": {
                    "type": "string",
                    "description": "Регулярное выражение для сегментации фрагмента; по умолчанию фрагмент не сегментируется."
                  }
                }
              },
              "examples": {
                "Basic": {
                  "value": {
                    "content": "c'est la vie"
                  }
                },
                "Hints for ambiguous cases": {
                  "value": {
                    "content": "singular",
                    "languages": "es|ar"
                  }
                },
                "Breakdown of languages segmenting by line": {
                  "value": {
                    "content": "скушай\r\nmuffin\r\nכפארה",
                    "languages": "en|ru|th|he",
                    "delimiter": "[\\r\\n]"
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "example": "application/json"
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "examples": {
                  "Basic": {
                    "value": {
                      "languages": [
                        {
                          "offset": 0,
                          "length": 12,
                          "language": "fr",
                          "score": 1181
                        }
                      ]
                    }
                  },
                  "Подсказки для неоднозначных случаев": {
                    "value": {
                      "languages": [
                        {
                          "offset": 0,
                          "length": 8,
                          "language": "es",
                          "score": 1137
                        }
                      ]
                    }
                  },
                  "Разбивка языков по строкам": {
                    "value": {
                      "languages": [
                        {
                          "offset": 0,
                          "length": 7,
                          "language": "ru",
                          "score": 866
                        },
                        {
                          "offset": 8,
                          "length": 6,
                          "language": "en",
                          "score": 731
                        },
                        {
                          "offset": 16,
                          "length": 6,
                          "language": "he",
                          "score": 1024
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/transform": {
      "post": {
        "operationId": "transform",
        "security": [
          {
            "Tisane-API-Key": []
          }
        ],
        "tags": [
          "NLU / NLP Methods"
        ],
        "summary": "Преобразовать или перевести текст",
        "description": "Этот метод переводит заданный текст.\nТекст запроса должен включать следующие элементы:\n* `from` (строка) - Стандартный тег IETF для исходного языка. Используйте `*` или набор кодов языка, разделенных вертикальной чертой, для вызова автоопределения.\n* `to` (строка) - Стандартный тег IETF для целевого языка. Если исходный и целевой языки одинаковы, будет применено перефразирование.\n* `content` (строка) — текстовое содержимое для перевода.\n* `settings` (объект) - дополнительные настройки перевода.\n\nДополнительная информация: [Руководство по настройке и кастомизации API Tisane](./tisane-api-configuration.md)\nОтветом является преобразованный текст.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "string"
                  },
                  "to": {
                    "type": "string"
                  },
                  "content": {
                    "type": "string"
                  },
                  "settings": {
                    "type": "object",
                    "properties": {
                      "snippets": {
                        "type": "boolean",
                        "description": "Если установлено значение `true`, соответствующие фрагменты включаются в разделы `abuse`, `sentiment_expressions` и `entities_summary`."
                      },
                      "abuse": {
                        "type": "boolean",
                        "description": "Выводить ли `abuse`. По умолчанию: `true`"
                      },
                      "sentiment": {
                        "type": "boolean",
                        "description": "Выводить ли тональность. По умолчанию: `true`"
                      },
                      "topics": {
                        "type": "boolean",
                        "description": "Выводить ли темы. По умолчанию: `true`"
                      },
                      "entities": {
                        "type": "boolean",
                        "description": "Выводить ли информацию о сущности. По умолчанию: `true`"
                      },
                      "relations": {
                        "type": "boolean",
                        "description": "Если `true`, то между сущностями устанавливаются связи."
                      },
                      "disable_spellcheck": {
                        "type": "boolean",
                        "description": "Если установлено значение `true`, проверка орфографии не используется. По умолчанию: `false` (проверка орфографии включена по умолчанию)"
                      },
                      "words": {
                        "type": "boolean",
                        "description": "Если установлено значение `true`, предоставляются отдельные лексические фрагменты."
                      },
                      "state": {
                        "type": "boolean",
                        "description": "Если установлено значение `true`, возвращается содержимое долговременной памяти."
                      },
                      "memory": {
                        "$ref": "#/components/schemas/Memory",
                        "description": "Инициализирует содержимое долговременной памяти."
                      }
                    },
                    "additionalProperties": true
                  }
                }
              },
              "examples": {
                "Перевод японского предложения": {
                  "value": {
                    "from": "ja",
                    "to": "en",
                    "content": "彼女はりんごを食べます",
                    "settings": {}
                  }
                },
                "Автоматическое определение языка и перевод китайского имени на английский": {
                  "value": {
                    "from": "*",
                    "to": "en",
                    "content": "汪杰世",
                    "settings": {
                      "entity": "person"
                    }
                  }
                },
                "Перевод с английского на русский": {
                  "value": {
                    "from": "en",
                    "to": "ru",
                    "content": "The movie is available on amazon prime",
                    "settings": {}
                  }
                },
                "Перевод русского жаргона наркоманов на английский": {
                  "value": {
                    "from": "ru",
                    "to": "en",
                    "content": "юзаю амф умеренно",
                    "settings": {}
                  }
                },
                "Перевод с иврита на русский с сохранением рода": {
                  "value": {
                    "from": "he",
                    "to": "ru",
                    "content": "אני אוהב סיניות",
                    "settings": {}
                  }
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "example": "application/json"
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ на перевод",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                },
                "examples": {
                  "Перевод японского предложения": {
                    "value": "She is eating an apple"
                  },
                  "Автоматическое определение языка и перевод китайского имени на английский": {
                    "value": "Wang Jie Shi"
                  },
                  "Перевод с английского на русский": {
                    "value": "Фильм доступен на amazon prime"
                  },
                  "Перевод русского жаргона наркоманов на английский": {
                    "value": "I moderately take amphetamine"
                  },
                  "Перевод с иврита на русский с сохранением рода": {
                    "value": "Я люблю китаянок"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Неверный запрос — неверный JSON или код языка."
          },
          "401": {
            "description": "Неавторизованный — неверный ключ API или превышена квота."
          },
          "500": {
            "description": "Внутренняя ошибка сервера"
          }
        }
      }
    },
    "/lm/inflections": {
      "get": {
        "operationId": "inflections",
        "security": [
          {
            "Tisane-API-Key": []
          }
        ],
        "tags": [
          "Language Model Direct Access"
        ],
        "summary": "Список склоняемых форм",
        "description": "Возвращает флективные формы указанной лексемы в пределах заданного семейства языков.",
        "parameters": [
          {
            "name": "language",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Код языка в Tisane. Например: `en`.",
            "example": "en"
          },
          {
            "name": "lexeme",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Идентификатор лексемы для проверки.",
            "example": 3130180
          },
          {
            "name": "family",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Идентификатор семейства для проверки.",
            "example": 58443
          }
        ],
        "responses": {
          "200": {
            "description": "Успешный ответ",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "text": {
                        "type": "string"
                      },
                      "isLemma": {
                        "type": "boolean"
                      },
                      "features": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "index": {
                              "type": "integer"
                            },
                            "value": {
                              "type": "string"
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "Формы склонения слова «buy» в английском языке": {
                    "value": [
                      {
                        "text": "bought",
                        "features": [
                          {
                            "index": 2,
                            "value": "ALL"
                          },
                          {
                            "index": 9,
                            "value": "ALL"
                          },
                          {
                            "index": 10,
                            "value": "PAP"
                          },
                          {
                            "index": 11,
                            "value": "ALL"
                          },
                          {
                            "index": 21,
                            "value": "IND"
                          },
                          {
                            "index": 15,
                            "value": "NO"
                          },
                          {
                            "index": 27,
                            "value": "ALL"
                          },
                          {
                            "index": 5,
                            "value": "ALL"
                          }
                        ]
                      },
                      {
                        "text": "bought",
                        "features": [
                          {
                            "index": 2,
                            "value": "ALL"
                          },
                          {
                            "index": 9,
                            "value": "ALL"
                          },
                          {
                            "index": 10,
                            "value": "PAST"
                          },
                          {
                            "index": 5,
                            "value": "ALL"
                          },
                          {
                            "index": 11,
                            "value": "ACT"
                          },
                          {
                            "index": 21,
                            "value": "IND"
                          },
                          {
                            "index": 15,
                            "value": "NO"
                          },
                          {
                            "index": 27,
                            "value": "ALL"
                          }
                        ]
                      },
                      {
                        "text": "buy",
                        "isLemma": true,
                        "features": [
                          {
                            "index": 10,
                            "value": "BASE"
                          },
                          {
                            "index": 11,
                            "value": "ACT"
                          },
                          {
                            "index": 21,
                            "value": "IND"
                          },
                          {
                            "index": 2,
                            "value": "ALL"
                          },
                          {
                            "index": 9,
                            "value": "ALL"
                          },
                          {
                            "index": 15,
                            "value": "NO"
                          },
                          {
                            "index": 27,
                            "value": "ALL"
                          },
                          {
                            "index": 5,
                            "value": "ALL"
                          }
                        ]
                      },
                      {
                        "text": "buys",
                        "features": [
                          {
                            "index": 5,
                            "value": "ALL"
                          },
                          {
                            "index": 2,
                            "value": "1"
                          },
                          {
                            "index": 9,
                            "value": "3"
                          },
                          {
                            "index": 10,
                            "value": "PRES"
                          },
                          {
                            "index": 15,
                            "value": "NO"
                          },
                          {
                            "index": 11,
                            "value": "ACT"
                          },
                          {
                            "index": 21,
                            "value": "IND"
                          },
                          {
                            "index": 27,
                            "value": "ALL"
                          }
                        ]
                      },
                      {
                        "text": "buying",
                        "features": [
                          {
                            "index": 2,
                            "value": "ALL"
                          },
                          {
                            "index": 9,
                            "value": "ALL"
                          },
                          {
                            "index": 10,
                            "value": "PRP"
                          },
                          {
                            "index": 5,
                            "value": "ALL"
                          },
                          {
                            "index": 15,
                            "value": "NO"
                          },
                          {
                            "index": 11,
                            "value": "ACT"
                          },
                          {
                            "index": 21,
                            "value": "IND"
                          },
                          {
                            "index": 27,
                            "value": "ALL"
                          }
                        ]
                      },
                      {
                        "text": "buy",
                        "features": [
                          {
                            "index": 10,
                            "value": "PRES"
                          },
                          {
                            "index": 11,
                            "value": "ACT"
                          },
                          {
                            "index": 21,
                            "value": "IND"
                          },
                          {
                            "index": 23,
                            "value": "BODY"
                          },
                          {
                            "index": 2,
                            "value": "ALL"
                          },
                          {
                            "index": 9,
                            "value": "1"
                          },
                          {
                            "index": 15,
                            "value": "NO"
                          },
                          {
                            "index": 27,
                            "value": "ALL"
                          },
                          {
                            "index": 3,
                            "value": "ALL"
                          },
                          {
                            "index": 29,
                            "value": "00"
                          },
                          {
                            "index": 5,
                            "value": "ALL"
                          },
                          {
                            "index": 22,
                            "value": "ALL"
                          }
                        ]
                      },
                      {
                        "text": "buy",
                        "features": [
                          {
                            "index": 10,
                            "value": "PRES"
                          },
                          {
                            "index": 11,
                            "value": "ACT"
                          },
                          {
                            "index": 21,
                            "value": "IND"
                          },
                          {
                            "index": 23,
                            "value": "BODY"
                          },
                          {
                            "index": 2,
                            "value": "ALL"
                          },
                          {
                            "index": 9,
                            "value": "2"
                          },
                          {
                            "index": 15,
                            "value": "NO"
                          },
                          {
                            "index": 27,
                            "value": "ALL"
                          },
                          {
                            "index": 3,
                            "value": "ALL"
                          },
                          {
                            "index": 29,
                            "value": "00"
                          },
                          {
                            "index": 5,
                            "value": "ALL"
                          },
                          {
                            "index": 22,
                            "value": "ALL"
                          }
                        ]
                      },
                      {
                        "text": "buy",
                        "features": [
                          {
                            "index": 10,
                            "value": "PRES"
                          },
                          {
                            "index": 11,
                            "value": "ACT"
                          },
                          {
                            "index": 21,
                            "value": "IND"
                          },
                          {
                            "index": 2,
                            "value": "MANY"
                          },
                          {
                            "index": 9,
                            "value": "3"
                          },
                          {
                            "index": 15,
                            "value": "NO"
                          },
                          {
                            "index": 27,
                            "value": "ALL"
                          },
                          {
                            "index": 3,
                            "value": "ALL"
                          },
                          {
                            "index": 29,
                            "value": "00"
                          },
                          {
                            "index": 5,
                            "value": "ALL"
                          },
                          {
                            "index": 22,
                            "value": "ALL"
                          }
                        ]
                      }
                    ]
                  },
                  "Флективные формы слова «Соединенные Штаты Америки» в русском языке": {
                    "value": [
                      {
                        "features": [
                          {
                            "index": 9,
                            "value": "3"
                          },
                          {
                            "index": 15,
                            "value": "NOM"
                          }
                        ],
                        "isLemma": true,
                        "text": "Соединённые Штаты Америки"
                      },
                      {
                        "features": [
                          {
                            "index": 15,
                            "value": "GEN"
                          },
                          {
                            "index": 9,
                            "value": "3"
                          }
                        ],
                        "text": "Соединенных Штатов Америки"
                      },
                      {
                        "features": [
                          {
                            "index": 15,
                            "value": "INST"
                          },
                          {
                            "index": 9,
                            "value": "3"
                          }
                        ],
                        "text": "Соединенными Штатами Америки"
                      },
                      {
                        "features": [
                          {
                            "index": 15,
                            "value": "DAT"
                          },
                          {
                            "index": 9,
                            "value": "3"
                          }
                        ],
                        "text": "Соединенным Штатам Америки"
                      },
                      {
                        "features": [
                          {
                            "index": 15,
                            "value": "PREP"
                          },
                          {
                            "index": 9,
                            "value": "3"
                          }
                        ],
                        "text": "Соединенных Штатах Америки"
                      },
                      {
                        "features": [
                          {
                            "index": 24,
                            "value": "THNG"
                          },
                          {
                            "index": 2,
                            "value": "1"
                          },
                          {
                            "index": 9,
                            "value": "3"
                          },
                          {
                            "index": 7,
                            "value": "NA"
                          },
                          {
                            "index": 15,
                            "value": "ACC"
                          }
                        ],
                        "text": "Соединённые Штаты Америки"
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}