コード例 #1
0
ファイル: WPEngine.py プロジェクト: keymanapp/onboard-keyman
    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]
コード例 #2
0
ファイル: WPDBusProxy.py プロジェクト: vpq98217/Inputability
 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
コード例 #3
0
ファイル: WPDBusProxy.py プロジェクト: Dhiru/Inputability-1
 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
コード例 #4
0
ファイル: WPEngine.py プロジェクト: Dhiru/Inputability-1
    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]
コード例 #5
0
ファイル: WPEngine.py プロジェクト: keymanapp/onboard-keyman
 def tokenize_context(self, text):
     """ let the service find the words in text """
     return pypredict.tokenize_context(text)
コード例 #6
0
ファイル: WPEngine.py プロジェクト: Dhiru/Inputability-1
 def tokenize_context(self, text):
     """ let the service find the words in text """
     tokens = pypredict.tokenize_context(text)
     return tokens