public void preprocess() {
        File file = new File(path);
        BufferedReader reader;
        try {
            reader = new BufferedReader(new FileReader(file));
            String line;

            while((line = reader.readLine()) != null) {
                String word = line.toLowerCase();
                maxWordLength = Math.max(maxWordLength, word.length());
                trie.add(word);
                sortedTrie.add(sort(word));
            }

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }