Package nltk :: Module data :: Class PathPointer
[hide private]
[frames] | no frames]

Class PathPointer

source code

object --+
         |
        PathPointer
Known Subclasses:

An abstract base class for 'path pointers,' used by NLTK's data package to identify specific paths. Two subclasses exist: FileSystemPathPointer identifies a file that can be accessed directly via a given absolute path. ZipFilePathPointer identifies a file contained within a zipfile, that can be accessed by reading that zipfile.

Instance Methods [hide private]
 
open(self, encoding=None)
Return a seekable read-only stream that can be used to read the contents of the file identified by this path pointer.
source code
 
file_size(self)
Return the size of the file pointed to by this path pointer, in bytes.
source code
 
join(self, fileid)
Return a new path pointer formed by starting at the path identified by this pointer, and then following the relative path given by fileid.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

open(self, encoding=None)

source code 

Return a seekable read-only stream that can be used to read the contents of the file identified by this path pointer.

Raises:
  • IOError - If the path specified by this pointer does not contain a readable file.

file_size(self)

source code 

Return the size of the file pointed to by this path pointer, in bytes.

Raises:
  • IOError - If the path specified by this pointer does not contain a readable file.

join(self, fileid)

source code 

Return a new path pointer formed by starting at the path identified by this pointer, and then following the relative path given by fileid. The path components of fileid should be seperated by forward slashes (/), regardless of the underlying file system's path seperator character.