User:Clara/S13/Experimenting with NLTK

From XPUB & Lens-Based wiki

With NLTK I started to analysed my text '?!' from Words of the Future to see if I could do something with the punctuation in the text


Using concordance

from nltk import word_tokenize

point = open("txt/!?_original.txt").read()
tokens = word_tokenize(point)
stengers = nltk.text.Text(tokens)

stengers.concordance("?", width=82 , lines=74)
Displaying 30 of 30 matches:
! / ? Nina Power Part 1 : ! “ [ T ] he entire
e comments , emails , and text messages ? If we take the tweets of Donald Trump a
the Nazis not need the exclamation mark ? Klemperer states , “ t is as if [ the L
he proclamation would need to stand out ? ” [ 3 ] This point alone should herald 
 infinitum … ( and what of the ellipses ? … another time , another time ) . If yo
he various uses of the exclamation mark ? While many of the comments suggest that
ter all ( ! ) done more than merely ( ! ? ) create ( ? ) and preserve ( ? ? ) the
 done more than merely ( ! ? ) create ( ? ) and preserve ( ? ? ) the same ( what 
ely ( ! ? ) create ( ? ) and preserve ( ? ? ) the same ( what same ? ) : namely (
y ( ! ? ) create ( ? ) and preserve ( ? ? ) the same ( what same ? ) : namely ( ?
d preserve ( ? ? ) the same ( what same ? ) : namely ( ? ! ? ) the abstention fro
? ) the same ( what same ? ) : namely ( ? ! ? ) the abstention from the enjoyment
the same ( what same ? ) : namely ( ? ! ? ) the abstention from the enjoyment of 
interest lies in the use of ‘ ! ’ and ‘ ? ’ and ‘ ! ? ’ and ‘ ? ? ’ and ‘ ? ! ? ’
s in the use of ‘ ! ’ and ‘ ? ’ and ‘ ! ? ’ and ‘ ? ? ’ and ‘ ? ! ? ’ and ‘ ! ! !
se of ‘ ! ’ and ‘ ? ’ and ‘ ! ? ’ and ‘ ? ? ’ and ‘ ? ! ? ’ and ‘ ! ! ! ’ . What 
 of ‘ ! ’ and ‘ ? ’ and ‘ ! ? ’ and ‘ ? ? ’ and ‘ ? ! ? ’ and ‘ ! ! ! ’ . What is
and ‘ ? ’ and ‘ ! ? ’ and ‘ ? ? ’ and ‘ ? ! ? ’ and ‘ ! ! ! ’ . What is Marx sign
‘ ? ’ and ‘ ! ? ’ and ‘ ? ? ’ and ‘ ? ! ? ’ and ‘ ! ! ! ’ . What is Marx signalli
 ! ! ! ’ . What is Marx signalling here ? Disbelief in idiocy , incomprehension ,
 but also perhaps a curious hope . Hope ? Hope in a better analysis , one worthie
l explain rather than mystify… Part 2 : ? Are we today in need of more question m
we today in need of more question marks ? Klemperer describes , as above , the qu
ggression or interruption : ‘ oh really ? ’ But it can also function as a kind of
ays ‘ hang on , what is being said here ? ’ , ‘ what is happening ? ’ , ‘ is this
ing said here ? ’ , ‘ what is happening ? ’ , ‘ is this okay ? ’ It is the questi
 what is happening ? ’ , ‘ is this okay ? ’ It is the question of the body that s
 the right thing , what they are saying ? ’ It is the feeling and the admission t
tion mark as a symbol , then , of trust ? There must be room for exploration , of
cal through and through . The ! and the ? are signs among other signs , but their
stengers.concordance("!", width=82 , lines=74)
Displaying 41 of 41 matches:
 ! / ? Nina Power Part 1 : ! “ [ T ] he en
! / ? Nina Power Part 1 : ! “ [ T ] he entire thrust of the LTI The
 well that it is the exclamation mark – ! – that dominates . A quick look at his 
rative sentence or word followed by a ‘ ! ’ : ‘ Big trade imbalance ! ’ , ‘ No mo
owed by a ‘ ! ’ : ‘ Big trade imbalance ! ’ , ‘ No more ! ’ , ‘ They ’ ve gone CR
: ‘ Big trade imbalance ! ’ , ‘ No more ! ’ , ‘ They ’ ve gone CRAZY ! ’ , ‘ Happ
 ‘ No more ! ’ , ‘ They ’ ve gone CRAZY ! ’ , ‘ Happy National Anthem Day ! ’ , ‘
CRAZY ! ’ , ‘ Happy National Anthem Day ! ’ , ‘ REST IN PEACE BILLY GRAHAM ! ’ , 
 Day ! ’ , ‘ REST IN PEACE BILLY GRAHAM ! ’ , ‘ IF YOU DON ’ T HAVE STEEL , YOU D
HAVE STEEL , YOU DON ’ T HAVE A COUNTRY ! ’ , ( we shall leave the matter of all 
00 Billion Trade Deficit-have no choice ! , ‘ Jobless claims at a 49 year low ! ’
e ! , ‘ Jobless claims at a 49 year low ! ’ and so on … you get the picture . Tru
lamation mark as apocalypse , not the ‘ ! ’ of surprise , amusement , girlish shy
kind which simply says ‘ oh my goodness ! ’ or ‘ that ’ s great ! ’ or ‘ I ’ m sh
 oh my goodness ! ’ or ‘ that ’ s great ! ’ or ‘ I ’ m shocked/surprised/happy st
‘ I ’ m shocked/surprised/happy stunned ! ’ But then we use them all the time and
y : ‘ I ’ m sorry this email is so late ! ’ , ‘ I have been so useless lately ! ’
e ! ’ , ‘ I have been so useless lately ! ’ , ‘ I ’ m so tired I can hardly see !
! ’ , ‘ I ’ m so tired I can hardly see ! ’ and so on , ad infinitum … ( and what
sionate use : “ love how she is so open ! Ò ” says Kailey Bashaw , to which Oliv
o stop drinking because of all the hate ! Lighten up people ! JLaw is gon na keep
use of all the hate ! Lighten up people ! JLaw is gon na keep thriving with or wi
p thriving with or without your support ! ! ” A similar kind of plea , the plea o
thriving with or without your support ! ! ” A similar kind of plea , the plea of 
eading of labour . This is unskillful ( ! ) , because ( ! ) indeed the owner of c
 . This is unskillful ( ! ) , because ( ! ) indeed the owner of capital ( ! ) has
use ( ! ) indeed the owner of capital ( ! ) has after all ( ! ) done more than me
 owner of capital ( ! ) has after all ( ! ) done more than merely ( ! ? ) create 
after all ( ! ) done more than merely ( ! ? ) create ( ? ) and preserve ( ? ? ) t
) the same ( what same ? ) : namely ( ? ! ? ) the abstention from the enjoyment o
n for which he demands , for instance ( ! ! ! ) interest. ’ How very ‘ skilful ’ 
for which he demands , for instance ( ! ! ! ) interest. ’ How very ‘ skilful ’ is
r which he demands , for instance ( ! ! ! ) interest. ’ How very ‘ skilful ’ is t
 mere ‘ demand ’ into a source of value ! ” [ 4 ] Marx was famously brutal and sc
 here our interest lies in the use of ‘ ! ’ and ‘ ? ’ and ‘ ! ? ’ and ‘ ? ? ’ and
ies in the use of ‘ ! ’ and ‘ ? ’ and ‘ ! ? ’ and ‘ ? ? ’ and ‘ ? ! ? ’ and ‘ ! !
d ‘ ? ’ and ‘ ! ? ’ and ‘ ? ? ’ and ‘ ? ! ? ’ and ‘ ! ! ! ’ . What is Marx signal
‘ ! ? ’ and ‘ ? ? ’ and ‘ ? ! ? ’ and ‘ ! ! ! ’ . What is Marx signalling here ? 
! ? ’ and ‘ ? ? ’ and ‘ ? ! ? ’ and ‘ ! ! ! ’ . What is Marx signalling here ? Di
? ’ and ‘ ? ? ’ and ‘ ? ! ? ’ and ‘ ! ! ! ’ . What is Marx signalling here ? Disb
and political through and through . The ! and the ? are signs among other signs ,


I then tried to create patches again

for line in stengers.concordance_list("!"):
    cwidth = (82 - len("!")) // 2
    print ( line.left_print.rjust(cwidth), line.query, line.right_print.ljust(cwidth)) 
    
print(" ")

for line in stengers.concordance_list("?", width=82, lines=74):
    cwidth = (82 - len("?")) // 2
    print ( line.left_print.rjust(cwidth), line.query, line.right_print.ljust(cwidth))
                                        ! / ? Nina Power Part 1 : ! “ [ T ] he e  
               ! / ? Nina Power Part 1 : ! “ [ T ] he entire thrust of the LTI Th  
  well that it is the exclamation mark – ! – that dominates . A quick look at his  
  ative sentence or word followed by a ‘ ! ’ : ‘ Big trade imbalance ! ’ , ‘ No m  
  wed by a ‘ ! ’ : ‘ Big trade imbalance ! ’ , ‘ No more ! ’ , ‘ They ’ ve gone C  
   ‘ Big trade imbalance ! ’ , ‘ No more ! ’ , ‘ They ’ ve gone CRAZY ! ’ , ‘ Hap  
  ‘ No more ! ’ , ‘ They ’ ve gone CRAZY ! ’ , ‘ Happy National Anthem Day ! ’ ,   
  RAZY ! ’ , ‘ Happy National Anthem Day ! ’ , ‘ REST IN PEACE BILLY GRAHAM ! ’ ,  
  Day ! ’ , ‘ REST IN PEACE BILLY GRAHAM ! ’ , ‘ IF YOU DON ’ T HAVE STEEL , YOU   
  AVE STEEL , YOU DON ’ T HAVE A COUNTRY ! ’ , ( we shall leave the matter of all  
  0 Billion Trade Deficit-have no choice ! , ‘ Jobless claims at a 49 year low !   
   ! , ‘ Jobless claims at a 49 year low ! ’ and so on … you get the picture . Tr  
  amation mark as apocalypse , not the ‘ ! ’ of surprise , amusement , girlish sh  
  ind which simply says ‘ oh my goodness ! ’ or ‘ that ’ s great ! ’ or ‘ I ’ m s  
  oh my goodness ! ’ or ‘ that ’ s great ! ’ or ‘ I ’ m shocked/surprised/happy s  
   I ’ m shocked/surprised/happy stunned ! ’ But then we use them all the time an  
   : ‘ I ’ m sorry this email is so late ! ’ , ‘ I have been so useless lately !   
   ! ’ , ‘ I have been so useless lately ! ’ , ‘ I ’ m so tired I can hardly see   
   ’ , ‘ I ’ m so tired I can hardly see ! ’ and so on , ad infinitum … ( and wha  
  ionate use : “ love how she is so open ! Ò ” says Kailey Bashaw , to which Oli  
   stop drinking because of all the hate ! Lighten up people ! JLaw is gon na kee  
  se of all the hate ! Lighten up people ! JLaw is gon na keep thriving with or w  
   thriving with or without your support ! ! ” A similar kind of plea , the plea   
  hriving with or without your support ! ! ” A similar kind of plea , the plea of  
  ading of labour . This is unskillful ( ! ) , because ( ! ) indeed the owner of   
 
                                     ! / ? Nina Power Part 1 : ! “ [ T ] he entire 
 e comments , emails , and text messages ? If we take the tweets of Donald Trump a 
 the Nazis not need the exclamation mark ? Klemperer states , “ t is as if [ the L 
 he proclamation would need to stand out ? ” [ 3 ] This point alone should herald  
  infinitum … ( and what of the ellipses ? … another time , another time ) . If yo 
 he various uses of the exclamation mark ? While many of the comments suggest that 
 ter all ( ! ) done more than merely ( ! ? ) create ( ? ) and preserve ( ? ? ) the 
  done more than merely ( ! ? ) create ( ? ) and preserve ( ? ? ) the same ( what  
 ely ( ! ? ) create ( ? ) and preserve ( ? ? ) the same ( what same ? ) : namely ( 
 y ( ! ? ) create ( ? ) and preserve ( ? ? ) the same ( what same ? ) : namely ( ? 
 d preserve ( ? ? ) the same ( what same ? ) : namely ( ? ! ? ) the abstention fro 
 ? ) the same ( what same ? ) : namely ( ? ! ? ) the abstention from the enjoyment 
 the same ( what same ? ) : namely ( ? ! ? ) the abstention from the enjoyment of  
 interest lies in the use of ‘ ! ’ and ‘ ? ’ and ‘ ! ? ’ and ‘ ? ? ’ and ‘ ? ! ? ’ 
 s in the use of ‘ ! ’ and ‘ ? ’ and ‘ ! ? ’ and ‘ ? ? ’ and ‘ ? ! ? ’ and ‘ ! ! ! 
 se of ‘ ! ’ and ‘ ? ’ and ‘ ! ? ’ and ‘ ? ? ’ and ‘ ? ! ? ’ and ‘ ! ! ! ’ . What  
  of ‘ ! ’ and ‘ ? ’ and ‘ ! ? ’ and ‘ ? ? ’ and ‘ ? ! ? ’ and ‘ ! ! ! ’ . What is 
 and ‘ ? ’ and ‘ ! ? ’ and ‘ ? ? ’ and ‘ ? ! ? ’ and ‘ ! ! ! ’ . What is Marx sign 
 ‘ ? ’ and ‘ ! ? ’ and ‘ ? ? ’ and ‘ ? ! ? ’ and ‘ ! ! ! ’ . What is Marx signalli 
  ! ! ! ’ . What is Marx signalling here ? Disbelief in idiocy , incomprehension , 
  but also perhaps a curious hope . Hope ? Hope in a better analysis , one worthie 
 l explain rather than mystify… Part 2 : ? Are we today in need of more question m 
 we today in need of more question marks ? Klemperer describes , as above , the qu 
 ggression or interruption : ‘ oh really ? ’ But it can also function as a kind of 
 ays ‘ hang on , what is being said here ? ’ , ‘ what is happening ? ’ , ‘ is this 
 ing said here ? ’ , ‘ what is happening ? ’ , ‘ is this okay ? ’ It is the questi 
  what is happening ? ’ , ‘ is this okay ? ’ It is the question of the body that s 
  the right thing , what they are saying ? ’ It is the feeling and the admission t 
 tion mark as a symbol , then , of trust ? There must be room for exploration , of 
 cal through and through . The ! and the ? are signs among other signs , but their