PeterDonis
Mentor
- 49,262
- 25,312
Even leaving aside the web bot issue, the OP requirements, as far as I can see, cannot be met without loading and parsing the whole file in some way, since you have to randomly select a word. If the file is sorted by initial letter (as at least one of the ones linked to in the OP is), you might be able to get away with just loading the portion of it contaning words beginning with the chosen letter to randomly select a word, but even for that you would have to know what portion that is in advance, i.e., you would have had to load the entire file and parse it in order to generate the information about what portion of the file contains words starting with each letter. You could do the latter in a pre-processing step and store the results in a second file, I suppose.Filip Larsen said:if whatever partial information is needed from a large file can be retrieved without reading and parsing the whole file and storing it memory first, then it likely will be more performant to not load the whole file in memory