A concordance is a list of words appearing in a body of text
A concordance is a list of words appearing in a body of text. The list of words includes only \"true\" words, consisting entirely of alphabetic characters, after all punctuation and whitcspacc characters have been discarded. Write a C99 function, with the prototype: char **concordance(char *filename, int *nwords); to build a concordance from a named text file. The first parameter, filename, provides the name of the text file containing the words. You may assume that the text file contains only alphabetic, punctuation, and whitespace characters. The second parameter, nwords, provides a pointer to an integer. On successful return from the function, the integer pointed to by nwords will contain the number of distinct words found in the file. On successful return, concordance will return a vector of strings, containing the distinct words found in the text file. If any problems are detected during the execution of concordance, the function should return the NULL pointer.
Solution
char **concordance(char *filename,int*nwords) throws Exception{
FileReader fileReader = new FileReader(filename);
BufferedReader bufferReader= new BufferedReader(fileReader );
String string=\" \", line =\" \";
while((line=bufferReader.readLine())!=null){
string +=line + \" \";
}
StringTokenizer stringTokenizer = new StringTokenizer(string)
return distinctStrings;
}
