Re: Process all files in a text list!
Re: Process all files in a text list!
- Subject: Re: Process all files in a text list!
- From: Michelle Steiner <email@hidden>
- Date: Wed, 29 Aug 2001 09:17:35 -0700
On 8/29/01 6:54 AM, Rachel <email@hidden> wrote:
>
My question would be: If one refers to a sentence as a paragraph, then how
>
does one refer to a paragraph?(in case I want to select paragraphs)
One does not refer to sentences as paragraphs; only if each sentence ends
with a carriage return, is each sentence a paragraph.
Any block of text that ends with a carriage return is a paragraph. You
can then refer to sentences within paragraphs. However, this is
application dependent; "sentence" is not part of AppleScript nor of any
of the standard scripting additions.
Here is a routine that will extract sentences from text--it is not
perfect because it assumes that a sentence ends with a period and a space.
set the fileToProcess to choose file
set the textToProcess to read fileToProcess
set Para1 to the first paragraph of the textToProcess
set the sentences to parseSentences(Para1)
set sentence2 to the second item of the sentences
on parseSentences(inputtext)
set {tid, text item delimiters} to {text item delimiters, ". "}
set the sentenceItems to text items of the inputtext
set text item delimiters to tid
return the sentenceItems
end parseSentences
It would also need error trapping to make sure that the specified
sentence exists (e.g., it doesn't try to get the fifth sentence of a
four-sentence paragraph.
--Michelle
----------------------------------------------------------------------
| Michelle Steiner | We're not human beings having a spiritual |
| | experience. We're spiritual beings |
| email@hidden | having a human experience. |
----------------------------------------------------------------------