def predict(self, context_line, limit=20, case_insensitive=False, case_insensitive_smart=False, accent_insensitive=False, accent_insensitive_smart=False, ignore_capitalized=False, ignore_non_capitalized=False): """ Find completion/prediction choices. """ LanguageModel = pypredict.LanguageModel options = 0 if case_insensitive: options |= LanguageModel.CASE_INSENSITIVE if case_insensitive_smart: options |= LanguageModel.CASE_INSENSITIVE_SMART if accent_insensitive: options |= LanguageModel.ACCENT_INSENSITIVE if accent_insensitive_smart: options |= LanguageModel.ACCENT_INSENSITIVE_SMART if ignore_capitalized: options |= LanguageModel.IGNORE_CAPITALIZED if ignore_non_capitalized: options |= LanguageModel.IGNORE_NON_CAPITALIZED context, spans = pypredict.tokenize_context(context_line) choices = self._get_prediction(self.models, context, limit, options) _logger.debug("context=" + repr(context)) _logger.debug("choices=" + repr(choices[:5])) return [x[0] for x in choices]
def tokenize_context(self, text): """ let the service find the words in text """ tokens = [] if 1: # avoid the D-Bus round-trip while we can tokens = pypredict.tokenize_context(text) else: tokens = self._call_method("tokenize_context", [], text) return tokens
def predict(self, context_line, limit = 20, case_insensitive = False, accent_insensitive = False, ignore_capitalized = False, ignore_non_capitalized = False): """ Find completion/prediction choices. """ LanguageModel = pypredict.LanguageModel options = 0 if case_insensitive: options |= LanguageModel.CASE_INSENSITIVE if accent_insensitive: options |= LanguageModel.ACCENT_INSENSITIVE if ignore_capitalized: options |= LanguageModel.IGNORE_CAPITALIZED if ignore_non_capitalized: options |= LanguageModel.IGNORE_NON_CAPITALIZED context = pypredict.tokenize_context(context_line) choices = self._get_prediction(self.models, context, limit, options) _logger.debug("context=" + repr(context)) _logger.debug("choices=" + repr(choices[:5])) return [x[0] for x in choices]
def tokenize_context(self, text): """ let the service find the words in text """ return pypredict.tokenize_context(text)
def tokenize_context(self, text): """ let the service find the words in text """ tokens = pypredict.tokenize_context(text) return tokens