Applescript:使用一个列表删除另一个列表

Applescript:使用一个列表删除另一个列表,applescript,Applescript,所以我有一个单词列表: {{"YOU"}, {"KNOW"}, {"BETTER"}, {"THAN"}, {"TO"}, {"PARK"}, {"YOUR"}, {"CAR"}, {"IN"}, {"UNASSIGNED"}, {"SPOTS"}} 我还有一份清单: {{"0", "<SIL>"}, {"269", "YOU"}, {"389", "<SIL>"}, {"439", "KNOW"}, {"509", "BETTER"}, {"829", "THAN"}

所以我有一个单词列表:

{{"YOU"}, {"KNOW"}, {"BETTER"}, {"THAN"}, {"TO"}, {"PARK"}, {"YOUR"}, {"CAR"}, {"IN"}, {"UNASSIGNED"}, {"SPOTS"}}
我还有一份清单:

{{"0", "<SIL>"}, {"269", "YOU"}, {"389", "<SIL>"}, {"439", "KNOW"}, {"509", "BETTER"}, {"829", "THAN"}, {"969", "TO"}, {"1059", "PARK"}, {"1350", "YOUR"}, {"1449", "CAR"}, {"1839", "IN"}, {"2059", "<SIL>"}, {"2089", "UNASSIGNED"}, {"2659", "SPOTS"}}
我是applescript新手,所以这对我来说真的很难


任何帮助都将不胜感激

此脚本在列表对中一次循环一个,对于每个列表对,检查原始列表中的每个单词是否在该对中,如果是,则将该对添加到结果列表中

set L1 to {{"YOU"}, {"KNOW"}, {"BETTER"}, {"THAN"}, {"TO"}, {"PARK"}, {"YOUR"}, {"CAR"}, {"IN"}, {"UNASSIGNED"}, {"SPOTS"}}

set L2 to {{"0", "<SIL>"}, {"269", "YOU"}, {"389", "<SIL>"}, {"439", "KNOW"}, {"509", "BETTER"}, {"829", "THAN"}, {"969", "TO"}, {"1059", "PARK"}, {"1350", "YOUR"}, {"1449", "CAR"}, {"1839", "IN"}, {"2059", "<SIL>"}, {"2089", "UNASSIGNED"}, {"2659", "SPOTS"}}

set L3 to {} -- initiate the resulting list
repeat with wordPair in L2 -- cycle through each list pair in L2
    repeat with wordSingle in L1 -- check each source word to see if found in the list pair
        if wordSingle is in wordPair then
            copy (wordPair as list) to end of L3
            exit repeat
        end if
    end repeat
end repeat
return L3
将L1设置为{{“你”}、{“知道”}、{“更好”}、{“比”}、{“到”}、{“停车”}、{“你的”}、{“车”}、{“在”}、{“未分配”}、{“点”}
将L2设置为{“0”、“269”、“你”、“389”、“439”、“知道”、“509”、“更好”、“比”}、{“969”、“到”}、{“1059”、“停车场”}、{“1350”、“你的”}、{“1449”、“汽车”}、{“1839”、“在”}、{“2059”、“2059”、“未分配”}、{“2659”、“点”}
将L3设置为{}——启动结果列表
对L2中的单词对重复——循环遍历L2中的每个列表对
用L1中的wordSingle重复——检查每个源单词,查看是否在列表对中找到
如果wordSingle在wordPair中,则
将(字对作为列表)复制到L3的末尾
退出重复
如果结束
结束重复
结束重复
返回L3

欢迎来到stackoverflow。这是一个网站,当用户遇到绊脚石并需要帮助解决问题时,可以从中获得编写代码的帮助。因此,我们希望您能够表明您正在编写代码,而不是寻找人为您编写代码。请告诉我们您在代码中的位置,我们将非常乐意帮助您。如果我不应该帮助他,mcgrailm。我看到他已经正确地形成了applescript列表,所以我认为他已经开始了。请原谅。不必道歉:)很高兴你能帮助他谢谢!我知道是这样的,但就是不懂语法。
set L1 to {{"YOU"}, {"KNOW"}, {"BETTER"}, {"THAN"}, {"TO"}, {"PARK"}, {"YOUR"}, {"CAR"}, {"IN"}, {"UNASSIGNED"}, {"SPOTS"}}

set L2 to {{"0", "<SIL>"}, {"269", "YOU"}, {"389", "<SIL>"}, {"439", "KNOW"}, {"509", "BETTER"}, {"829", "THAN"}, {"969", "TO"}, {"1059", "PARK"}, {"1350", "YOUR"}, {"1449", "CAR"}, {"1839", "IN"}, {"2059", "<SIL>"}, {"2089", "UNASSIGNED"}, {"2659", "SPOTS"}}

set L3 to {} -- initiate the resulting list
repeat with wordPair in L2 -- cycle through each list pair in L2
    repeat with wordSingle in L1 -- check each source word to see if found in the list pair
        if wordSingle is in wordPair then
            copy (wordPair as list) to end of L3
            exit repeat
        end if
    end repeat
end repeat
return L3