Home > Back-end >  I want to make a english word-meaning dictionary as a file/folder, what will be the most efficient w
I want to make a english word-meaning dictionary as a file/folder, what will be the most efficient w

Time:02-16

So i want to make a dictionary and there are two ways i can think of accomplishing this

  1. a dictinary directory where each word is stored as a filename with its meaning as the filecontent
  2. a single file with all words

First question can someone suggest any better way to store a dictionary which is efficient ? (i have to store this as a file)

Second question which of 2 methods suggested by me is more faster to access ?

Please note i am not going to search through this directory since it will be huge rather only check if the word exists or not by checking if the file exists and then print its content if its exists.

Edit: added how am i going to use the dictionary as suggested by @Vlad Feinstein

CodePudding user response:

The most important part is missing from your question: how are you going to use that dictionary?

However, in order to access words stored in individual files you would have to use OS-provided API, that is most likely less efficient that to go through data in a single file.

Please note that many words have multiple meanings. Did you consider some popular data formats, like JSON, to store all that?

  • Related