我有一個由文本生成的單詞列表。該清單包括專有名稱(例如John,Mary,Edinburgh)。在另一個領域,我有一個專名的名單。我想獲得沒有正確名稱的所有單詞形式的列表。如何從另一個列表中刪除一個列表中的單詞(設置操作)
我確實需要 allWordForms MINUS properNames
陣列可以使用的套裝。但我們只有設置操作Union
和Intersect
。
劇本至今
on mouseUp
put field "allWordForms" into tWordForms
split tWordForms by return
-- tWordForms is now an array
put field "properNames" into tProperNames
split tProperNames by return
-- tProperNames is now an array
-- .....
repeat
-- .....
-- .....
end repeat
combine tWordForms using return
put tWordForms into field "wordFormsWithoutProperNames"
end mouseUp
如何重複迴路樣子?
這裏是一個例子。
字段 「allWordForms」 包含
Mary
and
John
came
yesterday
They
want
to
move
from
Maryland
to
Petersbourough
`
字段 「properNames」 包含
John
Mary
Maryland
Peter
Petersbourough
期望的結果是有名單allWordForms
的副本與適當的名稱已刪除。
and
came
yesterday
They
want
to
move
from
to
我添加了一個示例的問題。您的解決方案提供了爲產生以下字符串(包括開頭空單)'和 昨天 來到他們 要從 到 移動 土地 到 sbourough'。 「馬里蘭」和「彼得斯堡」這兩個詞被切碎,這不是預期的結果。我想確保它與整個字形一起工作。這就是爲什麼我要求重複循環,並建議去陣列。數組支持set操作'Union'和'Intersect'。我正在尋找實現'tAllWordForms minus tProperNames'的livecode語法。 – 2013-05-05 13:25:55
沒有內置數組功能來實現您的目標,但第二個示例按照您的數據的要求工作。 – splash21 2013-05-05 17:35:30
注意:第一種解決方案不能可靠地工作。 – 2013-05-06 04:17:25