Skip to content

loaded 0 words when loading from dictionary? #2

@RedemptionC

Description

@RedemptionC

hi, I tried to run this project on my mac, but it doesn't seem to work:

ZYMOTECHNICAL
ZYMOTECHNICS
ZYMOTIC
ZYMOTICALLY
ZYMOTICS
ZYMURGIES
ZYMURGY
ZYTHUM
ZYTHUMS
ZYZZYVA
ZYZZYVAS
ZZZ
ZZZS
Loaded 0 words.
Done.
$ ls
LICENSE                 collins.txt             ngram_freq_dict.csv     trie.h
README.md               main.cpp                trie.cpp                wordsquares*

$

this is the change I made to this file:

diff --git a/main.cpp b/main.cpp
index 7528bc2..7f8590c 100644
--- a/main.cpp
+++ b/main.cpp
@@ -7,14 +7,14 @@

 //Path to the dictionary file
 //Recommended source: https://raw.githubusercontent.com/andrewchen3019/wordle/refs/heads/main/Collins%20Scrabble%20Words%20(2019).txt
-#define DICTIONARY "../../dictionaries/scrabble_words.txt"
+#define DICTIONARY "./collins.txt"
 //Path to the word frequency file
 //Recommended source: https://www.kaggle.com/datasets/wheelercode/dictionary-word-frequency
-#define FREQ_FILTER "../../dictionaries/ngram_freq_dict.csv"
+#define FREQ_FILTER "./ngram_freq_dict.csv"
 //Width of the word grid
-#define SIZE_W 5
+#define SIZE_W 3
 //Height of the word grid
-#define SIZE_H 5
+#define SIZE_H 3
 //Filter horizontal words to be in the top-N (or 0 for all words)
 #define MIN_FREQ_W 20000
 //Filter vertical words to be in the top-N (or 0 for all words)
@@ -42,6 +42,7 @@ void LoadDictionary(const char* fname, int length, Trie& trie, int min_freq) {
   std::ifstream fin(fname);
   std::string line;
   while (std::getline(fin, line)) {
+    std::cout << line << std::endl;
     if (line.size() != length) { continue; }
     for (auto& c : line) c = toupper(c);
     if (g_freqs.size() > 0 && min_freq > 0) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions