1. A method, implemented by a computer, for generating a directory, comprising: searching, by the computer, a plurality of directory byte streams in a text file, each of the directory byte streams including a predetermined directory key byte corresponding to a predetermined directory character; determining a plurality of directory character streams corresponding to the plurality of directory byte streams; determining a set of constants {Ei| i=1, 2, 3. .. } corresponding to all characters within each of the directory character streams that matches the predetermined directory character, wherein i is a sequence number of each of the matched characters in the respective directory character stream; calculating a value W corresponding to each of the directory character streams by a rule of W=E1+E2×pow (2, delta) +.. . +Ei×pow (2, delta×(i−1)) so as to determine, based on the calculated value, that one or more of the directory character streams are erroneous directory character streams, where pow is an exponential operation, and delta is an operational factor; filtering the plurality of directory character streams to remove the determined erroneous directory character streams; and generating a directory of the text file based on the filtered plurality of directory character streams.