Example #1
0
int main(int argc, char* argv[]) {
	cout << "argc " << argc << endl;
	cout << "argv[0] " << argv[0] << endl;
	cout << "argv[1] " << argv[1] << endl;

	ifstream reader(argv[1]);
	string line;
	vector<string> instance;
	Stemmer stemmer;
	int positive = 0;
	int negative = 0;
	int total = 0;
	while(reader.good()) {
		getline(reader, line);
		instance = split(line, '\t');
		if(instance.size() > 4) {
			if(instance[3] == "v") {
				cout << line << endl;
				string stem = stemmer.stem(instance[1]);
				cout << instance[2] + "/" + stem << endl;
				cout << (stem == instance[2]) << endl;
				if(!stem.compare(instance[2])) {
					positive++;
				} else {
					negative++;
				}
				total++;
				cout << endl;
			}
		}
	}
	cout << "Total count " << total << endl;
	cout << "Positive count " << positive << endl;
	cout << "Accuracy of " << (float) positive / (float) total << endl; 	
}
Example #2
0
 void FTSQuery::_addTerm( const StopWords* sw, Stemmer& stemmer, const string& term, bool negated ) {
     string word = tolowerString( term );
     if ( sw->isStopWord( word ) )
         return;
     word = stemmer.stem( word );
     if ( negated )
         _negatedTerms.insert( word );
     else
         _terms.push_back( word );
 }