Search_Function은 피아노연주나 검색같은 기능처리하는 펑션문임


걍 대충보고 구린지좀



Public Function Analys()


On Error Resume Next

Dim talk_spt() As String

Dim i, z, q, w As Long


z = 1


'도움말

If frmmain.txtConvert.Text = "도움말" Then


    Exit Function

End If


For i = 0 To Len(frmmain.txtConvert.Text) '0 ~ 전체길이 해석


    '격조사 ~에서

    For q = 0 To UBound(talk_in) '검색

        If Mid(frmmain.txtConvert.Text, i + 1, Len(talk_in(q))) = talk_in(q) Then

            If Mid(frmmain.txtConvert.Text, i + (Len(talk_in(q)) + 1), 1) = " " Then

                talk_memory2 = Mid(frmmain.txtConvert.Text, z, (i - z) + 1)

                z = i + Len(talk_in(q)) + 2

            End If

        End If

    Next q


    '속성 ~의

    For q = 0 To UBound(talk_of) '검색

        If Mid(frmmain.txtConvert.Text, i + 1, Len(talk_of(q))) = talk_of(q) Then

            If Mid(frmmain.txtConvert.Text, i + (Len(talk_of(q)) + 1), 1) = " " Then

                talk_memory3 = Mid(frmmain.txtConvert.Text, z, (i - z) + 1)

                z = i + Len(talk_of(q)) + 2

            End If

        End If

    Next q


    '을 & 를

    If ObjJosa(Mid(frmmain.txtConvert.Text, i + 1, 1)) = "를" And ((Mid(frmmain.txtConvert.Text, i + 2, 1) = "를" Or Mid(frmmain.txtConvert.Text, i + 2, 1) = "가")) Then

        If Mid(frmmain.txtConvert.Text, i + 3, 1) = " " Then

            If chk_and = False Then

                talk_memory = talk_memory & "," & Mid(frmmain.txtConvert.Text, z, (i - z) + 2)

            Else

                talk_memory = Mid(frmmain.txtConvert.Text, z, (i - z) + 1)

                chk_and = True

            End If

            z = i + 3

        End If

    End If

    

    If ObjJosa(Mid(frmmain.txtConvert.Text, i + 1, 1)) = "을" And ((Mid(frmmain.txtConvert.Text, i + 2, 1) = "을" Or Mid(frmmain.txtConvert.Text, i + 2, 1) = "이")) Then

        If Mid(frmmain.txtConvert.Text, i + 3, 1) = " " Then

            If chk_and = False Then

                talk_memory = talk_memory & "," & Mid(frmmain.txtConvert.Text, z, (i - z) + 2)

            Else

                talk_memory = Mid(frmmain.txtConvert.Text, z, (i - z) + 1)

                chk_and = True

            End If

            z = i + 3

        End If

    End If

    

    If Mid(frmmain.txtConvert.Text, i + 1, 1) <> "" Then

        If (Mid(frmmain.txtConvert.Text, i + 1, 1) >= "a" And Mid(frmmain.txtConvert.Text, i + 1, 1)) <= "z" Or ((Mid(frmmain.txtConvert.Text, i + 1, 1) >= "A" And Mid(frmmain.txtConvert.Text, i + 1, 1) <= "Z")) Then

            If ObjJosa(Mid(frmmain.txtConvert.Text, i + 2, 1)) = "영" Then

                If Mid(frmmain.txtConvert.Text, i + 3, 1) = " " Then

                    If chk_and = False Then

                        talk_memory = talk_memory & "," & Mid(frmmain.txtConvert.Text, z, (i - z) + 2)

                    Else

                        talk_memory = Mid(frmmain.txtConvert.Text, z, (i - z) + 1)

                        chk_and = True

                    End If

                    z = i + 3

                End If

            End If

        End If

    End If

    

    '기타

    If Mid(frmmain.txtConvert.Text, i + 1, 1) <> "" Then

        If (ObjJosa(Mid(frmmain.txtConvert.Text, i + 1, 1)) = "를" And Mid(frmmain.txtConvert.Text, i + 2, 1) = "을") Or (ObjJosa(Mid(frmmain.txtConvert.Text, i + 1, 1)) = "을" And Mid(frmmain.txtConvert.Text, i + 2, 1) = "를") Then

            If Mid(frmmain.txtConvert.Text, i + 3, 1) = " " Then

                frmmain.Alert ("문법이 안맞습니다 - " & Mid(frmmain.txtConvert.Text, i + 1, 1) & ObjJosa(Mid(frmmain.txtConvert.Text, i + 1, 1))), 2

                z = i + 2 + Len(Mid(frmmain.txtConvert.Text, z, (i - z) + 1))

            End If

        End If

    End If

    

    '접속부사 ~와,과

    For q = 0 To UBound(talk_and)

        If Mid(frmmain.txtConvert.Text, i + 1, Len(talk_and(q))) = talk_and(q) Then

            If Mid(frmmain.txtConvert.Text, i + (Len(talk_and(q)) + 1), 1) = " " Then

                If chk_and = False Then

                    talk_memory = talk_memory & "," & Mid(frmmain.txtConvert.Text, z, (i - z) + 1)

                Else

                    talk_memory = Mid(frmmain.txtConvert.Text, z, (i - z) + 1)

                    chk_and = True

                End If

                    z = i + Len(talk_and(q)) + 2

            End If

        End If

    Next q

    

    '서술격조사 ~은,는

    For q = 0 To UBound(talk_inv)

        If Mid(frmmain.txtConvert.Text, i + 1, Len(talk_inv(q))) = talk_inv(q) Then

            If Mid(frmmain.txtConvert.Text, i + (Len(talk_inv(q)) + 1), 1) = " " Then

                talk_memory = talk_memory & "," & Mid(frmmain.txtConvert.Text, z, (i - z) + 1)

                z = i + Len(talk_and(q)) + 2

                chk_and = True

                chk_inv = True

            End If

        End If

    Next q

    

    '보조사 ~이다

    For q = 0 To UBound(talk_is)

        If Mid(frmmain.txtConvert.Text, (i + 1), Len(talk_is(q)) + 1) = talk_is(q) Then

        

            If Mid(frmmain.txtConvert.Text, i + (Len(talk_is(q)) + 1), 1) = " " Or i = Len(frmmain.txtConvert.Text) - Len(talk_is(q)) Then

                If chk_inv = True Then

                    If InStr(talk_memory, ",") Then

                        'talk_memory = talk_memory & "," & Mid(frmmain.txtConvert.Text, z, (i - z) + 1)

                        talk_split() = Split(talk_memory, ",")

                        talk_search = Mid(frmmain.txtConvert.Text, z, (i - z) + 1)

                        If GetVar(talk_search) <> "" Then

                            talk_search = GetVar(talk_search)

                        End If

                        For w = 1 To UBound(talk_split)

                            If talk_memory3 <> "" Then

                                ChangeVar talk_memory3, talk_search, talk_split(w)

                                frmmain.Alert talk_memory3 & "의 " & talk_split(w) & ObjJosa(talk_split(w)) & " " & talk_search & "로 저장되었습니다.", 1

                            Else

                                ChangeVar talk_memory3, talk_search, ""

                                frmmain.Alert talk_split(w) & ObjJosa(talk_split(w)) & " 저장했습니다.", 1

                            End If

                        Next w

                        talk_memory3 = ""

                    Else

                        var_name.Add Mid(talk_memory, 2, Len(talk_memory))

                        var_cont.Add Mid(frmmain.txtConvert.Text, z, (i - z) + 1)

                        var_profile.Add ""

                        frmmain.Alert Mid(talk_memory, 2, Len(talk_memory)) & ObjJosa(Mid(talk_memory, 2, Len(talk_memory))) & " 저장했습니다.", 1

                    End If

                Else

                    frmmain.Alert Mid(talk_memory, 2, Len(talk_memory)) & ObjJosa(Mid(talk_memory, 2, Len(talk_memory))) & " 문법에 안맞습니다.", 2

                End If

            End If

        End If

    Next q

    

    '저장 ~는?

    For q = 0 To UBound(talk_ask)

        If Mid(frmmain.txtConvert.Text, i + 1, Len(talk_ask(q)) + 1) = talk_ask(q) Then

            If Mid(frmmain.txtConvert.Text, i + 2, 1) = " " Or i = Len(frmmain.txtConvert.Text) - Len(talk_ask(q)) Then

                If InStr(talk_memory, ",") Then

                    talk_memory = talk_memory & "," & Mid(frmmain.txtConvert.Text, z, (i - z) + 1)

                    talk_split() = Split(talk_memory, ",")

                    For w = 1 To UBound(talk_split)

                        If talk_memory3 <> "" Then

                            frmmain.Alert talk_memory3 & "의 " & ObjJosa2(talk_split(w)) & " " & GetVar(talk_split(w)), 1

                        Else

                            frmmain.Alert talk_split(w) & ObjJosa2(talk_split(w)) & " " & GetVar(talk_split(w)), 1

                        End If

                        

                    Next w

                Else

                    talk_memory = Mid(frmmain.txtConvert.Text, z, (i - z) + 1)

                    If talk_memory3 <> "" Then

                        frmmain.Alert talk_memory3 & "의 " & talk_memory & ObjJosa2(talk_memory) & " " & GetProfile(talk_memory3, talk_memory), 1

                    Else

                        frmmain.Alert talk_memory & ObjJosa2(talk_memory) & " " & GetVar(talk_memory), 1

                    End If

                End If

            End If

        End If

    Next q


    '행동 ~해줘

    For q = 0 To UBound(talk_process)

        If Mid(frmmain.txtConvert.Text, i + 1, Len(talk_process(q))) = talk_process(q) Then

            If Mid(frmmain.txtConvert.Text, i + (Len(talk_process(q)) + 1), 1) = " " Or i = Len(frmmain.txtConvert.Text) - Len(talk_process(q)) Then

                If InStr(talk_memory, ",") Then

                    talk_memory = talk_memory & "," & Mid(frmmain.txtConvert.Text, z + 1, (i - z))

                    talk_split() = Split(talk_memory, ",")

                    For w = 0 To UBound(talk_split) - 1

                    

                        If GetProfile(talk_memory3, talk_memory2) <> "" Then

                            talk_result = GetProfile(talk_memory3, talk_memory2)

                        ElseIf talk_memory3 <> "" Then

                            talk_result = talk_memory3

                        ElseIf talk_memory2 <> "" Then

                            talk_result = talk_memory2

                        End If

                        

                        If talk_split(w) <> "" Then

                            Search_Function (Mid(frmmain.txtConvert.Text, z + 1, (i - z))), talk_result, talk_split(w), talk_memory3

                        End If

                    Next w

                End If

            End If

        End If

    Next q

    

Next i


End Function