private static void WritePhraseLearningDataset() { foreach (var experiment in ConceptLearningDialogs.Experiments.Concat(CompositionLearningDialogs.Experiments)) //foreach (var experiment in new PhraseLearningDialogProvider(Experiments, "learn_restaurant_property2").Experiments) { var provider = new PhraseLearningDialogProvider(Experiments, experiment.Id); var writer = new PhraseLearningDatasetWriter(provider); writer.WriteValidDialogs(experiment.Id + ".json"); } }
private void annotationProvider(PhraseLearningDialogProvider dialogProvider, string url) { //refreshing if (GET("action") == "refresh") { dialogProvider.Refresh(); } //find id without annotation if (GET("action") == "id_without_annotation") { for (var i = 0; i < dialogProvider.DialogCount; ++i) { var testedDialog = dialogProvider.GetDialog(i); if (testedDialog.Annotation == null) { RedirectTo(url + "?id=" + i); return; } } } //annotation handling int annotatedId; int.TryParse(POST("annotated_id"), out annotatedId); var annotation = POST("annotation"); if (annotation != null) { var annotatedDialog = dialogProvider.GetDialog(annotatedId); if (annotatedDialog != null) { annotatedDialog.Annotate(annotation); } } //display indexed dialog int dialogIndex; int.TryParse(GET("id"), out dialogIndex); var dialog = dialogProvider.GetDialog(dialogIndex); SetParam("next_id_link", url + "?id=" + (dialogIndex + 1)); SetParam("previous_id_link", url + "?id=" + (dialogIndex - 1)); SetParam("refresh_link", url + "?id=" + dialogIndex + "&action=refresh"); SetParam("first_without_annotation_link", url + "?action=id_without_annotation"); SetParam("dialog", dialog); SetParam("total_dialog_count", dialogProvider.DialogCount); SetParam("dialog_index", dialogIndex.ToString()); Layout("layout.haml"); Render("annotate3.haml"); }
private static void InitializeExperiments() { //var simpleQuestions1 = Configuration.LoadSimpleQuestions("questions1.smpq"); var simpleQuestionsTrain = Configuration.SimpleQuestionsTrain; //var extensionQuestions = loadExtensionQuestions(Configuration.SimpleQuestionsTrain_Path); var experimentsRootPath = Configuration.ExperimentsRootPath; Experiments = new ExperimentCollection(experimentsRootPath, /* //question collection experiment * new QuestionCollectionExperiment(experimentsRootPath, "question_collection", 15, simpleQuestions1), * * //question collection experiment * new QuestionCollectionExperiment(experimentsRootPath, "question_collection2", 50, simpleQuestionsTrain), * * * //full operation question collection experiment */ new QuestionCollectionExperiment(experimentsRootPath, "question_collection_r_1", 100, simpleQuestionsTrain), new QuestionCollectionExperiment(experimentsRootPath, "question_collection_r_2", 100, simpleQuestionsTrain), new QuestionCollectionExperiment(experimentsRootPath, "question_collection_r_3", 100, simpleQuestionsTrain), new QuestionCollectionExperiment(experimentsRootPath, "question_collection_r_4", 100, simpleQuestionsTrain), new QuestionCollectionExperiment(experimentsRootPath, "question_collection_r_5", 100, simpleQuestionsTrain), new QuestionCollectionExperiment(experimentsRootPath, "question_collection_r_6", 100, simpleQuestionsTrain), new QuestionCollectionExperiment(experimentsRootPath, "question_collection_r_7", 100, simpleQuestionsTrain), new QuestionCollectionExperiment(experimentsRootPath, "question_collection_r_8", 100, simpleQuestionsTrain), new QuestionCollectionExperiment(experimentsRootPath, "question_collection_r_9", 100, simpleQuestionsTrain), /* new QuestionCollectionExperiment(experimentsRootPath, "question_collection_r_10", 100, simpleQuestionsTrain), * new QuestionCollectionExperiment(experimentsRootPath, "qdd_extension_r_1", 100, simpleQuestionsTrain), * new QuestionCollectionExperiment(experimentsRootPath, "qdd_extension_r_2", 100, simpleQuestionsTrain), * new QuestionCollectionExperiment(experimentsRootPath, "qdd_extension_r_3", 100, extensionQuestions), * new QuestionCollectionExperiment(experimentsRootPath, "qdd_extension_r_4", 100, extensionQuestions), * new QuestionCollectionExperiment(experimentsRootPath, "qdd_extension_r_5", 100, extensionQuestions), * new AnswerExtractionExperiment(experimentsRootPath, "answer_extraction", 100, simpleQuestionsTrain, Configuration.AnswerExtractor), * new GraphNavigationExperiment(experimentsRootPath, "graph_navigation", 100, Configuration.GetQuestionDialogsTrain()), * new GraphNavigationExperiment(experimentsRootPath, "edge_requests", 100, Configuration.GetQuestionDialogsTrain()),*/ /*new PhraseRestaurantExperiment(experimentsRootPath, "phrase_restaurant", 10, exportKnowledge: true, useKnowledge: false), * new PhraseRestaurantExperiment(experimentsRootPath, "phrase_restaurant2", 10, exportKnowledge: true, useKnowledge: false), * new PhraseRestaurantExperiment(experimentsRootPath, "phrase_restaurant3", 10, exportKnowledge: true, useKnowledge: false), * new PhraseRestaurantExperiment(experimentsRootPath, "phrase_restaurant4", 10, exportKnowledge: true, useKnowledge: false),*/ new LearnRestaurantPropertyExperiment(experimentsRootPath, "learn_restaurant_property", 10, exportKnowledge: true, useKnowledge: false, requestInformation: true), new PhraseRestaurantExperiment(experimentsRootPath, "shared_phrase_restaurant1", 10, exportKnowledge: true, useKnowledge: true), new PhraseRestaurantExperiment(experimentsRootPath, "shared_phrase_restaurant2", 10, exportKnowledge: true, useKnowledge: true), new LearnRestaurantPropertyExperiment(experimentsRootPath, "learn_restaurant_property2", 10, exportKnowledge: true, useKnowledge: true, requestInformation: true), new PhraseRestaurantExperiment(experimentsRootPath, "concept_learning1a", 50, exportKnowledge: true, useKnowledge: false), new PhraseRestaurantExperiment(experimentsRootPath, "concept_learning2a", 50, exportKnowledge: true, useKnowledge: false), new PhraseRestaurantExperiment(experimentsRootPath, "concept_learning1b", 50, exportKnowledge: true, useKnowledge: true), new PhraseRestaurantExperiment(experimentsRootPath, "concept_learning2b", 50, exportKnowledge: true, useKnowledge: true), new LearnRestaurantPropertyExperiment(experimentsRootPath, "composition_learning0", 50, exportKnowledge: true, useKnowledge: true, requestInformation: false), new LearnRestaurantPropertyExperiment(experimentsRootPath, "composition_learning1", 100, exportKnowledge: true, useKnowledge: true, requestInformation: true), new LearnRestaurantPropertyExperiment(experimentsRootPath, "composition_learning2", 100, exportKnowledge: true, useKnowledge: true, requestInformation: true), new LearnRestaurantPropertyExperiment(experimentsRootPath, "composition_learning3", 100, exportKnowledge: true, useKnowledge: true, requestInformation: true) ); QuestionDialogProvider = new QuestionDialogProvider(Experiments, simpleQuestionsTrain, "question_collection_r_"); ConceptLearningDialogs = new PhraseLearningDialogProvider(Experiments, "concept_learning1a", "concept_learning2a", "concept_learning1b", "concept_learning2b"); CompositionLearningDialogs = new PhraseLearningDialogProvider(Experiments, "composition_learning0", "composition_learning1", "composition_learning2", "composition_learning3"); }