Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

75
LINES

< > BotCompany Repo | #1004571 // Text Predict (dev.)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (4685L/31K/102K).

1  
!752
2  
3  
static new L<Test> tests;
4  
static Thread producer;
5  
static Reproducing rp;
6  
static ImageSurface imageSurface;
7  
8  
!include #1004562 // column prediction
9  
!include #1004570 // predictors
10  
11  
sclass Test {
12  
  float[][] cols;
13  
  int x1; // where we start testing
14  
  
15  
  *() {}
16  
  *(float[][] *cols, int *x1) {}
17  
}
18  
19  
p {
20  
  tests.add(makeTest("ABC", "X"));
21  
  tests.add(makeTest("DEF", "X"));
22  
  
23  
  showBWImage(columnsToImage(tests.get(0).cols));
24  
  
25  
  /*
26  
  rp = new Reproducing;
27  
  imageSurface = showBWImage(bw);
28  
  rp.bw = bw;
29  
  //rp.imageSurfaceToUpdateWithBest = showImage(bw.getBufferedImage());
30  
  
31  
  //rp.startProduction = r { produce() };
32  
  //rp.search();
33  
  
34  
  //showColumnErrors("LookLeft(width=8)");
35  
  
36  
  produce();
37  
  while licensed {
38  
    S desc = grabFromQueue(rp.newProducts);
39  
    Predictor p = makePredictor(desc);
40  
    float[][] cols = rp.getCols();
41  
    double score = testColumnRange(p, cols, 0, 15, l(cols));
42  
    print(desc);
43  
    print("  " + score);
44  
    //imageSurface.setImage(renderPrediction(desc, cols));
45  
  }
46  
  */
47  
}
48  
49  
static void produce() {
50  
  cancelThread(producer);
51  
  producer = new Thread(r {
52  
    // STRATEGY!
53  
    
54  
    rp.push("RepeatColumn");
55  
    rp.push("ShiftDown");
56  
    rp.push("LookLeft(width=7)");
57  
    rp.push("LookLeft(width=8)");
58  
    rp.push("LookLeft(width=9)");
59  
    rp.push("LookLeft(width=10)");
60  
  }, "Producer");
61  
  producer.start();
62  
}
63  
64  
static Test makeTest(S l, S r) {
65  
  BWImage a = renderTheText(l + " = "), b = renderTheText(l + " = " + r);
66  
  ret new Test(imageToColumns(b), a.getWidth());
67  
}
68  
69  
static Font renderTheText_font;
70  
71  
static BWImage renderTheText(S s) {
72  
  if (renderTheText_font == null)
73  
    renderTheText_font = loadFont("#1004569"); // "Ticketing"
74  
  ret new BWImage(renderText(renderTheText_font, 20f, s));
75  
}

Author comment

Began life as a copy of #1004567

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1004571
Snippet name: Text Predict (dev.)
Eternal ID of this version: #1004571/1
Text MD5: a122fba2b56f0b58942b4309f95c9b30
Transpilation MD5: 5a8f65e023d384e043ab335efe30defd
Author: stefan
Category: javax / a.i.
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-21 17:19:36
Source code size: 1807 bytes / 75 lines
Pitched / IR pitched: No / No
Views / Downloads: 461 / 549
Referenced in: [show references]