Uses 12447K of libraries. Click here for Pure Java version (11584L/55K).
1 | !7 |
2 | |
3 | cmodule LiveCompressor { |
4 | switchable int nPredictions = 5; |
5 | switchable bool optimize; |
6 | S input, output, prediction; |
7 | transient new LCStreamingCompressor comp; |
8 | transient S compressedText; |
9 | |
10 | visual centerAndSouth(jvsplit( |
11 | dm_textAreaAsSection input(), |
12 | dm_textAreaAsSection output()), |
13 | dm_labelAsSection prediction()); |
14 | |
15 | start { |
16 | dm_onFieldChangeAndNow input(r calc); |
17 | } |
18 | |
19 | void calc { |
20 | S input = this.input; |
21 | new Matches m; |
22 | if (optimize && startsWith(input, compressedText, m)) |
23 | comp.append(m.rest()); |
24 | else { |
25 | comp = new LCStreamingCompressor; |
26 | comp.append(input); |
27 | } |
28 | compressedText = input; |
29 | setField(output := lcStream_textWithBrackets(comp)); |
30 | |
31 | setField(prediction := join(lcStream_repeatedPrediction2(nPredictions, comp))); |
32 | } |
33 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1029112 |
Snippet name: | Live Compressor (LCStreamingCompressor) |
Eternal ID of this version: | #1029112/11 |
Text MD5: | 6c500f45b3f06ce293f8a4796a89c670 |
Transpilation MD5: | 855ee50406e80d71f5c4a3a1d381dd3f |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-12-21 19:18:23 |
Source code size: | 848 bytes / 33 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 220 / 1198 |
Version history: | 10 change(s) |
Referenced in: | [show references] |