/*
    Copyright (C) 2012 Bartosz Broda, Jacek Bochenek, Łukasz Biłeńkij, 
    Damian Jaworski, Wojciech Mazur, Dominik Piasecki, Maciej Piasecki, 
    Radosław Ramocki
    
    This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your option)
any later version.

    This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. 

    See the LICENSE and COPYING files for more details.
*/

#ifndef LINER_H
#define LINER_H

#include <string>
#include <vector>

namespace Corpus2{



class Liner
{
public:
	Liner(std::string model, std::string nerd,std::string linpath,std::string linfile);
	~Liner();

	typedef std::pair <std::pair<int,int>,std::string > linerTuple;

	void run_liner();
	std::string do_liner(std::string sentence);
	std::vector<linerTuple> process_liner_output(std::string liner_string);
	void reset_liner();

private:
	void close_liner(void);
	static bool tupleComp (const linerTuple& i, const linerTuple& j);

	std::string nerd_path;
	std::string model_file;
	std::string liner_path;
	std::string liner_file;

	pid_t pid;
	int	commpipe[2];
	int	commpipe2[2];
};

} // ns Corpus2

#endif // LINER_H
