def __init__(self, url, max_candidates=3, min_similarity=75, max_length=1000): gobject.GObject.__init__(self) HTTPClient.__init__(self) self.max_candidates = max_candidates self.min_similarity = min_similarity self.comparer = LevenshteinComparer(max_length) self.last_suggestions = None self.url = url self.source_lang = None self.target_lang = None
def __init__(self, max_candidates=3, min_similarity=75, max_length=1000): gobject.GObject.__init__(self) HTTPClient.__init__(self) self.max_candidates = max_candidates self.min_similarity = min_similarity self.comparer = LevenshteinComparer(max_length) self.last_suggestions = [] # used by the open-tran terminology backend self._languages = set() self.source_lang = None self.target_lang = None #detect supported language self.url_getlanguages = 'http://open-tran.eu/json/supported' self.url_translate = 'http://%s.%s.open-tran.eu/json/suggest' langreq = RESTRequest(self.url_getlanguages, id='') self.add(langreq) langreq.connect('http-success', lambda langreq, response: self.got_languages(response))
def __init__(self, max_candidates=3, min_similarity=75, max_length=1000): gobject.GObject.__init__(self) HTTPClient.__init__(self) self.max_candidates = max_candidates self.min_similarity = min_similarity self.comparer = LevenshteinComparer(max_length) self.last_suggestions = None # used by the open-tran terminology backend self._languages = set() self.source_lang = None self.target_lang = None #detect supported language self.url_getlanguages = 'http://open-tran.eu/json/supported' self.url_translate = 'http://%s.%s.open-tran.eu/json/suggest' langreq = RESTRequest(self.url_getlanguages, id='', method='GET', data=urllib.urlencode('')) self.add(langreq) langreq.connect( 'http-success', lambda langreq, response: self.got_languages(response) )
def __init__(self, url): gobject.GObject.__init__(self) HTTPClient.__init__(self) self.url = url + '/RPC2' self.multilang = False
def __init__(self, base_url): HTTPClient.__init__(self) self.base_url = base_url