Solved

I WANT to generate Spelling Errorrs!

Posted on 2004-09-23
10
169 Views
Last Modified: 2010-05-02
Hi,

I want to run my program against a list of words to generate spelling errors. That right.


For example:
wordlist.txt has the following
---------------------------------
cow
moon
forget
appropriate
---------------------------------

I want to read the file and spit out "misspellings" into another (badwords.txt) like this:
---------------------------------
coww
monn
forrget
approppriate
---------------------------------

Get my drift? Vowels don't have to be excluded. It would be a bonus if the errors could be associated to the qwerty keyboard.

Thankjs

SJ





0
Comment
Question by:StevenJames
10 Comments
 
LVL 32

Expert Comment

by:Erick37
ID: 12139656
0
 
LVL 4

Author Comment

by:StevenJames
ID: 12139722
Close, but no cigar:) I've used a list similar to this in other programs to do a google type suggestion but not what I'm looking for.
0
 
LVL 3

Expert Comment

by:domj
ID: 12139874
Do you just want one misspelling per input word?

Dom
0
 
LVL 4

Author Comment

by:StevenJames
ID: 12139906
Preferably.

I was thinking of looking for the first sylable and plugging a double consonant in at that point. But I don't know if that's possible. Something like LOOKING->LOKKING OR LOOKKING

Next best thing would be to look for a consonant in mid word and doubling it, or flipping it, or.. a bit dislexyc like behaviour:)



0
 
LVL 50

Expert Comment

by:Dave Brett
ID: 12140278
This may be of interest

http://oldlook.experts-exchange.com:8080/Applications/MS_Office/Excel/Q_21140938.html

We could write a simpler RegExp routine than the link above to mangle words

Cheers

Dave
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 4

Author Comment

by:StevenJames
ID: 12143065
Getting close here. I'd accept that if I can much up one letter only.
0
 
LVL 50

Expert Comment

by:Dave Brett
ID: 12143538
This code transposes the fourth letter into the third letter position for every word of four or more characters

Function SplitCap()
    Dim AnyStr As String
    AnyStr = "cow" & vbNewLine & "moon" & vbNewLine & "forget" & vbNewLine & "appropriate"
    Dim RegEx
    Set RegEx = CreateObject("vbscript.regexp")
    With RegEx
        .Global = True
        .Pattern = "(\b[a-z]{2})([a-z])([a-z])"
        .ignorecase = True
    End With
    SplitCap = RegEx.Replace(AnyStr, "$1" & "$3" & "$3")
    MsgBox SplitCap
    Set RegEx = Nothing
End Function

Cheers

Dave
0
 
LVL 50

Accepted Solution

by:
Dave Brett earned 340 total points
ID: 12143551
and if you change
      .Pattern = "(\b[a-z]{2})([a-z])([a-z])"
to
      .Pattern = "([a-z]{2})([a-z])([a-z])"

Then the 3rd, 7th, 11th character becomes the 4th, 8th, 12 etc

Cheers

Dave
0
 
LVL 4

Author Comment

by:StevenJames
ID: 12147080
Give the man a cigar!

Cool.

Thanks a lot.
0
 
LVL 50

Expert Comment

by:Dave Brett
ID: 12148574
Thanks for the grade Steven
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now