Skip to content

Commit 29fcf23

Browse files
committed
WS-1693: Add PermID to Simple Response.
1 parent 00e1882 commit 29fcf23

File tree

6 files changed

+62
-4
lines changed

6 files changed

+62
-4
lines changed

api/src/test/java/com/basistech/rosette/api/RosetteAPITest.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014 Basis Technology Corp.
2+
* Copyright 2014-2019 Basis Technology Corp.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -280,6 +280,20 @@ public void testGetEntityLinked() throws IOException {
280280
}
281281
}
282282

283+
284+
@Test
285+
public void testGetEntityPermId() throws IOException {
286+
if (testFilename.endsWith("-entities_permid.json")) {
287+
DocumentRequest<?> request = readValue(DocumentRequest.class);
288+
try {
289+
EntitiesResponse response = api.perform(AbstractRosetteAPI.ENTITIES_SERVICE_PATH, request, EntitiesResponse.class);
290+
verifyEntity(response);
291+
} catch (HttpRosetteAPIException e){
292+
verifyException(e);
293+
}
294+
}
295+
}
296+
283297
@Test
284298
public void testIgnoredUnknownField() throws IOException {
285299
if ("unknown-field-entities.json".equals(testFilename)) {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"content": "Virgin Galactic said that it will merge with Social Capital Hedosophia allowing the company to become publicly traded.",
3+
"language": "eng",
4+
"options": {"includePermID": true}
5+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"entities": [
3+
{
4+
"type": "PERSON",
5+
"mention": "Virgin Galactic",
6+
"normalized": "Virgin Galactic",
7+
"count": 1,
8+
"mentionOffsets": [
9+
{
10+
"startOffset": 16,
11+
"endOffset": 31
12+
}
13+
],
14+
"entityId": "T0",
15+
"confidence": 0.21180975,
16+
"permId": "https://permid.org/1-5000950848"
17+
},
18+
{
19+
"type": "ORGANIZATION",
20+
"mention": "Social Capital Hedosophia",
21+
"normalized": "Social Capital Hedosophia",
22+
"count": 1,
23+
"mentionOffsets": [
24+
{
25+
"startOffset": 61,
26+
"endOffset": 86
27+
}
28+
],
29+
"entityId": "T1",
30+
"confidence": 0.04323018,
31+
"permId": "https://permid.org/1-5057796824"
32+
}
33+
]
34+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
200

model/src/main/java/com/basistech/rosette/apimodel/EntitiesOptions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017 Basis Technology Corp.
2+
* Copyright 2017-2019 Basis Technology Corp.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -58,7 +58,7 @@ public class EntitiesOptions extends Options {
5858
private final String modelType;
5959

6060
/**
61-
* @retrun the includeDBpediaType flag.
61+
* @return the includeDBpediaType flag.
6262
*/
6363
private final Boolean includeDBpediaType;
6464

model/src/main/java/com/basistech/rosette/apimodel/Entity.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017 Basis Technology Corp.
2+
* Copyright 2017-2019 Basis Technology Corp.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -87,4 +87,8 @@ public class Entity {
8787
*/
8888
private final String dbpediaType;
8989

90+
/**
91+
* @return the PermID
92+
*/
93+
private final String permId;
9094
}

0 commit comments

Comments
 (0)