MCPcopy Create free account
hub / github.com/antlr/codebuff / toString

Method toString

src/org/antlr/codebuff/Neighbor.java:19–38  ·  view source on GitHub ↗
(FeatureMetaData[] FEATURES, List<Integer> Y)

Source from the content-addressed store, hash-verified

17 }
18
19 public String toString(FeatureMetaData[] FEATURES, List<Integer> Y) {
20 int[] X = corpus.featureVectors.get(corpusVectorIndex);
21 InputDocument doc = corpus.documentsPerExemplar.get(corpusVectorIndex);
22 String features = Trainer._toString(FEATURES, doc, X);
23 int line = X[Trainer.INDEX_INFO_LINE];
24 String lineText = doc.getLine(line);
25 int col = X[Trainer.INDEX_INFO_CHARPOS];
26 // insert a dot right before char position
27 if ( lineText!=null ) {
28 lineText = lineText.substring(0, col)+'\u00B7'+lineText.substring(col, lineText.length());
29 }
30 int cat = Y.get(corpusVectorIndex);
31 int[] elements = Trainer.triple(cat);
32// String display = String.format("%d|%d|%d", cat&0xFF, elements[0], elements[1]);
33 String wsDisplay = getWSCategoryStr(cat);
34 String alignDisplay = getHPosCategoryStr(cat);
35 String display = wsDisplay!=null ? wsDisplay : alignDisplay;
36 if ( display==null ) display = String.format("%8s","none");
37 return String.format("%s (%s,d=%1.3f): %s", features, display, distance, lineText);
38 }
39}

Callers

nothing calls this directly

Calls 8

_toStringMethod · 0.95
getLineMethod · 0.95
tripleMethod · 0.95
getWSCategoryStrMethod · 0.80
getHPosCategoryStrMethod · 0.80
getMethod · 0.65
lengthMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected