Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If your English dictionary is indeed a set (hopefully of lowercased words),</p> <pre><code>set(vocab) - english_dictionary </code></pre> <p>gives you the set of words which are in the <code>vocab</code> set but not in the <code>english_dictionary</code> one. (It's a pity that you turned <code>vocab</code> into a list by that <code>sorted</code>, since you need to turn it back into a set to perform operations such as this set difference!).</p> <p>If your English dictionary is in some different format, not really a set or not comprised only of lowercased words, you'll have to tell us what that format is for us to be able to help!-)</p> <p><strong>Edit</strong>: given the OP's edit shows that both <code>words</code> (what was previously called <code>vocab</code>) and <code>englishwords</code> (what I previously called <code>english_dictionary</code>) are in fact lists of lowercased words, then</p> <pre><code>newwords = set(words) - set(englishwords) </code></pre> <p>or</p> <pre><code>newwords = set(words).difference(englishwords) </code></pre> <p>are two ways to express "the set of words that are not englishwords". The former is slightly more concise, the latter perhaps a bit more readable (since it uses the word "difference" explicitly, instead of a minus sign) and perhaps a bit more efficient (since it doesn't explicitly transform the list <code>englishwords</code> into a set -- though, if speed is crucial this needs to be checked by measurement, since "internally" <code>difference</code> still needs to do some kind of "transformation-to-set"-like operation).</p> <p>If you're keen to have a list as the result instead of a set, <code>sorted(newwords)</code> will give you an alphabetically sorted list (<code>list(newwords)</code> would give you a list a bit faster, but in totally arbitrary order, and I suspect you'd rather wait a tiny extra amount of time and get, in return, a nicely alphabetized result;-).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload