API NLP – Tokenization (Tách từ)


  • URL https://viettelgroup.ai/nlp/api/v1/segment

  • Method POST

  • Header Parameters

    1. header "Content-Type: application/json" 2. header "token: token_id"

    Để có "token id" bạn có thể đăng ký tài khoản tại viettelgroup.ai, sau đó login, rồi vào menu token để tạo

Định dạng data gửi lên: Json (default)

{
    "sentence": "input text"
}

Trong đó: sentence là câu văn cần kiểm tra

Success Response

Code: 200
Content: Json array

Mô tả các tham số

API nhận đầu vào là 1 câu văn, đưa ra danh sách các từ và vị trí xuất hiện của chúng

Thuộc tính Value Description
word string từ trong câu
start_index Int vị trí bắt đầu tiếng trong câu văn
end_index Int vị trí kết thúc tiếng trong câu

Example Output

Success

{ 
   "code:":0,
   "message":"OK",
   "result":[ 
      { 
         "end_index":7,
         "start_index":0,
         "word":"Viettel"
      },
      { 
         "end_index":10,
         "start_index":8,
         "word":"là"
      },
      { 
         "end_index":17,
         "start_index":11,
         "word":"đơn vị"
      },
      { 
         "end_index":28,
         "start_index":18,
         "word":"trực thuộc"
      },
      { 
         "end_index":42,
         "start_index":29,
         "word":"Bộ Quốc Phòng"
      },
      { 
         "end_index":51,
         "start_index":43,
         "word":"Việt Nam"
      }
   ]
}

Failure

{ 
  "code": 1,
  "message": "Invalid json syntax! Cannot parse request!"
}
Nội dung