Commit 0d46b50
fix: support-matrix on fasttext-predict + fun_langid SyntaxWarnings (#1)
Three bugs surfaced when smoke-testing the published 0.1.0.dev1 wheel:
1. `commonlid generate-support-matrix` skipped GlotLID, OpenLID-v2 and
fasttext with `'_FastText' object has no attribute 'get_labels'`.
Root cause: the runtime dep `fasttext-predict` is inference-only and
exposes only `predict`/`multilinePredict`, but
`_fasttext_base.discover_supported_languages` calls `get_labels()`.
Add a binary parser for fasttext's `model.bin` dictionary block and
fall back to it when `get_labels` is missing. Stash the model path on
the instance at `load()` time.
2. `commonlid.vendor.fun_langid` raised two `SyntaxWarning: invalid
escape sequence '\/'` on every CLI invocation under Python 3.12+.
Make the offending strings raw — keeps the data identical to what
pre-3.12 Python produced (literal backslash + slash).
3. The dev1 wheel itself shipped the *placeholder* `cld3.py`
(`import cld3`) even though the source had been switched to the
`gcld3`-based `cld3-py` bindings. The model fix already lived in the
working tree; including this diff in the same PR ensures it lands
in the next release.
Add unit tests for the new binary parser (round-trip + magic check) and
for the `fasttext-predict` (no-`get_labels`) discovery path.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 75a42a5 commit 0d46b50
3 files changed
Lines changed: 139 additions & 4 deletions
File tree
- src/commonlid
- models
- vendor
- tests/models
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
12 | 58 | | |
13 | 59 | | |
14 | 60 | | |
| |||
23 | 69 | | |
24 | 70 | | |
25 | 71 | | |
| 72 | + | |
26 | 73 | | |
27 | 74 | | |
28 | 75 | | |
29 | 76 | | |
30 | 77 | | |
| 78 | + | |
31 | 79 | | |
32 | 80 | | |
33 | 81 | | |
| |||
72 | 120 | | |
73 | 121 | | |
74 | 122 | | |
75 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
76 | 130 | | |
77 | 131 | | |
78 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
79 | 139 | | |
80 | | - | |
| 140 | + | |
81 | 141 | | |
82 | 142 | | |
83 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
841 | 841 | | |
842 | 842 | | |
843 | 843 | | |
844 | | - | |
| 844 | + | |
845 | 845 | | |
846 | 846 | | |
847 | 847 | | |
| |||
2431 | 2431 | | |
2432 | 2432 | | |
2433 | 2433 | | |
2434 | | - | |
| 2434 | + | |
2435 | 2435 | | |
2436 | 2436 | | |
2437 | 2437 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
62 | 137 | | |
63 | 138 | | |
64 | 139 | | |
| |||
0 commit comments