@Test public void testTrigramAnnotator() throws IOException { Resource path = Resource.createTempDirectory(); LetterNGramEncoder trigram = new LetterNGramEncoder(3); trigram.setId("TRI"); assertFalse(trigram.isModelAvailable()); assertTrue(trigram.isModelAvailableInChildren()); Annotator annotator = new Annotator(trigram); assertTrue(annotator.isModelAvailable()); assertTrue(annotator.isModelAvailableInChildren()); assertEquals(3, trigram.getN()); trigram.trainModel(data.getDocuments()); trigram.saveModel(path, "trigram"); assertTrue(trigram.isModelAvailable()); assertTrue(annotator.isModelAvailable()); assertTrue(annotator.isModelAvailableInChildren()); assertEquals(2, trigram.encode("an").sumNumber().intValue()); annotator.writeTrainLog(path); annotator.writeTestLog(path); annotator.writeModel(path); Annotator test = AnnotatorFactory.loadAnnotator(path); assertTrue(annotator.isModelAvailable()); assertTrue(annotator.isModelAvailableInChildren()); }
public void trainModel(Dataset train, Dataset test, WordHelpers.Language lang) { provenance.setDataset(train.getName()); provenance.setLanguage(lang.toString().toLowerCase()); getTagger().setName(provenance.toString()); createTags(train.getDocuments(), Annotation.Source.GOLD); getTagger().trainModel(train, Annotation.Source.GOLD); createTags(test.getDocuments(), Annotation.Source.GOLD); getTagger().testModel(test, Annotation.Source.GOLD); }
MentionAnnotator extends Annotator { public void trainModel(Dataset train, Dataset test, WordHelpers.Language lang) { provenance.setDataset(train.getName()); provenance.setLanguage(lang.toString().toLowerCase()); getTagger().setName(provenance.toString()); createTags(train.getDocuments(), Annotation.Source.GOLD); getTagger().trainModel(train, Annotation.Source.GOLD); createTags(test.getDocuments(), Annotation.Source.GOLD); getTagger().testModel(test, Annotation.Source.GOLD); } }
MentionAnnotator extends Annotator { public void trainModel(Dataset train, Dataset test, WordHelpers.Language lang) { provenance.setDataset(train.getName()); provenance.setLanguage(lang.toString().toLowerCase()); getTagger().setName(provenance.toString()); createTags(train.getDocuments(), Annotation.Source.GOLD); getTagger().trainModel(train, Annotation.Source.GOLD); createTags(test.getDocuments(), Annotation.Source.GOLD); getTagger().testModel(test, Annotation.Source.GOLD); } MentionAnnotator();  MentionAnnotator(Tagger root); }
MentionAnnotator extends Annotator { public void trainModel(Dataset train, Dataset test, WordHelpers.Language lang) { provenance.setDataset(train.getName()); provenance.setLanguage(lang.toString().toLowerCase()); getTagger().setName(provenance.toString()); createTags(train.getDocuments(), Annotation.Source.GOLD); getTagger().trainModel(train, Annotation.Source.GOLD); createTags(test.getDocuments(), Annotation.Source.GOLD); getTagger().testModel(test, Annotation.Source.GOLD); } MentionAnnotator();  MentionAnnotator(Tagger root); @Override MentionTagger getTagger(); @Override String toString(); @Override void annotate(Collection<Document> docs); void trainModel(Dataset train, Dataset test, WordHelpers.Language lang); void trainModel(Dataset train, Annotation.Source annotationSource, WordHelpers.Language lang); void trainModel(Dataset train, Annotation.Source annotationSource, WordHelpers.Language lang, int limitExamples, boolean incremental, boolean randomize); void trainModelEarlyStopping(Dataset train, Dataset validation, Annotation.Source annotationSource, WordHelpers.Language lang, int epochSize, int minEpochs, int maxEpochs, int maxEpochsWithNoImprovement); void writeBestModel(Resource path, String name); void trainModel(Collection<Sentence> sentences, Annotation.Source tagSource, WordHelpers.Language lang); }
MentionAnnotator extends Annotator { public void trainModel(Dataset train, Dataset test, WordHelpers.Language lang) { provenance.setDataset(train.getName()); provenance.setLanguage(lang.toString().toLowerCase()); getTagger().setName(provenance.toString()); createTags(train.getDocuments(), Annotation.Source.GOLD); getTagger().trainModel(train, Annotation.Source.GOLD); createTags(test.getDocuments(), Annotation.Source.GOLD); getTagger().testModel(test, Annotation.Source.GOLD); } MentionAnnotator();  MentionAnnotator(Tagger root); @Override MentionTagger getTagger(); @Override String toString(); @Override void annotate(Collection<Document> docs); void trainModel(Dataset train, Dataset test, WordHelpers.Language lang); void trainModel(Dataset train, Annotation.Source annotationSource, WordHelpers.Language lang); void trainModel(Dataset train, Annotation.Source annotationSource, WordHelpers.Language lang, int limitExamples, boolean incremental, boolean randomize); void trainModelEarlyStopping(Dataset train, Dataset validation, Annotation.Source annotationSource, WordHelpers.Language lang, int epochSize, int minEpochs, int maxEpochs, int maxEpochsWithNoImprovement); void writeBestModel(Resource path, String name); void trainModel(Collection<Sentence> sentences, Annotation.Source tagSource, WordHelpers.Language lang);  }