<commit_before>#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "Utils.hpp"
#include "KeyframeSelection.hpp"
#include <iostream>
#include <vector>
#include <sstream>
#include <fstream>
#include <utility>
#include <algorithm>

using namespace std;
using namespace cv;

double SIMILARITY_THRESHOLD = 0.95;
double MIN_SIMILARITY = 0.2;

int main(int argc, char* argv[]) {
	if(argc < 3 && argc > 4) {
		cout << "Incorrect parameter count." << endl;
		cout << "Please, use './VKFrames <videoFilePath> <outputFilePath.csv> [<videoShotSegmentation.csv>]'" << endl;
		return 1;
	}	
	
	string videoPath = string(argv[1]);
	if(!Utils::checkFile(videoPath)) {
		cout << "The videoFilePath seems to be invalid or cannot be read" << endl;
		return 1;
	}
	
	string outputPath = string(argv[2]);
	if(Utils::checkFile(outputPath)) {		
		while(true) {
			string in;
			cout << "File '" << outputPath << "' already exists. Overwrite ? [y/N]" << endl;
			getline(std::cin,in);
			if(in == "Y" || in == "y") {
				break;
			}
			if(in == "" || in == "N" || in == "n") {
				return 1;
			}
		}
	} else {
		if(!Utils::checkOutputFile(outputPath)) {
			cout << "The outputFilePath seems to be invalid or cannot be written" << endl;
			return 1;
		}
	}
	
	vector< pair<int,int> > shots;
	if(argc == 4) {
		string inputCSV = string(argv[3]);
		if(!Utils::checkFile(inputCSV)) {
			cout << "The videoShotSegmentation seems to be invalid or cannot be read. Ignoring." << endl;			
		} else {
			shots = Utils::normalizePairs(Utils::parseCSV(inputCSV),-1);
		}		
	}
	
	KeyframeSelection kfs(videoPath, shots, SIMILARITY_THRESHOLD, MIN_SIMILARITY);
	vector< pair<int,int> > keyframes = Utils::normalizePairs(kfs.getKeyFrames(),1);
	
	Utils::writeOutputFile(outputPath,keyframes);	
	return 0;
}<commit_msg>Corrected a bug when running the program with incorrect number of parameters<commit_after>#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "Utils.hpp"
#include "KeyframeSelection.hpp"
#include <iostream>
#include <vector>
#include <sstream>
#include <fstream>
#include <utility>
#include <algorithm>

using namespace std;
using namespace cv;

double SIMILARITY_THRESHOLD = 0.95;
double MIN_SIMILARITY = 0.2;

int main(int argc, char* argv[]) {
	if(argc < 3 || argc > 4) {
		cout << "Incorrect parameter count." << endl;
		cout << "Please, use './VKFrames <videoFilePath> <outputFilePath.csv> [<videoShotSegmentation.csv>]'" << endl;
		return 1;
	}	
	
	string videoPath = string(argv[1]);
	if(!Utils::checkFile(videoPath)) {
		cout << "The videoFilePath seems to be invalid or cannot be read" << endl;
		return 1;
	}
	
	string outputPath = string(argv[2]);
	if(Utils::checkFile(outputPath)) {		
		while(true) {
			string in;
			cout << "File '" << outputPath << "' already exists. Overwrite ? [y/N]" << endl;
			getline(std::cin,in);
			if(in == "Y" || in == "y") {
				break;
			}
			if(in == "" || in == "N" || in == "n") {
				return 1;
			}
		}
	} else {
		if(!Utils::checkOutputFile(outputPath)) {
			cout << "The outputFilePath seems to be invalid or cannot be written" << endl;
			return 1;
		}
	}
	
	vector< pair<int,int> > shots;
	if(argc == 4) {
		string inputCSV = string(argv[3]);
		if(!Utils::checkFile(inputCSV)) {
			cout << "The videoShotSegmentation seems to be invalid or cannot be read. Ignoring." << endl;			
		} else {
			shots = Utils::normalizePairs(Utils::parseCSV(inputCSV),-1);
		}		
	}
	
	KeyframeSelection kfs(videoPath, shots, SIMILARITY_THRESHOLD, MIN_SIMILARITY);
	vector< pair<int,int> > keyframes = Utils::normalizePairs(kfs.getKeyFrames(),1);
	
	Utils::writeOutputFile(outputPath,keyframes);	
	return 0;
}
{'fraction_non_alphanumeric': 0.16138482023968043, 'fraction_numerical': 0.01118508655126498, 'mean_word_length': 4.305084745762712, 'pattern_counts': {'":': 0, '<': 87, '<?xml version=': 0, '>': 31, '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': '172301', 'n_tokens_mistral': 1494, 'n_tokens_neox': 1347, 'n_words': 331}