Solved

I WANT to generate Spelling Errorrs!

Posted on 2004-09-23
10
168 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
Comment Utility
0
 
LVL 4

Author Comment

by:StevenJames
Comment Utility
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
Comment Utility
Do you just want one misspelling per input word?

Dom
0
 
LVL 4

Author Comment

by:StevenJames
Comment Utility
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
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 4

Author Comment

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

Expert Comment

by:Dave Brett
Comment Utility
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
Comment Utility
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
Comment Utility
Give the man a cigar!

Cool.

Thanks a lot.
0
 
LVL 50

Expert Comment

by:Dave Brett
Comment Utility
Thanks for the grade Steven
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

762 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

15 Experts available now in Live!

Get 1:1 Help Now