Package nltk :: Package wordnet :: Module util :: Class IndexFile
[hide private]
[frames] | no frames]

Class IndexFile

source code

object --+
         |
        IndexFile

An IndexFile is an implementation class that presents a Sequence and Dictionary interface to a sorted index file.

Instance Methods [hide private]
 
__init__(self, pos, filenameroot)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
rewind(self)
Rewind to the beginning of the file.
source code
 
__nonzero__(self) source code
 
__len__(self) source code
 
__getitem__(self, index) source code
 
get(self, key, default=None) source code
 
keys(self)
Returns: a list of the keys of this index file.
source code
 
has_key(self, key)
Returns: True/false if this key is a valid index into the file.
source code
 
_buildIndexCacheFile(self) source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, pos, filenameroot)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • pos ({string}) - The part of speech of this index file e.g. 'noun'
  • filenameroot ({string}) - The base filename of the index file.
Overrides: object.__init__

rewind(self)

source code 

Rewind to the beginning of the file. Place the file pointer at the beginning of the first line whose first character is not whitespace.

get(self, key, default=None)

source code 
Parameters:
  • key ({string}) - first word of a line from an index file.
  • default - Return this if no entry exists for 'key'.

keys(self)

source code 
Returns:
a list of the keys of this index file.

has_key(self, key)

source code 
Parameters:
  • key ({string}) - the first word of a line in this index file.
Returns:
True/false if this key is a valid index into the file.