Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

I WANT to generate Spelling Errorrs!

Posted on 2004-09-23
10
Medium Priority
?
179 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: 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!

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Suggested Courses

730 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