Skip to content

Commit

Permalink
perf: cache split regex
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Nov 29, 2024
1 parent c5f8b62 commit 9433142
Show file tree
Hide file tree
Showing 5 changed files with 353 additions and 584 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ The following table shows the accuracy of the token count approximation for diff
| --- | --- | --- | --- |
| Short English text | 10 | 11 | 10.00% |
| German text with umlauts | 56 | 49 | 12.50% |
| Metamorphosis by Franz Kafka (English) | 31891 | 33928 | 6.39% |
| Die Verwandlung by Franz Kafka (German) | 40620 | 34908 | 14.06% |
| 道德經 by Laozi (Chinese) | 14386 | 11919 | 17.15% |
| TypeScript ES5 Type Declarations (~ 4000 loc) | 47890 | 50464 | 5.37% |
| Metamorphosis by Franz Kafka (English) | 31892 | 33930 | 6.39% |
| Die Verwandlung by Franz Kafka (German) | 40621 | 34908 | 14.06% |
| 道德經 by Laozi (Chinese) | 14387 | 11919 | 17.15% |
| TypeScript ES5 Type Declarations (~ 4000 loc) | 48408 | 51688 | 6.78% |
<!-- END GENERATED TOKEN COUNT TABLE -->

## Features
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "tokenx",
"type": "module",
"version": "0.4.0",
"packageManager": "pnpm@9.14.2",
"packageManager": "pnpm@9.14.4",
"description": "GPT token estimation and context size utilities without a full tokenizer",
"author": "Johann Schopplich <hello@johannschopplich.com>",
"license": "MIT",
Expand Down Expand Up @@ -52,14 +52,14 @@
"release": "bumpp"
},
"devDependencies": {
"@antfu/eslint-config": "^3.9.2",
"@types/node": "^22.9.3",
"@antfu/eslint-config": "^3.11.2",
"@types/node": "^22.10.1",
"bumpp": "^9.8.1",
"eslint": "^9.15.0",
"gpt-tokenizer": "^2.6.2",
"gpt-tokenizer": "^2.7.0",
"tsx": "^4.19.2",
"typescript": "^5.6.3",
"typescript": "^5.7.2",
"unbuild": "^3.0.0-rc.11",
"vitest": "^2.1.5"
"vitest": "^2.1.6"
}
}
Loading

0 comments on commit 9433142

Please sign in to comment.