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?
Finding the end of the first sentence
-
- 3StarLounger
- Posts: 287
- Joined: 09 Mar 2010, 23:16
- Location: Canberra Australia
Finding the end of the first sentence
Regards
John
John
-
- Administrator
- Posts: 12630
- Joined: 16 Jan 2010, 15:49
- Location: London, Europe
Re: Finding the end of the first sentence
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
-
- Administrator
- Posts: 78637
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Finding the end of the first sentence
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.
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
Hans
-
- 3StarLounger
- Posts: 287
- Joined: 09 Mar 2010, 23:16
- Location: Canberra Australia
Re: Finding the end of the first sentence
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.
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
John