Word Object model does not recognize ".," dot followed by comma

G

Guest

Hi,

I am trying to read ThisDocument.Range.Sentences, to process all the
sentences in a document. But when the text contains a ".," that is a full
stop followed by a comma, as in the following situations - "ABC & Co.," Word
object model does not recognize the text properly. For example,

Thank you for contacting ABC &Co., and we hope that our association will be
mutually profitable and beneficial.

Now when I read the sentences, I find that "," and ", and we hope that our
association will be mutually profitable and beneficial." are returned as the
two sentences contained. I presume this is a bug with the Object model. Have
anybody else encountered a similar situation?? Can somebody help me out
here.

Note: I am using Word 2003.

Thanks in advance,

Thanks and Regards,
Laks
 
J

Jean-Guy Marcil

(e-mail address removed) was telling us:
(e-mail address removed) nous racontait que :
Hi,

I am trying to read ThisDocument.Range.Sentences, to process all the
sentences in a document. But when the text contains a ".," that is a
full stop followed by a comma, as in the following situations - "ABC
& Co.," Word object model does not recognize the text properly. For
example,

Thank you for contacting ABC &Co., and we hope that our association
will be mutually profitable and beneficial.

Now when I read the sentences, I find that "," and ", and we hope
that our association will be mutually profitable and beneficial." are
returned as the two sentences contained. I presume this is a bug with
the Object model. Have anybody else encountered a similar situation??
Can somebody help me out here.

Note: I am using Word 2003.

It is probably due to the fact that Word uses ". " to delimit sentences.

Have you tried doing a "Find/Replace all" ".," by a generic string, like §.
Do your stuff, and then "Find/Replace all" § by ".,"

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

Jezebel

Hardly a bug in the object model. Bug in the algorithm for finding sentences
perhaps; but then sentences are not really well-defined in English either.
Do bullet points count as separate sentences? -- or constructions like this
one?
 
G

Guest

Hi,

Word treats '.' followed by space as a delimiter for normal sentences. Apart
from these, a '? ', '! ' and paragraph break are also delimiters

This sounds like a good idea. Will try it.
Hardly a bug in the object model. Bug in the algorithm for finding sentences
perhaps; but then sentences are not really well-defined in English either.

Well well, I am using Word's Range.Sentences to get the sentences. This
surely is a bug in the algo, but the algo used by the object model
internally!!
Do bullet points count as separate sentences? -- or constructions like this
one?

Yes. They do. Both bullet points and sentences like the one given above are
recognized as sentences.

Thanks and Regards,
Laks
 

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