<commit_before>//@author A0094446X
#include "stdafx.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <QApplication>
#include <QList>
#include "NLP_manager.h"

using Task = You::Controller::Task;
using Result = You::Controller::Result;
using TaskList = You::Controller::TaskList;
using Controller = You::Controller::Controller;

void YouMainGUI::NLPManager::setup() {
	// To change to get list of tasks from session instead of ALL tasks.
	// Somehow pass sm's taskIDs into this.
	// Set result to current context
	QPixmap pixmap;
	pixmap.fill(Qt::transparent);
	pixmap.load(":/Status_green.png", 0);
	parentGUI->ui.statusIcon->setPixmap(QPixmap(":/Status_green.png"));
	parentGUI->ui.statusIcon->show();
	parentGUI->statusBar()->insertPermanentWidget(
		0, parentGUI->ui.statusIcon, 0);
	parentGUI->statusBar()->insertPermanentWidget(
		0, parentGUI->ui.statusMessage, 0);
}

void YouMainGUI::NLPManager::query(
	const QString& query,
	const You::Controller::TaskList& taskList) {
	Result result = Controller::get().query(query.toStdWString(), taskList);

	struct ResultProcessorVisitor : boost::static_visitor<void> {
		explicit ResultProcessorVisitor(YouMainGUI* const parentGUI)
		: parentGUI(parentGUI) {
		}

		void operator()(You::Controller::ADD_RESULT addResult) {
			parentGUI->addTask(addResult.task);
		}
		void operator()(You::Controller::EDIT_RESULT editResult) {
			parentGUI->editTask(editResult.task);
		}
		void operator()(You::Controller::DELETE_RESULT deleteResult) {
			parentGUI->deleteTask(deleteResult.task);
		}

	private:
		YouMainGUI* parentGUI;
	};

	ResultProcessorVisitor visitor(parentGUI);
	boost::apply_visitor(visitor, result);
}

TaskList YouMainGUI::NLPManager::getTasks(
	const QList<Task::ID>& taskIDs) {
	std::vector<Task::ID> taskIDVector;
	std::copy(
		taskIDs.begin(),
		taskIDs.end(),
		std::back_inserter(taskIDVector)
	);

	return Controller::get().getTasks(taskIDVector);
}

TaskList YouMainGUI::NLPManager::getTasks() {
	return Controller::get().getTasks();
}<commit_msg>Fix compile error, GUI needs implementing.<commit_after>//@author A0094446X
#include "stdafx.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <QApplication>
#include <QList>
#include "NLP_manager.h"

using Task = You::Controller::Task;
using Result = You::Controller::Result;
using TaskList = You::Controller::TaskList;
using Controller = You::Controller::Controller;

void YouMainGUI::NLPManager::setup() {
	// To change to get list of tasks from session instead of ALL tasks.
	// Somehow pass sm's taskIDs into this.
	// Set result to current context
	QPixmap pixmap;
	pixmap.fill(Qt::transparent);
	pixmap.load(":/Status_green.png", 0);
	parentGUI->ui.statusIcon->setPixmap(QPixmap(":/Status_green.png"));
	parentGUI->ui.statusIcon->show();
	parentGUI->statusBar()->insertPermanentWidget(
		0, parentGUI->ui.statusIcon, 0);
	parentGUI->statusBar()->insertPermanentWidget(
		0, parentGUI->ui.statusMessage, 0);
}

void YouMainGUI::NLPManager::query(
	const QString& query,
	const You::Controller::TaskList& taskList) {
	Result result = Controller::get().query(query.toStdWString(), taskList);

	struct ResultProcessorVisitor : boost::static_visitor<void> {
		explicit ResultProcessorVisitor(YouMainGUI* const parentGUI)
		: parentGUI(parentGUI) {
		}

		void operator()(You::Controller::ADD_RESULT addResult) {
			parentGUI->addTask(addResult.task);
		}
		void operator()(const You::Controller::SHOW_RESULT& showResult) {
		}
		void operator()(You::Controller::EDIT_RESULT editResult) {
			parentGUI->editTask(editResult.task);
		}
		void operator()(You::Controller::DELETE_RESULT deleteResult) {
			parentGUI->deleteTask(deleteResult.task);
		}

	private:
		YouMainGUI* parentGUI;
	};

	ResultProcessorVisitor visitor(parentGUI);
	boost::apply_visitor(visitor, result);
}

TaskList YouMainGUI::NLPManager::getTasks(
	const QList<Task::ID>& taskIDs) {
	std::vector<Task::ID> taskIDVector;
	std::copy(
		taskIDs.begin(),
		taskIDs.end(),
		std::back_inserter(taskIDVector)
	);

	return Controller::get().getTasks(taskIDVector);
}

TaskList YouMainGUI::NLPManager::getTasks() {
	return Controller::get().getTasks();
}
{'fraction_non_alphanumeric': 0.14765906362545017, 'fraction_numerical': 0.005762304921968787, 'mean_word_length': 6.479353680430879, 'pattern_counts': {'":': 4, '<': 15, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2813593', 'n_tokens_mistral': 1443, 'n_tokens_neox': 1356, 'n_words': 251}