Sentence Vector
- Example request
//You are advised to construct and use the client in a singleton pattern to avoid frequent object creation. NlpfClient client = new NlpfClient(AuthMode.AKSK,authInfo); SentenceVectorsReq req = new SentenceVectorsReq(); //Construct a sentence for which a sentence vector needs to be obtained. List<String> sentences = new ArrayList<String>(); sentences.add("sentence-1"); sentences.add("sentence-2"); req.setSentences(sentences); //Model name. Only general is supported. req.setDomain("general"); try { SentenceVectorsResp resp = client.getSentenceVectors(req); } catch (NlpException e) { //A failure is thrown as an exception. For details about exceptions, see section "Exceptions". The client automatically processes exceptions. }
- Table 1 describes SentenceVectorsReq parameters.
Table 1 SentenceVectorsReq parameters Parameter
Mandatory
Type
Description
sentences
Yes
List<String>
Text list. The text is encoded using UTF-8 and contains 1 to 512 characters. The text list contains 1 to 1,000 text data records.
domain
No
String
Name of the model used for computing the sentence vector. Currently, only the default value general is available.
- Table 2 describes SentenceVectorsResp parameters.
Last Article: Text Similarity
Next Article: Accessing the Client via HTTP Proxies
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.