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).

!752

static new L<Test> tests;
static Thread producer;
static Reproducing rp;
static ImageSurface imageSurface;

!include #1004562 // column prediction
!include #1004570 // predictors

sclass Test {
  float[][] cols;
  int x1; // where we start testing
  
  *() {}
  *(float[][] *cols, int *x1) {}
}

p {
  tests.add(makeTest("ABC", "X"));
  tests.add(makeTest("DEF", "X"));
  
  showBWImage(columnsToImage(tests.get(0).cols));
  
  /*
  rp = new Reproducing;
  imageSurface = showBWImage(bw);
  rp.bw = bw;
  //rp.imageSurfaceToUpdateWithBest = showImage(bw.getBufferedImage());
  
  //rp.startProduction = r { produce() };
  //rp.search();
  
  //showColumnErrors("LookLeft(width=8)");
  
  produce();
  while licensed {
    S desc = grabFromQueue(rp.newProducts);
    Predictor p = makePredictor(desc);
    float[][] cols = rp.getCols();
    double score = testColumnRange(p, cols, 0, 15, l(cols));
    print(desc);
    print("  " + score);
    //imageSurface.setImage(renderPrediction(desc, cols));
  }
  */
}

static void produce() {
  cancelThread(producer);
  producer = new Thread(r {
    // STRATEGY!
    
    rp.push("RepeatColumn");
    rp.push("ShiftDown");
    rp.push("LookLeft(width=7)");
    rp.push("LookLeft(width=8)");
    rp.push("LookLeft(width=9)");
    rp.push("LookLeft(width=10)");
  }, "Producer");
  producer.start();
}

static Test makeTest(S l, S r) {
  BWImage a = renderTheText(l + " = "), b = renderTheText(l + " = " + r);
  ret new Test(imageToColumns(b), a.getWidth());
}

static Font renderTheText_font;

static BWImage renderTheText(S s) {
  if (renderTheText_font == null)
    renderTheText_font = loadFont("#1004569"); // "Ticketing"
  ret new BWImage(renderText(renderTheText_font, 20f, s));
}

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: 536 / 632
Referenced in: #1004572 - Text Predict Test Case 1