How to best organize a directory structure of a dictionary?
I need to create an English language dictionary. I plan to store dictionary entries inside text files (one file per entry) and store those files in file system. I’m looking the best way to organize the directory structure.
My first guess is the following:
/a apple.txt /b book.txt /c can.txt ...
But, since there are about 250000 words in English language, this structure is not good (since there will be about 9000 words in a directory).
So, what is the best way to organize files in directories? And will I be able to store the files in a GIT repository (won’t it be too slow)?
2 Solutions collect form web for “How to best organize a directory structure of a dictionary?”
Yes, you can store it in a GIT repository, and it should not affect the speed, although what I think you mean is whether you could push such a repository to a git host (you can). Plenty of huge repositories larger than dictionaries are hosted on GitHub and GitLab.
As for the structure, I don’t recommend putting each word in a separate file. It would be easier to put a lot of words into one file, using some format, separating each word with a delimiter. That way, your main dictionary program could scan a few files, rather than having to repeatedly open and close files. It would also make your repository far easier to navigate.
Because git will create one node for each file, I don’t think directory structure will influence the git accessing speed, the speed depends on the number of all your files. You should focus the design of directory structure based on the algorithm you will take to look up the dictionary.