Package translate :: Package storage :: Module statsdb
[hide private]
[frames] | no frames]

Module statsdb

source code

Module to provide a cache of statistics in a database.


Organization: Zuza Software Foundation

Copyright: 2007 Zuza Software Foundation

License: GPL

Classes [hide private]
  StatsCache
An object instantiated as a singleton for each statsfile that provides access to the database cache from a pool of StatsCache objects.
Functions [hide private]
 
wordcount(string) source code
 
wordsinunit(unit)
Counts the words in the unit's source and target, taking plurals into account.
source code
 
statefordb(unit)
Returns the numeric database state for the unit.
source code
 
emptystats()
Returns a dictionary with all statistics initalised to 0.
source code
 
suggestioninfo(filename)
Provides the filename of the associated file containing suggestions and its mtime, if it exists.
source code
Variables [hide private]
  kdepluralre = re.compile(r'^_n: ')
  brtagre = re.compile(r'<br\s*?/?>')
  xmltagre = re.compile(r'<[^>]+>')
  numberre = re.compile(r'\D\.\D')
  state_strings = {0: 'untranslated', 1: 'translated', 2: 'fuzzy'}
Function Details [hide private]

wordsinunit(unit)

source code 

Counts the words in the unit's source and target, taking plurals into account. The target words are only counted if the unit is translated.