0

テキストから生成された語形のリストがあります。このリストには固有名詞が含まれています (例: 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
4

2 に答える 2

1

考えられる解決策は次のとおりです。

on mouseUp
   put field "allWordForms" into tWordForms
   put field "properNames" into tProperNames

   # replace proper names
   repeat for each line tProperName in tProperNames
      replace tProperName with empty in tWordForms
   end repeat

   # remove blank lines
   replace LF & LF with LF in tWordForms   

   put tWordForms into field "wordFormsWithoutProperNames"
end mouseUp

追加情報を考慮した別のソリューション;

on mouseUp
   put field "allWordForms" & LF into tWordForms
   put field "properNames" into tProperNames

   repeat for each line tProperName in tProperNames
      replace tProperName & LF with empty in tWordForms
   end repeat

   put tWordForms into field "wordFormsWithoutProperNames"
end mouseUp
于 2013-05-05T07:19:35.317 に答える
0

パターン関数なしでフィルタコンテナを使用できます。

put field "allWordsForms" into tResult
repeat for each line aLine in field "ProperNames"
   filter tResult without aLine
end repeat
put tResult into field "wordFormsWithoutProperNames"
于 2013-05-08T08:39:30.813 に答える