guesslang-js
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -28,3 +28,3 @@ import '@tensorflow/tfjs-backend-cpu'; | ||
private readonly _normalizeNewline; | ||
constructor(modelOptions?: GuessLangOptions); | ||
constructor(options?: GuessLangOptions); | ||
private getModelJSON; | ||
@@ -31,0 +31,0 @@ private getWeights; |
{ | ||
"name": "guesslang-js", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Use guesslang's ML model to detect source code languages", | ||
@@ -5,0 +5,0 @@ "main": "dist/lib/guesslang.min.js", |
@@ -14,3 +14,3 @@ # guesslang-js | ||
```html | ||
<script type="text/javascript" src="guesslang.min.js"></script> | ||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/guesslang-js/dist/lib/guesslang.min.js"></script> | ||
``` | ||
@@ -123,2 +123,18 @@ | ||
### Advanced Options | ||
You can pass an optional object to `GuessLang` containing the following options: | ||
- `minContentSize?: number` - The minimum number of characters in a file to be considered for language detection. Defaults to `20`. | ||
- `maxContentSize?: number` - The maximum number of characters _that will be used_ in a file to be considered for language detection. Defaults to `100000`. | ||
For example: | ||
```js | ||
const guessLang = new GuessLang({ | ||
minContentSize: 0, | ||
maxContentSize: 1000, | ||
}); | ||
``` | ||
## Differences from vscode-languagedetection | ||
@@ -125,0 +141,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1011497
148