Const CONTRACTION_DATA = "are not=aren't,cannot=can't,could have=could've,could not=couldn't,did not=didn't,do not=don't,does not=doesn't,has not=hasn't,he had=he'd,he is=he's,he was=he's,he will=he'll,he would=he'd,how did=how'd,how is=how's,how was=how's,how will=how'll,I am=i'm,I had=I'd,I have=i've,I will=i'll,I would=i'd,is not=isn't,it is=it's,it was=it's,might have=might've,might not=mightn't,must have=must've,must not=mustn't,shall not=shan't,she had=she'd,she is=she's,she was=she's,she will=she'll,she would=she'd,should have=should've,should not=shouldn't,that is=that's,that is=there's,that was=that's,that was=there's,that will=that'll," & _
"that would=they'd,they are=they're,they have=they've,they will=they'll,was not=wasn't,we had=we'd,we were=we're,we will=we'll,we would=we'd,were not=weren't,what had=what'd,what is=what's,what was=what's,what would=what'd,when did=when'd,when is=when's,when was=when's,when will=when'll,where did=where'd,where is=where's,where was=where's,where will=where'll,where would=where'd,who did=who'd,who is=who's,who was=who 's,who will=who'll,who would=who'd,why did=why'd,why is=why's,why was=why's,why will=why'll,why would=why'd,will not=won't,would have=would've,would not=wouldn't,you are=you're,you had=you'd,you have=you've,you will=you'll,you would=you'd"
Dim aryContractions() As String
Private Sub PopulateContractions()
Dim aryTemp() As String
Dim aryTemp2() As String
Dim i As Integer
aryTemp = Split(CONTRACTION_DATA, ",")
ReDim aryContractions(UBound(aryTemp), 2)
For i = 0 To UBound(aryContractions)
aryTemp2 = Split(aryTemp(i), "=")
aryContractions(i, 0) = aryTemp2(0)
aryContractions(i, 1) = aryTemp2(1)
Next
End Sub
Public Function ConvertSpeech(strInput As String, intFormalityFactor As Integer)
Dim intRandom As Integer
Dim i As Integer
For i = 0 To UBound(aryContractions)
intRandom = Int(Rnd() * 100)
If (intFormalityFactor > intRandom) Then
strInput = Replace(strInput, aryContractions(i, 0), aryContractions(i, 1))
End If
Next
ConvertSpeech = strInput
End Function
There. Problem solved.