Package tipy :: Module minr :: Class DictMiner
[hide private]
[frames] | no frames]

Class DictMiner

source code

object --+    
         |    
     Miner --+
             |
            DictMiner

A miner to mine dictionary-like files.

This miner isn't a real miner as it only extract words from a dictionary-like file and insert them into a database. A dictionnary-like file is a file listing words, one word per line:

   about
   army
   bath
   boat
   ...

Class Hierarchy for DictMiner
Class Hierarchy for DictMiner

Nested Classes [hide private]
    Inherited from Miner
  __metaclass__
Metaclass for defining Abstract Base Classes (ABCs).
Instance Methods [hide private]
 
__init__(self, config, minerName, callback=None)
Constructor of the DictMiner class.
source code
 
mine(self)
Perform the mining operation.
source code
 
insert_words(self) source code

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

    Inherited from Miner
 
rm_db(self)
Remove the database file (call os.system).
source code
Class Variables [hide private]
  __abstractmethods__ = frozenset([])
    Inherited from Miner
  _abc_cache = <_weakrefset.WeakSet object at 0x7f2a42131ad0>
  _abc_negative_cache = <_weakrefset.WeakSet object at 0x7f2a421...
  _abc_negative_cache_version = 44
  _abc_registry = <_weakrefset.WeakSet object at 0x7f2a42131a90>
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, config, minerName, callback=None)
(Constructor)

source code 

Constructor of the DictMiner class.

Parameters:
  • config (drvr.Configuration) - The configuration file. It is used to retrieve the miner parameters.
  • minerName (str) - The name of the miner.
  • callback (fun(float, ...)) - The callback is used to show the progress percentage. In the gui a callback method is implemented to update a progress bar showing the n-grams insertion progress (cf. py).
Overrides: object.__init__

mine(self)

source code 

Perform the mining operation.

Overrides: Miner.mine

Note: This method could have used the update_db() method like the C orpusMiner and FbMiner do but this method avoid useless operations and is, therefore, faster.

To Do (0.0.9): Make sure every lines of the file contain one single word (or none).