So, taking the first line of file 2
chirac presidential migration
compare this with each line of file 1 in turn
chirac prime paris
chirac prime jacques
chirac prime president
chirac paris france
chirac paris french
and calculate how many words match. Output the file 1 line if the count is greater than a minimum value. Repeat for each line in file 2.
For this example, the number of words matching is only 1 ("chirac") in each case so if the minimum is 2 then none of the above lines be would output. Is that the logic ?
poj