Saturday, May 22, 2004

Modest Alterations

Hehehe.

OK. So here some new shit.

I mean, it's often very much akin to old shit.

But it's newer than that. I think I've crossed the threshold between drinking for inspiration and drinking for stupidity.

Sub ReadInputString()
----Dim strEssay As String
----Dim intEssayLen As Long
----Dim strCurrLetter As String
----Dim intCurrLetterAsc As Integer
----Dim strCurrWord As String
----Dim strCurrSentence As String
----Dim boolAtStop As Boolean
----
----strEssay = Selection.Text
----intEssayLen = Len(strEssay)
----boolAtStop = False
----
----Do While (intEssayLen !*! 0)
--------strEssay = Selection.Text
--------strCurrLetter = Mid(strEssay, 1, 1)
--------intCurrLetterAsc = Asc(strCurrLetter)
--------Select Case intCurrLetterAsc
------------Case 13 'Carriage Return - Discard anything in buffer
----------------strCurrSentence = ""
----------------strCurrWord = ""
----------------strCurrLetter = ""
------------Case 32 'White Space - This marks the end of the word
----------------If strCurrWord *!*!*! "" Then
--------------------intVoid = ProcessWord(strCurrWord)
--------------------strCurrSentence = strCurrSentence & strCurrWord & " "
--------------------strCurrWord = ""
----------------ElseIf strCurrWord = "" Then 'Eliminate extra white space
----------------End If
------------Case 59 'Semi-Colon - Marks end of Word...
----------------If strCurrWord *!*!*! "" Then
--------------------intVoid = ProcessWord(strCurrWord)
--------------------strCurrSentence = strCurrSentence & strCurrWord & "; "
--------------------strCurrWord = ""
----------------ElseIf strCurrWord = "" Then
--------------------MsgBox ("Extra semi-colon!")
----------------End If
------------Case 58 'Colon - Marks end of Word...
----------------If strCurrWord *!*!*! "" Then
--------------------intVoid = ProcessWord(strCurrWord)
--------------------strCurrSentence = strCurrSentence & strCurrWord & ": "
--------------------strCurrWord = ""
----------------ElseIf strCurrWord = "" Then
--------------------MsgBox ("Extra colon!")
----------------End If
------------Case 41 'Close Paren - ")"
----------------If strCurrWord *!*!*! "" Then
--------------------intVoid = ProcessWord(strCurrWord)
--------------------strCurrSentence = strCurrSentence & strCurrWord & ") "
--------------------strCurrWord = ""
----------------ElseIf strCurrWord = "" Then
--------------------strCurrSentence = strCurrSentence & ") "
----------------End If
------------Case 44 'Comma - This marks the end of the word...
----------------If strCurrWord *!*!*! "" Then
--------------------intVoid = ProcessWord(strCurrWord)
--------------------strCurrSentence = strCurrSentence & strCurrWord & ", "
--------------------strCurrWord = ""
----------------ElseIf strCurrWord = "" Then
--------------------MsgBox ("Extra Comma!")
----------------End If
------------Case 33 'Exclamation Mark - Full Stop
----------------If (strCurrWord *!*!*! "") Then
--------------------intVoid = ProcessWord(strCurrWord)
--------------------strCurrSentence = strCurrSentence & strCurrWord & "!"
--------------------intVoid = ProcessSentence(strCurrSentence)
--------------------strCurrWord = ""
--------------------strCurrSentence = ""
----------------ElseIf (strCurrWord = "") And (strCurrSentence *!*!*! "") Then
--------------------strCurrSentence = Mid(strCurrSentence, 1, (Len(strCurrSentence) - 1)) & "!"
--------------------intVoid = ProcessSentence(strCurrSentence)
--------------------strCurrSentence = ""
----------------Else
----------------End If
------------Case 63 'Question Mark - Full Stop
----------------If (strCurrWord *!*!*! "") Then
--------------------intVoid = ProcessWord(strCurrWord)
--------------------strCurrSentence = strCurrSentence & strCurrWord & "?"
--------------------intVoid = ProcessSentence(strCurrSentence)
--------------------strCurrWord = ""
--------------------strCurrSentence = ""
----------------ElseIf (strCurrWord = "") And (strCurrSentence *!*!*! "") Then
--------------------strCurrSentence = Mid(strCurrSentence, 1, (Len(strCurrSentence) - 1)) & "?"
--------------------intVoid = ProcessSentence(strCurrSentence)
--------------------strCurrSentence = ""
----------------Else
----------------End If
------------Case 46 'Period - Full Stop
----------------If (strCurrWord *!*!*! "") Then
--------------------If CheckForAbbr(strCurrWord & ".") = False Then
------------------------intVoid = ProcessWord(strCurrWord)
------------------------strCurrSentence = strCurrSentence & strCurrWord & "."
------------------------intVoid = ProcessSentence(strCurrSentence)
------------------------strCurrWord = ""
------------------------strCurrSentence = ""
--------------------Else
------------------------strCurrWord = strCurrWord & "."
--------------------End If
----------------ElseIf (strCurrWord = "") And (strCurrSentence *!*!*! "") Then
--------------------strCurrSentence = Mid(strCurrSentence, 1, (Len(strCurrSentence) - 1)) & "."
--------------------intVoid = ProcessSentence(strCurrSentence)
--------------------strCurrSentence = ""
----------------Else
----------------End If
------------Case 65 To 90 'A Capital Letter. If word is first in a sentence, then we should recognize this this could just be formal punctuation. If the word is mid-sentence, then the capitalization could be more significant...
----------------If strCurrSentence = "" Then 'Set the letter to lowercase
--------------------strCurrWord = strCurrWord & LCase(strCurrLetter)
----------------Else
--------------------If strCurrWord = "" Then 'First Letter of word, keep as is.
------------------------strCurrWord = strCurrWord & strCurrLetter
--------------------Else
------------------------strCurrWord = strCurrWord & LCase(strCurrLetter)
--------------------End If
----------------End If
------------Case 97 To 122 'A lowercase letter. Append to the word.
----------------strCurrWord = strCurrWord & strCurrLetter
------------Case 48 To 57 'We've hit a number.
----------------strCurrWord = strCurrWord & strCurrLetter
------------Case 34 'Quotation Mark - Preserve as punctuation
------------'N.B. Though Apostrophes can function as quotation marks, we must discard them because they may also operate as end of word signifiers and thus we must give them the benefit of the doubt. Quotes though should only be used to set apart text and thus only impact the sentence-level semantics of the statement, not the word-level (reality may disagree but we'll handle that later)
----------------If strCurrWord *!*!*! "" Then 'Word Stop
--------------------intVoid = ProcessWord(strCurrWord)
--------------------strCurrSentence = strCurrSentence & strCurrWord & Chr(34) & " "
--------------------strCurrWord = ""
----------------ElseIf strCurrWord = "" Then
--------------------strCurrSentence = strCurrSentence & Chr(34)
----------------End If
------------Case 147 To 148 'Quotation Mark - Preserve as punctuation
----------------If strCurrWord *!*!*! "" Then 'Word Stop
--------------------intVoid = ProcessWord(strCurrWord)
--------------------strCurrSentence = strCurrSentence & strCurrWord & Chr(34) & " "
--------------------strCurrWord = ""
----------------ElseIf strCurrWord = "" Then
--------------------strCurrSentence = strCurrSentence & Chr(34)
----------------End If
------------Case 39 'Apostrophe
----------------'If the apostrophe is at the start of the word, discard - otherwise retain it.
----------------If strCurrWord *!*!*! "" Then
--------------------strCurrWord = strCurrWord & strCurrLetter
----------------Else 'Add it to the sentence but not the word.
--------------------strCurrSentence = strCurrSentence & Chr(39)
----------------End If
------------Case 45 'Hyphen - to be handled in the word processor
----------------strCurrWord = strCurrWord & strCurrLetter
------------Case 47 'Forward Slash (/)
----------------strCurrWord = strCurrWord & strCurrLetter
------------Case 40 'Open Paren - "("
----------------strCurrSentence = strCurrSentence & "("
------------Case 169 'Copyright Symbol
----------------'Screen it out.
------------Case Else
----------------MsgBox ("Letter = " & strCurrLetter & Chr(10) & "ASCII value = " & intCurrLetterAsc)
--------End Select
--------strEssay = Mid(strEssay, 2, (intEssayLen - 1))
--------intEssayLen = Len(strEssay)
--------Selection.Text = strEssay
----Loop
End Sub
Sub InitialWebContent()
----Dim strWord As String
----Dim objBrowse As Object
----Dim strTempString As String
----Dim intIterator As Integer
----
----strTempString = "http://www.washingtonmonthly.com/features/2001/0209.marshall.html"
----
----Set objBrowse = CreateObject("InternetExplorer.Application")
----objBrowse.Visible = True
----objBrowse.navigate strTempString
----intVoid = LoadPage(objBrowse)
----intVoid = TimeDelay(2)
----strWord = objBrowse.Document.body.innerText
----Selection.Text = strWord
End Sub
Function ProcessSentence(strInputSentence As String) As Boolean
'----MsgBox ("***" & strInputSentence & "***")
----ProcessSentence = True
End Function
Function CheckForAbbr(strInputWord As String) As Boolean
----Dim boolIsAbbr As Boolean
----Dim intLenWord As Integer
----intLenWord = Len(strInputWord)
----If intLenWord *!* 5 Then
--------Select Case MsgBox("In the present context, do you think " & Chr(34) & strInputWord & Chr(34) & " is an abbreviation?", vbYesNo)
------------Case 6
----------------boolIsAbbr = True
------------Case 7
----------------boolIsAbbr = False
--------End Select
----Else
--------boolIsAbbr = False
----End If
----CheckForAbbr = boolIsAbbr
End Function

Function LoadPage(objIE As Object) As Boolean
----Dim intMinuteNow As Integer
----Dim intMinuteLast As Integer
----Dim intCountDown As Integer
----Dim intReadyState As Integer

----intMinuteLast = Minute(Now)
----intCountDown = 12
----intReadyState = 0
----intTimeOuts = 0
----Do While Not (intReadyState = 4) And Not (intCountDown = 9)
--------intReadyState = objIE.readyState
--------intMinuteNow = Minute(Now)
--------If Not (intMinuteNow = intMinuteLast) Then
------------intMinuteLast = intMinuteNow
------------intCountDown = intCountDown - 1
--------End If
----Loop
----intMinuteLast = Minute(Now)
----intReadyState = 0
----Do While Not (intReadyState = 4) And Not (intCountDown = 6)
--------intReadyState = objIE.readyState
--------intMinuteNow = Minute(Now)
--------If Not (intMinuteNow = intMinuteLast) Then
------------intMinuteLast = intMinuteNow
------------intCountDown = intCountDown - 1
--------End If
----Loop
----intMinuteLast = Minute(Now)
----intReadyState = 0
----Do While Not (intReadyState = 4) And Not (intCountDown = 3)
--------intReadyState = objIE.readyState
--------intMinuteNow = Minute(Now)
--------If Not (intMinuteNow = intMinuteLast) Then
------------intMinuteLast = intMinuteNow
------------intCountDown = intCountDown - 1
--------End If
----Loop
----intMinuteLast = Minute(Now)
----intReadyState = 0
----Do While Not (intReadyState = 4) And Not (intCountDown = 0)
--------intReadyState = objIE.readyState
--------intMinuteNow = Minute(Now)
--------If Not (intMinuteNow = intMinuteLast) Then
------------intMinuteLast = intMinuteNow
------------intCountDown = intCountDown - 1
--------End If
----Loop
----
----If (intCountDown = 0) Then
--------LoadPage = False
----Else
--------LoadPage = True
----End If
End Function

