What's New
From SemanticLab
Contents |
eWRT 0.6.0 (Easter Release)
Requirements
- python-setuptools
- python-nose >= 0.11 (debian-backports)
- python2.6+ recommended
Added / Improved Packages
- eWRT.util.timing
- decorator for timing methods
- eWRT.util.cache
- user customized keys using
fetchObjectIdand a key lookup functiongetKey - implements
__contains__and__delitem__to remove objects from the cache - fixed the
IterableCachemodule - improved unittesting
- use __call__ to directly call the cached object
- user customized keys using
Examples
Timing functions
from eWRT.util.timing import Timed @Timed def _timeFunction(self, a, b): [ x for x in xrange(1000) ] return a + b for x in xrange(10): _timeFunction(self, x, 10*x) # call statistics print _timeFunciton.totalCallDuration print _timeFunciton.lastCallDuration print _timeFunciton.numberOfCalls
Deleting and checking of cache items.
from eWRT.util.cache import DiskCached @DiskCached("./cache") def add(x,y): return x+y assert add(12,13) == 25 key = add.getKey(12,13) assert key in self.add del self.add[key] assert key not in self.add
User defined keys:
from eWRT.util.cache import DiskCache d = DiskCache("./cache") d.fetchObjectId(1, str, 1) assert 1 in d
eWRT 0.5.1 (Christmas Release)
Requirements
- python-setuptools
- python-nose >= 0.11 (debian-backports)
Added / Improved Packages
- eWRT.util.async
- asynchronous processing of tasks
- eWRT.util.profile
- easy profiling support
- eWRT.ws.geoLyzard
- compress input text before submission to the geoLyzard service
-
GeoLyzardIterator- batchwise geo-tagging
- eWRT.ws.geonames
- improved unittesting
- startup speedups
Examples
Batch geo-tagging of text documents:
from eWRT.ws.geoLyzard import GeoLyzard, GeoLyzardIterator from glob import glob GAZETTEER="C" CORPUS = dict( [ (fname, open(fname).read()) for fname in glob("./corpus/*.txt") ] ) for document_id, res in GeoLyzardIterator( text_dict, GAZETTEER, batch_size=50 ): print document_id, res
Asynchronous processing of a command-list:
from eWRT.util.async import Async async = Async("./.async_cachedir", max_processes=8) # post commands resultHash = dict( [ (cmd, async.post(cmd)) for cmd in COMMAND_LIST ] ) # retrieve results, when they are available for cmd, hashKey in resultHash: print "Command Result", async.fetch( hashKey )
Easy profiling:
from eWRT.util.profile import profile def mySlowFunction(): ... profile(mySlowFunction, logFile="mySlowFunction.log")

