From d2b6dcaaf6810741760ba82eef2edf0bccb8a7a2 Mon Sep 17 00:00:00 2001 From: syonfox Date: Sun, 25 Dec 2022 12:47:40 -0500 Subject: [PATCH] add a test for issue https://github.com/latitudegames/GPT-3-Encoder/issues/9 It seems to work fine --- Encoder.test.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Encoder.test.js b/Encoder.test.js index e333b55..0810326 100644 --- a/Encoder.test.js +++ b/Encoder.test.js @@ -107,3 +107,14 @@ test('stats test', () => { // const str = "toString constructor hasOwnProperty valueOf"; // expect(encode(str).length).toEqual(countTokens(str)); }) +test('test " issue #9', () => { + const str = '“wrote jack a letter”' + + let e = encode(str); + let stats = tokenStats(e); + // console.log("example stats: ", stats); + expect(e).toEqual([447, 250, 42910, 14509, 257, 3850, 447, 251]) + expect(decode(e)).toEqual(str) + // const str = "toString constructor hasOwnProperty valueOf"; + // expect(encode(str).length).toEqual(countTokens(str)); +})