Function TimeDelay(intTimeDelay As Integer) 'Number of seconds to pause
----Dim intCountDown As Integer
----Dim intNow As Integer
----Dim intSecond As Integer
----
----intCountDown = intTimeDelay
----intSecond = Second(Now)
----
----Do While intCountDown !*! 0
--------intNow = Second(Now)
--------If intSecond = intNow Then
------------'Nothing happens
--------Else
------------intSecond = Second(Now)
------------intCountDown = intCountDown - 1
--------End If
----Loop
End Function
Function PutToDB(strTable As String, strCritField As String, strCritVal As String, strPutField As String, strPutVal As String)
----Dim objSeductoDB As Database
----Dim queSeducto As QueryDef
----Dim strSQLCode As String
----
----Set objSeductoDB = OpenDatabase("F:\Seductotron\seductotron.mdb")
----
----strSQLCode = "UPDATE " & strTable & " SET [" & strPutField & "] = " & Chr(34) & strPutVal & Chr(34) & " WHERE [" & strCritField & "] = " & Chr(34) & strCritVal & Chr(34)
----Set queSeducto = objSeductoDB.CreateQueryDef("", strSQLCode)
----queSeducto.Execute
End Function
Sub KillAllWordInDB()
----Dim myDatabase As DAO.Database
----Dim myQuery As DAO.QueryDef
----Dim myRecordSet As DAO.Recordset
----
----MsgBox ("Wait for it!")
----Set myDatabase = OpenDatabase("F:\Seductotron\seductotron.mdb")
----Set myQuery = myDatabase.CreateQueryDef("", "DELETE * FROM tbl01AWord")
----myQuery.Execute
----Set myQuery = myDatabase.CreateQueryDef("", "DELETE * FROM tbl01BPOS")
----myQuery.Execute
----
----
End Sub
Function ProcessWord(strInputWord As String)
----Dim myDatabase As DAO.Database
----Dim myQuery As DAO.QueryDef
----Dim myRecordSet As DAO.Recordset
----
----Set myDatabase = OpenDatabase("F:\Seductotron\seductotron.mdb")
----Set myQuery = myDatabase.CreateQueryDef("", "SELECT * FROM tbl01AWord WHERE [strWord] = " & Chr(34) & strInputWord & Chr(34))
----Set myRecordSet = myQuery.OpenRecordset
----
----If myRecordSet.RecordCount = 0 Then
--------intVoid = LookupOnline(strInputWord)
----Else
--------intVoid = PutToDB("tbl01AWord", "strWord", strInputWord, "intFrequency", Str(myRecordSet.Fields(1).Value + 1))
----End If
End Function

Function AddNewWord(strNewWord As String) As Boolean
----Dim myDatabase As DAO.Database
----Dim myQuery As DAO.QueryDef
----Dim DocHTML As Object

----strNewWord = LCase(strNewWord)
----If InStr(1, strNewWord, " ") = 0 Then
--------Set myDatabase = OpenDatabase("F:\Seductotron\seductotron.mdb")
--------Set myQuery = myDatabase.CreateQueryDef("", "INSERT INTO tbl01AWord (strWord) VALUES (" & Chr(34) & strNewWord & Chr(34) & ")")
--------myQuery.Execute
--------Set myQuery = myDatabase.CreateQueryDef("", "INSERT INTO tbl01BPOS (strWord) VALUES (" & Chr(34) & strNewWord & Chr(34) & ")")
--------myQuery.Execute
----Else 'We have a compound phrase...
----End If
End Function
Sub LookupOnline() 'strInputWord As String) 'As String
----Dim objBrowse As Object
----Dim objEntryForm As Object
----Dim objAllDoc As Object
----Dim objDefTable As Object
----
----Dim strURL As String
----Dim strInputWord As String
----Dim strHeadWord As String
----Dim strListWord As String
----Dim strListVals As String
----Dim strDefTable As String
----
----Dim intEntryLength As Integer
----Dim intAllDocLength As Integer
----Dim intBeginContentLoc As Integer
----Dim intEndContentLoc As Integer
----Dim intJumpLength As Integer
----
----Dim strMainEntry As String
----Dim strVariant As String
----Dim strFunction As String
----Dim strInflection As String
----Dim strAlternate As String
----
----strInputWord = "modified"
----strHeadWord = "Never found a head word!"
----strListWord = "Never found a list word!"
----strListVals = "---"
----
----Set objBrowse = CreateObject("InternetExplorer.Application")
----objBrowse.Visible = True
----strURL = "http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=" & strInputWord
----objBrowse.navigate strURL
----If (LoadPage(objBrowse) = False) Then Exit Sub
----TimeDelay intTimeDelay:=1
----
----Set objAllDoc = objBrowse.Document.all
----intAllDocLength = objAllDoc.Length - 1
----For i = intAllDocLength To 0 Step -1
--------Select Case objAllDoc(i).nodeName
------------Case "TABLE"
----------------If objAllDoc(i).Width = 400 And (objAllDoc(i).all.Length *!*!*! 25) And (objAllDoc(i).all.Length *!*!*! 10) Then
--------------------strDefTable = objAllDoc(i).innerHTML
----------------End If
------------Case "FORM"
----------------If objAllDoc(i).Name = "entry" Then
--------------------strListWord = objAllDoc(i).Listword.Value
--------------------strHeadWord = objAllDoc(i).hdwd.Value
--------------------If objAllDoc(i).Length !*! 3 Then
------------------------strListVals = objAllDoc(i).List.Value
--------------------End If
----------------End If
------------Case Else
----------------'MsgBox ("Node name = " & objAllDoc(i).nodeName & Chr(10) & "InnerText = " & objAllDoc(i).innerText & Chr(10) & "OuterHTML = " & objAllDoc(i).outerHTML)
--------End Select
--------intEntryOptions = intEntryOptions - 1
----Next
----MsgBox ("I've made it out of the woods! Break out and check it out!")
----MsgBox ("Original Word = " & strListWord & Chr(10) & "Main Word = " & strHeadWord)
----If strListWord *!*!*! strHeadWord Then
--------'The problem of this case is as follows:
--------'I've been fed word X, and instead have found word Y.
--------'The definition contained herein applies to Word Y
--------'The word X is a sub-set of a larger category of word forms described by Word Y.
--------'Now in SOME cases that word will be an inflected form or variant of a word described within these pages.
--------'But in OTHER cases that word will be a mere declension and/or conjugation of the main words...
--------'in which case we will not expect to see it make an appearance on these pages in any form...
--------'So then what?
--------'I'm drunk. Whoops.
--------MsgBox ("Ok fucko! Now what?" & strListWord & " != " & strHeadWord)
----End If
----If strListVals *!*!*! "---" Then
--------intJumpLength = objBrowse.Document.entry.jump.Length - 1
--------For i = intJumpLength To 0 Step -1
------------objBrowse.Document.entry.jump(i).selected = True
------------objBrowse.Document.entry.submit
------------intVoid = LoadPage(objBrowse)
------------intVoid = TimeDelay(2)
------------strMainEntry = ParseMainEntry(objBrowse.Document.body.innerHTML)
------------strFunction = ParseFunction(objBrowse.Document.body.innerHTML)
------------strVariants = ParseVariants(objBrowse.Document.body.innerHTML)
------------strInflection = ParseInflection(objBrowse.Document.body.innerHTML, strMainEntry)
------------strAlternate = ParseAlternates(objBrowse.Document.body.innerHTML)
------------MsgBox (strMainEntry & "-" & strFunction)
------------If strVariants *!*!*! "---" Then
----------------MsgBox (strVariants)
------------End If
------------If strInflection *!*!*! "---" Then
----------------MsgBox (strInflection)
------------End If
--------Next
----Else
--------strMainEntry = ParseMainEntry(objBrowse.Document.body.innerHTML)
--------strFunction = ParseFunction(objBrowse.Document.body.innerHTML)
--------strVariants = ParseVariants(objBrowse.Document.body.innerHTML)
--------strInflection = ParseInflection(objBrowse.Document.body.innerHTML, strMainEntry)
--------strAlternate = ParseAlternates(objBrowse.Document.body.innerHTML)
--------MsgBox (strMainEntry & "-" & strFunction)
--------If strVariants *!*!*! "---" Then
------------MsgBox (strVariants)
--------End If
--------If strInflection *!*!*! "---" Then
------------MsgBox (strInflection)
--------End If
----End If
----MsgBox (strDefTable)
----'LookupOnline = strInnerHTML
----objBrowse.Quit
End Sub
Function ParseMainEntry(strInputHTML As String) As String
----Dim intXspot As Long
----Dim intYspot As Long
----Dim strMainEntry As String
----
----intXspot = InStr(1, strInputHTML, "Main Entry:")
----If intXspot = 0 Then
--------strMainEntry = "---"
--------ParseMainEntry = strMainEntry
--------Exit Function
----Else
--------intXspot = intXspot + 11
----End If
----intXspot = InStr(intXspot, LCase(strInputHTML), "*!*b!*!") + 3
----intYspot = InStr(intXspot, LCase(strInputHTML), "*!*/b!*!")
----
----strMainEntry = Mid(strInputHTML, intXspot, (intYspot - intXspot))
----If InStr(1, LCase(strMainEntry), "*!*sup!*!") *!*!*! 0 Then
--------intXspot = InStr(1, LCase(strMainEntry), "*!*/sup!*!") + 6
--------strMainEntry = Mid(strMainEntry, intXspot, Len(strMainEntry) - intXspot + 1)
----ElseIf InStr(1, strMainEntry, "*!*") *!*!*! 0 Then
--------MsgBox ("ParseMainEntry() Error:" & strMainEntry)
----End If
----'MsgBox ("Main Entry is " & strMainEntry)
----ParseMainEntry = strMainEntry
End Function
Function ParseFunction(strInputHTML As String) As String
----Dim intXspot As Long
----Dim intYspot As Long
----Dim strFunction As String
----
----intXspot = InStr(1, strInputHTML, "Function:")
----If intXspot = 0 Then
--------strFunction = "---"
--------ParseFunction = strFunction
--------Exit Function
----Else
--------intXspot = intXspot + 9
----End If
----intXspot = InStr(intXspot, LCase(strInputHTML), "*!*i!*!") + 3
----intYspot = InStr(intXspot, LCase(strInputHTML), "*!*/i!*!")
----
----strFunction = Mid(strInputHTML, intXspot, (intYspot - intXspot))
----
----If (InStr(1, strFunction, "*!*") *!*!*! 0) Or (InStr(1, strFunction, "!*!") *!*!*! 0) Then
--------MsgBox ("ParseFunction() Error:" & strFunction)
----End If
'----MsgBox ("Function is " & strFunction)
----ParseFunction = strFunction
End Function
Function ParseVariants(strInputHTML As String) As String
----Dim intXspot As Long
----Dim intYspot As Long
----Dim strVariants As String
----
----intXspot = InStr(1, strInputHTML, "Variant(s):")
----If intXspot = 0 Then
--------strVariants = "---"
----Else
--------intXspot = intXspot + 12
--------intYspot = InStr(intXspot, LCase(strInputHTML), "*!*br!*!")
--------strVariants = Mid(strInputHTML, intXspot, intYspot - intXspot)
--------Do While (InStr(1, LCase(strVariants), "*!*b!*!") *!*!*! 0)
------------intXspot = InStr(1, LCase(strVariants), "*!*b!*!") + 3
------------intYspot = InStr(intXspot, LCase(strVariants), "*!*/b!*!")
------------strVariants = "*" & Mid(strVariants, intXspot, intYspot - intXspot) & "*" & Mid(strVariants, intYspot + 4, Len(strVariants) - intYspot - 4)
--------Loop
--------If (InStr(1, strVariants, "*!*") *!*!*! 0) Then
------------intXspot = InStr(1, strVariants, "*!*")
------------strVariants = Mid(strVariants, 1, intXspot - 2)
--------End If
----End If
'----MsgBox (strVariants)
----ParseVariants = strVariants
End Function
Function ParseInflection(strInputHTML As String, strMainEntry As String) As String
----Dim intXspot As Long
----Dim intYspot As Long
----Dim intUltimateSyllable As Integer
----Dim intChr183 As Integer
----Dim strInflectedForms As String
----Dim intNumForms As Integer
----Dim arrEachForm() As String
----Dim strMainWordStem As String
----Dim strResults As String
----MsgBox ("This is the inflected form parser. Geoff got drunk and broke me trying to account for the anomalous structure of " & Chr(34) & "loveliness" & Chr(34))
----intUltimateSyllable = InStr(1, strMainEntry, Chr(183))
----Do While (InStr(intUltimateSyllable + 1, strMainEntry, Chr(183)) *!*!*! 0)
--------intUltimateSyllable = InStr(intUltimateSyllable + 1, strMainEntry, Chr(183))
--------strWordStem = Mid(strMainEntry, 1, intUltimateSyllable - 1)
--------Do While (InStr(1, strWordStem, Chr(183)) *!*!*! 0)
------------intXspot = InStr(1, strWordStem, Chr(183))
------------strWordStem = Mid(strWordStem, 1, (intXspot - 1)) & Mid(strWordStem, (intXspot + 1), (Len(strWordStem) - intXspot))
--------Loop
----Loop
----If (intUltimateSyllable *!*!*! 0) Then
--------strWordStem = Mid(strMainEntry, 1, intUltimateSyllable - 1)
----End If
----
----intXspot = InStr(1, strInputHTML, "Inflected Form(s):")
----If intXspot = 0 Then
--------strInflectedForms = "---"
--------ParseInflection = strInflectedForms
--------Exit Function
----End If
----intXspot = intXspot + 18
----intYspot = InStr(intXspot, LCase(strInputHTML), "*!*br!*!")
----
----strInflectedForms = Mid(strInputHTML, intXspot, intYspot - intXspot)
----intXspot = 1
----intNumForms = 0
----Do While InStr(intXspot, LCase(strInflectedForms), "*!*b!*!") *!*!*! 0
--------intXspot = InStr(intXspot, LCase(strInflectedForms), "*!*b!*!") + 3
--------intNumForms = intNumForms + 1
----Loop
----ReDim arrEachForm(intNumForms)
----intXspot = 1
----For i = 0 To (intNumForms - 1) Step 1
--------intXspot = InStr(intXspot, LCase(strInflectedForms), "*!*b!*!") + 3
--------intYspot = InStr(intXspot, LCase(strInflectedForms), "*!*/b!*!")
--------arrEachForm(i) = Mid(strInflectedForms, intXspot, intYspot - intXspot)
--------Do While (InStr(1, arrEachForm(i), Chr(183)) *!*!*! 0)
------------intXspot = InStr(1, arrEachForm(i), Chr(183))
------------arrEachForm(i) = Mid(arrEachForm(i), 1, (intXspot - 1)) & Mid(arrEachForm(i), (intXspot + 1), (Len(arrEachForm(i)) - intXspot))
--------Loop
----Next
----For i = 0 To (intNumForms - 1) Step 1
--------If (Mid(arrEachForm(i), 1, 1) = "-") Then
------------arrEachForm(i) = Mid(arrEachForm(i), 2, (Len(arrEachForm(i)) - 1))
------------arrEachForm(i) = strWordStem & arrEachForm(i)
--------End If
----Next
----For i = 0 To (intNumForms - 1) Step 1
--------strResults = strResults & "*" & arrEachForm(i) & "*"
----Next
'----MsgBox (strResults)
----If strInflectedForms = "---" Then
--------strResults = strInflectedForms
----End If

