Solved

I WANT to generate Spelling Errorrs!

Posted on 2004-09-23
10
172 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

861 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