<commit_before>package ClassLibrary;


import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Concordance implements Serializable {
    // private class fields.
    LinkedList[] hastable;
    String bookTitle, bookAuthor, filePath;
    int bookStartLine;
    
    public Concordance(String bt, String a, String fn) {
        this.hastable = new LinkedList[27];
        this.bookTitle = bt;
        this.bookAuthor = a;
        this.filePath = fn;
        this.bookStartLine = 0;
    }
    
    public boolean makeConcordance(){
        boolean success = false;
        int fileLineNumber = 0;
        int workLineNumber = 0;
        int hashKey;
        boolean bookStart = false;
        File file = new File(this.filePath);
        BufferedReader fileIn;
        if (file.isFile()){
            try {
                fileIn = new BufferedReader(new FileReader(file));
                while (fileIn.ready()){
                    fileLineNumber++;
                    String line = fileIn.readLine();
                    if (line.contains("*** END OF THIS PROJECT GUTENBERG")) bookStart = false;
                    if (bookStart){
                        workLineNumber++;
                        // If the line is bigger than 0, do the following.
                        // Split line into array
                        // filter out off bad chars and convert to lower case.
                        // Calculate hash for location of word.
                        // Check to see if word is already in the list, if not add it.
                        // If word is already in the list, update it.
                    }
                    else {
                        if (line.contains("*** START OF THIS PROJECT GUTENBERG")) {
                            bookStart = true;
                            this.bookStartLine = fileLineNumber + 1;
                        }
                    }
                }
            } catch (FileNotFoundException ex) {
                Logger.getLogger(Concordance.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(Concordance.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else{
            System.out.println("The file " + file.getName() + " does not exist in the 'books' folder.");
        }
        
        return success;
    }
    
    private class Word{
        String word;
        ArrayList<Integer> line_numbers;
        int number_apperances, apperance_rank;
        
        public Word(String w, String b, ArrayList<Integer>lns, int n, int a){
            this.word = w;
            this.line_numbers = lns;
            this.number_apperances = n;
            this.apperance_rank = a;
        }
    }
}<commit_msg>Added lines for testing the Concordance class.  All basic tests pass so far.<commit_after>package ClassLibrary;


import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Concordance implements Serializable {
    // private class fields.
    LinkedList[] hastable;
    String bookTitle, bookAuthor, filePath;
    int bookStartLine;
    
    public Concordance(String bt, String a, String fn) {
        this.hastable = new LinkedList[27];
        this.bookTitle = bt;
        this.bookAuthor = a;
        this.filePath = fn;
        this.bookStartLine = 0;
    }
    
    public boolean makeConcordance(){
        boolean success = false;
        int fileLineNumber = 0;
        int workLineNumber = 0;
        int hashKey;
        boolean bookStart = false;
        File file = new File(this.filePath);
        BufferedReader fileIn;
        if (file.isFile()){
            try {
                fileIn = new BufferedReader(new FileReader(file));
                while (fileIn.ready()){
                    fileLineNumber++;
                    String line = fileIn.readLine();
                    if (line.contains("*** END OF THIS PROJECT GUTENBERG")) bookStart = false;
                    if (bookStart){
                        workLineNumber++;
                        // If the line is bigger than 0, do the following.
                        // Split line into array
                        // filter out off bad chars and convert to lower case.
                        // Calculate hash for location of word.
                        // Check to see if word is already in the list, if not add it.
                        // If word is already in the list, update it.
                    }
                    else {
                        if (line.contains("*** START OF THIS PROJECT GUTENBERG")) {
                            bookStart = true;
                            this.bookStartLine = fileLineNumber + 1;
                        }
                    }
                }
                System.out.println(bookTitle + " " + bookAuthor + " " + filePath);
                System.out.println("Total line numbers of text file: " + fileLineNumber);
                System.out.println("Total line numbers of the book: " + workLineNumber);
                System.out.println("Book begins on line: " + this.bookStartLine);
                success = true;
            } catch (FileNotFoundException ex) {
                Logger.getLogger(Concordance.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(Concordance.class.getName()).log(Level.SEVERE, null, ex);
            }
        } else{
            System.out.println("The file " + file.getName() + " does not exist in the 'books' folder.");
        }
        
        return success;
    }
    
    private class Word{
        String word;
        ArrayList<Integer> line_numbers;
        int number_apperances, apperance_rank;
        
        public Word(String w, String b, ArrayList<Integer>lns, int n, int a){
            this.word = w;
            this.line_numbers = lns;
            this.number_apperances = n;
            this.apperance_rank = a;
        }
    }
}
{'fraction_non_alphanumeric': 0.08885798176479678, 'fraction_numerical': 0.002163498686447226, 'mean_word_length': 1.5641838351822503, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4605729', 'n_tokens_mistral': 1712, 'n_tokens_neox': 1626, 'n_words': 482}