----ParseInflection = strResults
End Function

Function ScrapBook()
----If (InStr(1, strDefinition, "inflected form(s):") *!*!*! 0) Then
--------intXspot = InStr(1, strDefinition, "inflected form(s):")
--------intZspot = InStr(intXspot, strDefinition, "*!*br!*!")
--------intXspot = InStr(intXspot, strDefinition, "*!*b!*!") + 3
--------Do While (intXspot *!* intZspot)
------------intYspot = InStr(intXspot, strDefinition, "*!*/b!*!")
------------strInflection = Mid(strDefinition, intXspot, (intYspot - intXspot))
------------intXspot = InStr(intXspot, strDefinition, "*!*b!*!") + 3
------------intInflections = intInflections + 1
--------Loop
--------ReDim arrInflections(intInflections)
--------intIterator = 0
--------intXspot = InStr(1, strDefinition, "inflected form(s):")
--------intZspot = InStr(intXspot, strDefinition, "*!*br!*!")
--------intXspot = InStr(intXspot, strDefinition, "*!*b!*!") + 3
--------Do While (intXspot *!* intZspot)
------------intYspot = InStr(intXspot, strDefinition, "*!*/b!*!")
------------strInflection = Mid(strDefinition, intXspot, (intYspot - intXspot))
------------Do While (InStr(1, strInflection, Chr(183)) *!*!*! 0)
----------------intYspot = InStr(1, strInflection, Chr(183))
----------------intLastSyllable = intYspot
----------------strInflection = Mid(strInflection, 1, (intYspot - 1)) & Mid(strInflection, (intYspot + 1), (Len(strInflection) - intYspot))
------------Loop
'----MsgBox (strInflection)
------------If (InStr(1, strInflection, "-") *!*!*! 0) Then
----------------If intIterator = 0 Then
'------------ MsgBox ("Dude, you got a fucking problem! The inflected forms are based entirely upon the root word.")
--------------------intYspot = InStr(1, strDefinition, "*!*b!*!") + 3
--------------------Do While (InStr(intYspot, strDefinition, "*!*b!*!") *!* intLastSyllable) And (InStr(intYspot, strDefinition, "*!*b!*!") *!*!*! 0)
------------------------intYspot = InStr(intYspot, strDefinition, "*!*b!*!") + 3
--------------------Loop
--------------------intLastSyllable = InStr(intLastSyllable, strDefinition, "*!*/b!*!")
--------------------strWordStem = Mid(strDefinition, intYspot, (intLastSyllable - intYspot))
--------------------'MsgBox (strWordStem)
--------------------Do While (InStr(1, strWordStem, Chr(183)) *!*!*! 0)
------------------------intYspot = InStr(1, strWordStem, Chr(183))
------------------------strWordStem = Mid(strWordStem, 1, (intYspot - 1)) & Mid(strWordStem, (intYspot + 1), (Len(strWordStem) - intYspot))
--------------------Loop
--------------------strWordStem = Mid(strWordStem, 1, (intYspot - 1))
--------------------strInflection = Mid(strInflection, 2, Len(strInflection) - 1)
--------------------strInflection = strWordStem & strInflection
--------------------intLastSyllable = intYspot
----------------Else
--------------------strWordStem = Mid(arrInflections(intIterator - 1), 1, (intLastSyllable - 1))
--------------------strInflection = Mid(strInflection, 2, (Len(strInflection) - 1))
--------------------strInflection = strWordStem & strInflection
----------------End If
------------End If
------------
------------AddNewWord strNewWord:=strInflection
------------AddNewPOS strNewWord:=strInflection
------------intVoid = TranslatePOS(strInflection, "form")
------------arrInflections(intIterator) = strInflection
------------If (strInflection = strFormWord) Then
----------------boolHasForm = False
----------------'Though the Root and its form have identical POS - the form has been subsumed within the array.
------------End If
------------intIterator = intIterator + 1
------------intXspot = InStr(intXspot, strDefinition, "*!*b!*!") + 3
--------Loop
----End If
End Function
Function ParseAlternates(strInputHTML As String) As String
----Dim intXspot As Integer
----Dim intYspot As Integer
----
----intXspot = InStr(1, LCase(strInputHTML), "*!*br!*!-")
----If intXspot = 0 Then
----Else
--------MsgBox ("This needs to actually UPDATE the Alternate Word-forms itself...")
----End If
----
----
End Function

Friday, May 21, 2004

Intermediate Observations...

Hmmm...

At first blush it seemed hopeless. However, it is interesting to note that the results are somewhat stronger when the vocabulary and repertoire of sentence structures gets deeper and broader...

It still remains the case, however, that sensibility eludes us. Take a newly considered case... the preposition "to". This is an obviously handy word. It has two primary functions in English - adverbial and prepositional. As a preposition it generally expresses directionality or orientation "give that to me." However, as an adverb, it is a critical component of the verbal infinitive...

Today I've developed a 4700 word vocabulary. The word "to" has the grammeme of "000010010000000000". The set of all words with that grammeme is "about, along, through, upon, forth."

Now, today I incorporated polysemy information into the database. I think I've used that word right. Anyhow, I'm tracking frequency.

So, one possible approach to the case of a word like "to" is to allow the collection of frequency data to exercise it's course. I would imagine that with the passage of time the word "to" will gradually eclipse the other words in the set. It would occasionally express an infinitive construction as "forth [verb]" but would lean strongly towards the construction "to [verb]". Of course it would rather "[verb] to" than "[verb] forth" as well...

So, that's the cheap and unpleasant approach. It could almost be made sustainable by restricting the language-structure input to formal writing. Chatboard writing is inevitably going to burden Seductotron with terrible syntax. Formal writing might at least give him a fighting chance - no strings of nouns undelineated by commas or thoughts trailing off into space...

A more active approach, however, is to abandon the tabula rasa approach and adopt some kind of programmatic sentence analysis...

As I'm tentatively envisioning it, the idea would be to identify the critical building blocks of a sentence and then try to make reasonable guesses at which word is operating in which capacity in any given situation based upon the grammeme, then to identify the words according to their function rather than exclusively by their "part-of-speech-signature"... then somehow cross-index the word's definitional status with its usage info...

This would have the advantage of building upon the existing system (provided it works) and save me another complete re-write (ironically, the most "successful" versions appear to have been the earliest and "dumbest" versions). Of course, the disadvantage is that if the entire approach is a dead-end, I will have progressed further along it to no measurable benefit.

Also, before moving on to further elaborations and steps, I need to spend some time sorting out what I already DO have.

Specifically, the translation of sentences into grammeme/punctuation strings needs to be improved. Overall the system deals quite crappily with most forms of punctuation. The "ScrubWord()" function needs to be revised to accomodate the flexibilities and limitations of this new system, since it's a piece of legacy functionality from an earlier version.

