Skip to content

Commit 79f8b28

Browse files
bhavika-dhanwaniShabirmean
authored andcommitted
resolved review comments
1 parent d989589 commit 79f8b28

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

dlp/snippets/src/main/java/dlp/snippets/InspectStringAugmentInfoType.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@ public static void main(String[] args) throws Exception {
3939
// The Google Cloud project id to use as a parent resource.
4040
String projectId = "your-project-id";
4141
// The string to de-identify.
42-
String textToInspect = "patient: quasimodo";
43-
inspectStringAugmentInfoType(projectId, textToInspect);
42+
String textToInspect = "The patient's name is quasimodo";
43+
String textToAugment = "quasimodo";
44+
inspectStringAugmentInfoType(projectId, textToInspect, textToAugment);
4445
}
4546

4647
// Inspects the provided text.
47-
public static void inspectStringAugmentInfoType(String projectId, String textToInspect)
48+
public static void inspectStringAugmentInfoType(String projectId, String textToInspect, String textToAugment)
4849
throws IOException {
4950
// Initialize client that will be used to send requests. This client only needs to be created
5051
// once, and can be reused for multiple requests. After completing all of your requests, call
@@ -62,11 +63,11 @@ public static void inspectStringAugmentInfoType(String projectId, String textToI
6263
CustomInfoType.Dictionary wordList =
6364
CustomInfoType.Dictionary.newBuilder()
6465
.setWordList(
65-
CustomInfoType.Dictionary.WordList.newBuilder().addWords("quasimodo").build())
66+
CustomInfoType.Dictionary.WordList.newBuilder().addWords(textToAugment).build())
6667
.build();
6768

6869
InfoType infoType = InfoType.newBuilder().setName("PERSON_NAME").build();
69-
// Construct the custom infotype detector associated with the word list.
70+
// Construct a custom infotype detector by augmenting the PERSON_NAME detector with a word list
7071
CustomInfoType customInfoType =
7172
CustomInfoType.newBuilder().setInfoType(infoType).setDictionary(wordList).build();
7273

dlp/snippets/src/test/java/dlp/snippets/InspectTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ public void testInspectWithHotwordRules() throws Exception {
411411
@Test
412412
public void testInspectStringAugmentInfoType() throws Exception {
413413
InspectStringAugmentInfoType.inspectStringAugmentInfoType(
414-
"bdp-2059-is-31084", "patient: quasimodo");
414+
PROJECT_ID, "The patient's name is Quasimodo", "Quasimodo");
415415
String output = bout.toString();
416416
assertThat(output).contains("Findings: 1");
417417
assertThat(output).contains("Info type: PERSON_NAME");

0 commit comments

Comments
 (0)