Finding the end of the first sentence

JohnH
3StarLounger
Posts: 287
Joined: 09 Mar 2010, 23:16
Location: Canberra Australia

Finding the end of the first sentence

Post by JohnH »

I need to extract the first sentence from a memo field.

I thought that I would look for ". " a full stop followed by a space, (or the end of the field) but they get used within sentences.
I could ask the users to put two spaces at the end of a sentence, but that does not sound reliable.

Any other suggestions?
Regards

John

User avatar
StuartR
Administrator
Posts: 12630
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Finding the end of the first sentence

Post by StuartR »

This will be difficult. I thought at first that you could search for a full stop, followed by white space, followed by a capital letter, but this would not work for an example like "There are a number of people who could do this, e.g. Stuart or John."
StuartR


User avatar
HansV
Administrator
Posts: 78637
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Finding the end of the first sentence

Post by HansV »

As Stuart indicates, this is far from trivial. It would require intelligent, language-aware parsing of the text. Probably the best you can do is extract up to the first full stop that is followed by a space (or to the end of the field), and then do a visual inspection to see in how many cases the result is incorrect.

And if the data still have to be entered: don't use a memo field with multiple sentences! Use a sub-table instead.
Best wishes,
Hans

JohnH
3StarLounger
Posts: 287
Joined: 09 Mar 2010, 23:16
Location: Canberra Australia

Re: Finding the end of the first sentence

Post by JohnH »

Thanks

I have since been told that the users do normally put two spaces at the end of the first sentence, so we will try using that.
Another option is to put the first sentence into a separate field, but there are lots of places where I would then need to put them back together again.
And I am flying interstate tomorrow to deliver this, so I am not keen on structural change at the moment.

This is an 'extra' that has arisen at the last minute, to try to automate something users have been doing manually for years, without telling me until today that the job even needed doing.
Regards

John