NER (Basic Edition)
- 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); NerReq req = new NerReq(); //text: indicates text to be identified, which is mandatory. req.setText("Text for analysis"); //Optional. zh indicates Chinese. req.setLang("zh"); try { NerResp resp = client.ner(req); } catch (NlpException e) { //A failure is thrown as an exception. For details, see the section "Exceptions". The client automatically processes the exception. }
- Table 1 describes NerReq parameters.
Table 1 NerReq parameters Parameter
Mandatory
Type
Description
text
Yes
String
Text to be identified
lang
No
String
Language to be identified. The default value is zh. Only Chinese is currently supported.
domain
No
String
Supported domain type. Currently, only general domain is supported. The default value is general. This parameter is optional for APIs of the basic version.
- Table 2 describes NerResp parameters.
- Table 3 describes the data structure description of the NamedEntity field.
Table 3 Data structure description of the NamedEntity field Parameter
Type
Description
word
String
Entity text
tag
String
Entity and enumerated type. The options are as follows: nr (person name), ns (location), nt (organization), tpt (time point), day (date), pct (percentage), mny, (currency), ord (ordinal number), qtt (quantifier); race (nationality), job, and email.
offset
Integer
Starting position of the entity text in the text to be analyzed
len
Integer
Entity text length
Last Article: Word Segmentation
Next Article: NER (Domain-specific Edition)
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.