Tabnine Logo
SpellCheckerSession.getSentenceSuggestions
Code IndexAdd Tabnine to your IDE (free)

How to use
getSentenceSuggestions
method
in
android.view.textservice.SpellCheckerSession

Best Java code snippets using android.view.textservice.SpellCheckerSession.getSentenceSuggestions (Showing top 5 results out of 315)

origin: peekler/GDG

@OnClick(R.id.btnCheckSpell)
public void checkSpellClicked(View view) {
  if (!etText.getText().toString().isEmpty()) {
    tvResult.setText("");
    if (spellCheckerSession != null) {
      spellCheckerSession.getSentenceSuggestions(
          new TextInfo[]{new TextInfo(etText.getText().toString())}, 1);
    } else {
      Log.e("TAG_SPELL", "Couldn't obtain the spell checker service.");
    }
  }
}
origin: derry/delion

/**
 * Queries the input text against the SpellCheckerSession.
 * @param text Text to be queried.
 */
@CalledByNative
private void requestTextCheck(String text) {
  // SpellCheckerSession thinks that any word ending with a period is a typo.
  // We trim the period off before sending the text for spellchecking in order to avoid
  // unnecessary red underlines when the user ends a sentence with a period.
  // Filed as an Android bug here: https://code.google.com/p/android/issues/detail?id=183294
  if (text.endsWith(".")) {
    text = text.substring(0, text.length() - 1);
  }
  mSpellCheckerSession.getSentenceSuggestions(new TextInfo[] {new TextInfo(text)}, 0);
}
origin: VladThodo/behe-keyboard

/**
 * Update the list of available candidates from the current composing
 * text.  This will need to be filled in by however you are determining
 * candidates.
 */
private void updateCandidates() {
  if (!mCompletionOn) {
    if (mComposing.length() > 0) {
      ArrayList<String> list = new ArrayList<String>();
      list.add(mComposing.toString());
      mScs.getSentenceSuggestions(new TextInfo[] {new TextInfo(mComposing.toString())}, 5);
      setSuggestions(list, true, true);
    } else {
      setSuggestions(null, false, false);
    }
  }
}
origin: blackcj/AndroidCustomKeyboard

/**
 * Update the list of available candidates from the current composing
 * text.  This will need to be filled in by however you are determining
 * candidates.
 */
private void updateCandidates() {
  if (!mCompletionOn) {
    if (mComposing.length() > 0) {
      ArrayList<String> list = new ArrayList<String>();
      //list.add(mComposing.toString());
      Log.d("SoftKeyboard", "REQUESTING: " + mComposing.toString());
      mScs.getSentenceSuggestions(new TextInfo[] {new TextInfo(mComposing.toString())}, 5);
      setSuggestions(list, true, true);
    } else {
      setSuggestions(null, false, false);
    }
  }
}

origin: stackoverflow.com

 public class SpellChecker implements SpellCheckerSessionListener {
  public SpellChecker(Activity a)
  {
    final TextServicesManager tsm = (TextServicesManager) a.getSystemService(
        Context.TEXT_SERVICES_MANAGER_SERVICE);
        SpellCheckerSession scs = tsm.newSpellCheckerSession(null, null, this, true);
        TextInfo[] tia = {new TextInfo("trewgjj"), new TextInfo("great")};
        scs.getSentenceSuggestions(tia, 3);
  }
  @Override
  public void onGetSuggestions(SuggestionsInfo[] results) {
    // TODO Auto-generated method stub
  }
  @Override
  public void onGetSentenceSuggestions(SentenceSuggestionsInfo[] results) {
    for (int i = 0; i < results.length; ++i) {
      // Returned suggestions are contained in SuggestionsInfo
      for (int j = 0; j < results[i].getSuggestionsCount(); ++j) {
        SuggestionsInfo si =  results[i].getSuggestionsInfoAt(j);
        if ((si.getSuggestionsAttributes() & SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY) != 0)
          Log.d("", "EXACT MATCH FOUND"); 
      }
    }
  }
}
android.view.textserviceSpellCheckerSessiongetSentenceSuggestions

Popular methods of SpellCheckerSession

    Popular in Java

    • Reactive rest calls using spring rest template
    • notifyDataSetChanged (ArrayAdapter)
    • setRequestProperty (URLConnection)
    • getSupportFragmentManager (FragmentActivity)
    • Menu (java.awt)
    • ServerSocket (java.net)
      This class represents a server-side socket that waits for incoming client connections. A ServerSocke
    • StringTokenizer (java.util)
      Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
    • TreeMap (java.util)
      Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
    • ExecutorService (java.util.concurrent)
      An Executor that provides methods to manage termination and methods that can produce a Future for tr
    • JList (javax.swing)
    • Top plugins for WebStorm
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now