VERSION 1.0 CLASS BEGIN MultiUse = -1 'True Persistable = 0 'NotPersistable DataBindingBehavior = 0 'vbNone DataSourceBehavior = 0 'vbNone MTSTransactionMode = 0 'NotAnMTSObject END Attribute VB_Name = "JPWordDeal" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = False Attribute VB_Ext_KEY = "SavedWithClassBuilder6","Yes" Attribute VB_Ext_KEY = "Top_Level","Yes" Option Explicit Private strWord As String Private isJugeTyped As Boolean Private enmType As EType Public Enum EType etNoun 'ming ci etAdjective 'xing rong ci etVerb1 'dong ci etVerb2 etVerb3Ka etVerb3Sa etAdjVerb 'xing rong dong ci etUnkown 'wei zhi End Enum Private Type T_KeyWord strKeyA As String strKeyI As String strKeyU As String strKeyU2 As String strKeyU2MaSi As String strKeyU2TE As String strKeyU2TA As String strKeyU2NaYi As String strKeyU2YiZi As String strKeyE As String strKeyO As String vA As Variant vI As Variant vU As Variant vU2 As Variant vU2MaSi As Variant vU2TE As Variant vU2TA As Variant vU2NaYi As Variant vU2YiZi As Variant vE As Variant vO As Variant End Type Private tkword As T_KeyWord Private Sub Class_Initialize() tkword.strKeyA = "あ,か,さ,た,な,は,ま,や,ら,わ" tkword.strKeyI = "い,き,し,ち,に,ひ,み,い,り,い" tkword.strKeyU = "う,く,す,つ,ぬ,ふ,む,ゆ,る,う" tkword.strKeyU2 = "う,ぐ,ぶ,る" tkword.strKeyU2MaSi = "い,ぎ,び,り" tkword.strKeyU2TE = "って,して,しで,って,んで,って" tkword.strKeyU2TA = "った,した,しだ,った,んだ,った" tkword.strKeyU2NaYi = "あ,が,ば,ら" tkword.strKeyU2YiZi = "お,こ,ご,そ,と,の,ぼ,も,ろ" tkword.strKeyE = "え,け,せ,て,ね,へ,め,え,れ,え" tkword.strKeyO = "お,ほ,よ,ろ,を" tkword.vA = Split(tkword.strKeyA,",") tkword.vI = Split(tkword.strKeyI,") tkword.vU = Split(tkword.strKeyU,") tkword.vU2 = Split(tkword.strKeyU2,") tkword.vU2MaSi = Split(tkword.strKeyU2MaSi,") tkword.vU2TE = Split(tkword.strKeyU2TE,") tkword.vU2TA = Split(tkword.strKeyU2TA,") tkword.vU2NaYi = Split(tkword.strKeyU2NaYi,") tkword.vU2YiZi = Split(tkword.strKeyU2YiZi,") tkword.vE = Split(tkword.strKeyE,") tkword.vO = Split(tkword.strKeyO,") End Sub Public Property Let Word(strUserWord As String) strUserWord = Trim(strUserWord) If strUserWord <> strWord Then strWord = strUserWord If strWord = "いい" Then strWord = "よい" enmType = enmGetWordType(strWord) End If End Property Public Property Get Word() As String Word = strWord End Property 'get the word's type Public Property Get WordType() As EType WordType = enmType End Property 'let the word's type Public Property Let WordType(enmT As EType) enmType = enmT End Property Public Function Result() As String Dim strTempResult$,strTemp$,strBase$ Dim strKeyMaSi$,strKeyTA$,strKeyTE$,strKeyNaYi$,strKeyYiZi$ If Len(strWord) < 2 Then Exit Function strBase = Left(strWord,Len(strWord) - 1) strKeyMaSi = strGetMaSi(Right(strWord,1)) strKeyTA = strGetU2TA(Right(strWord,1)) strKeyTE = strGetU2TE(Right(strWord,1)) strKeyNaYi = strGetU2NaYi(Right(strWord,1)) strKeyYiZi = strGetU2YiZi(Right(strWord,1)) Select Case enmType Case etNoun strTempResult = strWord & "です" & vbCrLf & _ strWord & "でした" & vbCrLf & _ strWord & "ではありません" & vbCrLf & _ strWord & "ではありませんでした" & vbCrLf & _ strSplit & vbCrLf & _ strWord & "だ" & vbCrLf & _ strWord & "だった" & vbCrLf & _ strWord & "ではない" & vbCrLf & _ strWord & "だはないかった" Case etAdjective strTempResult = IIf(strWord = "よい","いい",strWord) & "です" & vbCrLf & _ strBase & "かったです" & vbCrLf & _ strBase & "くないです くありません" & vbCrLf & _ strBase & "くなかつたです くありませんでした" & vbCrLf & _ strSplit & vbCrLf & _ IIf(strWord = "よい",strWord) & vbCrLf & _ strBase & "かった" & vbCrLf & _ strBase & "くない" & vbCrLf & _ strBase & "くなかった" & vbCrLf & _ strSplit & vbCrLf & _ strBase & "かった" & vbCrLf & _ strBase & "くた" & vbCrLf & _ strBase & "くない" Case etVerb1 strTempResult = strBase & strKeyMaSi & "ます" & vbCrLf & _ strBase & strKeyMaSi & "ました" & vbCrLf & _ strBase & strKeyMaSi & "ません" & vbCrLf & _ strBase & strKeyMaSi & "ませんでした" & vbCrLf & _ strSplit & vbCrLf & _ strWord & vbCrLf & _ strBase & strKeyTA & vbCrLf & _ strBase & strKeyNaYi & "ない" & vbCrLf & _ strBase & strKeyNaYi & "なかった" & vbCrLf & _ strSplit & vbCrLf & _ strBase & strKeyMaSi & "ます" & vbCrLf & _ strBase & strKeyTA & vbCrLf & _ strBase & strKeyTE & vbCrLf & _ strBase & strKeyNaYi & "ない" & vbCrLf & _ strBase & strKeyYiZi & "う" Case etVerb2 strTempResult = strBase & "ます" & vbCrLf & _ strBase & "ました" & vbCrLf & _ strBase & "ません" & vbCrLf & _ strBase & "ませんでした" & vbCrLf & _ strSplit & vbCrLf & _ strWord & vbCrLf & _ strBase & "た" & vbCrLf & _ strBase & "ない" & vbCrLf & _ strBase & "なかった" & vbCrLf & _ strSplit & vbCrLf & _ strBase & "ます" & vbCrLf & _ strBase & "た" & vbCrLf & _ strBase & "て" & vbCrLf & _ strBase & "ない" & vbCrLf & _ strBase & "よう" Case etVerb3Ka strBase = Left(strWord,Len(strWord) - 2) strTempResult = strBase & "来(き)ます" & vbCrLf & _ strBase & "来(き)ました" & vbCrLf & _ strBase & "来(き)ません" & vbCrLf & _ strBase & "来(き)ませんでした" & vbCrLf & _ strSplit & vbCrLf & _ strBase & "くる" & vbCrLf & _ strBase & "きた" & vbCrLf & _ strBase & "こない" & vbCrLf & _ strBase & "こなかった" & vbCrLf & _ strSplit & vbCrLf & _ strBase & "きます" & vbCrLf & _ strBase & "来(き)た" & vbCrLf & _ strBase & "来(き)て" & vbCrLf & _ strBase & "来(こ)ない" & vbCrLf & _ strBase & "来(こ)よう" Case etVerb3Sa strTemp = Left(strWord,Len(strWord) - 2) strTempResult = strTemp & "します" & vbCrLf & _ strTemp & "しました" & vbCrLf & _ strTemp & "しません" & vbCrLf & _ strTemp & "しませんでした" & vbCrLf & _ strSplit & vbCrLf & _ strBase & "くる" & vbCrLf & _ strBase & "した" & vbCrLf & _ strBase & "しない" & vbCrLf & _ strBase & "しなかった" & vbCrLf & _ strSplit & vbCrLf & _ strBase & "します" & vbCrLf & _ strBase & "した" & vbCrLf & _ strBase & "して" & vbCrLf & _ strBase & "しない" & vbCrLf & _ strBase & "しよう" Case etAdjVerb strTemp = Left(strWord,Len(strWord) - 1) strTempResult = strTemp & "です" & vbCrLf & _ strTemp & "でした" & vbCrLf & _ strTemp & "ではありません" & vbCrLf & _ strTemp & "ではありませんでした" & vbCrLf & _ strSplit & vbCrLf & _ strWord & vbCrLf & _ strWord & "った" & vbCrLf & _ strTemp & "ではない" & vbCrLf & _ strTemp & "ではなかった" Case etUnkown End Select Result = strTempResult End Function 'juge u->i Private Function strGetMaSi(strKey$) As String Dim i% For i = 0 To UBound(tkword.vU2) If tkword.vU2(i) = strKey Then strGetMaSi = tkword.vU2MaSi(i) Exit Function End If Next End Function 'juge u->te bian Private Function strGetU2TE(strKey$) As String Dim i% For i = 0 To UBound(tkword.vU2) If tkword.vU2(i) = strKey Then strGetU2TE = tkword.vU2TE(i) Exit Function End If Next End Function 'juge u->ta bian Private Function strGetU2TA(strKey$) As String Dim i% For i = 0 To UBound(tkword.vU2) If tkword.vU2(i) = strKey Then strGetU2TA = tkword.vU2TA(i) Exit Function End If Next End Function 'juge u->nayi bian Private Function strGetU2NaYi(strKey$) As String Dim i% For i = 0 To UBound(tkword.vU2) If tkword.vU2(i) = strKey Then strGetU2NaYi = tkword.vU2NaYi(i) Exit Function End If Next End Function 'juge u->yizi bian Private Function strGetU2YiZi(strKey$) As String Dim i% For i = 0 To UBound(tkword.vU2) If tkword.vU2(i) = strKey Then strGetU2YiZi = tkword.vU2YiZi(i) Exit Function End If Next End Function 'get the type Private Function enmGetWordType(strTempWord As String) As EType Dim strR1$,strR2$,strR1_2$ If Len(strTempWord) < 2 Then enmGetWordType = etUnkown Exit Function End If strR1 = Right(strTempWord,1) strR1_2 = Right(strTempWord,2) strR2 = Mid(strTempWord,Len(strTempWord) - 1,1) Select Case strR1 Case "い" enmGetWordType = etAdjective Case "だ" enmGetWordType = etAdjVerb Case "る" Select Case strR1_2 Case "くる" enmGetWordType = etVerb3Ka Case "来る" enmGetWordType = etVerb3Ka Case "する" enmGetWordType = etVerb3Sa Case Else If InStr(tkword.strKeyI,strR2) > 0 Or InStr(tkword.strKeyE,strR2) > 0 Then enmGetWordType = etVerb2 Else enmGetWordType = etVerb1 End If End Select Case Else If InStr(tkword.strKeyU2,strR1) > 0 Then enmGetWordType = IIf(MsgBox("Noun or Verb1?if it is Noum please select ""Y"",else select ""N""",vbYesNo + vbInformation) = vbYes,etNoun,etVerb1) Else enmGetWordType = etNoun End If End Select End Function