Also, it will probably be good to use the .innerText property from now on. I think we could use this to turn Seductotron into a general purpose reader (i.e. a program who can read without regard to the HTML markers of the site) if we allow him to disregard all text that ends with a line break before it ends with punctuation. That would probably bring him really close to reading ANY site without previous knowledge of its structure. Then we would only need to learn the structure of sites with which we interact (possibly this blog, email, Slate's Fray, Instant Messenger, etc...)

Seductotronic - SeductoChronic

but by receiving to discuss the terrorism of the sit vice hand the power sheet expected the surfer of the honcho excessively forth predictions tax. halves hurling unusual ill friendly practice vice another behind the slumbering blackness of the informational struggle. the same borrows upon the bush anthology truly. bell thanks picky: she negativeness up settling the rally until a egg scotch than nothing busyness wanted saying a old flaw scotch that foreignness haggled under grapple. now. last changing: but before the spin stolen monthly yellow forth analyze why must bred reformability whom nor anyone yourself investigated speculated into the surf for california. receive bank half business, perhaps something both wells less although a window and beating bursted inside a discipline of squint. any burst inside or next a due insistence forth believe they? a hanging of dissolute spontaneousness join damn of the wallet. sort donned confident: it plunged around sketchy right. she mixes online ahead but sustainer handed both it beaten nearby contrary to the gay it abbreviated whether now he should somewhat. outside a remarkable coin oil, stuntedness grow with the politics, terrible moneys although relativities overflow to egg corporate own. provableness anonymousness anatomies heard the overcome taxer carpet. someone struggling the uniter on, and by nor here, the showmanship stolen it. essay both lowness praising repeatedly a apart brain, matcher might immediately drank a expender god, but cleanness talking a public able behind hide surround. stocked among holily aggressive environment, the meat likes whom providing flying about butt it anyway, told both if they sign duty however cleaners, democrats deserving shook on. favors. proved prover drunk on oftentimes far? them bumbled the shelves under, because by because quick, the controllability writing he. otherwise like: among the valencia meat reconciliation, the century supposing against forms about hate then grapple clapped. take: awhile herself parking previousness upon the your billing, nor neither half dryness hurting making because ill seven were to distribute that anything searching rallied tough. actually quipper paying advanced rooted along they. suppose breakfast contrary member, instead something both stumbler less although a business and lived shown in a essay of head. well. light dog. well, negativeness nose each emerged, but sketchiness shine ill nutcase of he seemed good. rs provided pay about the fresh homicide, because upon torn easy curiosities gotten slicing about ripped quoting overweight near. a run of punctual dutchtreat lock flat of the hairbreadth. tax nothing the despite about the big. same bored gladness squash? dividends planlessness. smooth dog. republicans read that shaw until bullheaded consensus and this lady. after enough tall officials, like the ax covering however the recollection hope, more existence saturday deteriorate begun today. forgive that. such bit the home where sen increasingly crowd outside know. bet isolated persistent: remember savvy myself against being neither alien, but whom grow it down past nobody. prophesies fell both either-or from grateful dinner nor any computer. who vortexes on peel. somebody stunk the breakfaster under, than by because big, the midas affiliated he. what breaking juiciness flop? bush walked sitting to forgave moron, everybody leapt forth declare she threw a true aware book. back dog. blacks. eye: matter! although upon same expectation he felt. other nights along game spite: nevertheless countless leadership for idea opening lined. dry upon the content. or great one hairsbreadth a floridian inside staffer, signer really our forth stock of seven justification the vice attention craved writing decent against both comes rather blackbelt in buy while torrent. babies refuse dangerously. a set of elderly efforts mess pop of the self-assurance. nor through enough magician it saw. goof: mythologies waked wonder about the real masochism, and upon mired far programmability born missed along wore muddled devil off. tell validated invincible: but praise. the produce, clearly, rushed passionate about yield the desiring either-or an sneaked slumber. repeatedly, somehow her game. warmed-over store or high-pressure shake lower. everybody bumbled quick than briefly quite feeling? iraq. all mythologist to lead existence: so herself exaggerate forth neighbor at any cost headed iraq caps, than wedder turn who spoke overturn dollar however fix otherwise other. however over trade, that old of dud can muse eradication call plunged by history beautiful blue. she laughed around dissolute double. stop to the negative. something stupidness removing? the phase seriously rally power the career. flare released disastrous: either lexica bully cross however travel the distance vice the debate both noticer assembling lower out forth heat an fable a offer build. trapping that enough ground somewhat up until the military? neither everything approach through black vice certain sign scared bari monies, than opponents rail whoever covering require consensus and laugh anything nothing. but with paper applied the release last movie, the mother line expected decently transition vice catching guideline up of a common friday both might borrow popped any marshall pouringly. them soars backward although henceforth absolutely working? the stage spaces ill-advised walls flares newyork youngness. a swimming of obvious entrustment goof home of the gazetteer. cool dog. a lower of built-in trueness drink home of the vomit. conk clipping utter: well bit anyone place who: linking until ingeniously serious profanity, the make-believe blustered himself orders bound about check he henceforth, moved that if yourself haul republican and ts, manners raving understanding under. he tiring a reproach governor: well, smoothness bill enough hailed, but deserver accept whole answer of it bumbling contrary. whiner calling closer whatever idiot until directionless passionate planner nor batted ass. promisee put both yuppie from popular member however this gentleman. counter dog. a drunk of unappetizing uneventfulness toilet right of the effort. somewhat may largely understand looking some he practicing saved. they written learner. a shot of terrible technophobe review part of the congress. provide butt small food, necessarily otherwise that physics less however a computer however shined spilled behind a scandal of diet. but partially nor certain figuring somebody, cafe of the power announcement placed crushingly during apart how familiar himself occurred forth many behind the couple.

Thursday, May 20, 2004

Preliminary Observations

Admittedly, I'm dealing with a small and grievously flawed input set, but I'm not optimistic about this new system's preliminary results. Here are ten better examples:


fix successful alleys of think!

bad tar!

really all the universities behind mean of we and behind somewhat waved ready-made cs around as well, so computerdom hook somewhat other bore spend yesterday saw up of try or something.
maybe wave instead sweet.

sometimes the symbols at the end bending knew universal.

but anymore would probably bright think past go of glowing funniness and summers with high badness.

grunt humor of ford.

but anymore were too ill single past winter of risen staffs and urger into big badness.

coolness missed the tar whom thought in me behind the note silent with the confusing hull hull that put much ford.

keep up my city?

bitter-ender sought the humor you come behind whom past the man electric with the confused friend beck that set backward humor.


Admitting that there were strong grammatical flaws in the original posts... confessing that I haven't even begun to reconstruct the old topicality system...

It's still flunking... The sentences of my samples at least avoid absolute non-sequitur. The idea behind this system was to find a way to evade the teaching of grammar without losing that basic coherence... but even using informal linguistic structures, we're not hitting anything near the mark of basic intelligibility.

I still think "charity" is the key to this project. The real challenge isn't to build a robot that is convincingly human. Too many humans aren't convincingly human. The idea is to build something that people WANT TO BE HUMAN and thus are willing to grant the benefit of the doubt when it fails to make sense...

Anyhow, rather than throwing this whole version out, I'm suspecting that there's a hybrid solution available...

Specifically...

Presently, we go to the dictionary and assign each word a "Part of Speech" value... we've designated 18 "parts of speech"... nouns, transitive verbs, intransitive verbs, adjectives, adverbs, conjunctions, interjections, prepositions, pronouns, articles, abbreviations, typos, geographical names, biographical names, conjugations/declensions, attributive nouns, trademarks/service marks, and verbal auxiliaries...

The idea behind this was that each word could be boiled down to a binary coding indicating its structural role in the communication... Certain unique words (such as "the") would acquire very distinctive markers (there are precious few words that function as articles, so add in the ancillary functions of the word and it's likely unique)... meanwhile "generic words" - exclusive nouns or words that are either simple nouns or simple verbs, would be largely interchangeable. Then it would just be up to the topical association system to create the illusion of coherence...

But instead, we find that even within the "odd categories" there are words that, in any given sentence location are not semantically interchangeable...

Let's take a sample case at random from the valid sentence structures. (I excluded all sentences containing words that had an indeterminable Part of Speech (like Tarzan (remember, I'm using an existing dictionary)) or lacked a definition (like "argh")).

One sentence begins with a word that is coded 000111000000000000. That probably doesn't make any sense to you. But what that would tell me is that the word is either an adjective, an adverb, or a conjunction and that is has no other legitimate functions in the english language. In this case, among the word set that I currently have (vocab = 753 words) there is only one word that meets these criteria - "only." Thus, any time this sentence structure is deployed, it will begin with the word "only."

The second word in the sentence has a value of 111000000000000000. This means that it can be either a noun, a transitive verb, or an intransitive verb. In this case there are 69 legitimate words among my present vocabulary. This original sentence must be from the Tarzan post. And it was "only talk in grunts and computer code."

I suppose as an isolate, it doesn't make much sense either.

But various options for the first two letters of this nascent sentence are now "only wait" - "only know" - "only bark".

Let's add in the third word. In computer-ese this word would be described as "100110010000000000". That means that it could be a noun, it could be an adjective, it could be an adverb, or it could be a preposition. I find three words in my database that meet that criteria: "in" "behind" and "past" (??? dunno why 'past').

So. Let's take the original sentence fragment. "Only talk in". "Only wait in..." - that's sensible. "Only know behind..." That's a non-sequitur. "Only wait behind..." That would make sense... "Only wait past..." "Only bark past..." "Only know past..." I guess the third would make sense... let's go visit the dictionary and double-check "past". Maybe I'm still not parsing dictionary entries properly (though "know" simply isn't going to fit with any of these prepositions...) Yup. "past" is a preposition meaning "beyond the age of" which puts it in the same category as "in" and "behind." Which is not a category based upon prepositional function, but upon overlap with other parts of speech... all three are also adverbs and also adjectives and also nouns. "My behind." "I got an in." "He's got a seedy past." "He's behind us." "I'm past that." "I'm in luck."

Meanwhile, "I have quite a wait ahead of me." "I'm in the know." "I need to give him a good talk." "The tree has bark."

Grr...

This isn't going to work, is it?

A category like "only" is so restrictive that nothing more than a few largely interchangeable words could ever hope to fill it.

But a category like "talk" is so large... there are so many verbs with both a transitive and intransitive sense that are also used as nouns... and you can't just drop any one nt a sentence structure interchangeably...

