()
| 140 | } |
| 141 | |
| 142 | public void trainOnSampleDocs() throws Exception { |
| 143 | documentsPerExemplar = new ArrayList<>(); |
| 144 | featureVectors = new ArrayList<>(); |
| 145 | injectWhitespace = new ArrayList<>(); |
| 146 | hpos = new ArrayList<>(); |
| 147 | |
| 148 | for (InputDocument doc : documents) { |
| 149 | if ( showFileNames ) System.out.println(doc); |
| 150 | // Parse document, add feature vectors to this corpus |
| 151 | Trainer trainer = new Trainer(this, doc, language.indentSize); |
| 152 | trainer.computeFeatureVectors(); |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | /** Feature vectors in X are lumped together as they are read in each |
| 157 | * document. In kNN, this tends to find features from the same document |
no test coverage detected