Searching for Text

F

Frankbelly

I am trying to search for a particular phrase in a document. The only
problem is this type of document I'm searching is usually scanned so many
times the scanning OCR puts a semicolon or an apostraphe or comma somewhere
in the phrase making it difficult to find.

Example:

Search for phrase
Demand Production No

Sometimes the scanner will bring the phrase in as
Demand Pr'oduction No

Is there an easy way to include phases that are extremely close. I'm using
userforms so once the phrase is found and selected, the user will have the
option of clicking "Yes" this is one of them or "No" this is not.

Any help is much appreciated.

Thanks.
 
H

Helmut Weber

Hi Frankbelly,
Is there an easy way to include phrases that are extremely close.

I don't think so.

But, unless You are willing to spent a lot of time on learning
how to calculate similarity between strings,
you might use a phonetic search "Sounds like (English)"

At least searching for "production" finds "pro'duction".
Unfortunately, spaces seem to be not allowed in the search.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
J

Jay Freedman

Just a suggestion; I don't know how well this will work for you:

Pre-process the document by running a wildcard search that removes any
punctuation surrounded by letters.

Dim oRg As Range
Set oRg = ActiveDocument.Range
With oRg.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "([A-Za-z])([.,';:`])([A-Za-z])"
.Replacement.Text = "\1\3"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
End With

This may cause some trouble if the text in the document contains valid
contractions or other punctuation that belongs in the middle of a
word, but it may work out for you.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top