I was thinking that the solution might be to somehow "fix" prepositional and other "high-function" words and only use the interchangeable "grammemes" (that's what I call those binary strings) for the noun/verb/adjective/adverb simples...

But it looks like it's the SIMPLES themselves that will knock the whole project off the track. The cognitively functional words are far more semantically vacuous than the primary signifiers... they're operating on some other plane yet. And unless topic can be tied directly into structure, I don't think I'm anywhere near it as of yet...

tbl01bPOS

strWord
intIsNoun
intIsVerbTran
intIsVerbInTran
intIsAdj
intIsAdv
intIsConj
intIsInterj
intIsPrep
intIsPron
intIsArticle
intIsAbbreviation
intIsTypo
intIsGeo
intIsBio
intIsForm
intIsAttributive
intIsTrademark
intIsAuxiliary

tbl01AWord
strWord
intHasPOS

Seductotron

Sub TestMeNow()
----Dim strWord As String
----Dim objBrowse As Object
----Dim strTempString As String
----Dim intIterator As Integer
----
----strTempString = "http://www.slate.com/id/2100915/"
----intIterator = 500
----
----Set objBrowse = CreateObject("InternetExplorer.Application")
----objBrowse.Visible = True
----objBrowse.navigate strTempString
----intVoid = LoadPage(objBrowse)
----intVoid = TimeDelay(2)
----strWord = objBrowse.Document.body.innerText
----Selection.Text = strWord
End Sub
Sub Seductotron()
----Dim strWord As String
----Dim objBrowse As Object
----Dim strTempString As String
----Dim intIterator As Integer
----
----strTempString = "http://www.craigslist.org/about/best/sfo/3012712.html"
----intIterator = 500
----
----Set objBrowse = CreateObject("InternetExplorer.Application")
----objBrowse.Visible = True
----intVoid = CraigslistBestOfVocab(objBrowse, strTempString)
----intVoid = True
----Do While intIterator !*! 0
--------intVoid = LearnPOS(objBrowse)
--------intIterator = intIterator - 1
----Loop
----
----intViod = CraigslistBestOfStruct(objBrowse, strTempString)
End Sub
Function SeductoTwo()
----Dim strWord As String
----Dim objBrowse As Object
----Dim strTempString As String
----Dim intIterator As Integer
----
----Set objBrowse = CreateObject("InternetExplorer.Application")
----objBrowse.Visible = True
----intIterator = 500
----Do While intIterator !*! 0
--------intVoid = LearnPOS(objBrowse)
--------intIterator = intIterator - 1
----Loop
----intIterator = 100
----Do While intIterator !*! 0
--------strWord = WriteRandomSentence()
--------strTempString = strTempString & " " & strWord
--------intIterator = intIterator - 1
----Loop
----Selection.Text = strTempString
End Function

Function WriteRandomSentence() As String
----Dim strSentenceGrammar As String
----Dim strSentenceWords As String
----Dim strCurrentGrammeme As String
----Dim strCurrentWord As String
----Dim WordSet As recordset
----Dim strCurrentLetter As String
----Dim intLength As Long
----
----strSentenceGrammar = Trim(GetRandomSentenceStruct())
----intLength = Len(strSentenceGrammar)
' MsgBox (strSentenceGrammar)
----Do While (intLength !*! 0)
--------strCurrentLetter = Mid(strSentenceGrammar, 1, 1)
--------Select Case strCurrentLetter
------------Case "0"
----------------strCurrentGrammeme = strCurrentGrammeme & strCurrentLetter
------------Case "1"
----------------strCurrentGrammeme = strCurrentGrammeme & strCurrentLetter
------------Case Else
----------------If Not (strCurrentGrammeme = "") Then
--------------------Set WordSet = TranslateGrammemeToWord(strCurrentGrammeme)
--------------------strCurrentWord = ChooseWord(WordSet)
--------------------strSentenceWords = strSentenceWords & strCurrentWord & strCurrentLetter
----------------Else
--------------------strSentenceWords = strSentenceWords & strCurrentLetter
----------------End If
----------------strCurrentGrammeme = ""
--------End Select
--------strSentenceGrammar = Mid(strSentenceGrammar, 2, (intLength - 1))
--------intLength = Len(strSentenceGrammar)
----Loop
----strSentenceWords = strSentenceWords & strSentenceGrammar
----WriteRandomSentence = strSentenceWords
End Function
Function ChooseWord(WordSet As recordset) As String
----Dim intTotalRecords As Long
----Dim intTotalFreqVal As Long
----Dim intIterator As Long
----Dim intRandNum As Long
----Dim strRandWord As String
----
----Randomize
----
----intIterator = 0
----WordSet.MoveLast
----intTotalRecords = WordSet.RecordCount
----WordSet.MoveFirst
----Do While intIterator *!* intTotalRecords
--------intTotalFreqVal = intTotalFreqVal + WordSet.Fields(1).Value
--------WordSet.MoveNext
--------intIterator = intIterator + 1
----Loop
----intRandNum = Int(Rnd * intTotalFreqVal) + 1
----WordSet.MoveFirst
----Do While intRandNum *!* intTotalFreqVal
--------intTotalFreqVal = intTotalFreqVal - WordSet.Fields(1).Value
--------WordSet.MoveNext
----Loop
----strRandWord = WordSet.Fields(0).Value
----ChooseWord = strRandWord
End Function
Function ReadForSentences(strEssay As String)
----Dim intLength As Long
----Dim intCurrentLetter As Integer
----
----Dim strWorkToGo As String
----Dim strWorkToDate As String
----Dim strCurrentWord As String
----Dim strCurrentLetter As String
----Dim strGrammarWord As String
----Dim strGrammarSentence As String
----
----strWorkToDate = ""
----strWorkToGo = strEssay
----intLength = Len(strEssay)
----strCurrentWord = ""

----Do While (intLength !*! 0)
--------strCurrentLetter = Mid(strWorkToGo, 1, 1)
--------intCurrentLetter = Asc(strCurrentLetter)
--------'MsgBox (strWorkToDate)
--------Select Case intCurrentLetter
------------Case 1 To 31----'Random ass crappy little characters.
----------------strGrammarSentence = ""
----------------strGrammarWord = ""
----------------strCurrentWord = ""
------------Case 32 'It's a blank space.
----------------'MsgBox ("White Space! Instructions Required! Current Word = " & Chr(34) & strCurrentWord & Chr(34))
----------------If Not (strCurrentWord = "") Then
--------------------strGrammarWord = TranslateWordToGrammar(strCurrentWord)
--------------------strGrammarSentence = strGrammarSentence & strGrammarWord & " "
--------------------'MsgBox (strCurrentWord & Chr(10) & strGrammarWord & Chr(10) & strWorkToDate & Chr(10) & strGrammarSentence)
----------------Else
--------------------strGrammarSentence = strGrammarSentence & " "
----------------End If
----------------strCurrentWord = ""
------------Case 33 'Exclamation point.
'----------------MsgBox ("Exclamation Point!")
----------------strGrammarWord = TranslateWordToGrammar(strCurrentWord)
----------------strGrammarSentence = strGrammarSentence & strGrammarWord & "!"
'------------ MsgBox (strCurrentWord & Chr(10) & strGrammarWord & Chr(10) & Chr(10) & strGrammarSentence)
----------------intVoid = AddNewSentenceStructure(strGrammarSentence)
----------------strGrammarSentence = ""
----------------strGrammarWord = ""
----------------strCurrentWord = ""
------------Case 34 'A quotation mark. Eliminate & Ignore
----------------'MsgBox ("Quotation Mark")
------------Case 35 To 38 'Bail out. #, $, %, &
'----------------MsgBox ("#, $, %, & - Think of something.")
------------Case 39 'Apostrophes. Stop it here.
----------------'MsgBox ("We hit an apostrophe...")
------------Case 40 To 42 'Parentheses. Eliminate but Ignore. No action.
'------------ MsgBox ("A parentheses or... what is Asc(41)? " & Chr(41))
------------Case 43 'A plus sign!
'----------------MsgBox ("Hit a +")
------------Case 44 'A comma.
'------------ MsgBox ("Hit a comma")
'------------ MsgBox (strCurrentWord)
----------------strGrammarWord = TranslateWordToGrammar(strCurrentWord)
----------------strGrammarSentence = strGrammarSentence & strGrammarWord & ","
'------------ MsgBox (strCurrentWord & Chr(10) & strGrammarWord & Chr(10) & Chr(10) & strGrammarSentence)
----------------strCurrentWord = ""
------------Case 45 'Hyphens.
'------------ MsgBox ("Hyphenate!")
----------------strCurrentWord = strCurrentWord & strCurrentLetter
------------Case 46 'A period.
----------------'MsgBox ("Period")
----------------strGrammarWord = TranslateWordToGrammar(strCurrentWord)
----------------strGrammarSentence = strGrammarSentence & strGrammarWord & "."
'------------ MsgBox (strCurrentWord & Chr(10) & strGrammarWord & Chr(10) & Chr(10) & strGrammarSentence)
----------------intVoid = AddNewSentenceStructure(strGrammarSentence)
----------------strGrammarSentence = ""
----------------strGrammarWord = ""
----------------strCurrentWord = ""
------------Case 47 To 57 'There are numbers or a / in this word,
----------------'MsgBox (intCurrentLetter & " - " & strCurrentLetter)
------------Case 58 'A colon
'------------ MsgBox ("Colon:")
----------------strGrammarWord = TranslateWordToGrammar(strCurrentWord)
----------------strGrammarSentence = strGrammarSentence & strGrammarWord & ":"
'------------ MsgBox (strCurrentWord & Chr(10) & strGrammarWord & Chr(10) & Chr(10) & strGrammarSentence)
----------------intVoid = AddNewSentenceStructure(strGrammarSentence)
----------------strGrammarSentence = ""
----------------strGrammarWord = ""
----------------strCurrentWord = ""
------------Case 59 'Semi-Colon
'----------------MsgBox ("Hit a semi-Colon!")
'----------------MsgBox (strCurrentWord)
----------------strGrammarWord = TranslateWordToGrammar(strCurrentWord)
----------------strGrammarSentence = strGrammarSentence & strGrammarWord & ";"
'------------ MsgBox (strCurrentWord & Chr(10) & strGrammarWord & Chr(10) & Chr(10) & strGrammarSentence)
----------------strCurrentWord = ""
------------Case 60 To 62 'There is an equal sign. or HTML brackets *!*!*!
----------------strGrammarSentence = ""
----------------strGrammarWord = ""
----------------strCurrentWord = ""
------------Case 63 'A question mark.
'------------ MsgBox ("Question Mark?")
'------------MsgBox (strCurrentWord & Chr(10) & strGrammarWord & Chr(10) & Chr(10) & strGrammarSentence)
----------------strGrammarWord = TranslateWordToGrammar(strCurrentWord)
----------------strGrammarSentence = strGrammarSentence & strGrammarWord & "?"
'------------ MsgBox (strCurrentWord & Chr(10) & strGrammarWord & Chr(10) & Chr(10) & strGrammarSentence)
----------------intVoid = AddNewSentenceStructure(strGrammarSentence)
----------------strGrammarSentence = ""
----------------strGrammarWord = ""
----------------strCurrentWord = ""

------------Case 64 'An @.
'------------ MsgBox (intCurrentLetter & " - " & strCurrentLetter)
------------Case 65 To 90 'Uppercase letters
----------------strCurrentLetter = LCase(strCurrentLetter)
----------------strCurrentWord = strCurrentWord & strCurrentLetter
------------Case 91 ' Bracket [.
----------------MsgBox (intCurrentLetter & " - " & strCurrentLetter)
------------Case 92 ' A backslash (\).
----------------MsgBox (intCurrentLetter & " - " & strCurrentLetter)
------------Case 93 ' Bracket ]
----------------MsgBox (intCurrentLetter & " - " & strCurrentLetter)
------------Case 94 To 96 'Underscores, carets, and ass-backward apostrophes
'----------------MsgBox (intCurrentLetter & " - " & strCurrentLetter)
------------Case 97 To 122 'Lowercase letters
----------------strCurrentWord = strCurrentWord & strCurrentLetter
------------Case 123----'A curly brace.
----------------MsgBox (intCurrentLetter & " - " & strCurrentLetter)
------------Case 124----'The old pipe symbol.
----------------MsgBox (intCurrentLetter & " - " & strCurrentLetter)
------------Case 125----'Curly brace.
----------------MsgBox (intCurrentLetter & " - " & strCurrentLetter)
------------Case 126 To 145 'Stupid fey little vowel-like things.
----------------MsgBox (intCurrentLetter & " - " & strCurrentLetter)
------------Case 146----'Apostrophes.
----------------'MsgBox (intCurrentLetter & " - " & strCurrentLetter)
------------Case 147 To 148 'Quotation marks.
----------------MsgBox (intCurrentLetter & " - " & strCurrentLetter)
------------Case 150----'Hyphens.
'----------------MsgBox (intCurrentLetter & " - " & strCurrentLetter)
------------Case Else 'Odd.
'----------------MsgBox ("The letter is " & strCurrLetter & Chr(10) & "The value is " & intAsciiValue)
--------End Select
--------strWorkToDate = strWorkToDate & strCurrentLetter
--------intLength = intLength - 1
--------strWorkToGo = Mid(strWorkToGo, 2, intLength)
--------
----Loop
----'MsgBox (strWorkToGo)
End Function
Function AddNewSentenceStructure(strInputSentence As String)
----Dim myDatabase As DAO.Database
----Dim myQuery As DAO.QueryDef
----Dim myRecordSet As DAO.recordset
----
----Set myDatabase = OpenDatabase("F:\Seductotron\seductotron.mdb")
----Set myQuery = myDatabase.CreateQueryDef("", "SELECT * FROM tbl02AGrammar WHERE [strGrammar] = " & Chr(34) & strInputSentence & Chr(34))
----Set myRecordSet = myQuery.OpenRecordset
' MsgBox ("It's trying to make me add a new sentence! The sentence is below:" & Chr(10) & strInputSentence & Chr(10) & Chr(10) & "We should probably analyze it for structural integrity FIRST!")
----If InStr(1, strInputSentence, "000000000001000000") *!*!*! 0 Then
--------'Sentence HAS A TYPO!!!
'---- MsgBox ("TYPO! TYPO! TYPO!" & Chr(10) & strInputSentence)
--------Exit Function
----End If
----If InStr(1, strInputSentence, "000000000000000000") *!*!*! 0 Then
--------'Sentence HAS A NO-GO!!!
'---- MsgBox ("TYPO! TYPO! TYPO!" & Chr(10) & strInputSentence)
--------Exit Function
----End If
'----MsgBox ("We passed the smell-test! Sentence shall proceed.")
----If myRecordSet.RecordCount = 0 Then
--------Set myQuery = myDatabase.CreateQueryDef("", "INSERT INTO tbl02AGrammar (strGrammar, intFrequency) VALUES (" & Chr(34) & strInputSentence & Chr(34) & ", 1)")
--------myQuery.Execute
----Else
--------intVoid = PutToDB("tbl02AGrammar", "strGrammar", strInputSentence, "intFrequency", Str(myRecordSet.Fields(1).Value + 1))
----End If

End Function
Function TranslateWordToGrammar(strInputWord As String) As String
----Dim myDatabase As DAO.Database
----Dim myQuery As DAO.QueryDef
----Dim myRecordSet As DAO.recordset
----Dim intValidateTest As Integer
----Dim strGrammeme As String
----
----Set myDatabase = OpenDatabase("F:\Seductotron\seductotron.mdb")
----Set myQuery = myDatabase.CreateQueryDef("", "SELECT * FROM tbl01BPOS WHERE [strWord] = " & Chr(34) & strInputWord & Chr(34))
----Set myRecordSet = myQuery.OpenRecordset
----
----intValidateTest = myRecordSet.RecordCount
----If intValidateTest = 0 Then
--------strGrammeme = "000000000000000000"
----Else
--------strGrammeme = strGrammeme & myRecordSet.Fields(1).Value
--------strGrammeme = strGrammeme & myRecordSet.Fields(2).Value
--------strGrammeme = strGrammeme & myRecordSet.Fields(3).Value
--------strGrammeme = strGrammeme & myRecordSet.Fields(4).Value
--------strGrammeme = strGrammeme & myRecordSet.Fields(5).Value
--------strGrammeme = strGrammeme & myRecordSet.Fields(6).Value
--------strGrammeme = strGrammeme & myRecordSet.Fields(7).Value
--------strGrammeme = strGrammeme & myRecordSet.Fields(8).Value
--------strGrammeme = strGrammeme & myRecordSet.Fields(9).Value
--------strGrammeme = strGrammeme & myRecordSet.Fields(10).Value
--------strGrammeme = strGrammeme & myRecordSet.Fields(11).Value
--------strGrammeme = strGrammeme & myRecordSet.Fields(12).Value
--------strGrammeme = strGrammeme & myRecordSet.Fields(13).Value
--------strGrammeme = strGrammeme & myRecordSet.Fields(14).Value
--------strGrammeme = strGrammeme & myRecordSet.Fields(15).Value
--------strGrammeme = strGrammeme & myRecordSet.Fields(16).Value
--------strGrammeme = strGrammeme & myRecordSet.Fields(17).Value
--------strGrammeme = strGrammeme & myRecordSet.Fields(18).Value
----End If
----
----TranslateWordToGrammar = strGrammeme
End Function
Function TranslateGrammemeToWord(strGrammeme As String) As recordset
'At present this function merely returns a word based upon Part-Of-Speech.
'However, it should ultimately return a RECORDSET so that a separate function
'Can further refine the choices based upon topicality...
----Dim myDatabase As DAO.Database
----Dim myQuery As DAO.QueryDef
----Dim myRecordSet As DAO.recordset
----
----Dim intReturns As Long
----Dim intRandNum As Long
----
----Dim intIsNoun As Integer
----Dim intIsVerbTran As Integer
----Dim intIsVerbInTran As Integer
----Dim intIsAdj As Integer
----Dim intIsAdv As Integer
----Dim intIsConj As Integer
----Dim intIsInterj As Integer
----Dim intIsPrep As Integer
----Dim intIsPron As Integer
----Dim intIsArticle As Integer
----Dim intIsAbbreviation As Integer
----Dim intIsTypo As Integer
----Dim intIsGeo As Integer
----Dim intIsBio As Integer
----Dim intIsForm As Integer
----Dim intIsAttributive As Integer
----Dim intIsTrademark As Integer
----Dim intIsAuxiliary As Integer
----
----Dim strSQLCode As String
----Dim strResultWord As String
----
----Randomize

----Set myDatabase = OpenDatabase("F:\Seductotron\seductotron.mdb")
----strSQLCode = "SELECT * FROM tbl01AWord INNER JOIN tbl01BPOS ON tbl01AWord.strWord = tbl01BPOS.strWord WHERE "
--------
----intIsNoun = Mid(strGrammeme, 1, 1)
----strSQLCode = strSQLCode & "([tbl01BPOS.intIsNoun] = " & intIsNoun & ") AND "
----intIsVerbTran = Mid(strGrammeme, 2, 1)
----strSQLCode = strSQLCode & "([tbl01BPOS.intIsVerbTran] = " & intIsVerbTran & ") AND "
----intIsVerbInTran = Mid(strGrammeme, 3, 1)
----strSQLCode = strSQLCode & "([tbl01BPOS.intIsVerbInTran] = " & intIsVerbInTran & ") AND "
----intIsAdj = Mid(strGrammeme, 4, 1)
----strSQLCode = strSQLCode & "([tbl01BPOS.intIsAdj] = " & intIsAdj & ") AND "
----intIsAdv = Mid(strGrammeme, 5, 1)
----strSQLCode = strSQLCode & "([tbl01BPOS.intIsAdv] = " & intIsAdv & ") AND "
----intIsConj = Mid(strGrammeme, 6, 1)
----strSQLCode = strSQLCode & "([tbl01BPOS.intIsConj] = " & intIsConj & ") AND "
----intIsInterj = Mid(strGrammeme, 7, 1)
----strSQLCode = strSQLCode & "([tbl01BPOS.intIsInterj] = " & intIsInterj & ") AND "
----intIsPrep = Mid(strGrammeme, 8, 1)
----strSQLCode = strSQLCode & "([tbl01BPOS.intIsPrep] = " & intIsPrep & ") AND "
----intIsPron = Mid(strGrammeme, 9, 1)
----strSQLCode = strSQLCode & "([tbl01BPOS.intIsPron] = " & intIsPron & ") AND "
----intIsArticle = Mid(strGrammeme, 10, 1)
----strSQLCode = strSQLCode & "([tbl01BPOS.intIsArticle] = " & intIsArticle & ") AND "
----intIsAbbreviation = Mid(strGrammeme, 11, 1)
----strSQLCode = strSQLCode & "([tbl01BPOS.intIsAbbreviation] = " & intIsAbbreviation & ") AND "
----intIsTypo = Mid(strGrammeme, 12, 1)
----strSQLCode = strSQLCode & "([tbl01BPOS.intIsTypo] = " & intIsTypo & ") AND "
----intIsGeo = Mid(strGrammeme, 13, 1)
----strSQLCode = strSQLCode & "([tbl01BPOS.intIsGeo] = " & intIsGeo & ") AND "
----intIsBio = Mid(strGrammeme, 14, 1)
----strSQLCode = strSQLCode & "([tbl01BPOS.intIsBio] = " & intIsBio & ") AND "
----intIsForm = Mid(strGrammeme, 15, 1)
----strSQLCode = strSQLCode & "([tbl01BPOS.intIsForm] = " & intIsForm & ") AND "
----intIsAttributive = Mid(strGrammeme, 16, 1)
----strSQLCode = strSQLCode & "([tbl01BPOS.intIsAttributive] = " & intIsAttributive & ") AND "
----intIsTrademark = Mid(strGrammeme, 17, 1)
----strSQLCode = strSQLCode & "([tbl01BPOS.intIsTrademark] = " & intIsTrademark & ") AND "
----intIsAuxiliary = Mid(strGrammeme, 18, 1)
----strSQLCode = strSQLCode & "([tbl01BPOS.intIsAuxiliary] = " & intIsAuxiliary & ")"
----
----Set myQuery = myDatabase.CreateQueryDef("", strSQLCode)
'----MsgBox (strSQLCode)
----
----Set myRecordSet = myQuery.OpenRecordset
----If myRecordSet.RecordCount = 0 Then
--------MsgBox ("Uh-oh! You fucked up!")
----Else
----End If
----myRecordSet.MoveFirst
----Set TranslateGrammemeToWord = myRecordSet
End Function
Function CraigslistBestOfStruct(objIE As Object, strURL As String)
Dim strCraigslistURL As String
----Dim strHTMLBuffer As String
----Dim intPostsToRead As Long
----Dim intPostLoc As Long
----Dim strPostID As String
----Dim strLastPostID As String
----Dim strPostURL As String
----Dim strLastPostRead As String
----Dim strPostContent As String
----
----strPostURL = strURL
----
----objIE.Visible = True
----objIE.navigate strPostURL
----intVoid = LoadPage(objIE)
----TimeDelay (2)
----intVoid = ReadForSentences(objIE.Document.body.innerText)
End Function
Function CraigslistBestOfVocab(objIE As Object, strURL As String)
----Dim strCraigslistURL As String
----Dim strHTMLBuffer As String
----Dim intPostsToRead As Long
----Dim intPostLoc As Long
----Dim strPostID As String
----Dim strLastPostID As String
----Dim strPostURL As String
----Dim strLastPostRead As String
----Dim strPostContent As String
----
----strPostURL = strURL
--------
----objIE.Visible = True
----objIE.navigate strPostURL
----intVoid = LoadPage(objIE)
----TimeDelay (2)
----strHTMLBuffer = objIE.Document.body.innerHTML
----strHTMLBuffer = RemoveHTML(strHTMLBuffer)
----intVoid = ReadForNewVocab(strHTMLBuffer)
End Function

Function PutToDB(strTable As String, strCritField As String, strCritVal As String, strPutField As String, strPutVal As String)
----Dim objSeductoDB As Database
----Dim queSeducto As QueryDef
----Dim strSQLCode As String
----
----Set objSeductoDB = OpenDatabase("F:\Seductotron\seductotron.mdb")
----
----strSQLCode = "UPDATE " & strTable & " SET [" & strPutField & "] = " & Chr(34) & strPutVal & Chr(34) & " WHERE [" & strCritField & "] = " & Chr(34) & strCritVal & Chr(34)
----'MsgBox (strSQLCode)
----Set queSeducto = objSeductoDB.CreateQueryDef("", strSQLCode)
----queSeducto.Execute
End Function
Function LoadPage(objIE As Object) As Boolean
----Dim intMinuteNow As Integer
----Dim intMinuteLast As Integer
----Dim intCountDown As Integer
----Dim intReadyState As Integer

----intMinuteLast = Minute(Now)
----intCountDown = 12
----intReadyState = 0
----intTimeOuts = 0
----Do While Not (intReadyState = 4) And Not (intCountDown = 9)
--------intReadyState = objIE.readyState
--------intMinuteNow = Minute(Now)
--------If Not (intMinuteNow = intMinuteLast) Then
------------intMinuteLast = intMinuteNow
------------intCountDown = intCountDown - 1
--------End If
----Loop
----intMinuteLast = Minute(Now)
----intReadyState = 0
----Do While Not (intReadyState = 4) And Not (intCountDown = 6)
--------intReadyState = objIE.readyState
--------intMinuteNow = Minute(Now)
--------If Not (intMinuteNow = intMinuteLast) Then
------------intMinuteLast = intMinuteNow
------------intCountDown = intCountDown - 1
--------End If
----Loop
----intMinuteLast = Minute(Now)
----intReadyState = 0
----Do While Not (intReadyState = 4) And Not (intCountDown = 3)
--------intReadyState = objIE.readyState
--------intMinuteNow = Minute(Now)
--------If Not (intMinuteNow = intMinuteLast) Then
------------intMinuteLast = intMinuteNow
------------intCountDown = intCountDown - 1
--------End If
----Loop
----intMinuteLast = Minute(Now)
----intReadyState = 0
----Do While Not (intReadyState = 4) And Not (intCountDown = 0)
--------intReadyState = objIE.readyState
--------intMinuteNow = Minute(Now)
--------If Not (intMinuteNow = intMinuteLast) Then
------------intMinuteLast = intMinuteNow
------------intCountDown = intCountDown - 1
--------End If
----Loop
----
----If (intCountDown = 0) Then
--------LoadPage = False
----Else
--------LoadPage = True
----End If
End Function

Function TimeDelay(intTimeDelay As Integer) 'Number of seconds to pause
----Dim intCountDown As Integer
----Dim intNow As Integer
----Dim intSecond As Integer
----
----intCountDown = intTimeDelay
----intSecond = Second(Now)
----
----Do While intCountDown !*! 0
--------intNow = Second(Now)
--------If intSecond = intNow Then
------------'Nothing happens
--------Else
------------intSecond = Second(Now)
------------intCountDown = intCountDown - 1
--------End If
----Loop
End Function
Function RemoveHTML(strInputString As String) As String
----Dim intXspot As Long
----Dim intYspot As Long
----Dim intZspot As Long
----Dim intInputLength As Long
----Dim intSnippetLength As Long
----Dim strSnippet As String
----Dim strFirstPart As String
----Dim strSecondPart As String
----
----intXspot = InStr(1, strInputString, "*!*")
----Do While Not (intXspot = 0)
--------intYspot = InStr(1, strInputString, "!*!")
--------If (intYspot *!* intXspot) Then
------------intXspot = intYspot - 2
--------End If
--------intInputLength = Len(strInputString)
--------strSnippet = Mid(strInputString, (intXspot), (intYspot - intXspot + 1))
--------intZspot = InStr(1, strInputString, strSnippet)
--------intSnippetLength = Len(strSnippet)
--------If (intZspot !*! 1) And Not ((intZspot + intSnippetLength) = intInputLength + 1) Then
------------strFirstPart = Mid(strInputString, 1, intZspot - 1)
------------strSecondPart = Mid(strInputString, (intZspot + intSnippetLength), (intInputLength - intSnippetLength))
------------strInputString = strFirstPart & strSecondPart
--------ElseIf (intZspot = 1) Then
------------strInputString = Mid(strInputString, (intSnippetLength + 1), (intInputLength - intSnippetLength))
--------ElseIf ((intZspot + intSnippetLength) = intInputLength + 1) Then
------------strInputString = Mid(strInputString, 1, (intInputLength - intSnippetLength))
--------End If
--------intXspot = InStr(1, strInputString, "*!*")
----Loop
----
----RemoveHTML = strInputString
End Function
Function ReadForNewVocab(strInputText As String)
----Dim strCurrentWord As String
----Dim intXspot As Integer
----
----intXspot = InStr(1, strInputText, " ")
----Do While (intXspot !*! 0)
--------intXspot = InStr(1, strInputText, " ")
--------If (intXspot *!*!*! 0) Then
------------strCurrentWord = Mid(strInputText, 1, intXspot - 1)
--------Else 'We are at the end of the sentence
------------strCurrentWord = strInputText
--------End If
--------strCurrentWord = ScrubWord(strCurrentWord)
--------AddNewWord strNewWord:=strCurrentWord
--------strInputText = Mid(strInputText, intXspot + 1, Len(strInputText) - intXspot)
----Loop
End Function
Function ScrubWord(strInputWord As String) As String
----Dim intLength As Integer
----Dim intIterator As Integer
----Dim strOutputWord As String
----Dim strCurrLetter As String
----Dim intAsciiValue As Integer
----
----intLength = Len(strInputWord)
----intIterator = 1
----
----Do While (intIterator *!*= intLength)
--------strCurrLetter = Mid(strInputWord, intIterator, 1)
--------intAsciiValue = Asc(strCurrLetter)
--------Select Case intAsciiValue
------------Case 1 To 31----'Random ass crappy little characters. Fuck you! Get out! I banish you from my database!
----------------ScrubWord = ""
----------------Exit Function
------------Case 32 'This should be impossible. It's a blank space.
------------Case 33 'Exclamation point. Stop it here.
----------------ScrubWord = strOutputWord
----------------Exit Function
------------Case 34 'A quotation mark. Eliminate & Ignore
------------Case 35 To 38 'Bail out. #, $, %, &
----------------ScrubWord = ""
----------------Exit Function
------------Case 39 'Apostrophes. Stop it here.
----------------ScrubWord = strOutputWord
----------------Exit Function
------------Case 40 To 42 'Parentheses. Eliminate but Ignore. No action.
------------Case 43 'A plus sign! Begone malodorous word!
----------------ScrubWord = ""
----------------Exit Function
------------Case 44 'A comma. Stop word here.
----------------ScrubWord = strOutputWord
----------------Exit Function
------------Case 45 'Hyphens. Should be retained. Unless at start of word.
----------------If Not (intIterator = 1) Then
--------------------strOutputWord = strOutputWord & strCurrLetter
----------------End If
------------Case 46 'A period. Stop it here.
----------------ScrubWord = strOutputWord
----------------Exit Function
------------Case 47 To 57 'There are numbers or a / in this word. Bail out now!
----------------ScrubWord = ""
----------------Exit Function
------------Case 58 To 59 'A colon or semi-colon. Stop it here.
----------------ScrubWord = strOutputWord
----------------Exit Function
------------Case 60 To 62 'Bail out now! There is an equal sign. or HTML brackets *!*!*!
----------------ScrubWord = ""
----------------Exit Function
------------Case 63 'A question mark. Stop it here.
----------------ScrubWord = strOutputWord
----------------Exit Function
------------Case 64 'An @. I'm gonna' say bail on such a word.
----------------ScrubWord = ""
----------------Exit Function
------------Case 65 To 90 'Uppercase letters
----------------strOutputWord = strOutputWord & strCurrLetter
------------Case 91 ' Bracket [. Eliminate & Ignore.
------------Case 92 ' A backslash (\). BEGONE HEATHEN!
----------------ScrubWord = ""
----------------Exit Function
------------Case 93 ' Bracket ]. Ignore. No action.
------------Case 94 To 96 'Underscores, carets, and ass-backward apostrophes. No way.
----------------ScrubWord = ""
----------------Exit Function
------------Case 97 To 122 'Lowercase letters
----------------strOutputWord = strOutputWord & strCurrLetter
------------Case 123----'A curly brace. Eliminate & ignore.
------------Case 124----'The old pipe symbol. As in "type autoexec.bat|more." Just say no to nostalgia.
----------------ScrubWord = ""
----------------Exit Function
------------Case 125----'Curly brace. Eliminate & ignore.
------------Case 126 To 145 'Stupid fey little vowel-like things.
----------------ScrubWord = ""
----------------Exit Function
------------Case 146----'Apostrophes. Change apostrophe into SQL compatible character.
----------------strOutputWord = strOutputWord & "!"
------------Case 147 To 148 'Quotation marks. Ignore. No action.
------------Case 150----'Hyphens. Should be retained.
----------------If Not (intIterator = 1) Then
--------------------strOutputWord = strOutputWord & strCurrLetter
----------------End If
------------Case Else 'Abort Word
----------------'MsgBox ("The letter is " & strCurrLetter & Chr(10) & "The value is " & intAsciiValue)
----------------ScrubWord = ""
----------------Exit Function
--------End Select
--------intIterator = intIterator + 1
----Loop
----ScrubWord = strOutputWord
End Function
Function AddNewWord(strNewWord As String)
----Dim myDatabase As DAO.Database
----Dim myQuery As DAO.QueryDef
----Dim myRecordSet As DAO.recordset
----
----strNewWord = LCase(strNewWord)
----strNewWord = ScrubWord(strNewWord)

----Set myDatabase = OpenDatabase("F:\Seductotron\seductotron.mdb")
----Set myQuery = myDatabase.CreateQueryDef("", "SELECT * FROM tbl01AWord WHERE [strWord] = " & Chr(34) & strNewWord & Chr(34))
----Set myRecordSet = myQuery.OpenRecordset
----
----If myRecordSet.RecordCount = 0 Then
--------Set myQuery = myDatabase.CreateQueryDef("", "INSERT INTO tbl01AWord (strWord, intHasPOS) VALUES (" & Chr(34) & strNewWord & Chr(34) & ", 0)")
--------myQuery.Execute
----Else
--------intVoid = PutToDB("tbl01AWord", "strWord", strNewWord, "intFrequency", Str(myRecordSet.Fields(2).Value + 1))
----End If
End Function

Function LearnPOS(objBrowse As Object)
----Dim boolHasForm As Boolean
----
----Dim intZspot As Long
----Dim intInflections As Long
----Dim intIterator As Long
----Dim intXspot As Long
----Dim intYspot As Long
----Dim intLastSyllable As Long
----
----Dim strWord As String
----Dim strURL As String
----Dim strDefinition As String
----Dim strDefText As String
----Dim strRootWord As String
----Dim strFormWord As String
----Dim strWordList As String
----Dim boolIsWord As Boolean
----Dim strFunction As String
----Dim strFuncWord As String
----Dim strUsage As String
----Dim strInflection As String
----Dim strWordStem As String
----Dim arrInflections() As String
----Dim strAlternate As String
----Dim strAlternateFunction As String
----Dim boolCanGo As Boolean
----
----strWord = GetUnknownPOS
----If strWord = "ABORT!!!" Then
--------boolCanGo = False
----Else
--------boolCanGo = True
----End If
----intInflections = 0
----boolHasForm = False
----strURL = "http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=" & strWord
----objBrowse.navigate strURL
----If (LoadPage(objBrowse) = False) Then Exit Function
----TimeDelay intTimeDelay:=1
----strDefinition = LCase(objBrowse.Document.body.innerHTML)
----intVoid = PutToDB("tbl01AWord", "strWord", strWord, "intHasPOS", "1")
----'Now we begin parsing the definition.
----'Is it a word?
----If (InStr(1, strDefinition, "!-- begin content") = 0) Then
----'If it is not, then please classify it as a typo!
--------boolIsWord = False
--------'MsgBox ("You have entered a word that is not in this dictionary!")
--------AddNewPOS strNewWord:=strWord
--------strFunction = "typo"
--------intVoid = TranslatePOS(strWord, strFunction)
--------Exit Function
----Else: boolIsWord = True
----'We shall proceed!
--------intXspot = InStr(1, strDefinition, "!-- begin content") + 21
--------intYspot = InStr(1, strDefinition, "!-- end content")
--------If (intXspot = 0) Or (intYspot = 0) Then
------------MsgBox ("We got a problem. intXspot or intYspot = 0 but it thinks it's got a definition!")
------------Exit Function
--------End If
----End If
----
----strDefinition = Mid(strDefinition, intXspot, intYspot - intXspot)
----strRootWord = objBrowse.Document.entry.hdwd.Value
----strFormWord = objBrowse.Document.entry.listword.Value
----
----If (strRootWord *!*!*! strFormWord) Then
----'This is a case where one word is a form of another.
' MsgBox ("We're dealing with a form! The real word is " & Chr(34) & strRootWord & Chr(34) & " NOT " & Chr(34) & strFormWord & Chr(34))
--------AddNewWord strNewWord:=strRootWord
--------AddNewPOS strNewWord:=strFormWord
--------intVoid = TranslatePOS(strFormWord, "form")
--------strWord = strRootWord
--------boolHasForm = True
----End If

----AddNewPOS strNewWord:=strWord

----If (InStr(1, strDefinition, "*!*br!*!-") *!*!*! 0) Then
----'This is a case where there are alternate forms with alternate POS at bottom of page
' MsgBox ("Let us begin with the alternates!")
--------intXspot = InStr(1, strDefinition, "*!*br!*!-")
--------Do While (intXspot *!*!*! 0)
------------intXspot = InStr(intXspot, strDefinition, "*!*b!*!") + 3
------------intYspot = InStr(intXspot, strDefinition, "*!*/b!*!")
------------strAlternate = Mid(strDefinition, intXspot, (intYspot - intXspot))
------------Do While (InStr(1, strAlternate, Chr(183)) *!*!*! 0)
----------------intLastSyllable = InStr(1, strAlternate, Chr(183))
----------------strAlternate = Mid(strAlternate, 1, (intLastSyllable - 1)) & Mid(strAlternate, (intLastSyllable + 1), (Len(strAlternate) - intLastSyllable))
------------Loop
------------If (InStr(intXspot, strDefinition, "*!*b!*!:") = 0) Then
----------------intXspot = InStr(intXspot, strDefinition, "*!*i!*!") + 3
----------------intYspot = InStr(intXspot, strDefinition, "*!*/i!*!")
----------------strAlternateFunction = Mid(strDefinition, intXspot, (intYspot - intXspot))
----------------If (InStr(1, strAlternate, "*!*") = 0) And (InStr(1, strAlternateFunction, "*!*") = 0) Then
'------------ MsgBox ("Alternate word form!" & Chr(10) & strAlternate & " - " & strAlternateFunction)
--------------------AddNewWord strNewWord:=strAlternate
--------------------AddNewPOS strNewWord:=strAlternate
--------------------intVoid = TranslatePOS(strAlternate, strAlternateFunction)
----------------Else
--------------------intXspot = Len(strDefinition)
----------------End If
----------------If (strAlternate = strFormWord) Then
----------------'This means that the wordform DOES NOT share a POS with its root!
--------------------boolHasForm = False
----------------End If
------------End If
------------intXspot = InStr(intXspot, strDefinition, "*!*br!*!-")
--------Loop
----End If
----If (InStr(1, strDefinition, "inflected form(s):") *!*!*! 0) Then
--------intXspot = InStr(1, strDefinition, "inflected form(s):")
--------intZspot = InStr(intXspot, strDefinition, "*!*br!*!")
--------intXspot = InStr(intXspot, strDefinition, "*!*b!*!") + 3
--------Do While (intXspot *!* intZspot)
------------intYspot = InStr(intXspot, strDefinition, "*!*/b!*!")
------------strInflection = Mid(strDefinition, intXspot, (intYspot - intXspot))
------------intXspot = InStr(intXspot, strDefinition, "*!*b!*!") + 3
------------intInflections = intInflections + 1
--------Loop
--------ReDim arrInflections(intInflections)
--------intIterator = 0
--------intXspot = InStr(1, strDefinition, "inflected form(s):")
--------intZspot = InStr(intXspot, strDefinition, "*!*br!*!")
--------intXspot = InStr(intXspot, strDefinition, "*!*b!*!") + 3
--------Do While (intXspot *!* intZspot)
------------intYspot = InStr(intXspot, strDefinition, "*!*/b!*!")
------------strInflection = Mid(strDefinition, intXspot, (intYspot - intXspot))
------------Do While (InStr(1, strInflection, Chr(183)) *!*!*! 0)
----------------intYspot = InStr(1, strInflection, Chr(183))
----------------intLastSyllable = intYspot
----------------strInflection = Mid(strInflection, 1, (intYspot - 1)) & Mid(strInflection, (intYspot + 1), (Len(strInflection) - intYspot))
------------Loop
'---- MsgBox (strInflection)
------------If (InStr(1, strInflection, "-") *!*!*! 0) Then
----------------If intIterator = 0 Then
'----------------MsgBox ("Dude, you got a fucking problem! The inflected forms are based entirely upon the root word.")
--------------------intLastSyllable = InStr(1, strDefinition, Chr(183))
--------------------intYspot = InStr(1, strDefinition, "*!*b!*!") + 3
--------------------Do While (InStr(intYspot, strDefinition, "*!*b!*!") *!* intLastSyllable) And (InStr(intYspot, strDefinition, "*!*b!*!") *!*!*! 0)
------------------------intYspot = InStr(intYspot, strDefinition, "*!*b!*!") + 3
--------------------Loop
--------------------intLastSyllable = InStr(intLastSyllable, strDefinition, "*!*/b!*!")
--------------------strWordStem = Mid(strDefinition, intYspot, (intLastSyllable - intYspot))
--------------------'MsgBox (strWordStem)
--------------------Do While (InStr(1, strWordStem, Chr(183)) *!*!*! 0)
------------------------intYspot = InStr(1, strWordStem, Chr(183))
------------------------strWordStem = Mid(strWordStem, 1, (intYspot - 1)) & Mid(strWordStem, (intYspot + 1), (Len(strWordStem) - intYspot))
--------------------Loop
--------------------strWordStem = Mid(strWordStem, 1, (intYspot - 1))
--------------------strInflection = Mid(strInflection, 2, Len(strInflection) - 1)
--------------------strInflection = strWordStem & strInflection
--------------------intLastSyllable = intYspot
----------------Else
--------------------strWordStem = Mid(arrInflections(intIterator - 1), 1, (intLastSyllable - 1))
--------------------strInflection = Mid(strInflection, 2, (Len(strInflection) - 1))
--------------------strInflection = strWordStem & strInflection
----------------End If
------------End If
------------
------------AddNewWord strNewWord:=strInflection
------------AddNewPOS strNewWord:=strInflection
------------intVoid = TranslatePOS(strInflection, "form")
------------arrInflections(intIterator) = strInflection
------------If (strInflection = strFormWord) Then
----------------boolHasForm = False
----------------'Though the Root and its form have identical POS - the form has been subsumed within the array.
------------End If
------------intIterator = intIterator + 1
------------intXspot = InStr(intXspot, strDefinition, "*!*b!*!") + 3
--------Loop
----End If

----If (InStr(1, strDefinition, "function:") *!*!*! 0) Then 'It's got a function!
--------intXspot = InStr(1, strDefinition, "function:")
--------intXspot = InStr(intXspot, strDefinition, "*!*i!*!") + 3
--------intYspot = InStr(intXspot, strDefinition, "*!*/i!*!")
--------strFunction = Mid(strDefinition, intXspot, intYspot - intXspot)
--------intVoid = TranslatePOS(strWord, strFunction)
--------If (boolHasForm = True) Then
------------intVoid = TranslatePOS(strFormWord, strFunction)
--------End If
--------If intInflections !*! 0 Then
------------intIterator = 0
------------Do While (intIterator *!* intInflections)
----------------intVoid = TranslatePOS(arrInflections(intIterator), strFunction)
----------------intIterator = intIterator + 1
------------Loop
--------End If
----Else 'It doesn't!
' MsgBox ("No function to this word!")
----End If
----If (InStr(1, strDefinition, "usage:") *!*!*! 0) Then 'It's got a function!
--------intXspot = InStr(1, strDefinition, "usage:")
--------intXspot = InStr(intXspot, strDefinition, "*!*i!*!") + 3
--------intYspot = InStr(intXspot, strDefinition, "*!*/i!*!")
--------strFunction = Mid(strDefinition, intXspot, intYspot - intXspot)
--------intVoid = TranslatePOS(strWord, strFunction)
--------If (boolHasForm = True) Then
------------intVoid = TranslatePOS(strFormWord, strFunction)
--------End If
--------If intInflections !*! 0 Then
------------intIterator = 0
------------Do While (intIterator *!* intInflections)
----------------intVoid = TranslatePOS(arrInflections(intIterator), strFunction)
----------------intIterator = intIterator + 1
------------Loop
--------End If
----Else 'It doesn't!
----End If
----If (InStr(1, strDefinition, "*!*option!*!") *!*!*! 0) Then 'We got multi-functions!
--------strWordList = objBrowse.Document.entry.List.Value
' MsgBox (strWordList)
--------intXspot = 1
--------Do While (intXspot *!*!*! 0)
------------intXspot = InStr(1, strWordList, ";")
------------If intXspot *!*!*! 0 Then
----------------strFunction = Mid(strWordList, 1, intXspot - 1)
------------End If

------------If InStr(1, strFunction, "]") *!*!*! 0 Then
----------------strFunction = Mid(strFunction, InStr(1, strFunction, ",") + 1, (InStr(1, strFunction, "]") - InStr(1, strFunction, ",") - 1))
'-------- MsgBox (strFunction)
----------------strFuncWord = Mid(strWordList, 1, InStr(1, strWordList, "[") - 1)
----------------If strFuncWord *!*!*! strWord Then
--------------------If strFuncWord *!*!*! strFormWord Then
'---------------- MsgBox ("It's trying to pull a fast one on me - " & strFuncWord)
------------------------intVoid = AddNewWord(strFuncWord)
--------------------Else
------------------------intVoid = TranslatePOS(strFormWord, strFunction)
--------------------End If
--------------------
----------------Else
--------------------intVoid = TranslatePOS(strWord, strFunction)
----------------End If
------------End If
------------strWordList = Mid(strWordList, intXspot + 1, (Len(strWordList) - intXspot))
--------Loop
----End If
----LearnPOS = boolCanGo
End Function
Function AddNewPOS(strNewWord As String)
----Dim myDatabase As DAO.Database
----Dim myQuery As DAO.QueryDef
----Dim myRecordSet As DAO.recordset
----
----strNewWord = LCase(strNewWord)
----
----Set myDatabase = OpenDatabase("F:\Seductotron\seductotron.mdb")
----Set myQuery = myDatabase.CreateQueryDef("", "SELECT * FROM tbl01BPOS WHERE [strWord] = " & Chr(34) & strNewWord & Chr(34))
----Set myRecordSet = myQuery.OpenRecordset
----
----If myRecordSet.RecordCount = 0 Then
--------Set myQuery = myDatabase.CreateQueryDef("", "INSERT INTO tbl01BPOS (strWord) VALUES (" & Chr(34) & strNewWord & Chr(34) & ")")
--------myQuery.Execute
----End If
End Function
Function TranslatePOS(strWord As String, strFunction As String) As String
----
----If (InStr(1, strFunction, "superlative of") *!*!*! 0) Then
--------intCutOff = InStr(1, strFunction, "superlative of") + 13
--------strFunction = Mid(strFunction, 1, intCutOff)
----End If
----If (InStr(1, strFunction, "comparative of") *!*!*! 0) Then
--------intCutOff = InStr(1, strFunction, "comparative of") + 13
--------strFunction = Mid(strFunction, 1, intCutOff)
----End If
----Select Case strFunction
--------Case "noun"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsNoun", strPutVal:="1"
--------Case "transitive verb"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsVerbTran", strPutVal:="1"
--------Case "intransitive verb"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsVerbInTran", strPutVal:="1"
--------Case "verb"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsVerbInTran", strPutVal:="1"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsVerbTran", strPutVal:="1"
--------Case "definite article"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsArticle", strPutVal:="1"
--------Case "indefinite article"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsArticle", strPutVal:="1"
--------Case "adverb"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsAdv", strPutVal:="1"
--------Case "preposition"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsPrep", strPutVal:="1"
--------Case "conjunction"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsConj", strPutVal:="1"
--------Case "pronoun"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsPron", strPutVal:="1"
--------Case "interjection"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsInterj", strPutVal:="1"
--------Case "typo"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsTypo", strPutVal:="1"
--------Case "geographical name"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsGeo", strPutVal:="1"
--------Case "biographical name"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsBio", strPutVal:="1"
--------Case "adjective"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsAdj", strPutVal:="1"
--------Case "form"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsForm", strPutVal:="1"
--------Case "often attributive"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsAttributive", strPutVal:="1"
--------Case "often capitalized"
------------'There's nothing to be done about this one.
--------Case "slang"
------------'There's nothing to be done here either.
--------Case "abbreviation"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsAbbreviation", strPutVal:="1"
--------Case "service mark"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsTrademark", strPutVal:="1"
--------Case "trademark"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsTrademark", strPutVal:="1"
--------Case "verbal auxiliary"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsAuxiliary", strPutVal:="1"
--------Case "adjective or noun"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsAdj", strPutVal:="1"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsNoun", strPutVal:="1"
--------Case "pronoun, plural in construction"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsPron", strPutVal:="1"
--------Case "pronoun,plural in construction"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsPron", strPutVal:="1"
--------Case "pronoun,singular or plural in construction"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsPron", strPutVal:="1"
--------Case "pronoun, singular or plural in construction"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsPron", strPutVal:="1"
--------Case "pronoun,sometimes plural in construction"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsPron", strPutVal:="1"
--------Case "noun,plural in construction"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsNoun", strPutVal:="1"
--------Case "adjective or adverb"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsAdj", strPutVal:="1"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsAdv", strPutVal:="1"
--------Case "adverb or adjective"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsAdv", strPutVal:="1"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsAdj", strPutVal:="1"
--------Case "adjective,superlative of"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsAdj", strPutVal:="1"
--------Case "adverb,superlative of"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsAdv", strPutVal:="1"
--------Case "adjective,comparative of"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsAdj", strPutVal:="1"
--------Case "adverb,comparative of"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsAdv", strPutVal:="1"
--------Case "noun, plural in construction"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsNoun", strPutVal:="1"
--------Case "noun plural but singular or plural in construction"
------------PutToDB strTable:="tbl01BPOS", strCritField:="strWord", strCritVal:=strWord, strPutField:="intIsNoun", strPutVal:="1"
--------Case Else
------------If InStr(1, strFunction, "[") = 0 Then
'----------------MsgBox ("I'm looking at an unkown value here - " & strFunction)
------------End If
----End Select
----TranslatePOS = strReturnVal
End Function
Function GetUnknownPOS() As String
----Dim myDatabase As DAO.Database
----Dim myQuery As DAO.QueryDef
----Dim myRecordSet As DAO.recordset
----
----Set myDatabase = OpenDatabase("F:\Seductotron\seductotron.mdb")
----Set myQuery = myDatabase.CreateQueryDef("", "SELECT * FROM tbl01AWord WHERE [intHasPOS] = 0")
----Set myRecordSet = myQuery.OpenRecordset
----If myRecordSet.RecordCount = 0 Then
--------GetUnknownPOS = "ABORT!!!"
----Else
--------GetUnknownPOS = myRecordSet.Fields(0).Value
----End If
End Function
Function GetFromDB(strTable As String, strCritField As String, strCritVal As String, strReturnField As String) As String
----Dim myDatabase As DAO.Database
----Dim myQuery As DAO.QueryDef
----Dim myRecordSet As DAO.recordset
----Dim strReturnVal As String
----
----Set myDatabase = OpenDatabase("F:\Seductotron\seductotron.mdb")
----Set myQuery = myDatabase.CreateQueryDef("", "SELECT " & strReturnField & " FROM " & strTable & " WHERE [" & strCritField & "] = " & Chr(34) & strCritVal & Chr(34) & ")")
----Set myRecordSet = myQuery.OpenRecordset
----
----If myRecordSet.RecordCount = 0 Then
--------MsgBox ("Uh-oh! We got a fuckup! Press Ctrl+Brk!")
----Else
--------strReturnVal = myRecordSet.Fields(0).Value
----End If
----GetFromDB = strReturnVal
End Function
Function GetRandomSentenceStruct() As String
----Dim myDatabase As DAO.Database
----Dim myQuery As DAO.QueryDef
----Dim myRecordSet As DAO.recordset
----Dim strReturnVal As String
----Dim intTotalFreqVal As Long
----Dim intTotalRecords As Long
----Dim intIterator As Long
----Dim intRandNum As Long
----Dim intMaxNum As Long
----
----Set myDatabase = OpenDatabase("F:\Seductotron\seductotron.mdb")
----Set myQuery = myDatabase.CreateQueryDef("", "SELECT * FROM tbl02AGrammar")
----Set myRecordSet = myQuery.OpenRecordset
----intIterator = 0
----Randomize
----
----If myRecordSet.RecordCount = 0 Then
--------MsgBox ("Uh-oh! We got a fuckup! Press Ctrl+Brk!")
----Else
--------myRecordSet.MoveLast
--------intTotalRecords = myRecordSet.RecordCount
--------myRecordSet.MoveFirst
--------Do While intIterator *!* intTotalRecords
------------intTotalFreqVal = intTotalFreqVal + myRecordSet.Fields(1).Value
------------myRecordSet.MoveNext
------------intIterator = intIterator + 1
--------Loop
--------intRandNum = Int(Rnd * intTotalFreqVal) + 1
--------myRecordSet.MoveFirst
--------Do While intRandNum *!* intTotalFreqVal
------------intTotalFreqVal = intTotalFreqVal - myRecordSet.Fields(1).Value
------------myRecordSet.MoveNext
--------Loop
----End If
----strReturnVal = myRecordSet.Fields(0).Value
----GetRandomSentenceStruct = strReturnVal
End Function