Spaces:
Running
Running
Add Portuguese (Brazil): gector-bert-pt-br v1.0.0 (parity with quickstart.py on its 603 gold sentences)
Browse files
README.md
CHANGED
|
@@ -13,18 +13,19 @@ models:
|
|
| 13 |
- proofbird/gector-bert-es
|
| 14 |
- proofbird/gector-bert-fr
|
| 15 |
- proofbird/gector-bert-de
|
|
|
|
| 16 |
short_description: Proofbird grammar models, running in your browser
|
| 17 |
---
|
| 18 |
|
| 19 |
# Try Proofbird Grammar
|
| 20 |
|
| 21 |
-
Proofbird's on-device grammar models — English, Italian, Spanish, French and
|
| 22 |
The model is downloaded once (about 450 MB per language, then kept by your browser) and runs on your own computer with
|
| 23 |
ONNX Runtime Web; the text you type is never sent anywhere.
|
| 24 |
|
| 25 |
What the page runs is a line-by-line JavaScript port of each model's `quickstart.py` (`gector.js`): the same
|
| 26 |
-
tokenizer, the same five passes, the same suggestions — checked against the Python file on all
|
| 27 |
-
the
|
| 28 |
time.
|
| 29 |
|
| 30 |
This is the model on its own. The [Proofbird](https://proofbird.app) app adds the guards in each model's
|
|
|
|
| 13 |
- proofbird/gector-bert-es
|
| 14 |
- proofbird/gector-bert-fr
|
| 15 |
- proofbird/gector-bert-de
|
| 16 |
+
- proofbird/gector-bert-pt-br
|
| 17 |
short_description: Proofbird grammar models, running in your browser
|
| 18 |
---
|
| 19 |
|
| 20 |
# Try Proofbird Grammar
|
| 21 |
|
| 22 |
+
Proofbird's on-device grammar models — English, Italian, Spanish, French, German and Brazilian Portuguese — running **in your browser**.
|
| 23 |
The model is downloaded once (about 450 MB per language, then kept by your browser) and runs on your own computer with
|
| 24 |
ONNX Runtime Web; the text you type is never sent anywhere.
|
| 25 |
|
| 26 |
What the page runs is a line-by-line JavaScript port of each model's `quickstart.py` (`gector.js`): the same
|
| 27 |
+
tokenizer, the same five passes, the same suggestions — checked against the Python file on all 3 152 gold sentences of
|
| 28 |
+
the six models (identical token ids, corrections and suggestions). Like the Proofbird app, it checks one sentence at a
|
| 29 |
time.
|
| 30 |
|
| 31 |
This is the model on its own. The [Proofbird](https://proofbird.app) app adds the guards in each model's
|
app.js
CHANGED
|
@@ -12,8 +12,10 @@ const MODELS = {
|
|
| 12 |
text: "Ma sœur sont très content. Les enfants joue dans le jardin.", tries: ["Nous est arrivés en retard.", "Je vais à le marché."] },
|
| 13 |
de: { name: "Deutsch", tag: "v2.1.0", licence: "Apache-2.0",
|
| 14 |
text: "Meine Schwester sind sehr mude. Du hat heute keine zeit.", tries: ["Die Kinder spielt im Garten.", "Ich hoffe, das du kommst."] },
|
|
|
|
|
|
|
| 15 |
};
|
| 16 |
-
const NAMES = { en: "English", it: "Italian", es: "Spanish", fr: "French", de: "German" };
|
| 17 |
const CACHE = "proofbird-models-v1";
|
| 18 |
const $ = (id) => document.getElementById(id);
|
| 19 |
|
|
@@ -25,8 +27,10 @@ let edited = false;
|
|
| 25 |
|
| 26 |
function pickLanguage() {
|
| 27 |
for (const l of navigator.languages || [navigator.language || "en"]) {
|
| 28 |
-
const
|
|
|
|
| 29 |
if (MODELS[code]) return code;
|
|
|
|
| 30 |
}
|
| 31 |
return "en";
|
| 32 |
}
|
|
|
|
| 12 |
text: "Ma sœur sont très content. Les enfants joue dans le jardin.", tries: ["Nous est arrivés en retard.", "Je vais à le marché."] },
|
| 13 |
de: { name: "Deutsch", tag: "v2.1.0", licence: "Apache-2.0",
|
| 14 |
text: "Meine Schwester sind sehr mude. Du hat heute keine zeit.", tries: ["Die Kinder spielt im Garten.", "Ich hoffe, das du kommst."] },
|
| 15 |
+
"pt-br": { name: "Português (Brasil)", tag: "v1.0.0", licence: "Apache-2.0",
|
| 16 |
+
text: "A casa são muito bonito. As crianças brinca no jardim.", tries: ["Os meninos come em casa.", "Vou a praia amanhã."] },
|
| 17 |
};
|
| 18 |
+
const NAMES = { en: "English", it: "Italian", es: "Spanish", fr: "French", de: "German", "pt-br": "Portuguese (Brazil)" };
|
| 19 |
const CACHE = "proofbird-models-v1";
|
| 20 |
const $ = (id) => document.getElementById(id);
|
| 21 |
|
|
|
|
| 27 |
|
| 28 |
function pickLanguage() {
|
| 29 |
for (const l of navigator.languages || [navigator.language || "en"]) {
|
| 30 |
+
const full = l.toLowerCase(), code = full.slice(0, 2);
|
| 31 |
+
if (MODELS[full]) return full; // a variant model (pt-BR) by its full tag first
|
| 32 |
if (MODELS[code]) return code;
|
| 33 |
+
if (code === "pt") return "pt-br"; // the one Portuguese model so far
|
| 34 |
}
|
| 35 |
return "en";
|
| 36 |
}
|
gector.js
CHANGED
|
@@ -12,7 +12,7 @@ const isAlnum = (ch) => ch.length > 0 && ALNUM.test(Array.from(ch)[0]);
|
|
| 12 |
export class Gector {
|
| 13 |
/**
|
| 14 |
* files: { config, tokenizer, rules, verbs } - config.json and tokenizer.json parsed, language-rules.json parsed (or {}),
|
| 15 |
-
* verb-form-vocab.txt as text (or ""). lang: "en" | "it" | "es" | "fr" | "de". run(ids) -> { labels, d } (Float32Arrays,
|
| 16 |
* [tokens x 5000] and [tokens x 2]).
|
| 17 |
*/
|
| 18 |
constructor(files, lang, run, { keepConfidence = 0, minErrorProb = 0 } = {}) {
|
|
|
|
| 12 |
export class Gector {
|
| 13 |
/**
|
| 14 |
* files: { config, tokenizer, rules, verbs } - config.json and tokenizer.json parsed, language-rules.json parsed (or {}),
|
| 15 |
+
* verb-form-vocab.txt as text (or ""). lang: "en" | "it" | "es" | "fr" | "de" | "pt-br". run(ids) -> { labels, d } (Float32Arrays,
|
| 16 |
* [tokens x 5000] and [tokens x 2]).
|
| 17 |
*/
|
| 18 |
constructor(files, lang, run, { keepConfidence = 0, minErrorProb = 0 } = {}) {
|