tiny-lang-detect

Generate tiny models for language detection  https://p.ce9e.org/tiny-lang-detect/demo/
git clone https://git.ce9e.org/tiny-lang-detect.git

commit
127bc181a6b4c10fd266504951d68dbc2e9aa4ef
parent
3f86e6fb263df69ee5a826710b4c22496916add0
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2025-05-10 15:40
tweak test output

Diffstat

M README.md 2 +-
M test.py 5 ++++-

2 files changed, 5 insertions, 2 deletions


diff --git a/README.md b/README.md

@@ -14,7 +14,7 @@ Example usage:
   14    14 $ ./download_data.sh
   15    15 $ python gen_model.py en de -n 10 > en_de.json
   16    16 $ python test.py en_de.json
   17    -1 overall correctness 96.3% (1000)
   -1    17 963 out of 1000 samples were detected correctly (96.3%)
   18    18 ```
   19    19 
   20    20 A model might look like this:

diff --git a/test.py b/test.py

@@ -85,7 +85,10 @@ def test(model):
   85    85                     if actual == lang:
   86    86                         correct += 1
   87    87 
   88    -1     print(f'overall correctness {correct / total:.1%} ({total})')
   -1    88     print(
   -1    89         f'{correct} out of {total} samples were detected correctly'
   -1    90         f' ({correct / total:.1%})'
   -1    91     )
   89    92 
   90    93 
   91    94 if __name__ == '__main__':