Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It's really easy using the <a href="http://nltk.org/" rel="nofollow">Natural Language Toolkit (nltk)</a>.</p> <pre><code>import nltk, string text = "Listen, strange women lyin' in ponds distributin' swords is no basis for a system of government. Supreme executive power derives from a mandate from the masses, not from some farcical aquatic ceremony." tokens = nltk.word_tokenize(text) # remove punctuation tokens = [word.replace("-"," ") for word in tokens if word not in string.punctuation] </code></pre> <p>In use:</p> <pre><code>&gt;&gt;&gt; text = "Listen, strange women lyin' in ponds distributin' swords is no basis for a system of government. Supreme executive power derives from a mandate from the masses, not from some farcical aquatic ceremony." &gt;&gt;&gt; tokens = nltk.word_tokenize(text) &gt;&gt;&gt; tokens = [word.replace("-"," ") for word in tokens if word not in string.punctuation] &gt;&gt;&gt; tokens ['Listen', 'strange', 'women', 'lyin', 'in', 'ponds', 'distributin', 'swords', ' is', 'no', 'basis', 'for', 'a', 'system', 'of', 'government.', 'Supreme', 'execu tive', 'power', 'derives', 'from', 'a', 'mandate', 'from', 'the', 'masses', 'not ', 'from', 'some', 'farcical', 'aquatic', 'ceremony'] </code></pre> <p>Apparently, your desired output is pretty unclear, but if you're looking for a string version of that output, you could take that <code>tokens</code> variable and do:</p> <pre><code>print '[' + ', '.join(tokens) + ']' </code></pre> <p>Looks like:</p> <pre><code>&gt;&gt;&gt; print '['+', '.join(tokens)+']' [Listen, strange, women, lyin, in, ponds, distributin, swords, is, no, basis, fo r, a, system, of, government., Supreme, executive, power, derives, from, a, mand ate, from, the, masses, not, from, some, farcical, aquatic, ceremony] </code></pre> <p>Your "walls of text" do make it hard to figure out what you want.</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. 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.
 

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