Commit 3179d5fd by etcart

added comments and explanations

parent d78631fd
No preview for this file type
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <dirent.h> #include <dirent.h>
#include <time.h> #include <time.h>
#define RIVSIZE 5 #define RIVSIZE 5
#define CACHESIZE 0 #define CACHESIZE 0
#define THRESHOLD 0.70 #define THRESHOLD 0.70
#include "RIVtoolsCPUlinux.h" #include "RIVtoolsCPUlinux.h"
void getcentroids(sparseRIV* centroids, sparseRIV* vectorSet, int centroidCount, int vectorCount); void getcentroids(sparseRIV* centroids, sparseRIV* vectorSet, int centroidCount, int vectorCount);
void directoryToL2s(char *rootString, sparseRIV** fileRIVs, int *fileCount); void directoryToL2s(char *rootString, sparseRIV** fileRIVs, int *fileCount);
int main(int argc, char *argv[]){ int main(int argc, char *argv[]){
clock_t begintotal = clock(); clock_t begintotal = clock();
int fileCount = 0; int fileCount = 0;
RIVInit(); RIVInit();
sparseRIV *fileRIVs = (sparseRIV*) malloc(1*sizeof(sparseRIV)); sparseRIV *fileRIVs = (sparseRIV*) malloc(1*sizeof(sparseRIV));
char rootString[2000]; char rootString[2000];
if(argc <2){ if(argc <2){
printf("give me a directory"); printf("give me a directory");
return 1; return 1;
} }
strcpy(rootString, argv[1]); strcpy(rootString, argv[1]);
strcat(rootString, "/"); strcat(rootString, "/");
directoryToL2s(rootString, &fileRIVs, &fileCount); directoryToL2s(rootString, &fileRIVs, &fileCount);
printf("fileCount: %d\n", fileCount); printf("fileCount: %d\n", fileCount);
getMagnitudes(fileRIVs, fileCount); getMagnitudes(fileRIVs, fileCount);
clock_t beginnsquared = clock(); clock_t beginnsquared = clock();
sparseRIV centroids[5]; sparseRIV centroids[5];
strcpy(centroids[0].name, "boobs"); strcpy(centroids[0].name, "boobs");
strcpy(centroids[1].name, "ass"); strcpy(centroids[1].name, "ass");
strcpy(centroids[2].name, "shit"); strcpy(centroids[2].name, "shit");
strcpy(centroids[3].name, "cocks"); strcpy(centroids[3].name, "cocks");
strcpy(centroids[4].name, "fuck"); strcpy(centroids[4].name, "fuck");
for(int i=0; i<5; i++){ for(int i=0; i<5; i++){
centroids[i] = wordtoL2(centroids[i].name); centroids[i] = wordtoL2(centroids[i].name);
} }
getMagnitudes(centroids, 5); getMagnitudes(centroids, 5);
getcentroids(centroids, fileRIVs, 5, fileCount); getcentroids(centroids, fileRIVs, 5, fileCount);
clock_t endnsquared = clock(); clock_t endnsquared = clock();
double time = (double)(endnsquared - beginnsquared) / CLOCKS_PER_SEC; double time = (double)(endnsquared - beginnsquared) / CLOCKS_PER_SEC;
printf("nsquared time:%lf\n\n", time); printf("nsquared time:%lf\n\n", time);
printf("%d <", RIVKey.thing); printf("%d <", RIVKey.thing);
clock_t endtotal = clock(); clock_t endtotal = clock();
double time_spent = (double)(endtotal - begintotal) / CLOCKS_PER_SEC; double time_spent = (double)(endtotal - begintotal) / CLOCKS_PER_SEC;
printf("total time:%lf\n\n", time_spent); printf("total time:%lf\n\n", time_spent);
free(fileRIVs); free(fileRIVs);
return 0; return 0;
} }
void directoryToL2s(char *rootString, sparseRIV** fileRIVs, int *fileCount){ void directoryToL2s(char *rootString, sparseRIV** fileRIVs, int *fileCount){
char pathString[2000]; char pathString[2000];
DIR *directory; DIR *directory;
struct dirent *files = 0; struct dirent *files = 0;
if(!(directory = opendir(rootString))){ if(!(directory = opendir(rootString))){
printf("location not found, %s\n", rootString); printf("location not found, %s\n", rootString);
return; return;
} }
while((files=readdir(directory))){ while((files=readdir(directory))){
if(*(files->d_name) == '.') continue; if(*(files->d_name) == '.') continue;
if(files->d_type == DT_DIR){ if(files->d_type == DT_DIR){
strcpy(pathString, rootString); strcpy(pathString, rootString);
strcat(pathString, files->d_name); strcat(pathString, files->d_name);
strcat(pathString, "/"); strcat(pathString, "/");
directoryToL2s(pathString, fileRIVs, fileCount); directoryToL2s(pathString, fileRIVs, fileCount);
} }
strcpy(pathString, rootString); strcpy(pathString, rootString);
strcat(pathString, files->d_name); strcat(pathString, files->d_name);
FILE *input = fopen(pathString, "r"); FILE *input = fopen(pathString, "r");
if(!input){ if(!input){
printf("file %s doesn't seem to exist, breaking out of loop", pathString); printf("file %s doesn't seem to exist, breaking out of loop", pathString);
return; return;
}else{ }else{
(*fileRIVs) = (sparseRIV*)realloc((*fileRIVs), ((*fileCount)+1)*sizeof(sparseRIV)); (*fileRIVs) = (sparseRIV*)realloc((*fileRIVs), ((*fileCount)+1)*sizeof(sparseRIV));
(*fileRIVs)[(*fileCount)] = fileToL2Clean(input); (*fileRIVs)[(*fileCount)] = fileToL2Clean(input);
strcpy((*fileRIVs)[(*fileCount)].name, pathString); strcpy((*fileRIVs)[(*fileCount)].name, pathString);
fclose(input); fclose(input);
(*fileCount)++; (*fileCount)++;
} }
} }
} }
void getcentroids(sparseRIV* centroids, sparseRIV* vectorSet, int centroidCount, int vectorCount){ void getcentroids(sparseRIV* centroids, sparseRIV* vectorSet, int centroidCount, int vectorCount){
float** cosines = malloc(centroidCount*sizeof(int*)); float** cosines = malloc(centroidCount*sizeof(int*));
for(int i=0; i<centroidCount; i++){ for(int i=0; i<centroidCount; i++){
cosines[i] = cosineCompare(centroids[i], vectorSet, vectorCount); cosines[i] = cosineCompare(centroids[i], vectorSet, vectorCount);
} }
int* centroidIndexes[centroidCount]; int* centroidIndexes[centroidCount];
int indexCounts[centroidCount]; int indexCounts[centroidCount];
int* denses[centroidCount]; int* denses[centroidCount];
*centroidIndexes = calloc(vectorCount*centroidCount, sizeof(int)); *centroidIndexes = calloc(vectorCount*centroidCount, sizeof(int));
*denses = malloc(RIVKey.RIVsize*centroidCount * sizeof(int)); *denses = malloc(RIVKey.RIVsize*centroidCount * sizeof(int));
for(int i=1; i<centroidCount; i++){ for(int i=1; i<centroidCount; i++){
centroidIndexes[i] = centroidIndexes[0]+i*vectorCount; centroidIndexes[i] = centroidIndexes[0]+i*vectorCount;
denses[i] = denses[0] +i*RIVKey.RIVsize; denses[i] = denses[0] +i*RIVKey.RIVsize;
} }
float token = 2.0; float token = 2.0;
int counter = 0; int counter = 0;
for(int i=0; i<vectorCount; i++){ for(int i=0; i<vectorCount; i++){
token = 2.0; token = 2.0;
printf("\nfor vector %d:\n", i); printf("\nfor vector %d:\n", i);
for(int j = 0; j<centroidCount; j++){ for(int j = 0; j<centroidCount; j++){
printf("centroid %d: %f", j, cosines[j][i]); printf("centroid %d: %f", j, cosines[j][i]);
if(fabsf(cosines[j][i])< token){ if(fabsf(cosines[j][i])< token){
token = fabsf(cosines[j][i]); token = fabsf(cosines[j][i]);
counter = j; counter = j;
} }
} }
centroidIndexes[counter][indexCounts[counter]] = i; centroidIndexes[counter][indexCounts[counter]] = i;
indexCounts[counter] += 1; indexCounts[counter] += 1;
} }
for(int i=0; i<centroidCount; i++){ for(int i=0; i<centroidCount; i++){
memset(denses[i], 0, RIVKey.RIVsize); memset(denses[i], 0, RIVKey.RIVsize);
printf("\n\nnumber %d\n", i); printf("\n\nnumber %d\n", i);
for(int j=0; j<indexCounts[i]; i++){ for(int j=0; j<indexCounts[i]; i++){
addS2D(denses[i], vectorSet[j]); addS2D(denses[i], vectorSet[j]);
for(int k=0; k<RIVKey.RIVsize; k++){ for(int k=0; k<RIVKey.RIVsize; k++){
printf("%d, ", denses[i][k]); printf("%d, ", denses[i][k]);
} }
} }
} }
} }
No preview for this file type
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <dirent.h> #include <dirent.h>
#include <time.h> #include <time.h>
#define RIVSIZE 5000 #define RIVSIZE 5000
#define CACHESIZE 0 #define CACHESIZE 0
#define NONZEROS 2 #define NONZEROS 2
#define THRESHOLD 0.7 #define THRESHOLD 0.7
#define COSINEACTION do {\ #define COSINEACTION do {\
if(cosine > THRESHOLD){ \ if(cosine > THRESHOLD){ \
printf("%s\t%s\n%f\n", baseRIV.name, (*multipliers).name, cosine);\ printf("%s\t%s\n%f\n", baseRIV.name, (*multipliers).name, cosine);\
(*multipliers).boolean = 0; \ (*multipliers).boolean = 0; \
RIVKey.thing++; \ RIVKey.thing++; \
}\ }\
}while(0) }while(0)
#include "RIVtoolsMorphic.h" #include "RIVtoolsMorphic.h"
void directoryToL2s(char *rootString, sparseRIV** fileRIVs, int *fileCount); void directoryToL2s(char *rootString, sparseRIV** fileRIVs, int *fileCount);
int main(int argc, char *argv[]){ int main(int argc, char *argv[]){
clock_t begintotal = clock(); clock_t begintotal = clock();
int fileCount = 0; int fileCount = 0;
RIVInit(); RIVInit();
sparseRIV *fileRIVs = (sparseRIV*) malloc(1*sizeof(sparseRIV)); sparseRIV *fileRIVs = (sparseRIV*) malloc(1*sizeof(sparseRIV));
char rootString[2000]; char rootString[2000];
if(argc <2){ if(argc <2){
printf("give me a directory"); printf("give me a directory");
return 1; return 1;
} }
strcpy(rootString, argv[1]); strcpy(rootString, argv[1]);
strcat(rootString, "/"); strcat(rootString, "/");
directoryToL2s(rootString, &fileRIVs, &fileCount); directoryToL2s(rootString, &fileRIVs, &fileCount);
printf("fileCount: %d\n", fileCount); printf("fileCount: %d\n", fileCount);
sparseRIV* fileRIVs_slider = fileRIVs; sparseRIV* fileRIVs_slider = fileRIVs;
sparseRIV* fileRIVs_stop = fileRIVs+fileCount; sparseRIV* fileRIVs_stop = fileRIVs+fileCount;
while(fileRIVs_slider <fileRIVs_stop){ while(fileRIVs_slider <fileRIVs_stop){
(*fileRIVs_slider).magnitude = getMagnitudeSparse(*fileRIVs_slider); (*fileRIVs_slider).magnitude = getMagnitudeSparse(*fileRIVs_slider);
fileRIVs_slider++; fileRIVs_slider++;
} }
clock_t beginnsquared = clock(); clock_t beginnsquared = clock();
float cosine; float cosine;
float minmag; float minmag;
float maxmag; float maxmag;
denseRIV baseDense; denseRIV baseDense;
baseDense.values = malloc(RIVSIZE*sizeof(int)); baseDense.values = malloc(RIVSIZE*sizeof(int));
fileRIVs_slider = fileRIVs; fileRIVs_slider = fileRIVs;
sparseRIV* comparators_slider; sparseRIV* comparators_slider;
while(fileRIVs_slider<fileRIVs_stop){ while(fileRIVs_slider<fileRIVs_stop){
comparators_slider = fileRIVs; comparators_slider = fileRIVs;
memset(baseDense.values, 0, RIVSIZE*sizeof(int)); memset(baseDense.values, 0, RIVSIZE*sizeof(int));
baseDense.values = addS2D(baseDense.values, *fileRIVs_slider); baseDense.values = addS2D(baseDense.values, *fileRIVs_slider);
baseDense.magnitude = (*fileRIVs_slider).magnitude; baseDense.magnitude = (*fileRIVs_slider).magnitude;
minmag = baseDense.magnitude*.85; minmag = baseDense.magnitude*.85;
maxmag = baseDense.magnitude*1.15; maxmag = baseDense.magnitude*1.15;
while(comparators_slider < fileRIVs_slider){ while(comparators_slider < fileRIVs_slider){
if((*comparators_slider).magnitude < maxmag && (*comparators_slider).magnitude > minmag && (*comparators_slider).boolean){ if((*comparators_slider).magnitude < maxmag && (*comparators_slider).magnitude > minmag && (*comparators_slider).boolean){
cosine = cosCompare(baseDense, *comparators_slider); cosine = cosCompare(baseDense, *comparators_slider);
if(cosine>THRESHOLD){ if(cosine>THRESHOLD){
printf("%s\t%s\n%f\n", (*fileRIVs_slider).name , (*comparators_slider).name, cosine); printf("%s\t%s\n%f\n", (*fileRIVs_slider).name , (*comparators_slider).name, cosine);
(*comparators_slider).boolean = 0; (*comparators_slider).boolean = 0;
RIVKey.thing++; RIVKey.thing++;
} }
} }
comparators_slider++; comparators_slider++;
//cosineCompare(fileRIVs[i], fileRIVs, i); //cosineCompare(fileRIVs[i], fileRIVs, i);
} }
fileRIVs_slider++; fileRIVs_slider++;
} }
clock_t endnsquared = clock(); clock_t endnsquared = clock();
double time = (double)(endnsquared - beginnsquared) / CLOCKS_PER_SEC; double time = (double)(endnsquared - beginnsquared) / CLOCKS_PER_SEC;
printf("nsquared time:%lf\n\n", time); printf("nsquared time:%lf\n\n", time);
printf("%d <", RIVKey.thing); printf("%d <", RIVKey.thing);
clock_t endtotal = clock(); clock_t endtotal = clock();
double time_spent = (double)(endtotal - begintotal) / CLOCKS_PER_SEC; double time_spent = (double)(endtotal - begintotal) / CLOCKS_PER_SEC;
printf("total time:%lf\n\n", time_spent); printf("total time:%lf\n\n", time_spent);
free(fileRIVs); free(fileRIVs);
return 0; return 0;
} }
void directoryToL2s(char *rootString, sparseRIV** fileRIVs, int *fileCount){ void directoryToL2s(char *rootString, sparseRIV** fileRIVs, int *fileCount){
char pathString[2000]; char pathString[2000];
DIR *directory; DIR *directory;
struct dirent *files = 0; struct dirent *files = 0;
if(!(directory = opendir(rootString))){ if(!(directory = opendir(rootString))){
printf("location not found, %s\n", rootString); printf("location not found, %s\n", rootString);
return; return;
} }
while((files=readdir(directory))){ while((files=readdir(directory))){
if(*(files->d_name) == '.') continue; if(*(files->d_name) == '.') continue;
if(files->d_type == DT_DIR){ if(files->d_type == DT_DIR){
strcpy(pathString, rootString); strcpy(pathString, rootString);
strcat(pathString, files->d_name); strcat(pathString, files->d_name);
strcat(pathString, "/"); strcat(pathString, "/");
directoryToL2s(pathString, fileRIVs, fileCount); directoryToL2s(pathString, fileRIVs, fileCount);
} }
strcpy(pathString, rootString); strcpy(pathString, rootString);
strcat(pathString, files->d_name); strcat(pathString, files->d_name);
FILE *input = fopen(pathString, "r"); FILE *input = fopen(pathString, "r");
if(!input){ if(!input){
printf("file %s doesn't seem to exist, breaking out of loop", pathString); printf("file %s doesn't seem to exist, breaking out of loop", pathString);
return; return;
}else{ }else{
(*fileRIVs) = (sparseRIV*)realloc((*fileRIVs), ((*fileCount)+1)*sizeof(sparseRIV)); (*fileRIVs) = (sparseRIV*)realloc((*fileRIVs), ((*fileCount)+1)*sizeof(sparseRIV));
(*fileRIVs)[(*fileCount)] = fileToL2(input); (*fileRIVs)[(*fileCount)] = fileToL2(input);
strcpy((*fileRIVs)[(*fileCount)].name, pathString); strcpy((*fileRIVs)[(*fileCount)].name, pathString);
fclose(input); fclose(input);
(*fileCount)++; (*fileCount)++;
} }
} }
} }
No preview for this file type
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
#define CACHESIZE 100000 #define CACHESIZE 100000
#include "RIVtoolsCPUlinux.h" #include "RIVtoolsCPUlinux.h"
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#include <dirent.h> #include <dirent.h>
#include <error.h> #include <error.h>
void fileGrind(FILE* textFile); void fileGrind(FILE* textFile);
void addS2Ds(denseRIV *denseSet, sparseRIV additive, int RIVCount); void addS2Ds(denseRIV *denseSet, sparseRIV additive, int RIVCount);
int checkDupe(denseRIV* RIVSet, char* word, int wordCount); int checkDupe(denseRIV* RIVSet, char* word, int wordCount);
void directoryGrind(char *rootString); void directoryGrind(char *rootString);
int main(int argc, char *argv[]){ int main(int argc, char *argv[]){
clock_t begintotal = clock(); clock_t begintotal = clock();
RIVInit(); RIVInit();
char pathString[1000]; char pathString[1000];
strcpy(pathString, argv[1]); strcpy(pathString, argv[1]);
strcat(pathString, "/"); strcat(pathString, "/");
directoryGrind(pathString); directoryGrind(pathString);
clock_t endtotal = clock(); clock_t endtotal = clock();
double time_spent = (double)(endtotal - begintotal) / CLOCKS_PER_SEC; double time_spent = (double)(endtotal - begintotal) / CLOCKS_PER_SEC;
printf("total time:%lf\n\n", time_spent); printf("total time:%lf\n\n", time_spent);
RIVCleanup(); RIVCleanup();
return 0; return 0;
} }
void addS2Ds(denseRIV *denseSet, sparseRIV additive, int RIVCount){ void addS2Ds(denseRIV *denseSet, sparseRIV additive, int RIVCount){
denseRIV *denseSet_slider; denseRIV *denseSet_slider;
denseRIV *dense_stop = denseSet+RIVCount; denseRIV *dense_stop = denseSet+RIVCount;
int *locations = additive.locations; int *locations = additive.locations;
int *locations_stop = locations+additive.count; int *locations_stop = locations+additive.count;
int *values = additive.values; int *values = additive.values;
//int *target; //int *target;
while(locations<locations_stop){ while(locations<locations_stop){
denseSet_slider = denseSet; denseSet_slider = denseSet;
while(denseSet_slider<dense_stop){ while(denseSet_slider<dense_stop){
(*denseSet_slider).values[*locations]+= *values; (*denseSet_slider).values[*locations]+= *values;
//*target+=*values; //*target+=*values;
denseSet_slider++; denseSet_slider++;
} }
locations++; locations++;
values++; values++;
} }
} }
int checkDupe(denseRIV* RIVSet, char* word, int wordCount){ int checkDupe(denseRIV* RIVSet, char* word, int wordCount){
denseRIV* RIVStop = RIVSet+wordCount; denseRIV* RIVStop = RIVSet+wordCount;
while(RIVSet<RIVStop){ while(RIVSet<RIVStop){
if(!strcmp(word, RIVSet->name)){ if(!strcmp(word, RIVSet->name)){
return 1; return 1;
} }
RIVSet++; RIVSet++;
} }
return 0; return 0;
} }
void directoryGrind(char *rootString){ void directoryGrind(char *rootString){
char pathString[2000]; char pathString[2000];
DIR *directory; DIR *directory;
struct dirent *files = 0; struct dirent *files = 0;
if(!(directory = opendir(rootString))){ if(!(directory = opendir(rootString))){
printf("location not found, %s\n", rootString); printf("location not found, %s\n", rootString);
return; return;
} }
while((files=readdir(directory))){ while((files=readdir(directory))){
while(!strcmp(files->d_name, ".") || !strcmp(files->d_name, "..")){ while(!strcmp(files->d_name, ".") || !strcmp(files->d_name, "..")){
files = readdir(directory); files = readdir(directory);
} }
if(files->d_type == DT_DIR){ if(files->d_type == DT_DIR){
strcpy(pathString, rootString); strcpy(pathString, rootString);
strcat(pathString, files->d_name); strcat(pathString, files->d_name);
strcat(pathString, "/"); strcat(pathString, "/");
directoryGrind(pathString); directoryGrind(pathString);
} }
strcpy(pathString, rootString); strcpy(pathString, rootString);
strcat(pathString, files->d_name); strcat(pathString, files->d_name);
printf("%s\n", pathString); printf("%s\n", pathString);
FILE *input = fopen(pathString, "r+"); FILE *input = fopen(pathString, "r+");
if(input){ if(input){
fileGrind(input); fileGrind(input);
fclose(input); fclose(input);
} }
} }
} }
void fileGrind(FILE* textFile){ void fileGrind(FILE* textFile){
sparseRIV aggregateRIV = fileToL2Clean(textFile); sparseRIV aggregateRIV = fileToL2Clean(textFile);
fseek(textFile, 0, SEEK_SET); fseek(textFile, 0, SEEK_SET);
int wordCount = 0; int wordCount = 0;
denseRIV *RIVArray = (denseRIV*)malloc(aggregateRIV.frequency*sizeof(denseRIV)); denseRIV *RIVArray = (denseRIV*)malloc(aggregateRIV.frequency*sizeof(denseRIV));
char word[200]; char word[200];
while(fscanf(textFile, "%99s", word)){ while(fscanf(textFile, "%99s", word)){
if(feof(textFile)) break; if(feof(textFile)) break;
if(!(*word))continue; if(!(*word))continue;
if(!isWordClean((char*)word)){ if(!isWordClean((char*)word)){
continue; continue;
} }
if(checkDupe(RIVArray, word, wordCount)){ if(checkDupe(RIVArray, word, wordCount)){
continue; continue;
} }
RIVArray[wordCount] = lexPull(word); RIVArray[wordCount] = lexPull(word);
if(!*((RIVArray[wordCount].name))) break; if(!*((RIVArray[wordCount].name))) break;
int* thing = RIVArray[wordCount].frequency; int* thing = RIVArray[wordCount].frequency;
*thing = *thing + 1; *thing = *thing + 1;
//printf("%s, %d, %d\n", RIVArray[wordCount].name, *(RIVArray[wordCount].frequency), *thing); //printf("%s, %d, %d\n", RIVArray[wordCount].name, *(RIVArray[wordCount].frequency), *thing);
wordCount++; wordCount++;
} }
//printf("%d\n", wordCount); //printf("%d\n", wordCount);
addS2Ds(RIVArray, aggregateRIV, wordCount); addS2Ds(RIVArray, aggregateRIV, wordCount);
denseRIV* RIVArray_slider = RIVArray; denseRIV* RIVArray_slider = RIVArray;
denseRIV* RIVArray_stop = RIVArray+wordCount; denseRIV* RIVArray_stop = RIVArray+wordCount;
while(RIVArray_slider<RIVArray_stop){ while(RIVArray_slider<RIVArray_stop){
lexPush(*RIVArray_slider); lexPush(*RIVArray_slider);
RIVArray_slider++; RIVArray_slider++;
} }
free(RIVArray); free(RIVArray);
free(aggregateRIV.locations); free(aggregateRIV.locations);
//free(aggregateRIV.values); //free(aggregateRIV.values);
} }
File added
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <time.h>
#include "RIVtoolsCPUlinux.h"
void directoryToL2s(char *rootString);
int main(){
RIVInit();
char rootString[] = "lexicon/";
directoryToL2s(rootString);
}
void directoryToL2s(char *rootString){
sparseRIV fileRIV;
char pathString[2000];
DIR *directory;
struct dirent *files = 0;
if(!(directory = opendir(rootString))){
printf("location not found, %s\n", rootString);
return;
}
while((files=readdir(directory))){
if(*(files->d_name) == '.') continue;
if(files->d_type == DT_DIR){
strcpy(pathString, rootString);
strcat(pathString, files->d_name);
strcat(pathString, "/");
directoryToL2s(pathString);
}
strcpy(pathString, rootString);
strcat(pathString, files->d_name);
FILE *input = fopen(pathString, "r");
if(!input){
printf("file %s doesn't seem to exist, breaking out of loop", pathString);
return;
}else{
denseRIV temp = lexPull(pathString);
fileRIV = consolidateD2S(temp.values);
strcpy(fileRIV.name, pathString);
float count = fileRIV.count;
printf("%s, saturation: %f\n", fileRIV.name, count);
fclose(input);
free(temp.values);
//free(fileRIV.locations);
}
}
}
File added
meet_verb discuss_verb non-grid_adjective am_noun process_verb attendee_noun julia_noun lynn_noun steve_noun sheila_noun meet_verb discuss_verb non-grid_adjective am_noun process_verb attendee_noun julia_noun lynn_noun steve_noun sheila_noun
calendar_noun entry_noun appointment_noun calendar_noun entry_noun appointment_noun
description_noun meet_verb discuss_verb non-grid_adjective am_noun process_verb attendee_noun julia_noun lynn_noun steve_noun sheila_noun jerry_noun conference_noun room_noun description_noun meet_verb discuss_verb non-grid_adjective am_noun process_verb attendee_noun julia_noun lynn_noun steve_noun sheila_noun jerry_noun conference_noun room_noun
date_noun time_noun pm_noun pm_noun central_noun standard_noun time_noun date_noun time_noun pm_noun pm_noun central_noun standard_noun time_noun
detailed_adjective description_noun united_noun states_noun license_noun detailed_adjective description_noun united_noun states_noun license_noun
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment