{ "schemes": ["https"], "swagger": "2.0", "info": { "description": "NLP APIs available on InsightEra NLP Platform", "title": "NLP Platform API", "termsOfService": "http://swagger.io/terms/", "contact": { "name": "API Support", "email": "dev@insightera.co.th" }, "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" }, "version": "1.0" }, "host": "nlp.insightera.co.th", "basePath": "/api", "paths": { "/nlp/address-extractor": { "post": { "description": "A service for converting a plain text address to a structural address where each part of the address are extracted and labeled. A complete list of parts which will be extracted are as follow:\n1. Name\n2. Phone number\n3. Tambol\n4. Amphoe\n5. Province\n6. Postcode\n7. Probability of an input text being an address (0.0 to 1.0)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "nlp" ], "summary": "Address extractor", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Address", "name": "address", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagAddrInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagAddr" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/classification/change-model-name": { "post": { "description": "Change existing model name.\n* \u003ci\u003emodelId\u003c/i\u003e: An ID from training service which represent an actual model to be used.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "classification" ], "summary": "Change model name", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Input", "name": "input", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagClassModelNameRecord" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagClassModelNameORecord" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/classification/delete": { "post": { "description": "Delete model", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "classification" ], "summary": "Delete model", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Input", "name": "input", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagClassModelInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagClassDeleteResult" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/classification/model": { "post": { "description": "Retrieve model details:\n* Model name\n* Model status\n* Created date\n* Number of samples in each class", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "classification" ], "summary": "Model detail", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Input", "name": "input", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagClassModelInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagClassModelOutput" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/classification/predict": { "post": { "description": "Predict classes of input texts using a model previously trained. In each training request, a user will receive a model ID. The ID is required for this service so that it knows which model to use for prediction. Model ID and a secret token must be matched (the same token used when trained a model) in order to continue using this service.\n* \u003ci\u003emodelId\u003c/i\u003e: An ID from training service which represent an actual model to be used.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "classification" ], "summary": "Predict", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Input", "name": "input", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagClassPredictInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagClassPredictOutput" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/classification/retrain": { "post": { "description": "continue training a model based on an existing model. Users should provide only new information the model has never learnt before. A \u003ci\u003emodel_id\u003c/i\u003e must be provided otherwise the service will response an error.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "classification" ], "summary": "Retrain", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Input", "name": "input", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagClassRetrainRecord" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagClassRetrainResult" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/classification/token": { "get": { "description": "Retrieve all models belong to a given token:\n* Model name\n* Model status\n* Created date\n* Number of sample in each class", "produces": [ "application/json" ], "tags": [ "classification" ], "summary": "Model Details by Token", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagClassTokenResult" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/classification/train": { "post": { "description": "Train a classification model. The general idea begins with a user provides dataset with labels, our service uses these information to build a classification model and give back a model ID. A user then use this model ID with prediction service to have model classified users' text. Every classification models can be accessed only if users provide the same token used during training process. This means all models are protected. Only those who have access to a secret token can use the model.\n* \u003ci\u003emodel_name\u003c/i\u003e (optional) - if not provided, \u003ci\u003emodel_id\u003c/i\u003e will be used as \u003ci\u003emodel_name\u003c/i\u003e", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "classification" ], "summary": "Train", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Input", "name": "input", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagClassTrainRecord" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagClassTrainResult" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/classification/train-with-file": { "post": { "description": "Train a classification model with file. The general idea begins with a user provides dataset with labels, our service uses these information to build a classification model and give back a model ID. A user then use this model ID with prediction service to have model classified users' text. Every classification models can be accessed only if users provide the same token used during training process. This means all models are protected. Only those who have access to a secret token can use the model.\n* \u003ci\u003emodel_name\u003c/i\u003e (optional) - if not provided, \u003ci\u003emodel_id\u003c/i\u003e will be used as \u003ci\u003emodel_name\u003c/i\u003e\n* \u003ci\u003efile\u003c/i\u003e - 2 column file with classname and value in xlsx or csv format (comma delimited)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "classification" ], "summary": "Train with file", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "type": "file", "description": "file", "name": "file", "in": "formData", "required": true }, { "type": "string", "description": "model_name", "name": "model_name", "in": "formData" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagClassTrainResult" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/cleaning": { "post": { "description": "A service for normalizing texts, especially texts from social media and chat which tend to be informal and purposely misspelled (or slang), into a cleaner version to ease further analysis:\n* 'keep_alphabet' If set, tokenization result which contains only one alphabet will be preserved (default: false).\n* 'keep_rt' if set, @RT from Twitter will be preserved (default: false).\n* 'keep_stopwords' if set, stopwords will be preserved (default: false).\n* 'keep_url' if set, urls will be preserved (default: false).\n* 'keep_emoji' if set, emoji will be preserved (default: true).\n* 'normalize' if set, misspelled words will be auto-corrected or transformed into a cleaner form (default: false).\n* 'only_vocab' If set, words that are not in a dictionary will be removed (default: false).", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "nlp" ], "summary": "Text cleaning", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Input", "name": "input", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagCleaningInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagCleaningResult" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/clustering": { "post": { "description": "A service for organizing random texts into multiple groups. The service will try grouping them into a number of group defined by a user (\u003ci\u003ek\u003c/i\u003e).\n* \u003ci\u003eengine\u003c/i\u003e: machine learning algorithm: k-mean (default), hierarchy\n* \u003ci\u003efeature_engine\u003c/i\u003e: feature extraction method: bag-of-word (default), word-vector\n* \u003ci\u003emax_k\u003c/i\u003e: maximum cluster (optional)\n* \u003ci\u003ek\u003c/i\u003e: number of cluster (optional). If k is not provided, the service will try to find the least k that makes good cluster automatically.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "nlp" ], "summary": "Text clustering", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Input", "name": "input", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagClusteringInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagClusteringOutput" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/common-phrase": { "post": { "description": "A clustering service specifically customized for chat log.\n\u003ci\u003ek\u003c/i\u003e: a number of cluster (group) to separate texts into.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "nlp" ], "summary": "Common phrase", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Input", "name": "input", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagCommonPhraseInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagCommonPhraseOutput" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/country": { "post": { "description": "A service for finding a destination country in an address. The service will return the official name of the country and ISO country code.\n* User can provide additional aliases for each countries using \u003ci\u003eextra_dict\u003c/i\u003e option.\n* By default, the service will only return one country. If \u003ci\u003emultiple\u003c/i\u003e is set, it will return all countries found in an input text.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "nlp" ], "summary": "Country detection", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Input", "name": "input", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagCountryInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagCountryResult" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/datetime-parser-new": { "post": { "description": "A service for converting date and time entities in a plain text, e.g. 17 มกราคม 2020, today, tomorrow, 2 hrs ago to a timestamp. A service supports both Thai and English, and supports both absolute time (24 มิถุนายน 2563) and relative time (เมื่อวาน).\n", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "nlp" ], "summary": "Datetime parser", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Input", "name": "input", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagDucklingInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagDucklingNResult" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/extract-email": { "post": { "description": "A service for detect emamil(s) in plain text.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "nlp" ], "summary": "Email extractor", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Email", "name": "address", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagEmailInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagEmail" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/ner": { "post": { "description": "A service which locate and classify named entities into pre-defined categories such as name, locaton and time.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "nlp" ], "summary": "Named Entity Recognition", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Input", "name": "input", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagNERInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagNEROutput" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/ocr": { "post": { "description": "A servie for extracting text from an image such as a printed paper or a photograph which contains texts.", "consumes": [ "multipart/form-data" ], "produces": [ "application/json" ], "tags": [ "nlp" ], "summary": "OCR", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "type": "file", "description": "ImagePath", "name": "image", "in": "formData", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagOCROutput" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/pos": { "post": { "description": "A service which classify words in a given sentence into a paricular part-of-speech (Noun, Verb, Pronoun)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "nlp" ], "summary": "POS", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Input", "name": "input", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagPOSInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagPOSOutput" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/qa": { "post": { "description": "A service for answering questions based on a given story. A user must provide both story and questions in single request.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "nlp" ], "summary": "QA (coming soon)", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Input", "name": "input", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagQAInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagQAOutput" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/sentiment-new": { "post": { "description": "A service for identifying and categorizing opinions expressed in a given text. The result ranges between -1 (negative) and 1 (positive).", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "nlp" ], "summary": "Sentiment analysis", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Input", "name": "input", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagSentimentNInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagSentimentNOutput" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/similar": { "post": { "description": "A service for finding semantically related words for a given word. Example use cases are recommendation, clustering and word normalization.\n* 'top' is a number of expecting words in the result.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "nlp" ], "summary": "Similar words", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Input", "name": "input", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagSimilarNInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagSimilarNResult" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/spell-correction": { "post": { "description": "A service which auto-correct and recommends correct words for misspelling words in a sentence.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "nlp" ], "summary": "Spell correction", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Input", "name": "input", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagSpellInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagSpellResult" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } }, "/nlp/tokenize": { "post": { "description": "A service for breaking (tokenize) a sentence into a sequence of words. Only support Thai and English.\n\u003ci\u003eengine\u003c/i\u003e: specify tokenization algorithm to be used, available choices are:\n* \u003ci\u003elongest_match\u003c/i\u003e: Simple longest matching\n* \u003ci\u003elongest_inse\u003c/i\u003e: Add some rule-based improvement to 'longest_match'\n* \u003ci\u003elongest_tcc\u003c/i\u003e: Apply TCC after 'longest_match'\n* \u003ci\u003edeep\u003c/i\u003e: LSTM with one character context\n* \u003ci\u003edeep_context_10\u003c/i\u003e: LSTM with 10 (front) + 10 (back) characters context\n* \u003ci\u003edeep_context_dict\u003c/i\u003e: Apply dictionary cross-check to 'deep_context_10'", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "nlp" ], "summary": "Thai text tokenization", "parameters": [ { "type": "string", "default": "97051ade29a61c860f57dc9443128464", "description": "Token", "name": "token", "in": "query", "required": true }, { "description": "Input", "name": "input", "in": "body", "required": true, "schema": { "type": "object", "$ref": "#/definitions/record.SwagTokenizeInput" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/record.SwagTokenizeResult" } }, "400": { "description": "Bad Request", "schema": { "type": "string" } }, "401": { "description": "Unauthorized", "schema": { "type": "string" } }, "408": { "description": "Request Timeout", "schema": { "type": "string" } }, "500": { "description": "Internal Server Error", "schema": { "type": "string" } } } } } }, "definitions": { "record.SwagAddr": { "type": "object", "properties": { "message": { "type": "object", "properties": { "amphoe": { "type": "object", "properties": { "scope": { "type": "array", "items": { "type": "integer" }, "example": [ 116, 126 ] }, "text": { "type": "string", "example": "คลองสาน" } } }, "is_address_score": { "type": "number", "example": 0.99 }, "name": { "type": "object", "properties": { "scope": { "type": "array", "items": { "type": "integer" }, "example": [ 3, 26 ] }, "text": { "type": "string", "example": "ปุญญพัฒน์ เศรษฐ์สมบูรณ์" } } }, "original_text": { "type": "string", "example": "นายปุญญพัฒน์ เศรษฐ์สมบูรณ์ 081-234-5678 110/1 อาคาร KX (ใกล้ๆ BTS วงเวียนใหญ่) ชั้น 14 ถ.กรุงธนบุรี แขวงบางลำภูล่าง เขตคลองสาน กรุงเทพมหานคร 10600 จ-ศ 10:00-19:00" }, "other": { "type": "string", "example": "นาย 110/1 อาคาร KX (ใกล้ๆ BTS วงเวียนใหญ่) ชั้น 14 ถ.กรุงธนบุรี จ-ศ 10:00-19:00" }, "phone": { "type": "array", "items": { "type": "object", "properties": { "scope": { "type": "array", "items": { "type": "integer" }, "example": [ 27, 39 ] }, "text": { "type": "string", "example": "0812345678" } } } }, "postcode": { "type": "object", "properties": { "scope": { "type": "array", "items": { "type": "integer" }, "example": [ 141, 146 ] }, "text": { "type": "string", "example": "10600" } } }, "province": { "type": "object", "properties": { "scope": { "type": "array", "items": { "type": "integer" }, "example": [ 127, 140 ] }, "text": { "type": "string", "example": "กรุงเทพมหานคร" } } }, "tambon": { "type": "object", "properties": { "scope": { "type": "array", "items": { "type": "integer" }, "example": [ 100, 115 ] }, "text": { "type": "string", "example": "บางลำภูล่าง" } } }, "test_scope": { "type": "object", "properties": { "amphoe": { "type": "string", "example": "เขตคลองสาน" }, "name": { "type": "string", "example": "ปุญญพัฒน์ เศรษฐ์สมบูรณ์" }, "phone": { "type": "array", "items": { "type": "string" }, "example": [ "081-234-5678" ] }, "postcode": { "type": "string", "example": "10600" }, "province": { "type": "string", "example": "กรุงเทพมหานคร" }, "tambon": { "type": "string", "example": "แขวงบางลำภูล่าง" } } } } } } }, "record.SwagAddrInput": { "type": "object", "properties": { "text": { "type": "string", "example": "นายปุญญพัฒน์ เศรษฐ์สมบูรณ์ 081-234-5678 110/1 อาคาร KX (ใกล้ๆ BTS วงเวียนใหญ่) ชั้น 14 ถ.กรุงธนบุรี แขวงบางลำภูล่าง เขตคลองสาน กรุงเทพมหานคร 10600 จ-ศ 10:00-19:00" } } }, "record.SwagClassDeleteResult": { "type": "object", "properties": { "error_msg": { "type": "string" }, "result": { "type": "string", "example": "ok" } } }, "record.SwagClassModelInput": { "type": "object", "properties": { "model_id": { "type": "string", "example": "m-dfcf872c-ef34-11e9-ad3b-84a93e037981" } } }, "record.SwagClassModelNameORecord": { "type": "object", "properties": { "message": { "type": "object", "properties": { "model_id": { "type": "string", "example": "m-6069d024-368d-11ea-978f-2e728ce88125" }, "result": { "type": "string", "example": "ok" } } } } }, "record.SwagClassModelNameRecord": { "type": "object", "properties": { "model_id": { "type": "string", "example": "m-6069d024-368d-11ea-978f-2e728ce88125" }, "model_name": { "type": "string", "example": "Hello world !" } } }, "record.SwagClassModelOutput": { "type": "object", "properties": { "message": { "type": "object", "properties": { "created_at": { "type": "object", "properties": { "$date": { "type": "integer", "example": 1571134602455 } } }, "modelId": { "type": "string", "example": "m-dfcf872c-ef34-11e9-ad3b-84a93e037981" }, "modelName": { "type": "string", "example": "education_vs_politic" }, "trains": { "type": "integer", "example": 2000 } } } } }, "record.SwagClassPredictInput": { "type": "object", "properties": { "model_id": { "type": "string", "example": "m-dfcf872c-ef34-11e9-ad3b-84a93e037981" }, "samples": { "type": "array", "items": { "type": "string" }, "example": [ "การศึกษาเป็นสิ่งที่จำเป็นหรือไม่..." ] } } }, "record.SwagClassPredictOutput": { "type": "object", "properties": { "message": { "type": "object", "properties": { "model_id": { "type": "string", "example": "m-dfcf872c-ef34-11e9-ad3b-84a93e037981" }, "output": { "type": "array", "items": { "type": "object", "properties": { "classes": { "type": "array", "items": { "type": "object", "properties": { "class_id": { "type": "integer", "example": 0 }, "class_name": { "type": "string", "example": "education" }, "probability": { "type": "number", "example": 0.9243098131705381 } } } }, "text": { "type": "string", "example": "การศึกษาเป็นสิ่งที่จำเป็นหรือไม่..." } } } }, "result": { "type": "string", "example": "ok" } } } } }, "record.SwagClassRetrainRecord": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "class_name": { "type": "string", "example": "education" }, "samples": { "type": "array", "items": { "type": "string" }, "example": [ "การศึกษาของเมืองไทยวันนี้...", "ครูมีหน้าที่อบรมสั่งสอนนักเรียน...", "เด็กไทยทุกคนมีหน้าที่ต้องไปโรงเรียน..." ] } } } }, "is_sync": { "type": "boolean", "example": true }, "modelId": { "type": "string", "example": "m-123e4567-e89b-12d3-a456-426655440000" } } }, "record.SwagClassRetrainResult": { "type": "object", "properties": { "result": { "type": "string", "example": "success" } } }, "record.SwagClassTokenResult": { "type": "object", "properties": { "model_id_list": { "type": "array", "items": { "type": "object", "properties": { "created_at": { "type": "string", "example": "Fri, 27 Dec 2019 04:49:20 GMT" }, "model_id": { "type": "string", "example": "m-3ebd1518-2864-11ea-aedd-02420a000255" }, "model_name": { "type": "string", "example": "test ja" }, "total_class": { "type": "integer", "example": 2 }, "updated_at": { "type": "string", "example": "Fri, 27 Dec 2019 04:49:23 GMT" } } } } } }, "record.SwagClassTrainRecord": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "class_name": { "type": "string", "example": "education" }, "samples": { "type": "array", "items": { "type": "string" }, "example": [ "การศึกษาของเมืองไทยวันนี้...", "ครูมีหน้าที่อบรมสั่งสอนนักเรียน...", "เด็กไทยทุกคนมีหน้าที่ต้องไปโรงเรียน..." ] } } } }, "is_sync": { "type": "boolean", "example": true }, "model_name": { "description": "ModelID string `json:\"modelId\" example:\"null\"`", "type": "string", "example": "education_vs_politic" } } }, "record.SwagClassTrainResult": { "type": "object", "properties": { "result": { "type": "object", "properties": { "model_id": { "type": "string", "example": "m-123e4567-e89b-12d3-a456-426655440000" } } } } }, "record.SwagCleaningInput": { "type": "object", "properties": { "text": { "type": "string", "example": "โอ้โหหหหห๊ วันนี้อากาศร้อนมากกกเลยยย 555" } } }, "record.SwagCleaningResult": { "type": "object", "properties": { "result": { "type": "object", "properties": { "message": { "type": "object", "properties": { "text": { "description": "Description string `json:\"description\" example:\"\"`", "type": "string", "example": "โอ้โหหหหห๊ วันนี้อากาศร้อนมากกกเลยยย 555" }, "tokens": { "type": "array", "items": { "type": "string" }, "example": [ "โอ้โห", "อากาศ", "ร้อน", "เลย", "555" ] } } }, "result": { "type": "string", "example": "ok" } } } } }, "record.SwagClusteringInput": { "type": "object", "properties": { "engine": { "type": "string", "example": "k-mean" }, "feature_engine": { "type": "string", "example": "bag-of-word" }, "k": { "type": "integer", "example": 1 }, "max_k": { "type": "integer", "example": 3 }, "samples": { "type": "array", "items": { "type": "string" }, "example": [ "foo", "bar", "bar" ] } } }, "record.SwagClusteringOutput": { "type": "object", "properties": { "result": { "type": "object", "properties": { "message": { "type": "object", "properties": { "cluster": { "type": "array", "items": { "type": "integer" }, "example": [ 0, 0, 0 ] }, "description": { "type": "string", "example": "k-mean model with bag-of-word. Maximum number of clusters is 1, result have 1 cluster." } } }, "result": { "type": "string", "example": "ok" } } } } }, "record.SwagCommonPhraseInput": { "type": "object", "properties": { "k": { "type": "integer" }, "samples": { "type": "array", "items": { "type": "string" } } } }, "record.SwagCommonPhraseOutput": { "type": "object", "properties": { "result": { "type": "object", "properties": { "common-phrase": { "type": "object", "properties": { "samples": { "type": "array", "items": { "type": "\u0026{%!s(token.Pos=1330) \u003cnil\u003e string}" } }, "scores": { "type": "array", "items": { "type": "integer" } } } }, "description": { "type": "string" } } } } }, "record.SwagCountryInput": { "type": "object", "properties": { "extra_dict": { "type": "array", "items": { "type": "object", "properties": { "alias_english": { "type": "array", "items": { "type": "string" }, "example": [ "New York" ] }, "alias_thai": { "type": "array", "items": { "type": "string" }, "example": [ "นิวยอค" ] }, "country_code": { "type": "string", "example": "US" } } } }, "multiple": { "type": "boolean", "example": false }, "text": { "type": "string", "example": "ส่งไปนิวยอหน่อยครับ" } } }, "record.SwagCountryResult": { "type": "object", "properties": { "message": { "type": "object", "properties": { "country": { "type": "object", "properties": { "code": { "type": "string", "example": "US" }, "scope": { "type": "array", "items": { "type": "integer" }, "example": [ 5, 10 ] }, "text": { "type": "string", "example": "สหรัฐอเมริกา" } } }, "original_text": { "type": "string", "example": "ส่งไปนิวยอหน่อยครับ" }, "other": { "type": "string", "example": "ส่งไปหน่อยครับ" }, "test_scope": { "type": "object", "properties": { "country": { "type": "string", "example": "นิวยอ" } } } } } } }, "record.SwagDucklingInput": { "type": "object", "properties": { "text": { "type": "string", "example": "today" } } }, "record.SwagDucklingNResult": { "type": "object", "properties": { "status": { "type": "string", "example": "ok" }, "timestamp": { "type": "integer", "example": 1577811600 } } }, "record.SwagEmail": { "type": "object", "properties": { "results": { "type": "array", "items": { "type": "object", "properties": { "emails": { "type": "array", "items": { "type": "object", "properties": { "domain_name": { "type": "string", "example": "insightera.co.th" }, "email": { "type": "string", "example": "contact@insightera.co.th" }, "scope": { "type": "array", "items": { "type": "integer" }, "example": [ 22, 46 ] }, "username": { "type": "string", "example": "contact" } } } }, "text": { "type": "string", "example": "สอบถามเพิ่มเติมได้ที่ contact@insightera.co.th ครับ" } } } }, "status": { "type": "string", "example": "ok" } } }, "record.SwagEmailInput": { "type": "object", "properties": { "texts": { "type": "array", "items": { "type": "string" }, "example": [ "สอบถามเพิ่มเติมได้ที่ contact@insightera.co.th ครับ" ] } } }, "record.SwagNERInput": { "type": "object", "properties": { "texts": { "type": "array", "items": { "type": "string" }, "example": [ "นายแดงหิวข้าว", "ผมเจอนายแดงตอนเช้า" ] } } }, "record.SwagNEROutput": { "type": "object", "properties": { "message": { "type": "object", "properties": { "description": { "type": "string" }, "ner": { "type": "array", "items": { "type": "\u0026{%!s(token.Pos=1066) \u003cnil\u003e %!s(*ast.StructType=\u0026{1068 0xc00044fdd0 false})}" } } } }, "status": { "type": "string" } } }, "record.SwagOCROutput": { "type": "object", "properties": { "result": { "type": "object", "properties": { "filename": { "type": "string", "example": "image_with_text.jpg" }, "text": { "type": "string", "example": "ทดสอบด้วยภาษาไทย\nการแกะตัวหนังสือจากภาพ\nขอบคุณครับ" } } }, "status": { "type": "string", "example": "ok" } } }, "record.SwagPOSInput": { "type": "object", "properties": { "texts": { "type": "array", "items": { "type": "string" }, "example": [ "นายแดงกินข้าวแกง", "มดแดงกินมะม่วง" ] } } }, "record.SwagPOSOutput": { "type": "object", "properties": { "message": { "type": "object", "properties": { "description": { "type": "string" }, "pos": { "type": "array", "items": { "type": "\u0026{%!s(token.Pos=789) \u003cnil\u003e %!s(*ast.StructType=\u0026{791 0xc00044f9e0 false})}" } } } }, "status": { "type": "string" } } }, "record.SwagQAInput": { "type": "object", "properties": { "context": { "type": "string", "example": "จังหวัดแค็วม์โปแลนด์ wojewdztwochemskie เป็นหน่วยการปกครองท้องถิ่นของประเทศโปแลนด์ในช่วงปี ค.ศ.1975 - ค.ศ.1998 จังหวัดได้รับการรวมเข้ากับจังหวัดลูบลินมีเมืองหลักคือแค็วม์ใน ปี ค.ศ.1998 มีพื้นที่ประมาณ 3865 ตารางกิโลเมตรและมีประชากร 248800 คน" }, "questions": { "type": "array", "items": { "type": "string" }, "example": [ "จังหวัดแค็วม์ก่อตั้งขึ้นในปีอะไร", "แค็วม์มีพื้นที่เท่าไร", "แค็วม์มีจำนวนประชากรกี่คน" ] } } }, "record.SwagQAOutput": { "type": "object", "properties": { "result": { "type": "object", "properties": { "description": { "type": "string" }, "question-answer": { "type": "array", "items": { "type": "string" }, "example": [ " ", "ประมาณ 3865 ตารางกิโลเมตร", "248800 คน" ] } } } } }, "record.SwagSentimentNInput": { "type": "object", "properties": { "engine": { "type": "string", "example": "deepsent" }, "texts": { "type": "array", "items": { "type": "string" }, "example": [ "อากาศดีๆจะมีในยามเช้า เหงาาาาสักเท่าไหร่", "ไม่ต้องโทรม้าาา เพราะชั่นจะไหมรับสาย", "สนใจนะครับ", "ชอบๆ สนุกดีดีดีดี", "อาหารไม่อร่อยเลยนะ", "หงุดหงิดจังเลยโว้ยยยย" ] } } }, "record.SwagSentimentNOutput": { "type": "object", "properties": { "message": { "type": "object", "properties": { "description": { "type": "string" }, "sentiments": { "type": "array", "items": { "type": "object", "properties": { "score": { "type": "number", "example": 0.07 }, "text": { "type": "string", "example": "อากาศดีๆจะมีในยามเช้า เหงาาาาสักเท่าไหร่" } } } } } }, "status": { "type": "string", "example": "ok" } } }, "record.SwagSimilarNInput": { "type": "object", "properties": { "engine": { "type": "string", "example": "skipgram-5" }, "top": { "type": "integer", "example": 5 }, "word": { "type": "string", "example": "สวย" } } }, "record.SwagSimilarNResult": { "type": "object", "properties": { "message": { "type": "object", "properties": { "desc": { "type": "string", "example": "Used 'skipgram-5' engine. Choose the top 5 similar words." }, "word": { "type": "string", "example": "สวย" }, "word-similarity": { "type": "array", "items": { "type": "object", "properties": { "score": { "type": "number", "example": 0.59 }, "word": { "type": "string", "example": "น่ารัก" } } } } } }, "status": { "type": "string" } } }, "record.SwagSpellInput": { "type": "object", "properties": { "text": { "type": "string", "example": "การสนทนนี้น่าสนใใจ มากๆๆๆ +++" } } }, "record.SwagSpellResult": { "type": "object", "properties": { "result": { "type": "object", "properties": { "spell": { "description": "Description string `json:\"description\"`", "type": "array", "items": { "type": "object", "properties": { "index": { "type": "array", "items": { "type": "integer" }, "example": [ 3, 7 ] }, "spell": { "type": "boolean", "example": false }, "suggestion": { "type": "array", "items": { "type": "object", "properties": { "สนทนา": { "type": "number", "example": 0.11273138225078583 }, "สนาน": { "type": "number", "example": 0.11190706491470337 } } } }, "token": { "type": "string", "example": "สนทน" } } } }, "text": { "type": "string", "example": "การสนทนนี้น่าสนใใจ มากๆๆๆ +++" } } } } }, "record.SwagTokenizeInput": { "type": "object", "properties": { "engine": { "type": "string", "example": "deep_context_10" }, "text": { "type": "string", "example": "เรามาตัดคำไทยกันเถอะ" } } }, "record.SwagTokenizeResult": { "type": "object", "properties": { "result": { "type": "object", "properties": { "description": { "type": "string", "example": "Using 'deep_context_10' engine" }, "text": { "type": "string", "example": "เรามาตัดคำไทยกันเถอะ" }, "tokens": { "type": "array", "items": { "type": "string" }, "example": [ "เรา", "มา", "ตัด", "คำ", "ไทย", "กัน", "เถอะ" ] } } } } } } }