저는 visual basic으로 작업하고 있습니다. 입력하는 동안 단어 목록에서 읽는 기능을 만들어서 단어를 가능한 완성 된 단어로 바꾸십시오. t9 텍스트 기능처럼. 이것은 내가 작업하고있는 코드입니다.텍스트 대체 기능
Public Class Keyboard2
Private Property dval As Integer
Private Sub GoToNext_Click(sender As Object, e As EventArgs) Handles GoToNext.Click
'when this button is pressed the next possible word will be genereated and will replace the previous word by calling the "GetWord" Sub
GetWord()
End Sub
Private Sub GetWord()
dval = dval + 1 ' this value is used to ensure that there can be no error in word replacement and it separates each change.
Dim lastWord As String = RichTextBox1.Text.Split(" ").Last ' get the last word entered in the text box
If dval = 1 AndAlso RichTextBox1.Text.EndsWith("top") AndAlso lastWord = "top" Then
'To change the last word to the next possible word
RichTextBox1.Text = String.Concat(RichTextBox1.Text.Remove(RichTextBox1.Text.Length - lastWord.Length), "topmost")
End If
If dval = 2 AndAlso RichTextBox1.Text.EndsWith("topmost") AndAlso lastWord = "topmost" Then
RichTextBox1.Text = String.Concat(RichTextBox1.Text.Remove(RichTextBox1.Text.Length - lastWord.Length), "topping")
End If
If dval = 3 AndAlso RichTextBox1.Text.EndsWith("topping") AndAlso lastWord = "topping" Then
RichTextBox1.Text = String.Concat(RichTextBox1.Text.Remove(RichTextBox1.Text.Length - lastWord.Length), "top")
dval = 0
End If
End Sub
End Class
이 방법은 어떤 사람에게 유용 할 수 있습니다 그리고 난 당신이 그것을 좋아 희망하지만 나를 위해 내가 수동으로 단어의 수천을 입력해야하기 때문에 사용하기 아주 나쁜 방법입니다.
데이터베이스로이 작업을 수행 할 수 있습니까? 누구든지 어떤 예를 가지고 있나. 시간 내 주셔서 감사합니다.
아직 단어 목록이 없습니까? –
나는 목록이 있지만 지금까지 100 단어 만 추가되었습니다.이 방법으로 더 이상 가고 싶지 않습니다. 막대한 양의 줄을 차지하고 런타임 중에 함수에 액세스하면 "GetWord"기능이 실행될 때까지 응용 프로그램이 중지됩니다. –
@RuchmairDixon : IME 지원을 사용했다면 Windows의 언어 자동 완성 기능이 도움이되지 않을까요? – matzone