nltk.binary_search_file()

nltk.binary_search_file(file, key, cache={}, cacheDepth=-1)[source]

Return the line from the file with first word key. Searches through a sorted file using the binary search algorithm.

Parameters:
  • file (file) – the file to be searched through.
  • key (str) – the identifier we are searching for.