Beispiel #1
0
    public void ReplaceWord(string correctWord)
    {
        List <string> inputText = new List <string>();
        StringBuilder builder   = new StringBuilder();
        string        input     = TextField.text;

        string[] parts = input.Split(' ');
        parts = parts.Take(parts.Length - 1).ToArray();

        for (int i = 0; i < parts.Length; i++)
        {
            inputText.Add(parts[i]);
        }

        inputText.Add(correctWord);

        foreach (string w in inputText)
        {
            builder.Append(w).Append(" ");
        }
        TextField.text = builder.ToString();
        TextField.ActivateInputField();

        WordPredictor.PredictNextWords(correctWord);
    }
Beispiel #2
0
 void Update()
 {
     //if(Input.GetKeyUp(KeyCode.Space) || Space.ButtonUp && inputField.isFocused)
     if (Input.GetKeyUp(KeyCode.Space))
     {
         string inputText = inputField.text.TrimEnd();
         string lastWord  = inputText.Split(' ').Last();
         NGramHandler.PredictNextWords(lastWord);
     }
 }
Beispiel #3
0
 private void PredictNextWords(string suggestedWord)
 {
     nGramGenerator.PredictNextWords(suggestedWord, autocompleters.ToArray());
 }