Showing posts with label GAE. Show all posts
Showing posts with label GAE. Show all posts

Saturday, January 2, 2010

Python Wrapper of Google Language API with GAE Support

Code is hosted here.

Licensed under MIT license.

Usage:

>>> from glanguage import Translator
>>> t = Translator()
>>> t.translate('Hello, World', lang_from='en', lang_to='fr')
'Bonjour tout le monde'
>>> what = t.detect('你好')
>>> what.lang
'Chinese_simplified'
>>> what.lang_code
'zh-CN'
>>> print what
<language: (chinese_simplified)="" zh-cn="">
>>>

If the value of lang_from in the translate() method is omitted,
the language of the original text will be detected automatically.
The value of lang_to is default to 'en'.

Support for Google App Engine is added. The usage stays the same
on GAE. I also did some simplification to the original code
found online.

A lot credit goes to Peteris Krumins (peter@catonmat.net), who
wrote the code originally.

Wednesday, December 17, 2008

Google App Engine's real indexing limit

5000, that the number you are looking for. I tried to fill up a db.ListProperty(int) as much as I could. The SDK stopped working and started complaining about me having too much to be indexed at this point, 5000. So if you have more than 5000 entities to index in a ListProperty, get around. I came up with a solution where you use a db.ListProperty(db.Key) to hold the keys of the actual ListProperty(s) you use to store stuff. And then make some special interface for it so that it loop through its parts automatically. Implementing such kind of interface, including a reading method, a saving method and a deleting method took up about 70 lines of code, empty lines included. And then I have no limits on GAE's indexing any more!