Multiple Offenders
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Multiple Offenders
The European languages I have a reasonable knowledge of (Scots, English, French and Bulgarian) all have
the annoying tendency to use 3 different punctuation marks to finish sentences:
1. The full stop ".'.
2. The question mark "?".
3. The exclamation mark "!".
So, attempting to chop up a text into sentences by using full stops as my itemDelimiter
excludes those finishing with question or exclamation marks . . .
So, I would be most grateful if someone could tell me how to use multiple item delimiters.
the annoying tendency to use 3 different punctuation marks to finish sentences:
1. The full stop ".'.
2. The question mark "?".
3. The exclamation mark "!".
So, attempting to chop up a text into sentences by using full stops as my itemDelimiter
excludes those finishing with question or exclamation marks . . .
So, I would be most grateful if someone could tell me how to use multiple item delimiters.
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Multiple Offenders
Hi Richmond,
You may use sentence
I understand sentence delimiter is one of these chars ".?!" followed by one space and an uppercase letter.
Try this
Kind regards
Jean-Marc
You may use sentence
I understand sentence delimiter is one of these chars ".?!" followed by one space and an uppercase letter.
Try this
Code: Select all
on mouseup
put "Paul. Paul ? Paul !" into tVar
answer the num of sentences of tVar
repeat with i = 1 to the num of sentences of tVar
answer sentence i of tVar
wait 1000 milliseconds
end repeat
end mouseup
Jean-Marc
https://alternatic.ch
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Multiple Offenders
Thanks, I just checked that in the Dictionary.
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Multiple Offenders
Hi,
I also use a getTextInRules function to apply rules described in my prev post.
Jean-Marc
I also use a getTextInRules function to apply rules described in my prev post.
Code: Select all
function getTextInRules pText
put ",;:.?!" into tPon
put ".?!" into tPonWithMaj
put empty into rTextInRules
repeat with i = 1 to the num of chars of pText
if tMaj or i = 1 then
put upper(char i of pText )after rTextInRules
put false into tMaj
else
put char i of pText after rTextInRules
end if
if char i of pText is in tPon and char (i+1) of pText <> " " then
put " " after rTextInRules
if char i of pText is in tPonWithMaj then
put true into tMaj
end if
end if
end repeat
return rTextInRules
end getTextInRules
https://alternatic.ch
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Multiple Offenders
Sentence worked like a charm.
I had forgotten what a pain-in-the-bum the Dictionary was on Linux until last
night when I was in bed "having a thing" with my Xubuntu laptop and the
Dictionary took up the whole screen, blocking out the IDE because my web-browser
of choice is set to full-screen for other uses . . .
- -
File removed as updated version posted below.
I had forgotten what a pain-in-the-bum the Dictionary was on Linux until last
night when I was in bed "having a thing" with my Xubuntu laptop and the
Dictionary took up the whole screen, blocking out the IDE because my web-browser
of choice is set to full-screen for other uses . . .
- -
Code: Select all
on mouseUp
put empty into fld "REZZZ"
put empty into fld "OX"
put empty into fld "D1"
put empty into fld "D2"
ask "What is the first word are you interested in?"
if it is not empty then
put it into DUMA1
put DUMA1 into fld "D1"
ask "What is the second word are you interested in?"
if it is not empty then
put it into DUMA2
put DUMA2 into fld "D2"
---
put fld "fff" into EFF
put 1 into LAPC
repeat until EFF is empty
put empty into KOUNT
put sentence 1 of EFF into SFF
---
if SFF contains DUMA1 then
add 1 to KOUNT
end if
if SFF contains DUMA2 then
add 2 to KOUNT
end if
if KOUNT > 1 then
put SFF into line LAPC of fld "REZZZ"
put (LAPC && "co-occurrences") into fld "OX"
add 1 to LAPC
end if
---
delete sentence 1 of EFF
end repeat
---
end if
end if
end mouseUp
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Multiple Offenders
Added IMPORT and EXPORT capabilities.
- Attachments
-
- COOCCUR.livecode.zip
- Here's the stack.
- (12.78 KiB) Downloaded 101 times