-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
FiddlyDigital
committed
Jul 6, 2023
1 parent
af93fb1
commit f370dd4
Showing
3 changed files
with
38 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
import { Anonimizer, Feature, IAnonimizer } from "../src"; | ||
let anonimizer: IAnonimizer; | ||
|
||
beforeAll(() => { | ||
anonimizer = new Anonimizer(); | ||
}); | ||
|
||
describe('Test Anomization and Rehydration', () => { | ||
test('When using the same input, Anonomisation then rehydrations should produce the exact same text.', () => { | ||
const originalInput = "Write an email to Jim, asking them to email Philip at [email protected] to call Maria about getting that PO sorted. Also ask about the progress of the #Acquisition Deal."; | ||
const featuresToReplace = new Array(Feature.People, Feature.Emails, Feature.Urls, Feature.HashTags); | ||
let [safeText, runValueMap] = anonimizer.anonimize(originalInput, featuresToReplace); | ||
expect(safeText != originalInput); | ||
|
||
let rehydratedText = anonimizer.reHydrate(safeText, runValueMap); | ||
expect(safeText != rehydratedText); | ||
expect(originalInput == rehydratedText); | ||
}); | ||
|
||
test('PromptResponse Rehydration post prompt anonimisation', () => { | ||
const originalInput = "Write an email to Jim, asking them to email Philip at [email protected] to call Maria about getting that PO sorted. Also ask about the progress of the #Acquisition Deal."; | ||
const featuresToReplace = new Array(Feature.People, Feature.Emails, Feature.Urls, Feature.HashTags); | ||
let [safeText, runValueMap] = anonimizer.anonimize(originalInput, featuresToReplace); | ||
expect(safeText != originalInput); | ||
|
||
const promptResponse = `Dear Ava, | ||
I hope this email finds you well. I have an important request on behalf of Charlotte from our team. Charlotte would greatly appreciate it if you could reach out to Benjamin at [email protected] and ask him to call her regarding the Purchase Order (PO) that needs to be sorted urgently. | ||
Additionally, Charlotte would like to inquire about the progress and any updates regarding the #Alligator Deal. She would like to stay informed and ensure everything is on track. | ||
Best Regards,` | ||
let rehydratedText = anonimizer.reHydrate(promptResponse, runValueMap); | ||
expect(rehydratedText === `Dear Jim, | ||
I hope this email finds you well. I have an important request on behalf of Maria from our team. Maria would greatly appreciate it if you could reach out to Philip at [email protected] and ask him to call her regarding the Purchase Order (PO) that needs to be sorted urgently. | ||
Additionally, Maria would like to inquire about the progress and any updates regarding the #Acquisition Deal. She would like to stay informed and ensure everything is on track. | ||
Best Regards,`); | ||
}) | ||
}); | ||
import { Anonimizer, Feature, IAnonimizer } from "../../src"; | ||
let anonimizer: IAnonimizer; | ||
|
||
beforeAll(() => { | ||
anonimizer = new Anonimizer(); | ||
}); | ||
|
||
describe('Test Anomization and Rehydration', () => { | ||
test('When using the same input, Anonomisation then rehydrations should produce the exact same text.', () => { | ||
const originalInput = "Write an email to Jim, asking them to email Philip at [email protected] to call Maria about getting that PO sorted. Also ask about the progress of the #Acquisition Deal."; | ||
const featuresToReplace = new Array(Feature.People, Feature.Emails, Feature.Urls, Feature.HashTags); | ||
let [safeText, runValueMap] = anonimizer.anonimize(originalInput, featuresToReplace); | ||
expect(safeText != originalInput); | ||
|
||
let rehydratedText = anonimizer.reHydrate(safeText, runValueMap); | ||
expect(safeText != rehydratedText); | ||
expect(originalInput == rehydratedText); | ||
}); | ||
|
||
test('PromptResponse Rehydration post prompt anonimisation', () => { | ||
const originalInput = "Write an email to Jim, asking them to email Philip at [email protected] to call Maria about getting that PO sorted. Also ask about the progress of the #Acquisition Deal."; | ||
const featuresToReplace = new Array(Feature.People, Feature.Emails, Feature.Urls, Feature.HashTags); | ||
let [safeText, runValueMap] = anonimizer.anonimize(originalInput, featuresToReplace); | ||
expect(safeText != originalInput); | ||
|
||
const promptResponse = `Dear Ava, | ||
I hope this email finds you well. I have an important request on behalf of Charlotte from our team. Charlotte would greatly appreciate it if you could reach out to Benjamin at [email protected] and ask him to call her regarding the Purchase Order (PO) that needs to be sorted urgently. | ||
Additionally, Charlotte would like to inquire about the progress and any updates regarding the #Alligator Deal. She would like to stay informed and ensure everything is on track. | ||
Best Regards,` | ||
let rehydratedText = anonimizer.reHydrate(promptResponse, runValueMap); | ||
expect(rehydratedText === `Dear Jim, | ||
I hope this email finds you well. I have an important request on behalf of Maria from our team. Maria would greatly appreciate it if you could reach out to Philip at [email protected] and ask him to call her regarding the Purchase Order (PO) that needs to be sorted urgently. | ||
Additionally, Maria would like to inquire about the progress and any updates regarding the #Acquisition Deal. She would like to stay informed and ensure everything is on track. | ||
Best Regards,`); | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters