Dutch 1.0.0: run 2026-11-15-1125 + guards (gold 550/203/18/0, Tatoeba 0.00%, Europarl held-out 0.00%)
Browse files- LICENSE +202 -0
- NOTICE +13 -0
- README.md +237 -0
- config.json +0 -0
- gector-guards.json +622 -0
- gector-meta.json +40 -0
- language-rules.json +7 -0
- model.onnx +3 -0
- quickstart.ipynb +118 -0
- quickstart.py +236 -0
- tokenizer.json +0 -0
- tokenizer_config.json +15 -0
- verb-form-vocab.txt +0 -0
- vocab.txt +0 -0
LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
Apache License
|
| 3 |
+
Version 2.0, January 2004
|
| 4 |
+
http://www.apache.org/licenses/
|
| 5 |
+
|
| 6 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 7 |
+
|
| 8 |
+
1. Definitions.
|
| 9 |
+
|
| 10 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 11 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 12 |
+
|
| 13 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 14 |
+
the copyright owner that is granting the License.
|
| 15 |
+
|
| 16 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 17 |
+
other entities that control, are controlled by, or are under common
|
| 18 |
+
control with that entity. For the purposes of this definition,
|
| 19 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 20 |
+
direction or management of such entity, whether by contract or
|
| 21 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 22 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 23 |
+
|
| 24 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 25 |
+
exercising permissions granted by this License.
|
| 26 |
+
|
| 27 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 28 |
+
including but not limited to software source code, documentation
|
| 29 |
+
source, and configuration files.
|
| 30 |
+
|
| 31 |
+
"Object" form shall mean any form resulting from mechanical
|
| 32 |
+
transformation or translation of a Source form, including but
|
| 33 |
+
not limited to compiled object code, generated documentation,
|
| 34 |
+
and conversions to other media types.
|
| 35 |
+
|
| 36 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 37 |
+
Object form, made available under the License, as indicated by a
|
| 38 |
+
copyright notice that is included in or attached to the work
|
| 39 |
+
(an example is provided in the Appendix below).
|
| 40 |
+
|
| 41 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 42 |
+
form, that is based on (or derived from) the Work and for which the
|
| 43 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 44 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 45 |
+
of this License, Derivative Works shall not include works that remain
|
| 46 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 47 |
+
the Work and Derivative Works thereof.
|
| 48 |
+
|
| 49 |
+
"Contribution" shall mean any work of authorship, including
|
| 50 |
+
the original version of the Work and any modifications or additions
|
| 51 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 52 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 53 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 54 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 55 |
+
means any form of electronic, verbal, or written communication sent
|
| 56 |
+
to the Licensor or its representatives, including but not limited to
|
| 57 |
+
communication on electronic mailing lists, source code control systems,
|
| 58 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 59 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 60 |
+
excluding communication that is conspicuously marked or otherwise
|
| 61 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 62 |
+
|
| 63 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 64 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 65 |
+
subsequently incorporated within the Work.
|
| 66 |
+
|
| 67 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 68 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 69 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 70 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 71 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 72 |
+
Work and such Derivative Works in Source or Object form.
|
| 73 |
+
|
| 74 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 75 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 76 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 77 |
+
(except as stated in this section) patent license to make, have made,
|
| 78 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 79 |
+
where such license applies only to those patent claims licensable
|
| 80 |
+
by such Contributor that are necessarily infringed by their
|
| 81 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 82 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 83 |
+
institute patent litigation against any entity (including a
|
| 84 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 85 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 86 |
+
or contributory patent infringement, then any patent licenses
|
| 87 |
+
granted to You under this License for that Work shall terminate
|
| 88 |
+
as of the date such litigation is filed.
|
| 89 |
+
|
| 90 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 91 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 92 |
+
modifications, and in Source or Object form, provided that You
|
| 93 |
+
meet the following conditions:
|
| 94 |
+
|
| 95 |
+
(a) You must give any other recipients of the Work or
|
| 96 |
+
Derivative Works a copy of this License; and
|
| 97 |
+
|
| 98 |
+
(b) You must cause any modified files to carry prominent notices
|
| 99 |
+
stating that You changed the files; and
|
| 100 |
+
|
| 101 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 102 |
+
that You distribute, all copyright, patent, trademark, and
|
| 103 |
+
attribution notices from the Source form of the Work,
|
| 104 |
+
excluding those notices that do not pertain to any part of
|
| 105 |
+
the Derivative Works; and
|
| 106 |
+
|
| 107 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 108 |
+
distribution, then any Derivative Works that You distribute must
|
| 109 |
+
include a readable copy of the attribution notices contained
|
| 110 |
+
within such NOTICE file, excluding those notices that do not
|
| 111 |
+
pertain to any part of the Derivative Works, in at least one
|
| 112 |
+
of the following places: within a NOTICE text file distributed
|
| 113 |
+
as part of the Derivative Works; within the Source form or
|
| 114 |
+
documentation, if provided along with the Derivative Works; or,
|
| 115 |
+
within a display generated by the Derivative Works, if and
|
| 116 |
+
wherever such third-party notices normally appear. The contents
|
| 117 |
+
of the NOTICE file are for informational purposes only and
|
| 118 |
+
do not modify the License. You may add Your own attribution
|
| 119 |
+
notices within Derivative Works that You distribute, alongside
|
| 120 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 121 |
+
that such additional attribution notices cannot be construed
|
| 122 |
+
as modifying the License.
|
| 123 |
+
|
| 124 |
+
You may add Your own copyright statement to Your modifications and
|
| 125 |
+
may provide additional or different license terms and conditions
|
| 126 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 127 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 128 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 129 |
+
the conditions stated in this License.
|
| 130 |
+
|
| 131 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 132 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 133 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 134 |
+
this License, without any additional terms or conditions.
|
| 135 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 136 |
+
the terms of any separate license agreement you may have executed
|
| 137 |
+
with Licensor regarding such Contributions.
|
| 138 |
+
|
| 139 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 140 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 141 |
+
except as required for reasonable and customary use in describing the
|
| 142 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 143 |
+
|
| 144 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 145 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 146 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 147 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 148 |
+
implied, including, without limitation, any warranties or conditions
|
| 149 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 150 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 151 |
+
appropriateness of using or redistributing the Work and assume any
|
| 152 |
+
risks associated with Your exercise of permissions under this License.
|
| 153 |
+
|
| 154 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 155 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 156 |
+
unless required by applicable law (such as deliberate and grossly
|
| 157 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 158 |
+
liable to You for damages, including any direct, indirect, special,
|
| 159 |
+
incidental, or consequential damages of any character arising as a
|
| 160 |
+
result of this License or out of the use or inability to use the
|
| 161 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 162 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 163 |
+
other commercial damages or losses), even if such Contributor
|
| 164 |
+
has been advised of the possibility of such damages.
|
| 165 |
+
|
| 166 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 167 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 168 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 169 |
+
or other liability obligations and/or rights consistent with this
|
| 170 |
+
License. However, in accepting such obligations, You may act only
|
| 171 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 172 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 173 |
+
defend, and hold each Contributor harmless for any liability
|
| 174 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 175 |
+
of your accepting any such warranty or additional liability.
|
| 176 |
+
|
| 177 |
+
END OF TERMS AND CONDITIONS
|
| 178 |
+
|
| 179 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 180 |
+
|
| 181 |
+
To apply the Apache License to your work, attach the following
|
| 182 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 183 |
+
replaced with your own identifying information. (Don't include
|
| 184 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 185 |
+
comment syntax for the file format. We also recommend that a
|
| 186 |
+
file or class name and description of purpose be included on the
|
| 187 |
+
same "printed page" as the copyright notice for easier
|
| 188 |
+
identification within third-party archives.
|
| 189 |
+
|
| 190 |
+
Copyright [yyyy] [name of copyright owner]
|
| 191 |
+
|
| 192 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 193 |
+
you may not use this file except in compliance with the License.
|
| 194 |
+
You may obtain a copy of the License at
|
| 195 |
+
|
| 196 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 197 |
+
|
| 198 |
+
Unless required by applicable law or agreed to in writing, software
|
| 199 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 200 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 201 |
+
See the License for the specific language governing permissions and
|
| 202 |
+
limitations under the License.
|
NOTICE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Proofbird GECToR grammar model (Dutch)
|
| 2 |
+
Copyright 2026 Patrick Andrew Hartnett
|
| 3 |
+
|
| 4 |
+
This product includes software developed by Patrick Andrew Hartnett for Proofbird
|
| 5 |
+
(https://proofbird.app). Source: https://huggingface.co/proofbird/gector-bert-nl
|
| 6 |
+
|
| 7 |
+
Based on GroNLP/bert-base-dutch-cased (BERTje) by Wietse de Vries, Andreas van Cranenburgh,
|
| 8 |
+
Arianna Bisazza, Tommaso Caselli, Gertjan van Noord and Malvina Nissim, University of Groningen
|
| 9 |
+
(Apache License 2.0), and the GECToR tagging scheme (Omelianchuk et al., 2020; Apache License 2.0).
|
| 10 |
+
|
| 11 |
+
Fine-tuned on text that includes the proceedings of the European Parliament
|
| 12 |
+
(© European Union, 1996-2011; Europarl, https://www.statmt.org/europarl/),
|
| 13 |
+
reused under the European Parliament's legal notice with the source acknowledged.
|
README.md
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- nl
|
| 5 |
+
base_model: GroNLP/bert-base-dutch-cased
|
| 6 |
+
pipeline_tag: token-classification
|
| 7 |
+
library_name: onnx
|
| 8 |
+
tags:
|
| 9 |
+
- grammatical-error-correction
|
| 10 |
+
- gector
|
| 11 |
+
- onnx
|
| 12 |
+
- on-device
|
| 13 |
+
- dutch
|
| 14 |
+
datasets:
|
| 15 |
+
- wikimedia/wikipedia
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# Proofbird Grammar — Dutch
|
| 19 |
+
|
| 20 |
+
`gector-bert-nl` · on-device Dutch grammar correction
|
| 21 |
+
|
| 22 |
+
[](https://huggingface.co/spaces/proofbird/try-grammar)
|
| 23 |
+
|
| 24 |
+
**Try it in your browser:** type a sentence and see the corrections. The model runs on your own computer; nothing to install, and your text never leaves the page.
|
| 25 |
+
|
| 26 |
+
**Version 1.0.0** · run `2026-11-15-1125` · tag [`v1.0.0`](https://huggingface.co/proofbird/gector-bert-nl/tree/v1.0.0), the files the Proofbird app downloads. Pin it with `revision="v1.0.0"`. Versions: a change to the model's design (encoder, inputs, outputs) raises the first number, a new training run or changed guards and rules the second, card or metadata fixes the third.
|
| 27 |
+
|
| 28 |
+
A GECToR-style sequence tagger for Dutch grammatical error correction, exported to ONNX (fp32) to run on the CPU. It is
|
| 29 |
+
the on-device grammar model of [Proofbird](https://proofbird.app), a writing assistant for Windows, and it is published
|
| 30 |
+
here so anyone can inspect what runs on their machine.
|
| 31 |
+
|
| 32 |
+
GECToR does not rewrite text. For each token it predicts one edit tag (keep, delete, replace with a word, append a
|
| 33 |
+
word, change case, change a word's ending), and the edits are applied and the sentence re-tagged up to five times. The
|
| 34 |
+
tagger only proposes local edits; it never paraphrases.
|
| 35 |
+
|
| 36 |
+
## Quick start
|
| 37 |
+
|
| 38 |
+
[](https://colab.research.google.com/#fileId=https%3A//huggingface.co/proofbird/gector-bert-nl/blob/main/quickstart.ipynb)
|
| 39 |
+
|
| 40 |
+
No API key, no GPU. One file, [`quickstart.py`](quickstart.py), downloads the model and runs it with ONNX Runtime.
|
| 41 |
+
|
| 42 |
+
```bash
|
| 43 |
+
pip install onnxruntime tokenizers huggingface_hub
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
```python
|
| 47 |
+
import importlib.util
|
| 48 |
+
from huggingface_hub import hf_hub_download
|
| 49 |
+
|
| 50 |
+
spec = importlib.util.spec_from_file_location("quickstart", hf_hub_download("proofbird/gector-bert-nl", "quickstart.py"))
|
| 51 |
+
quickstart = importlib.util.module_from_spec(spec)
|
| 52 |
+
spec.loader.exec_module(quickstart)
|
| 53 |
+
|
| 54 |
+
model = quickstart.Gector("proofbird/gector-bert-nl")
|
| 55 |
+
corrected, suggestions = model.correct("Deze huis zijn erg mooi.")
|
| 56 |
+
print(corrected)
|
| 57 |
+
print(suggestions)
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
```text
|
| 61 |
+
Dit huis is erg mooi.
|
| 62 |
+
[{"start": 0, "length": 4, "original": "Deze", "replacement": "Dit"}, {"start": 10, "length": 4, "original": "zijn", "replacement": "is"}]
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
Each suggestion gives the character position in **your** text (`start`, `length`), what is there now (`original`) and what to put instead (`replacement`), so you can underline it and offer the fix. From the command line: `python quickstart.py "Deze huis zijn erg mooi."` prints every step below.
|
| 66 |
+
|
| 67 |
+
## What it corrects
|
| 68 |
+
|
| 69 |
+
The d/t endings of the present tense (`Ik vindt` → `vind`, `Zij vind` → `vindt`) and of the past participle (`verstuurt`
|
| 70 |
+
→ `verstuurd`), the past-tense suffix (`praate` → `praatte`), subject-verb agreement in person and number (`Hij werken` →
|
| 71 |
+
`werkt`, `De kinderen speelt` → `spelen`, `Wij heeft` → `hebben`, `Er is veel mensen` → `Er zijn`), `de` and `het`
|
| 72 |
+
(`het stoel` → `de stoel`), the demonstratives (`Deze huis` → `Dit huis`) and relative pronouns (`het huis die` → `dat`),
|
| 73 |
+
the inflected adjective (`een lief hond` → `een lieve hond`), `als` and `dan` after a comparative (`groter als` →
|
| 74 |
+
`dan`), subject pronouns (`Hun wonen` → `Zij wonen`) and `jou`/`jouw`, compounds written apart (`tand arts` →
|
| 75 |
+
`tandarts`), the trema (`ideeen` → `ideeën`), and a capital at the start of a sentence.
|
| 76 |
+
|
| 77 |
+
## How it was trained
|
| 78 |
+
|
| 79 |
+
- **Base encoder:** [`GroNLP/bert-base-dutch-cased`](https://huggingface.co/GroNLP/bert-base-dutch-cased) (BERTje,
|
| 80 |
+
Apache-2.0). A tagging head (5 000 edit labels) and an error-detection head sit on top.
|
| 81 |
+
- **Data: synthetic only.** Three sources, 3 159 747 sentences in all:
|
| 82 |
+
- 1 500 000 sentences from Dutch Wikipedia
|
| 83 |
+
([`wikimedia/wikipedia`](https://huggingface.co/datasets/wikimedia/wikipedia), `20231101.nl`);
|
| 84 |
+
- 1 500 000 sentences from the proceedings of the European Parliament (Europarl v7, sessions 1996 – May 2011): speech
|
| 85 |
+
in the first and second person, questions and argument, the register encyclopedic text lacks;
|
| 86 |
+
- 159 747 sentences from [Tatoeba](https://tatoeba.org), everyday Dutch (all that pass the length filter, less the
|
| 87 |
+
sentences held out for the checks below).
|
| 88 |
+
|
| 89 |
+
They were corrupted by hand-written Dutch error rules; about 10% stay clean, so the model learns to leave correct text
|
| 90 |
+
alone. Each rule was run over real text first and changed wherever the "error" it made also occurs as correct Dutch.
|
| 91 |
+
150 000 additional template sentences teach patterns the corpora rarely contain (every person of the present tense,
|
| 92 |
+
`jij`/`je` after the verb, `de`/`het` with an adjective, `er is`/`er zijn`).
|
| 93 |
+
- **No learner corpora** and no non-commercial data in the fine-tuning. No user text was used.
|
| 94 |
+
- One epoch (98 475 steps, batch 64, learning rate 3e-5) on one NVIDIA L4. Run id `2026-11-15-1125`.
|
| 95 |
+
|
| 96 |
+
## How it was measured
|
| 97 |
+
|
| 98 |
+
| Check | Result |
|
| 99 |
+
|---|---|
|
| 100 |
+
| Gold set (771 hand-written sentences: 568 with one error each, 203 correct) | **550 fixed, 203 left alone, 18 missed, 0 made worse** |
|
| 101 |
+
| False alarms on 4 000 everyday Tatoeba sentences (held out from training) | 0 changed (0.00%) |
|
| 102 |
+
| False alarms on 4 000 sentences from European Parliament sessions the model never saw (June 2011) | 0 changed (0.00%) |
|
| 103 |
+
| Stability: the gold re-run with one extra token in front of each sentence | 2 sentences change result (the 5 capitalisation rows change by construction and are not counted) |
|
| 104 |
+
|
| 105 |
+
The scores are with the apply-side guards in `gector-guards.json` (below). Without them the model changes 6 Tatoeba and
|
| 106 |
+
3 Europarl sentences, all of them false alarms of the shapes the guards hold back. The model was trained for precision:
|
| 107 |
+
a missed error costs less than a wrong correction. The misses: a plural subject that is a noun does not always pull its
|
| 108 |
+
verb into the plural (`De bomen staat` is left alone), `We gaat` and `Jullie komt`, the past tense of a verb whose stem
|
| 109 |
+
ends in `k` (`kookde`), an inflected adjective after `is` (`Het weer is mooie`), and two irregular present forms the
|
| 110 |
+
guards hold back (`Hij gaan`, `Het kind slapen`). The gold set was written for this model and has not yet been
|
| 111 |
+
reviewed by a native speaker. It has not been measured on learner essays.
|
| 112 |
+
|
| 113 |
+
**The guards.** `gector-guards.json` holds back edits we measured as wrong in a known shape. They run in the Proofbird
|
| 114 |
+
app (not in `quickstart.py` or the demo) and are part of every score above. Among them: a verb's `-t` form keeps its
|
| 115 |
+
long vowel (`gaat`, `slaapt`, never `gat`, `slapt`); a word is deleted only when it is written twice, and `dat dat`,
|
| 116 |
+
`die die`, `jullie jullie` stay (`Ik wist dat dat Tom gelukkig zou maken`); `dit` after a form of `zijn` is a pronoun
|
| 117 |
+
(`Is dit kunst?`); `Zei u` is the verb; `uw` before a noun stays (`Kam uw haar`) and `u` after its verb stays (`Bent u
|
| 118 |
+
leraar?`).
|
| 119 |
+
|
| 120 |
+
## Files
|
| 121 |
+
|
| 122 |
+
| File | What it is |
|
| 123 |
+
|---|---|
|
| 124 |
+
| `model.onnx` | The tagger (fp32, opset 17). Inputs `input_ids`, `attention_mask`; outputs `logits_labels` [1, T, 5000] and `logits_d` [1, T, 2]. |
|
| 125 |
+
| `config.json` | The edit-label vocabulary (`id2label`). |
|
| 126 |
+
| `vocab.txt`, `tokenizer.json`, `tokenizer_config.json` | The base encoder's WordPiece tokenizer. |
|
| 127 |
+
| `gector-meta.json` | Export facts: encoder, tokenizer family, decoding defaults, run id, version. |
|
| 128 |
+
| `gector-guards.json` | Apply-side guards: rules that hold back an edit the model gets wrong in a known way (for example `gaan` → `gat`). Part of the measured result. |
|
| 129 |
+
| `language-rules.json` | Language facts the runtime needs (sentence-final punctuation handling). |
|
| 130 |
+
| `verb-form-vocab.txt` | Empty for Dutch: verb forms are corrected with ending and replacement tags, not a verb table. |
|
| 131 |
+
| `quickstart.py` | A complete Python runner: download, tokenize, run, decode, apply, suggestions. See *Quick start*. |
|
| 132 |
+
| `quickstart.ipynb` | The same, as a notebook (the *Open in Colab* button). |
|
| 133 |
+
|
| 134 |
+
The Proofbird app runs the same algorithm in C# with ONNX Runtime; the files are standard, so any GECToR-style
|
| 135 |
+
decoder can use them.
|
| 136 |
+
|
| 137 |
+
## How it works, step by step
|
| 138 |
+
|
| 139 |
+
The model never sees letters and never writes text. It reads numbers (token ids) and answers, for every word, which **edit** to make: one of 5 000 tags such as `$KEEP`, `$DELETE`, `$APPEND_de`, `$REPLACE_als` or `$TRANSFORM_SUF__an` (change a word's ending). `quickstart.py` does everything around it. This is the real run of the example above.
|
| 140 |
+
|
| 141 |
+
**1. Prepare the text.** `language-rules.json` says the final full stop comes off before the model sees the sentence (it goes back on at the end): `Deze huis zijn erg mooi`.
|
| 142 |
+
|
| 143 |
+
**2. The request.** The words are looked up in the model's dictionary (`vocab.txt`). A rare word is split into pieces; the edit is read at its first piece. `[CLS]` stands for a dummy first word, `$START`, so an edit on it can add a word at the very beginning; `[SEP]` marks the end.
|
| 144 |
+
|
| 145 |
+
```text
|
| 146 |
+
words $START Deze huis zijn erg mooi
|
| 147 |
+
tokens [CLS] Deze huis zijn erg mooi [SEP]
|
| 148 |
+
input_ids [1, 2109, 13479, 22777, 11330, 15788, 2]
|
| 149 |
+
attention_mask [1, 1, 1, 1, 1, 1, 1]
|
| 150 |
+
```
|
| 151 |
+
|
| 152 |
+
Two inputs, both whole numbers (int64), shape `[1, 7]`: one sentence of 7 tokens.
|
| 153 |
+
|
| 154 |
+
**3. The response.** Two outputs (float32): `logits_labels` `[1, 7, 5000]`, a score for each of the 5 000 edits at every token, and `logits_d` `[1, 7, 2]`, a score for "this word is correct" and "this word is wrong". A softmax turns each row into probabilities; the most probable edit at each word's first token is the one applied.
|
| 155 |
+
|
| 156 |
+
**4. Pass by pass.** The corrected sentence goes back in, until a pass changes nothing (at most five passes). Connected errors are fixed one after the other.
|
| 157 |
+
|
| 158 |
+
*Pass 1:* `Deze huis zijn erg mooi`
|
| 159 |
+
|
| 160 |
+
| Word | Wrong | Chosen edit | Probability |
|
| 161 |
+
|---|---|---|---|
|
| 162 |
+
| $START | 0.0% | $KEEP | 100.0% |
|
| 163 |
+
| Deze | 98.7% | **$REPLACE_Dit** | 99.7% |
|
| 164 |
+
| huis | 0.0% | $KEEP | 100.0% |
|
| 165 |
+
| zijn | 64.9% | **$REPLACE_is** | 61.2% |
|
| 166 |
+
| erg | 0.0% | $KEEP | 100.0% |
|
| 167 |
+
| mooi | 0.0% | $KEEP | 100.0% |
|
| 168 |
+
|
| 169 |
+
→ `Dit huis is erg mooi`
|
| 170 |
+
|
| 171 |
+
*Pass 2:* `Dit huis is erg mooi`
|
| 172 |
+
|
| 173 |
+
| Word | Wrong | Chosen edit | Probability |
|
| 174 |
+
|---|---|---|---|
|
| 175 |
+
| $START | 0.0% | $KEEP | 100.0% |
|
| 176 |
+
| Dit | 0.0% | $KEEP | 100.0% |
|
| 177 |
+
| huis | 0.0% | $KEEP | 100.0% |
|
| 178 |
+
| is | 0.0% | $KEEP | 100.0% |
|
| 179 |
+
| erg | 0.0% | $KEEP | 100.0% |
|
| 180 |
+
| mooi | 0.0% | $KEEP | 100.0% |
|
| 181 |
+
|
| 182 |
+
→ `Dit huis is erg mooi` — no change, so it stops.
|
| 183 |
+
|
| 184 |
+
**5. The suggestions.** The original and the final words are compared, and each changed stretch becomes one suggestion with its position in the original text (unchanged text keeps its own spacing), as in the Quick start output above.
|
| 185 |
+
|
| 186 |
+
**6. Settings.** `Gector(repo, keep_confidence=0.0, min_error_prob=0.0)` takes the two GECToR precision knobs (the Proofbird app runs with both at 0, and at most five passes):
|
| 187 |
+
|
| 188 |
+
- `keep_confidence` adds a bonus to `$KEEP` before choosing: higher means fewer, safer edits.
|
| 189 |
+
- `min_error_prob` ignores an edit the model is less sure of, and leaves the whole sentence alone when no word is at least that likely to be wrong. With `min_error_prob=0.9` the example is still corrected (`Dit huis is erg mooi.`): the model is 98.7% sure one word is wrong.
|
| 190 |
+
|
| 191 |
+
## What Proofbird adds
|
| 192 |
+
|
| 193 |
+
`quickstart.py` is the model on its own. The [Proofbird](https://proofbird.app) app runs the same algorithm in C# and adds:
|
| 194 |
+
|
| 195 |
+
- **Guards**: per-language rules that hold back edits we measured as wrong in a known shape. `gector-guards.json`, in this repository, lists which guards are on for Dutch and their word lists; what each guard does is code in the app. The scores under *How it was measured* are with the guards.
|
| 196 |
+
- **Spelling, checked separately** by the operating system's spell checker; the guards use it so a grammar edit is not made on a word that is misspelled.
|
| 197 |
+
- **A card for each change** that names the error ("Subject–verb agreement") and, on request, explains it.
|
| 198 |
+
|
| 199 |
+
`quickstart.py` and the in-browser demo run the model on its own, without the guards.
|
| 200 |
+
|
| 201 |
+
## Licence and attribution
|
| 202 |
+
|
| 203 |
+
The model weights and the files in this repository are released under the
|
| 204 |
+
[Apache License 2.0](LICENSE). If you redistribute the model or a model built from it, keep the
|
| 205 |
+
[NOTICE](NOTICE) file with it (Apache-2.0, section 4(d)).
|
| 206 |
+
|
| 207 |
+
The training data carries its own terms. Wikipedia text is © Wikipedia contributors,
|
| 208 |
+
[CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/). Tatoeba sentences are from
|
| 209 |
+
[tatoeba.org](https://tatoeba.org), [CC BY 2.0 FR](https://creativecommons.org/licenses/by/2.0/fr/). Contains text
|
| 210 |
+
from the proceedings of the European Parliament, © European Union, 1996–2011, reused under the European Parliament's
|
| 211 |
+
[legal notice](https://www.europarl.europa.eu/legal-notice/en/), through the Europarl corpus
|
| 212 |
+
([statmt.org/europarl](https://www.statmt.org/europarl/), Philipp Koehn, *Europarl: A Parallel Corpus for Statistical
|
| 213 |
+
Machine Translation*, MT Summit 2005). The base encoder is BERTje, `GroNLP/bert-base-dutch-cased`, by Wietse de Vries,
|
| 214 |
+
Andreas van Cranenburgh, Arianna Bisazza, Tommaso Caselli, Gertjan van Noord and Malvina Nissim (University of
|
| 215 |
+
Groningen), Apache License 2.0: *BERTje: A Dutch BERT Model*, arXiv:1912.09582, 2019. The tagging scheme follows GECToR
|
| 216 |
+
(Omelianchuk et al., 2020, *GECToR – Grammatical Error Correction: Tag, Not Rewrite*).
|
| 217 |
+
|
| 218 |
+
## How to cite
|
| 219 |
+
|
| 220 |
+
If you use or build on this model, please cite it:
|
| 221 |
+
|
| 222 |
+
```bibtex
|
| 223 |
+
@misc{hartnett2026gectornl,
|
| 224 |
+
author = {Hartnett, Patrick Andrew},
|
| 225 |
+
title = {Proofbird GECToR grammar model (Dutch)},
|
| 226 |
+
year = {2026},
|
| 227 |
+
publisher = {Hugging Face},
|
| 228 |
+
howpublished = {\url{https://huggingface.co/proofbird/gector-bert-nl}},
|
| 229 |
+
note = {Proofbird, https://proofbird.app}
|
| 230 |
+
}
|
| 231 |
+
```
|
| 232 |
+
|
| 233 |
+
If you build on this model, a link back to this page is appreciated.
|
| 234 |
+
|
| 235 |
+
## Contact
|
| 236 |
+
|
| 237 |
+
Published by Patrick Andrew Hartnett as personal work. Questions and reports: open a discussion on this repository.
|
config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
gector-guards.json
ADDED
|
@@ -0,0 +1,622 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"guards": [
|
| 3 |
+
{
|
| 4 |
+
"type": "velar_orthography",
|
| 5 |
+
"note": "built-in (always on): reject a spurious h-insertion on a non-velar stem"
|
| 6 |
+
},
|
| 7 |
+
{
|
| 8 |
+
"type": "elision_echo",
|
| 9 |
+
"note": "built-in (always on): collapse a redundant elision echo (un'ora ora -> un'ora)"
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
"type": "auxiliary_number",
|
| 13 |
+
"note": "built-in (always on): keep 'e`' before a singular participle ('E` andata' is 3sg and correct; 'sono' would flip it to 1sg)"
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"type": "block_replace",
|
| 17 |
+
"from": "baden",
|
| 18 |
+
"to": "badt",
|
| 19 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"type": "block_replace",
|
| 23 |
+
"from": "Baden",
|
| 24 |
+
"to": "Badt",
|
| 25 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 26 |
+
},
|
| 27 |
+
{
|
| 28 |
+
"type": "block_replace",
|
| 29 |
+
"from": "beheren",
|
| 30 |
+
"to": "behert",
|
| 31 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"type": "block_replace",
|
| 35 |
+
"from": "Beheren",
|
| 36 |
+
"to": "Behert",
|
| 37 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"type": "block_replace",
|
| 41 |
+
"from": "bepalen",
|
| 42 |
+
"to": "bepalt",
|
| 43 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 44 |
+
},
|
| 45 |
+
{
|
| 46 |
+
"type": "block_replace",
|
| 47 |
+
"from": "Bepalen",
|
| 48 |
+
"to": "Bepalt",
|
| 49 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"type": "block_replace",
|
| 53 |
+
"from": "bestaan",
|
| 54 |
+
"to": "bestat",
|
| 55 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
"type": "block_replace",
|
| 59 |
+
"from": "Bestaan",
|
| 60 |
+
"to": "Bestat",
|
| 61 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 62 |
+
},
|
| 63 |
+
{
|
| 64 |
+
"type": "block_replace",
|
| 65 |
+
"from": "besteden",
|
| 66 |
+
"to": "bestedt",
|
| 67 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
"type": "block_replace",
|
| 71 |
+
"from": "Besteden",
|
| 72 |
+
"to": "Bestedt",
|
| 73 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"type": "block_replace",
|
| 77 |
+
"from": "bestuderen",
|
| 78 |
+
"to": "bestudert",
|
| 79 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 80 |
+
},
|
| 81 |
+
{
|
| 82 |
+
"type": "block_replace",
|
| 83 |
+
"from": "Bestuderen",
|
| 84 |
+
"to": "Bestudert",
|
| 85 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 86 |
+
},
|
| 87 |
+
{
|
| 88 |
+
"type": "block_replace",
|
| 89 |
+
"from": "betalen",
|
| 90 |
+
"to": "betalt",
|
| 91 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"type": "block_replace",
|
| 95 |
+
"from": "Betalen",
|
| 96 |
+
"to": "Betalt",
|
| 97 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 98 |
+
},
|
| 99 |
+
{
|
| 100 |
+
"type": "block_replace",
|
| 101 |
+
"from": "bewaren",
|
| 102 |
+
"to": "bewart",
|
| 103 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 104 |
+
},
|
| 105 |
+
{
|
| 106 |
+
"type": "block_replace",
|
| 107 |
+
"from": "Bewaren",
|
| 108 |
+
"to": "Bewart",
|
| 109 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 110 |
+
},
|
| 111 |
+
{
|
| 112 |
+
"type": "block_replace",
|
| 113 |
+
"from": "beweren",
|
| 114 |
+
"to": "bewert",
|
| 115 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 116 |
+
},
|
| 117 |
+
{
|
| 118 |
+
"type": "block_replace",
|
| 119 |
+
"from": "Beweren",
|
| 120 |
+
"to": "Bewert",
|
| 121 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
"type": "block_replace",
|
| 125 |
+
"from": "bewonen",
|
| 126 |
+
"to": "bewont",
|
| 127 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
"type": "block_replace",
|
| 131 |
+
"from": "Bewonen",
|
| 132 |
+
"to": "Bewont",
|
| 133 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 134 |
+
},
|
| 135 |
+
{
|
| 136 |
+
"type": "block_replace",
|
| 137 |
+
"from": "breken",
|
| 138 |
+
"to": "brekt",
|
| 139 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 140 |
+
},
|
| 141 |
+
{
|
| 142 |
+
"type": "block_replace",
|
| 143 |
+
"from": "Breken",
|
| 144 |
+
"to": "Brekt",
|
| 145 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 146 |
+
},
|
| 147 |
+
{
|
| 148 |
+
"type": "block_replace",
|
| 149 |
+
"from": "delen",
|
| 150 |
+
"to": "delt",
|
| 151 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 152 |
+
},
|
| 153 |
+
{
|
| 154 |
+
"type": "block_replace",
|
| 155 |
+
"from": "Delen",
|
| 156 |
+
"to": "Delt",
|
| 157 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
"type": "block_replace",
|
| 161 |
+
"from": "dragen",
|
| 162 |
+
"to": "dragt",
|
| 163 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 164 |
+
},
|
| 165 |
+
{
|
| 166 |
+
"type": "block_replace",
|
| 167 |
+
"from": "Dragen",
|
| 168 |
+
"to": "Dragt",
|
| 169 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 170 |
+
},
|
| 171 |
+
{
|
| 172 |
+
"type": "block_replace",
|
| 173 |
+
"from": "dromen",
|
| 174 |
+
"to": "dromt",
|
| 175 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 176 |
+
},
|
| 177 |
+
{
|
| 178 |
+
"type": "block_replace",
|
| 179 |
+
"from": "Dromen",
|
| 180 |
+
"to": "Dromt",
|
| 181 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 182 |
+
},
|
| 183 |
+
{
|
| 184 |
+
"type": "block_replace",
|
| 185 |
+
"from": "duren",
|
| 186 |
+
"to": "durt",
|
| 187 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 188 |
+
},
|
| 189 |
+
{
|
| 190 |
+
"type": "block_replace",
|
| 191 |
+
"from": "Duren",
|
| 192 |
+
"to": "Durt",
|
| 193 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 194 |
+
},
|
| 195 |
+
{
|
| 196 |
+
"type": "block_replace",
|
| 197 |
+
"from": "gaan",
|
| 198 |
+
"to": "gat",
|
| 199 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 200 |
+
},
|
| 201 |
+
{
|
| 202 |
+
"type": "block_replace",
|
| 203 |
+
"from": "Gaan",
|
| 204 |
+
"to": "Gat",
|
| 205 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 206 |
+
},
|
| 207 |
+
{
|
| 208 |
+
"type": "block_replace",
|
| 209 |
+
"from": "halen",
|
| 210 |
+
"to": "halt",
|
| 211 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 212 |
+
},
|
| 213 |
+
{
|
| 214 |
+
"type": "block_replace",
|
| 215 |
+
"from": "Halen",
|
| 216 |
+
"to": "Halt",
|
| 217 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
"type": "block_replace",
|
| 221 |
+
"from": "herhalen",
|
| 222 |
+
"to": "herhalt",
|
| 223 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 224 |
+
},
|
| 225 |
+
{
|
| 226 |
+
"type": "block_replace",
|
| 227 |
+
"from": "Herhalen",
|
| 228 |
+
"to": "Herhalt",
|
| 229 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 230 |
+
},
|
| 231 |
+
{
|
| 232 |
+
"type": "block_replace",
|
| 233 |
+
"from": "hopen",
|
| 234 |
+
"to": "hopt",
|
| 235 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 236 |
+
},
|
| 237 |
+
{
|
| 238 |
+
"type": "block_replace",
|
| 239 |
+
"from": "Hopen",
|
| 240 |
+
"to": "Hopt",
|
| 241 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 242 |
+
},
|
| 243 |
+
{
|
| 244 |
+
"type": "block_replace",
|
| 245 |
+
"from": "horen",
|
| 246 |
+
"to": "hort",
|
| 247 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 248 |
+
},
|
| 249 |
+
{
|
| 250 |
+
"type": "block_replace",
|
| 251 |
+
"from": "Horen",
|
| 252 |
+
"to": "Hort",
|
| 253 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 254 |
+
},
|
| 255 |
+
{
|
| 256 |
+
"type": "block_replace",
|
| 257 |
+
"from": "huren",
|
| 258 |
+
"to": "hurt",
|
| 259 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 260 |
+
},
|
| 261 |
+
{
|
| 262 |
+
"type": "block_replace",
|
| 263 |
+
"from": "Huren",
|
| 264 |
+
"to": "Hurt",
|
| 265 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 266 |
+
},
|
| 267 |
+
{
|
| 268 |
+
"type": "block_replace",
|
| 269 |
+
"from": "koken",
|
| 270 |
+
"to": "kokt",
|
| 271 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 272 |
+
},
|
| 273 |
+
{
|
| 274 |
+
"type": "block_replace",
|
| 275 |
+
"from": "Koken",
|
| 276 |
+
"to": "Kokt",
|
| 277 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 278 |
+
},
|
| 279 |
+
{
|
| 280 |
+
"type": "block_replace",
|
| 281 |
+
"from": "kopen",
|
| 282 |
+
"to": "kopt",
|
| 283 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 284 |
+
},
|
| 285 |
+
{
|
| 286 |
+
"type": "block_replace",
|
| 287 |
+
"from": "Kopen",
|
| 288 |
+
"to": "Kopt",
|
| 289 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 290 |
+
},
|
| 291 |
+
{
|
| 292 |
+
"type": "block_replace",
|
| 293 |
+
"from": "leren",
|
| 294 |
+
"to": "lert",
|
| 295 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 296 |
+
},
|
| 297 |
+
{
|
| 298 |
+
"type": "block_replace",
|
| 299 |
+
"from": "Leren",
|
| 300 |
+
"to": "Lert",
|
| 301 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 302 |
+
},
|
| 303 |
+
{
|
| 304 |
+
"type": "block_replace",
|
| 305 |
+
"from": "lopen",
|
| 306 |
+
"to": "lopt",
|
| 307 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 308 |
+
},
|
| 309 |
+
{
|
| 310 |
+
"type": "block_replace",
|
| 311 |
+
"from": "Lopen",
|
| 312 |
+
"to": "Lopt",
|
| 313 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 314 |
+
},
|
| 315 |
+
{
|
| 316 |
+
"type": "block_replace",
|
| 317 |
+
"from": "maken",
|
| 318 |
+
"to": "makt",
|
| 319 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 320 |
+
},
|
| 321 |
+
{
|
| 322 |
+
"type": "block_replace",
|
| 323 |
+
"from": "Maken",
|
| 324 |
+
"to": "Makt",
|
| 325 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 326 |
+
},
|
| 327 |
+
{
|
| 328 |
+
"type": "block_replace",
|
| 329 |
+
"from": "nemen",
|
| 330 |
+
"to": "nemt",
|
| 331 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 332 |
+
},
|
| 333 |
+
{
|
| 334 |
+
"type": "block_replace",
|
| 335 |
+
"from": "Nemen",
|
| 336 |
+
"to": "Nemt",
|
| 337 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 338 |
+
},
|
| 339 |
+
{
|
| 340 |
+
"type": "block_replace",
|
| 341 |
+
"from": "noteren",
|
| 342 |
+
"to": "notert",
|
| 343 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 344 |
+
},
|
| 345 |
+
{
|
| 346 |
+
"type": "block_replace",
|
| 347 |
+
"from": "Noteren",
|
| 348 |
+
"to": "Notert",
|
| 349 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 350 |
+
},
|
| 351 |
+
{
|
| 352 |
+
"type": "block_replace",
|
| 353 |
+
"from": "proberen",
|
| 354 |
+
"to": "probert",
|
| 355 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 356 |
+
},
|
| 357 |
+
{
|
| 358 |
+
"type": "block_replace",
|
| 359 |
+
"from": "Proberen",
|
| 360 |
+
"to": "Probert",
|
| 361 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 362 |
+
},
|
| 363 |
+
{
|
| 364 |
+
"type": "block_replace",
|
| 365 |
+
"from": "roken",
|
| 366 |
+
"to": "rokt",
|
| 367 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 368 |
+
},
|
| 369 |
+
{
|
| 370 |
+
"type": "block_replace",
|
| 371 |
+
"from": "Roken",
|
| 372 |
+
"to": "Rokt",
|
| 373 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 374 |
+
},
|
| 375 |
+
{
|
| 376 |
+
"type": "block_replace",
|
| 377 |
+
"from": "slaan",
|
| 378 |
+
"to": "slat",
|
| 379 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 380 |
+
},
|
| 381 |
+
{
|
| 382 |
+
"type": "block_replace",
|
| 383 |
+
"from": "Slaan",
|
| 384 |
+
"to": "Slat",
|
| 385 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 386 |
+
},
|
| 387 |
+
{
|
| 388 |
+
"type": "block_replace",
|
| 389 |
+
"from": "slapen",
|
| 390 |
+
"to": "slapt",
|
| 391 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 392 |
+
},
|
| 393 |
+
{
|
| 394 |
+
"type": "block_replace",
|
| 395 |
+
"from": "Slapen",
|
| 396 |
+
"to": "Slapt",
|
| 397 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 398 |
+
},
|
| 399 |
+
{
|
| 400 |
+
"type": "block_replace",
|
| 401 |
+
"from": "spelen",
|
| 402 |
+
"to": "spelt",
|
| 403 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 404 |
+
},
|
| 405 |
+
{
|
| 406 |
+
"type": "block_replace",
|
| 407 |
+
"from": "Spelen",
|
| 408 |
+
"to": "Spelt",
|
| 409 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 410 |
+
},
|
| 411 |
+
{
|
| 412 |
+
"type": "block_replace",
|
| 413 |
+
"from": "spreken",
|
| 414 |
+
"to": "sprekt",
|
| 415 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 416 |
+
},
|
| 417 |
+
{
|
| 418 |
+
"type": "block_replace",
|
| 419 |
+
"from": "Spreken",
|
| 420 |
+
"to": "Sprekt",
|
| 421 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 422 |
+
},
|
| 423 |
+
{
|
| 424 |
+
"type": "block_replace",
|
| 425 |
+
"from": "staan",
|
| 426 |
+
"to": "stat",
|
| 427 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 428 |
+
},
|
| 429 |
+
{
|
| 430 |
+
"type": "block_replace",
|
| 431 |
+
"from": "Staan",
|
| 432 |
+
"to": "Stat",
|
| 433 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 434 |
+
},
|
| 435 |
+
{
|
| 436 |
+
"type": "block_replace",
|
| 437 |
+
"from": "studeren",
|
| 438 |
+
"to": "studert",
|
| 439 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 440 |
+
},
|
| 441 |
+
{
|
| 442 |
+
"type": "block_replace",
|
| 443 |
+
"from": "Studeren",
|
| 444 |
+
"to": "Studert",
|
| 445 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 446 |
+
},
|
| 447 |
+
{
|
| 448 |
+
"type": "block_replace",
|
| 449 |
+
"from": "sturen",
|
| 450 |
+
"to": "sturt",
|
| 451 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 452 |
+
},
|
| 453 |
+
{
|
| 454 |
+
"type": "block_replace",
|
| 455 |
+
"from": "Sturen",
|
| 456 |
+
"to": "Sturt",
|
| 457 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 458 |
+
},
|
| 459 |
+
{
|
| 460 |
+
"type": "block_replace",
|
| 461 |
+
"from": "verdelen",
|
| 462 |
+
"to": "verdelt",
|
| 463 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 464 |
+
},
|
| 465 |
+
{
|
| 466 |
+
"type": "block_replace",
|
| 467 |
+
"from": "Verdelen",
|
| 468 |
+
"to": "Verdelt",
|
| 469 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 470 |
+
},
|
| 471 |
+
{
|
| 472 |
+
"type": "block_replace",
|
| 473 |
+
"from": "verhogen",
|
| 474 |
+
"to": "verhogt",
|
| 475 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 476 |
+
},
|
| 477 |
+
{
|
| 478 |
+
"type": "block_replace",
|
| 479 |
+
"from": "Verhogen",
|
| 480 |
+
"to": "Verhogt",
|
| 481 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 482 |
+
},
|
| 483 |
+
{
|
| 484 |
+
"type": "block_replace",
|
| 485 |
+
"from": "verhuren",
|
| 486 |
+
"to": "verhurt",
|
| 487 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 488 |
+
},
|
| 489 |
+
{
|
| 490 |
+
"type": "block_replace",
|
| 491 |
+
"from": "Verhuren",
|
| 492 |
+
"to": "Verhurt",
|
| 493 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 494 |
+
},
|
| 495 |
+
{
|
| 496 |
+
"type": "block_replace",
|
| 497 |
+
"from": "verklaren",
|
| 498 |
+
"to": "verklart",
|
| 499 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 500 |
+
},
|
| 501 |
+
{
|
| 502 |
+
"type": "block_replace",
|
| 503 |
+
"from": "Verklaren",
|
| 504 |
+
"to": "Verklart",
|
| 505 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 506 |
+
},
|
| 507 |
+
{
|
| 508 |
+
"type": "block_replace",
|
| 509 |
+
"from": "verkopen",
|
| 510 |
+
"to": "verkopt",
|
| 511 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 512 |
+
},
|
| 513 |
+
{
|
| 514 |
+
"type": "block_replace",
|
| 515 |
+
"from": "Verkopen",
|
| 516 |
+
"to": "Verkopt",
|
| 517 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 518 |
+
},
|
| 519 |
+
{
|
| 520 |
+
"type": "block_replace",
|
| 521 |
+
"from": "verstaan",
|
| 522 |
+
"to": "verstat",
|
| 523 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 524 |
+
},
|
| 525 |
+
{
|
| 526 |
+
"type": "block_replace",
|
| 527 |
+
"from": "Verstaan",
|
| 528 |
+
"to": "Verstat",
|
| 529 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 530 |
+
},
|
| 531 |
+
{
|
| 532 |
+
"type": "block_replace",
|
| 533 |
+
"from": "versturen",
|
| 534 |
+
"to": "versturt",
|
| 535 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 536 |
+
},
|
| 537 |
+
{
|
| 538 |
+
"type": "block_replace",
|
| 539 |
+
"from": "Versturen",
|
| 540 |
+
"to": "Versturt",
|
| 541 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 542 |
+
},
|
| 543 |
+
{
|
| 544 |
+
"type": "block_replace",
|
| 545 |
+
"from": "vertalen",
|
| 546 |
+
"to": "vertalt",
|
| 547 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 548 |
+
},
|
| 549 |
+
{
|
| 550 |
+
"type": "block_replace",
|
| 551 |
+
"from": "Vertalen",
|
| 552 |
+
"to": "Vertalt",
|
| 553 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 554 |
+
},
|
| 555 |
+
{
|
| 556 |
+
"type": "block_replace",
|
| 557 |
+
"from": "vragen",
|
| 558 |
+
"to": "vragt",
|
| 559 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 560 |
+
},
|
| 561 |
+
{
|
| 562 |
+
"type": "block_replace",
|
| 563 |
+
"from": "Vragen",
|
| 564 |
+
"to": "Vragt",
|
| 565 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 566 |
+
},
|
| 567 |
+
{
|
| 568 |
+
"type": "block_replace",
|
| 569 |
+
"from": "wonen",
|
| 570 |
+
"to": "wont",
|
| 571 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 572 |
+
},
|
| 573 |
+
{
|
| 574 |
+
"type": "block_replace",
|
| 575 |
+
"from": "Wonen",
|
| 576 |
+
"to": "Wont",
|
| 577 |
+
"note": "an open-syllable stem doubles its vowel before -t (gaat, slaapt): never stem + t (NL run 1 gold)"
|
| 578 |
+
},
|
| 579 |
+
{
|
| 580 |
+
"type": "delete_only_duplicates",
|
| 581 |
+
"words": "dat|die|jullie|had|is",
|
| 582 |
+
"note": "delete only a repeated word; dat dat, die die, jullie jullie are conjunction/relative + pronoun (NL run 1)"
|
| 583 |
+
},
|
| 584 |
+
{
|
| 585 |
+
"type": "redirect_replace",
|
| 586 |
+
"from": "dit",
|
| 587 |
+
"to": "deze",
|
| 588 |
+
"redirect": "dit",
|
| 589 |
+
"whenPrevIs": "is|was|wordt|werd|zijn|waren|blijft|bleef|lijkt|leek",
|
| 590 |
+
"note": "'Is dit kunst?' - after a form of zijn, dit is a pronoun; deze is never the fix (NL run 1 Tatoeba)"
|
| 591 |
+
},
|
| 592 |
+
{
|
| 593 |
+
"type": "redirect_replace",
|
| 594 |
+
"from": "zei",
|
| 595 |
+
"to": "zij",
|
| 596 |
+
"redirect": "zei",
|
| 597 |
+
"whenNextIs": "u|je|jij|hij|ze|zij|het|men|ik|we|wij|jullie|dat|niets|niks|nee|ja",
|
| 598 |
+
"note": "'Zei u \"dertig euro\"?' - zei before a subject pronoun is the verb, never zij (NL run 1 Tatoeba)"
|
| 599 |
+
},
|
| 600 |
+
{
|
| 601 |
+
"type": "redirect_replace",
|
| 602 |
+
"from": "uw",
|
| 603 |
+
"to": "u",
|
| 604 |
+
"redirect": "uw",
|
| 605 |
+
"whenNextIs": "aarde|adres|adressen|afspraak|afspraken|angst|angsten|antwoord|antwoorden|appel|appels|arm|armen|artikel|artikelen|arts|artsen|auto|auto's|avond|avonden|baan|baas|banen|bank|banken|bazen|bed|bedden|bedrag|bedragen|bedrijf|bedrijven|been|begin|begroting|begrotingen|beker|bekers|belang|belangen|beleid|benen|berg|bergen|bericht|berichten|beroep|beroepen|beslissing|beslissingen|besluit|besluiten|besturen|bestuur|bevolking|bibliotheek|bibliotheken|bloem|bloemen|boek|boeken|boekje|boekjes|boer|boeren|bomen|boom|boot|bord|borden|bos|bossen|boten|brief|brieven|broden|broek|broeken|broer|broers|brood|brug|bruggen|bureau|bureaus|buren|burgemeester|burgemeesters|bus|bussen|buurman|buurvrouw|buurvrouwen|cadeau|cadeaus|café|cafés|chauffeur|chauffeurs|cijfer|cijfers|club|clubs|collega|collega's|commissie|commissies|computer|computers|concert|concerten|contract|contracten|dag|dagen|dak|daken|debat|debatten|deel|delen|deur|deuren|dier|dieren|diner|diners|dochter|dochters|doel|doelen|dokter|dokters|dorp|dorpen|dromen|droom|economie|ei|eieren|eiland|eilanden|einde|ervaring|ervaringen|eten|examen|examens|fabriek|fabrieken|familieleden|familielid|feest|feesten|fiets|fietsen|film|films|fles|flessen|foto|foto's|fout|fouten|fruit|functie|functies|gebied|gebieden|gebouw|gebouwen|geld|gemeente|gemeenten|geschiedenis|gesprek|gesprekken|geval|gevallen|gevolg|gevolgen|gezicht|gezichten|gezin|gezinnen|glas|glazen|grens|grenzen|haar|hand|handen|hart|harten|haven|havens|herfst|hoek|hoeken|hond|honden|hoofd|hoofden|hoop|hotel|hotels|hout|huis|huisje|huisjes|huizen|hulp|idee|ideeën|ijs|industrie|industrieën|insect|insecten|instrument|instrumenten|jaar|jaren|jas|jassen|jongetje|jongetjes|kaart|kaarten|kaas|kamer|kamers|kanaal|kanalen|kans|kansen|kantoor|kantoren|kast|kasten|kat|katten|kazen|kerk|kerken|keuken|keukens|keuze|keuzes|kind|kinderen|kindje|kindjes|klant|klanten|klas|klassen|kleur|kleuren|klimaat|klok|klokken|koe|koeien|koffie|konijn|konijnen|kopje|kopjes|kracht|krachten|krant|kranten|kunst|kussen|kussens|laken|lakens|lamp|lampen|land|landen|leden|lente|lepel|lepels|leraar|leraren|lerares|leraressen|les|lessen|leven|levens|lichaam|lichamen|licht|lichten|lid|lidstaat|lidstaten|lied|liederen|liefde|lucht|maan|maand|maanden|maatschappij|macht|machten|man|manen|mannen|markt|markten|meer|meisje|meisjes|melk|mening|meningen|meren|mes|messen|metaal|metalen|milieu|minister|ministers|moeder|moeders|moment|momenten|mond|monden|muren|musea|museum|muur|muziek|natuur|neus|neuzen|nieuws|nummer|nummers|ogen|onderwijs|onderzoek|onderzoeken|ontbijt|ontwikkeling|ontwikkelingen|oog|oom|ooms|oor|oorlog|oorlogen|opdracht|opdrachten|opleiding|opleidingen|oplossing|oplossingen|oren|orkest|orkesten|paard|paarden|pakket|pakketten|pan|pannen|papier|park|parken|parlement|parlementen|peer|pen|pennen|peren|personeel|plaats|plaatsen|plan|plannen|plein|pleinen|plek|plekken|ploeg|ploegen|politie|post|prijs|prijzen|probleem|problemen|programma|programma's|provincie|provincies|publiek|punt|punten|raam|ramen|recht|rechten|reden|redenen|regel|regels|regen|regering|regeringen|reis|reizen|rekening|rekeningen|restaurant|restaurants|resultaat|resultaten|richtlijn|richtlijnen|rivier|rivieren|rust|salaris|salarissen|samenwerking|schaap|schapen|schilderij|schilderijen|schoen|schoenen|scholen|school|sector|sectoren|seizoen|seizoenen|sleutel|sleutels|sneeuw|soep|soepen|spel|spellen|sport|sporten|stad|station|stations|steden|steen|stem|stemmen|stenen|stoel|stoelen|straat|strand|stranden|straten|student|studenten|stuk|stukken|systeem|systemen|taal|taart|taarten|tafel|tafels|talen|tand|tanden|tante|tantes|tapijt|tapijten|tas|tassen|team|teams|telefoon|telefoons|theater|theaters|thee|tijd|tijden|toekomst|toneel|tram|trams|trap|trappen|trein|treinen|tuin|tuinen|universiteit|universiteiten|uren|uur|vader|vaders|vakantie|vakanties|varken|varkens|veld|velden|verdrag|verdragen|vergadering|vergaderingen|verhaal|verhalen|verkiezing|verkiezingen|verordening|verordeningen|verslag|verslagen|vis|vissen|vlees|vliegtuig|vliegtuigen|vloer|vloeren|voet|voeten|vogel|vogels|volk|volkeren|voorbeeld|voorbeelden|voorstel|voorstellen|vork|vorken|vraag|vragen|vrede|vriend|vrienden|vriendin|vriendinnen|vrouw|vrouwen|vuur|water|wedstrijd|wedstrijden|week|weekend|weekenden|weer|weg|wegen|weken|wereld|werk|wet|wetten|wijk|wijken|wind|winden|winkel|winkels|winter|winters|woord|woorden|zand|zee|zeeën|ziekenhuis|ziekenhuizen|ziekte|ziektes|zin|zinnen|zomer|zomers|zon|zonen|zonnen|zoon|zorg|zorgen|zus|zussen",
|
| 606 |
+
"note": "uw before a noun is the possessive (Kam uw haar), never u (NL run 1 Tatoeba)"
|
| 607 |
+
},
|
| 608 |
+
{
|
| 609 |
+
"type": "redirect_replace",
|
| 610 |
+
"from": "u",
|
| 611 |
+
"to": "uw",
|
| 612 |
+
"redirect": "u",
|
| 613 |
+
"whenPrevIs": "bent|heeft|hebt|kunt|kan|wilt|wil|zult|zal|zou|mag|moet|was|dank|bedankt",
|
| 614 |
+
"note": "u after its verb is the subject/object (Bent u leraar?), never uw (NL run 1 pick, Tatoeba)"
|
| 615 |
+
},
|
| 616 |
+
{
|
| 617 |
+
"type": "no_unknown_replacement",
|
| 618 |
+
"scope": "strict",
|
| 619 |
+
"note": "never propose a non-word (word knowledge; strict: a misspelling re-inflected into another non-word is held too; runs last)"
|
| 620 |
+
}
|
| 621 |
+
]
|
| 622 |
+
}
|
gector-meta.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"base": "GroNLP/bert-base-dutch-cased",
|
| 3 |
+
"encoder": "GroNLP/bert-base-dutch-cased",
|
| 4 |
+
"precision": "fp32",
|
| 5 |
+
"tokenizer": "wordpiece",
|
| 6 |
+
"logits_labels_dim": 5000,
|
| 7 |
+
"logits_d_dim": 2,
|
| 8 |
+
"onnx_inputs": [
|
| 9 |
+
"input_ids",
|
| 10 |
+
"attention_mask"
|
| 11 |
+
],
|
| 12 |
+
"onnx_outputs": [
|
| 13 |
+
"logits_labels",
|
| 14 |
+
"logits_d"
|
| 15 |
+
],
|
| 16 |
+
"defaults": {
|
| 17 |
+
"keep_confidence": 0.0,
|
| 18 |
+
"min_error_prob": 0.0,
|
| 19 |
+
"n_iteration": 5
|
| 20 |
+
},
|
| 21 |
+
"run_id": "2026-11-15-1125",
|
| 22 |
+
"exported_at": "2026-11-15T18:32:26+01:00",
|
| 23 |
+
"checkpoint": "ckpt_best.pt",
|
| 24 |
+
"git_commit": "72e412a43d77",
|
| 25 |
+
"recipe_sha256": {
|
| 26 |
+
"build_dataset.py": "60d98041be3f",
|
| 27 |
+
"preprocess.py": "384e6c617e5e",
|
| 28 |
+
"train.py": "0099cfb09274",
|
| 29 |
+
"export_onnx.py": "75d209308612",
|
| 30 |
+
"runrecord.py": "2cf1c9541658",
|
| 31 |
+
"tatoeba_split.py": "7cf3f8b22747",
|
| 32 |
+
"selection.py": "b20862d4cb42",
|
| 33 |
+
"lanes.py": "2fed6c3e606d",
|
| 34 |
+
"europarl_split.py": "ef38a5ea27c3",
|
| 35 |
+
"corrupt_nl.py": "7f3b12bfd03c",
|
| 36 |
+
"morph_nl.py": "0ac0f1a7d83b",
|
| 37 |
+
"language-rules.nl.json": "dffd761addb9"
|
| 38 |
+
},
|
| 39 |
+
"version": "1.0.0"
|
| 40 |
+
}
|
language-rules.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"version": 1,
|
| 3 |
+
"language": "nl",
|
| 4 |
+
"_comment": "Per-bundle language facts (see C# LanguageRules / ADR-004). stripTrailingTerminator true: the NL bundle follows the same BERT/WordPiece recipe as Italian — validate at eval. clauseConjunctions: connectors after a comma = independent-clause boundary for GectorAnalyzer.Correct's clause split. Dutch caveat (same as German): omdat/terwijl/hoewel/zodat introduce verb-FINAL subordinate clauses — the Italian perché/mentre precedent (HARMFUL 0) suggests fragments are safe for word-level edits, but PRUNE these at the NL eval if comma_context shows harm. Validate against lang/nl/gold comma_context at eval.",
|
| 5 |
+
"stripTrailingTerminator": true,
|
| 6 |
+
"clauseConjunctions": ["maar", "en", "of", "want", "dus", "toch", "echter", "daarom", "daarna", "bovendien", "omdat", "terwijl", "hoewel", "zodat"]
|
| 7 |
+
}
|
model.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fa309166d3082c9e367df16effc7c3c07d845babdd1f6e66b94b6f23dbd0d9d2
|
| 3 |
+
size 449811159
|
quickstart.ipynb
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"# Proofbird grammar model (Dutch): quick start\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"Run [`proofbird/gector-bert-nl`](https://huggingface.co/proofbird/gector-bert-nl) in a few lines. It is small (about 450 MB), runs on a CPU in about\n",
|
| 10 |
+
"30 ms a sentence, and needs no API key."
|
| 11 |
+
]
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"cell_type": "code",
|
| 15 |
+
"metadata": {},
|
| 16 |
+
"execution_count": null,
|
| 17 |
+
"outputs": [],
|
| 18 |
+
"source": [
|
| 19 |
+
"!pip install -q onnxruntime tokenizers huggingface_hub"
|
| 20 |
+
]
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"cell_type": "markdown",
|
| 24 |
+
"metadata": {},
|
| 25 |
+
"source": [
|
| 26 |
+
"## 1. Load the model and correct a sentence\n",
|
| 27 |
+
"\n",
|
| 28 |
+
"`quickstart.py`, published with the model, downloads it, runs it, and returns the corrected text plus one suggestion per\n",
|
| 29 |
+
"change (character position, original, replacement)."
|
| 30 |
+
]
|
| 31 |
+
},
|
| 32 |
+
{
|
| 33 |
+
"cell_type": "code",
|
| 34 |
+
"metadata": {},
|
| 35 |
+
"execution_count": null,
|
| 36 |
+
"outputs": [],
|
| 37 |
+
"source": [
|
| 38 |
+
"import importlib.util\n",
|
| 39 |
+
"from huggingface_hub import hf_hub_download\n",
|
| 40 |
+
"\n",
|
| 41 |
+
"path = hf_hub_download(\"proofbird/gector-bert-nl\", \"quickstart.py\")\n",
|
| 42 |
+
"spec = importlib.util.spec_from_file_location(\"quickstart\", path)\n",
|
| 43 |
+
"quickstart = importlib.util.module_from_spec(spec)\n",
|
| 44 |
+
"spec.loader.exec_module(quickstart)\n",
|
| 45 |
+
"\n",
|
| 46 |
+
"model = quickstart.Gector(\"proofbird/gector-bert-nl\")\n",
|
| 47 |
+
"corrected, suggestions = model.correct(\"Deze huis zijn erg mooi.\")\n",
|
| 48 |
+
"print(corrected)\n",
|
| 49 |
+
"suggestions"
|
| 50 |
+
]
|
| 51 |
+
},
|
| 52 |
+
{
|
| 53 |
+
"cell_type": "markdown",
|
| 54 |
+
"metadata": {},
|
| 55 |
+
"source": [
|
| 56 |
+
"## 2. See every pass\n",
|
| 57 |
+
"\n",
|
| 58 |
+
"The model does not write text. For every word it picks one of 5 000 edits; the corrected sentence goes back in until\n",
|
| 59 |
+
"nothing changes, so connected errors are fixed one after the other. `verbose=True` prints what each pass sent and got\n",
|
| 60 |
+
"back."
|
| 61 |
+
]
|
| 62 |
+
},
|
| 63 |
+
{
|
| 64 |
+
"cell_type": "code",
|
| 65 |
+
"metadata": {},
|
| 66 |
+
"execution_count": null,
|
| 67 |
+
"outputs": [],
|
| 68 |
+
"source": [
|
| 69 |
+
"corrected, suggestions = model.correct(\"Deze huis zijn erg mooi.\", verbose=True)"
|
| 70 |
+
]
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"cell_type": "markdown",
|
| 74 |
+
"metadata": {},
|
| 75 |
+
"source": [
|
| 76 |
+
"## 3. Your own text\n",
|
| 77 |
+
"\n",
|
| 78 |
+
"`model.passes` holds the same per-pass detail as a list of dictionaries, if you want to build on it."
|
| 79 |
+
]
|
| 80 |
+
},
|
| 81 |
+
{
|
| 82 |
+
"cell_type": "code",
|
| 83 |
+
"metadata": {},
|
| 84 |
+
"execution_count": null,
|
| 85 |
+
"outputs": [],
|
| 86 |
+
"source": [
|
| 87 |
+
"text = \"Zij heeft een lief hond.\"\n",
|
| 88 |
+
"print(model.correct(text)[0])\n",
|
| 89 |
+
"model.passes[0][\"words\"]"
|
| 90 |
+
]
|
| 91 |
+
},
|
| 92 |
+
{
|
| 93 |
+
"cell_type": "markdown",
|
| 94 |
+
"metadata": {},
|
| 95 |
+
"source": [
|
| 96 |
+
"---\n",
|
| 97 |
+
"Published by Patrick Andrew Hartnett. The [Proofbird](https://proofbird.app) writing assistant for Windows uses this\n",
|
| 98 |
+
"model on-device and adds the guards in `gector-guards.json` and an explanation for each change. If you build on this\n",
|
| 99 |
+
"model, a link back is appreciated."
|
| 100 |
+
]
|
| 101 |
+
}
|
| 102 |
+
],
|
| 103 |
+
"metadata": {
|
| 104 |
+
"kernelspec": {
|
| 105 |
+
"display_name": "Python 3",
|
| 106 |
+
"language": "python",
|
| 107 |
+
"name": "python3"
|
| 108 |
+
},
|
| 109 |
+
"language_info": {
|
| 110 |
+
"name": "python"
|
| 111 |
+
},
|
| 112 |
+
"colab": {
|
| 113 |
+
"provenance": []
|
| 114 |
+
}
|
| 115 |
+
},
|
| 116 |
+
"nbformat": 4,
|
| 117 |
+
"nbformat_minor": 5
|
| 118 |
+
}
|
quickstart.py
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Proofbird GECToR grammar model (Dutch): a complete, minimal way to run it (Python).
|
| 2 |
+
|
| 3 |
+
pip install onnxruntime tokenizers huggingface_hub numpy
|
| 4 |
+
python quickstart.py "Deze huis zijn erg mooi."
|
| 5 |
+
|
| 6 |
+
This is the same algorithm the Proofbird app runs (C#), minus the guards in gector-guards.json (see the model card,
|
| 7 |
+
"What Proofbird adds"). Published by Patrick Andrew Hartnett - https://proofbird.app
|
| 8 |
+
"""
|
| 9 |
+
import argparse
|
| 10 |
+
import difflib
|
| 11 |
+
import json
|
| 12 |
+
import os
|
| 13 |
+
import re
|
| 14 |
+
|
| 15 |
+
import numpy as np
|
| 16 |
+
import onnxruntime as ort
|
| 17 |
+
from huggingface_hub import snapshot_download
|
| 18 |
+
from tokenizers import Tokenizer
|
| 19 |
+
|
| 20 |
+
MODEL = "proofbird/gector-bert-nl"
|
| 21 |
+
WORD = re.compile(r"\w+(?:'\w+)?|[^\w\s]") # a word (with one apostrophe inside), or one punctuation mark
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
class Gector:
|
| 25 |
+
def __init__(self, model=MODEL, keep_confidence=0.0, min_error_prob=0.0):
|
| 26 |
+
"""keep_confidence: a bonus added to "$KEEP" before choosing (higher = fewer, safer edits).
|
| 27 |
+
min_error_prob: ignore an edit, or a whole sentence, the model is less sure of than this.
|
| 28 |
+
Both 0 by default, as in the Proofbird app."""
|
| 29 |
+
self.keep_confidence, self.min_error_prob = keep_confidence, min_error_prob
|
| 30 |
+
path = model if os.path.isdir(model) else snapshot_download(model)
|
| 31 |
+
cfg = json.load(open(os.path.join(path, "config.json"), encoding="utf-8"))
|
| 32 |
+
self.labels = [cfg["id2label"][str(i)] for i in range(len(cfg["id2label"]))]
|
| 33 |
+
self.keep = self.labels.index(cfg.get("keep_label", "$KEEP"))
|
| 34 |
+
self.incorrect = {v: int(k) for k, v in cfg["d_id2label"].items()}[cfg.get("incorrect_label", "$INCORRECT")]
|
| 35 |
+
rules_path = os.path.join(path, "language-rules.json")
|
| 36 |
+
rules = json.load(open(rules_path, encoding="utf-8")) if os.path.exists(rules_path) else {}
|
| 37 |
+
# The final full stop comes off before the model and goes back on after (where the bundle says so).
|
| 38 |
+
self.strip = rules.get("stripTerminators", ".!?") if rules.get("stripTrailingTerminator") else ""
|
| 39 |
+
# Articles written glued to the next word with an apostrophe, which the model reads as two words (bundle data).
|
| 40 |
+
self.glued = set((rules.get("elision") or {}).get("nonElidingArticles") or rules.get("nonElidingArticles") or [])
|
| 41 |
+
self.verbs = {} # "<word>_<from>_<to>" -> the verb form, for $TRANSFORM_VERB_*
|
| 42 |
+
verb_path = os.path.join(path, "verb-form-vocab.txt")
|
| 43 |
+
if os.path.exists(verb_path):
|
| 44 |
+
for line in open(verb_path, encoding="utf-8"):
|
| 45 |
+
if ":" in line:
|
| 46 |
+
words, tags = line.strip().split(":")
|
| 47 |
+
w1, w2 = words.split("_")
|
| 48 |
+
self.verbs[f"{w1}_{tags}"] = w2
|
| 49 |
+
self.tokenizer = Tokenizer.from_file(os.path.join(path, "tokenizer.json"))
|
| 50 |
+
self.session = ort.InferenceSession(os.path.join(path, "model.onnx"), providers=["CPUExecutionProvider"])
|
| 51 |
+
|
| 52 |
+
# --- one pass: words in, one tag per word out -------------------------------------------------------------
|
| 53 |
+
def tag(self, words):
|
| 54 |
+
enc = self.tokenizer.encode(words, is_pretokenized=True) # [CLS] w1 ... wn [SEP]; [CLS] stands for $START
|
| 55 |
+
input_ids = np.array([enc.ids], dtype=np.int64)
|
| 56 |
+
logits_labels, logits_d = self.session.run(
|
| 57 |
+
["logits_labels", "logits_d"],
|
| 58 |
+
{"input_ids": input_ids, "attention_mask": np.ones_like(input_ids)})
|
| 59 |
+
probs = softmax(logits_labels[0]) # [tokens, 5000]
|
| 60 |
+
probs[:, self.keep] += self.keep_confidence
|
| 61 |
+
wrong = softmax(logits_d[0])[:, self.incorrect] # [tokens]
|
| 62 |
+
result, seen = [], set()
|
| 63 |
+
for t, w in enumerate(enc.word_ids): # one label per word, read at its first token
|
| 64 |
+
word = 0 if t == 0 else (None if w is None else w + 1)
|
| 65 |
+
if word is None or word in seen:
|
| 66 |
+
continue
|
| 67 |
+
seen.add(word)
|
| 68 |
+
best = int(probs[t].argmax())
|
| 69 |
+
label = self.labels[best] if probs[t, best] >= self.min_error_prob else "$KEEP"
|
| 70 |
+
result.append((label, float(probs[t, best]), float(wrong[t])))
|
| 71 |
+
if max(r[2] for r in result) < self.min_error_prob: # no word is confidently wrong: keep the sentence
|
| 72 |
+
result = [("$KEEP", p, e) for _, p, e in result]
|
| 73 |
+
return input_ids, logits_labels.shape, result
|
| 74 |
+
|
| 75 |
+
# --- apply one tag to one word ------------------------------------------------------------------------------
|
| 76 |
+
def edit(self, word, label):
|
| 77 |
+
if label.startswith("$APPEND_"):
|
| 78 |
+
return word + " " + label[8:]
|
| 79 |
+
if word == "$START" or label == "$KEEP":
|
| 80 |
+
return word
|
| 81 |
+
if label.startswith("$REPLACE_"):
|
| 82 |
+
return label[9:]
|
| 83 |
+
if label == "$DELETE":
|
| 84 |
+
return ""
|
| 85 |
+
if label.startswith("$TRANSFORM_SUF_"): # change the ending: $TRANSFORM_SUF_<old>_<new>
|
| 86 |
+
old, new = label[15:].split("_", 1)
|
| 87 |
+
if not word.endswith(old):
|
| 88 |
+
return word
|
| 89 |
+
stem = word[: len(word) - len(old)]
|
| 90 |
+
return stem + new
|
| 91 |
+
if label.startswith("$TRANSFORM_VERB_"): # verb form from verb-form-vocab.txt
|
| 92 |
+
return self.verbs.get(f"{word}_{label[16:]}", word)
|
| 93 |
+
if label == "$TRANSFORM_CASE_CAPITAL":
|
| 94 |
+
return word[:1].upper() + word[1:].lower()
|
| 95 |
+
if label == "$TRANSFORM_CASE_LOWER":
|
| 96 |
+
return word.lower()
|
| 97 |
+
if label == "$TRANSFORM_CASE_UPPER":
|
| 98 |
+
return word.upper()
|
| 99 |
+
if label == "$TRANSFORM_AGREEMENT_PLURAL":
|
| 100 |
+
return word + "s"
|
| 101 |
+
if label == "$TRANSFORM_AGREEMENT_SINGULAR":
|
| 102 |
+
return word[:-1]
|
| 103 |
+
if label == "$TRANSFORM_SPLIT_HYPHEN":
|
| 104 |
+
return word.replace("-", " ")
|
| 105 |
+
if label.startswith("$MERGE_"):
|
| 106 |
+
return word + " " + label
|
| 107 |
+
return word
|
| 108 |
+
|
| 109 |
+
# --- the whole call: up to 5 passes, then the suggestions -------------------------------------------------
|
| 110 |
+
def correct(self, text, max_passes=5, verbose=False):
|
| 111 |
+
core, tail = text, ""
|
| 112 |
+
if self.strip and text.rstrip()[-1:] and text.rstrip()[-1] in self.strip:
|
| 113 |
+
core, tail = text.rstrip()[:-1], text[len(text.rstrip()) - 1:]
|
| 114 |
+
plain = core.replace("’", "'") # the models were trained on straight apostrophes
|
| 115 |
+
words = self.words(plain)
|
| 116 |
+
self.passes = [] # what each pass saw and did (for printing or a UI)
|
| 117 |
+
for n in range(1, max_passes + 1):
|
| 118 |
+
input_ids, shape, tags = self.tag(words)
|
| 119 |
+
edited = [self.edit(w, label) for w, (label, _, _) in zip(["$START"] + words, tags)]
|
| 120 |
+
tokens = (" ".join(e for e in edited if e).replace(" $MERGE_HYPHEN ", "-")
|
| 121 |
+
.replace(" $MERGE_SPACE ", "").split())
|
| 122 |
+
new_words = [x for t in rejoin(t for t in tokens if t != "$START") for x in self.words(t)]
|
| 123 |
+
self.passes.append({
|
| 124 |
+
"pass": n, "input": join(" ".join(words)), "input_ids": input_ids[0].tolist(),
|
| 125 |
+
"logits_labels_shape": list(shape),
|
| 126 |
+
"words": [{"word": w, "tag": label, "probability": round(p, 6), "wrong": round(wrong, 6),
|
| 127 |
+
"edit": e if e != w else None}
|
| 128 |
+
for w, (label, p, wrong), e in zip(["$START"] + words, tags, edited)],
|
| 129 |
+
"result": join(" ".join(new_words)), "changed": new_words != words})
|
| 130 |
+
if verbose:
|
| 131 |
+
print_pass(self.passes[-1])
|
| 132 |
+
if new_words == words:
|
| 133 |
+
break
|
| 134 |
+
words = new_words
|
| 135 |
+
found = self.suggestions(plain, words) # same length as core, so positions match the real text
|
| 136 |
+
corrected = core
|
| 137 |
+
for f in reversed(found): # apply right to left, so positions stay valid
|
| 138 |
+
f["original"] = core[f["start"]: f["start"] + f["length"]]
|
| 139 |
+
corrected = corrected[: f["start"]] + f["replacement"] + corrected[f["start"] + f["length"]:]
|
| 140 |
+
return corrected + tail, found
|
| 141 |
+
|
| 142 |
+
def words(self, text):
|
| 143 |
+
return [w for w, _, _ in self.spans(text)]
|
| 144 |
+
|
| 145 |
+
def spans(self, text, surface=False):
|
| 146 |
+
"""The words of the text with their character positions. An article glued to the next word with an apostrophe
|
| 147 |
+
(the bundle's list) is split into the two words the model was trained on."""
|
| 148 |
+
out = []
|
| 149 |
+
for m in WORD.finditer(text):
|
| 150 |
+
article, sep, rest = m.group().partition("'")
|
| 151 |
+
if sep and rest and article.lower() in self.glued:
|
| 152 |
+
# the article keeps its apostrophe for comparing (so splitting it counts as a change), not for the model
|
| 153 |
+
first = article + "'" if surface else article
|
| 154 |
+
out += [(first, m.start(), m.start() + len(first)), (rest, m.end() - len(rest), m.end())]
|
| 155 |
+
else:
|
| 156 |
+
out.append((m.group(), m.start(), m.end()))
|
| 157 |
+
return out
|
| 158 |
+
|
| 159 |
+
def suggestions(self, original, corrected_words):
|
| 160 |
+
"""Compare the original words with the corrected ones: one suggestion per changed stretch, with its character
|
| 161 |
+
position in the ORIGINAL text. Unchanged text keeps the writer's own spacing and characters."""
|
| 162 |
+
spans = self.spans(original, surface=True)
|
| 163 |
+
a = [w for w, _, _ in spans]
|
| 164 |
+
out = []
|
| 165 |
+
for op, i1, i2, j1, j2 in difflib.SequenceMatcher(a=a, b=corrected_words, autojunk=False).get_opcodes():
|
| 166 |
+
if op == "equal":
|
| 167 |
+
continue
|
| 168 |
+
new = join(" ".join(corrected_words[j1:j2]))
|
| 169 |
+
if i1 == i2: # pure insertion
|
| 170 |
+
if i1 < len(a): # before a word: "new "; before punctuation: " new"
|
| 171 |
+
start = end = spans[i1][1]
|
| 172 |
+
if new[-1:] in OPENING:
|
| 173 |
+
pass # an opening mark hugs the next word
|
| 174 |
+
elif i1 == 0 or a[i1][0].isalnum():
|
| 175 |
+
new = new + " "
|
| 176 |
+
else:
|
| 177 |
+
new = " " + new
|
| 178 |
+
else: # at the very end
|
| 179 |
+
start = end = spans[-1][2] if spans else 0
|
| 180 |
+
new = (" " if new[:1].isalnum() else "") + new
|
| 181 |
+
else:
|
| 182 |
+
start, end = spans[i1][1], spans[i2 - 1][2]
|
| 183 |
+
if new and end < len(original) and original[end].isalnum() and new[-1].isalnum():
|
| 184 |
+
new += " " # a glued article split off: keep a space before the next word
|
| 185 |
+
if not new: # pure deletion: take one neighbouring space with it
|
| 186 |
+
if end < len(original) and original[end] == " ":
|
| 187 |
+
end += 1
|
| 188 |
+
elif start > 0 and original[start - 1] == " ":
|
| 189 |
+
start -= 1
|
| 190 |
+
out.append({"start": start, "length": end - start, "original": original[start:end], "replacement": new})
|
| 191 |
+
return out
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
OPENING = "([{“«\"" # marks that hug the word after them
|
| 195 |
+
CLOSING = ".,;:!?)]}%»”" # marks that hug the word before them
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
def softmax(x):
|
| 199 |
+
e = np.exp(x - x.max(axis=-1, keepdims=True))
|
| 200 |
+
return e / e.sum(axis=-1, keepdims=True)
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
def print_pass(p):
|
| 204 |
+
print(f"\n--- pass {p['pass']}: \"{p['input']}\"")
|
| 205 |
+
print(f"request input_ids {p['input_ids']} attention_mask all 1")
|
| 206 |
+
print(f"response logits_labels {p['logits_labels_shape']} logits_d {p['logits_labels_shape'][:2] + [2]}")
|
| 207 |
+
for w in p["words"]:
|
| 208 |
+
print(f" {w['word']:<12} wrong {w['wrong']:6.1%} {w['tag']} {w['probability']:.1%}")
|
| 209 |
+
print(f"result \"{p['result']}\"" + ("" if p["changed"] else " (no change: stop)"))
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
def rejoin(tokens):
|
| 213 |
+
"""A word the model ends with an apostrophe hugs the next word."""
|
| 214 |
+
out = []
|
| 215 |
+
for t in tokens:
|
| 216 |
+
if out and len(out[-1]) > 1 and out[-1].endswith("'") and t[:1].isalnum():
|
| 217 |
+
out[-1] += t
|
| 218 |
+
else:
|
| 219 |
+
out.append(t)
|
| 220 |
+
return out
|
| 221 |
+
|
| 222 |
+
|
| 223 |
+
def join(text):
|
| 224 |
+
"""Words back to normal text: no space before closing punctuation or after an opening mark."""
|
| 225 |
+
text = re.sub(f" ([{re.escape(CLOSING)}])", r"\1", " ".join(text.split()))
|
| 226 |
+
return re.sub(f"([{re.escape(OPENING.replace(chr(34), ''))}]) ", r"\1", text)
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
if __name__ == "__main__":
|
| 230 |
+
ap = argparse.ArgumentParser()
|
| 231 |
+
ap.add_argument("text")
|
| 232 |
+
ap.add_argument("--model", default=MODEL, help="a Hugging Face repo id or a local folder")
|
| 233 |
+
args = ap.parse_args()
|
| 234 |
+
corrected, found = Gector(args.model).correct(args.text, verbose=True)
|
| 235 |
+
print(f"\ncorrected: \"{corrected}\"")
|
| 236 |
+
print("suggestions:", json.dumps(found, indent=2, ensure_ascii=False))
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"cls_token": "[CLS]",
|
| 4 |
+
"do_lower_case": false,
|
| 5 |
+
"is_local": false,
|
| 6 |
+
"local_files_only": false,
|
| 7 |
+
"mask_token": "[MASK]",
|
| 8 |
+
"model_max_length": 512,
|
| 9 |
+
"pad_token": "[PAD]",
|
| 10 |
+
"sep_token": "[SEP]",
|
| 11 |
+
"strip_accents": null,
|
| 12 |
+
"tokenize_chinese_chars": true,
|
| 13 |
+
"tokenizer_class": "BertTokenizer",
|
| 14 |
+
"unk_token": "[UNK]"
|
| 15 |
+
}
|
verb-form-vocab.txt
ADDED
|
File without changes
|
vocab.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|