Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

I WANT to generate Spelling Errorrs!

Posted on 2004-09-23
10
Medium Priority
?
186 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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
 
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 1360 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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 …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…

916 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