Package org.apache.stanbol.enhancer.topic.api.training

Examples of org.apache.stanbol.enhancer.topic.api.training.TrainingSet


        ResponseBuilder rb;
        if (!classifier.isUpdatable()) {
            rb = Response.status(Response.Status.BAD_REQUEST).entity(
                String.format("Classifier %s is not updateble.\n", classifier.getName()));
        } else {
            TrainingSet trainingSet = classifier.getTrainingSet();
            exampleId = trainingSet.registerExample(exampleId, textContent, concepts);
            // TODO: make example GETable resources and return a 201 to it instead of a simple message.
            rb = Response.ok(String.format(
                "Successfully added or updated example '%s' in training set '%s'.\n", exampleId,
                trainingSet.getName()));
        }
        addCORSOrigin(servletContext, rb, headers);
        return rb.build();
    }
View Full Code Here


        ResponseBuilder rb;
        if (!classifier.isUpdatable()) {
            rb = Response.status(Response.Status.BAD_REQUEST).entity(
                String.format("Classifier %s is not updateble.\n", classifier.getName()));
        } else {
            TrainingSet trainingSet = classifier.getTrainingSet();
            if (exampleIds != null && !exampleIds.isEmpty()) {
                for (String exampleId : exampleIds) {
                    trainingSet.registerExample(exampleId, null, null);
                }
            } else {
                // implement a way to cleanup a complete training set? or is it too dangerous and we should
                // return an error instead?
            }
            rb = Response.ok(String.format("Successfully deleted examples in training set '%s'.\n",
                trainingSet.getName()));
        }
        addCORSOrigin(servletContext, rb, headers);
        return rb.build();
    }
View Full Code Here

    public TrainingSet getTrainingSet() {
        if (trainingSet != null) {
            return trainingSet;
        }
        if (trainingSetTracker != null) {
            TrainingSet trainingsSet = (TrainingSet) trainingSetTracker.getService();
            if(trainingsSet == null){
                for(int i=0; i < 5 && trainingsSet == null; i++){
                    try {
                        trainingsSet = (TrainingSet) trainingSetTracker.waitForService(1000);
                    } catch (InterruptedException e) {/*ignore*/}
 
View Full Code Here

TOP

Related Classes of org.apache.stanbol.enhancer.topic.api.training.TrainingSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.