In [1]:
# install nltk, gensim and keep all texts in the text folder (or link)
# creating line-sentences for gensim.word2vec mode with nltk
import os  
from nltk.tokenize import sent_tokenize, word_tokenize
import nltk

# 2 main functions to get the sentences ready for the model into lists(sentence) of lists(words)

def line_sentences(file_path):
    """
    return a list of lineSentences. breaks utf-8 ;(
    """
    #sfs = nltk.tokenize.stanford_segmenter.StanfordSegmenter("stanford-parser.jar")   
    raw = unicode(open(file_path).read(), errors='replace')
    #sent_tokenize_list = sfs.segment_sents(raw)
    sent_tokenize_list = sent_tokenize(raw)
    return sent_tokenize_list

def sentences_word_tokenized(lines):
    """
    breaks the line sentences into word lists
    """
    lines_tokenized = []
    for line in lines:
        lines_tokenized.append(word_tokenize(line))
        #lines_tokenized.append(map(lambda w : w.encode('ascii','ignore'),word_tokenize(line)))
    return lines_tokenized
        
def save_line_sentence_file(file_path, sentences):
    sentences = LineSentence(file_path)

In [2]:
# prepare the text

file_path = 'text/lucien_sfez.txt' # 'text/v4_combined.txt'
lines = line_sentences(file_path)#'text/v4_combined.txt')
sentences = sentences_word_tokenized(lines)

def print_lines():
    for line in lines:
        print line, word_tokenize(line)
        
def print_sentences():
    for sentence in sentences:
        print sentence

In [3]:
# build the model
import gensim
import math

#model.build_vocab(sentences)
model = gensim.models.Word2Vec(sentences, size=1000, window=5, min_count=3, workers=8)
#model.save()
model.init_sims(replace=True)
print model
print 'model memory size, mb:', model.estimate_memory()['total']/(math.pow(1024,2))


Word2Vec(vocab=85, size=1000, alpha=0.025)
model memory size, mb: 0.689029693604

In [4]:
# should go into my_module

def print_similarities(similarity_list):
    for similarity in similarity_list:
        print similarity[0].ljust(18),similarity[1]
        

def word_similar_cosmul_p(word,topn=10, do_print = True,words_only = False):
    if do_print: print "word:",word
    similarities = model.similar_by_word(word,topn)
    if do_print: print_similarities(similarities)    
    if words_only:
        similarities = map(lambda sim : sim[0],similarities)
    return similarities

In [5]:
# print all words in the vocabulary and their 10 most similar words
for w in model.vocab:
    word_similar_cosmul_p(w)


word: control
the                0.34049808979
to                 0.337391734123
,                  0.332774996758
of                 0.286473095417
and                0.284089297056
be                 0.280399888754
with               0.274270892143
in                 0.267456412315
from               0.250575184822
is                 0.248816519976
word: and
to                 0.481027781963
the                0.475595921278
,                  0.44372177124
of                 0.423580527306
from               0.379990100861
with               0.378594428301
be                 0.360528856516
a                  0.357245773077
.                  0.35586091876
has                0.349672198296
word: all
the                0.330345898867
and                0.322357356548
,                  0.306019961834
to                 0.297556340694
from               0.272700697184
of                 0.264623463154
.                  0.252791345119
be                 0.24866579473
are                0.245259046555
a                  0.235549613833
word: work
and                0.236459761858
to                 0.225032255054
the                0.221486091614
of                 0.206877410412
,                  0.201968982816
be                 0.197644770145
control            0.187502145767
a                  0.187116056681
in                 0.182685613632
more               0.175298690796
word: human
the                0.284697204828
to                 0.282541304827
,                  0.267171055079
of                 0.244097530842
.                  0.240508630872
and                0.238457530737
from               0.236953347921
a                  0.233832523227
be                 0.233533710241
are                0.230209201574
word: be
the                0.443313956261
to                 0.423336565495
,                  0.371442079544
and                0.360528856516
of                 0.343494772911
is                 0.34268540144
a                  0.34139829874
are                0.339661419392
.                  0.301420986652
has                0.301050782204
word: computer
and                0.242246702313
the                0.229876667261
to                 0.224962964654
of                 0.211216971278
,                  0.209904193878
in                 0.20403945446
is                 0.196233034134
control            0.188783571124
are                0.187987446785
has                0.186252981424
word: being
the                0.304230600595
,                  0.265654563904
to                 0.26062977314
be                 0.256647974253
of                 0.252041846514
and                0.249048963189
not                0.238103359938
but                0.231529399753
a                  0.230623245239
are                0.224801108241
word: communication
of                 0.225786045194
to                 0.22480276227
the                0.206093415618
you                0.191636770964
no                 0.184943154454
,                  0.182707265019
and                0.17555218935
by                 0.167577892542
with               0.164302259684
all                0.162467762828
word: over
world              0.139181241393
,                  0.132094651461
the                0.129914090037
.                  0.123642273247
as                 0.113408699632
make               0.112276002765
to                 0.111976765096
is                 0.110848903656
has                0.109180241823
are                0.109134621918
word: in
to                 0.346649050713
the                0.344433575869
,                  0.341332703829
and                0.322607219219
of                 0.30772459507
a                  0.286838680506
but                0.276707261801
be                 0.271286219358
control            0.267456412315
are                0.265627324581
word: life
,                  0.274194777012
the                0.269951164722
of                 0.257742226124
to                 0.243635684252
and                0.223328143358
from               0.216012343764
be                 0.210386991501
not                0.202309906483
control            0.20202550292
slowness           0.197941958904
word: an
be                 0.242535486817
the                0.211793869734
to                 0.205335259438
of                 0.193456754088
,                  0.188123464584
is                 0.184542775154
and                0.184107780457
are                0.179191052914
being              0.177071601152
no                 0.168697088957
word: down
to                 0.243848472834
the                0.242299690843
.                  0.218121230602
,                  0.212910801172
control            0.208434432745
has                0.191448643804
and                0.190445289016
no                 0.188596889377
with               0.187672257423
a                  0.185121148825
word: beings
to                 0.294216275215
the                0.285004138947
and                0.278204381466
,                  0.266296207905
of                 0.262151837349
are                0.23565068841
is                 0.231229484081
be                 0.226156353951
with               0.226072579622
from               0.218144595623
word: books
to                 0.24511988461
,                  0.228829562664
the                0.21790291369
of                 0.203336045146
with               0.200533688068
are                0.199281275272
and                0.186775505543
as                 0.185581877828
from               0.185430005193
.                  0.181159198284
word: are
to                 0.427413761616
the                0.391164958477
,                  0.377324819565
of                 0.343820005655
is                 0.343729436398
be                 0.339661419392
and                0.331873863935
a                  0.308653354645
.                  0.299850136042
from               0.295408934355
word: have
of                 0.200997561216
the                0.195214420557
to                 0.194526404142
,                  0.192929640412
from               0.173824325204
with               0.162978380919
be                 0.160348594189
control            0.159255981445
and                0.158292591572
but                0.15543410182
word: sense
the                0.236998975277
to                 0.222990170121
and                0.22209392488
of                 0.211687490344
is                 0.199207246304
,                  0.198037475348
are                0.193004325032
with               0.192809343338
at                 0.185386508703
a                  0.183017253876
word: our
and                0.235392466187
of                 0.233970239758
to                 0.231310114264
,                  0.230518117547
the                0.222617715597
has                0.211729764938
.                  0.205729603767
is                 0.189869090915
you                0.174512416124
be                 0.172325640917
word: fear
to                 0.205608308315
a                  0.201588869095
the                0.200331807137
be                 0.184865042567
,                  0.181970447302
and                0.172610580921
in                 0.170524567366
you                0.16877630353
of                 0.166955858469
are                0.150466531515
word: reality
,                  0.198873266578
to                 0.186882376671
a                  0.182841718197
of                 0.180758059025
be                 0.166847020388
from               0.157597437501
has                0.156954616308
down               0.155581533909
and                0.142436981201
world              0.141702741385
word: machines
the                0.248783394694
to                 0.231909960508
,                  0.198064744473
and                0.194550231099
is                 0.181044995785
do                 0.171549603343
but                0.168159008026
are                0.163604155183
by                 0.16356125474
of                 0.162479549646
word: We
of                 0.181121125817
,                  0.170194804668
a                  0.169154554605
but                0.159829497337
you                0.147766709328
control            0.145818248391
the                0.143075585365
to                 0.141619026661
and                0.138969287276
not                0.134041532874
word: management
the                0.197543799877
to                 0.183975920081
of                 0.179258868098
be                 0.175626516342
and                0.173329114914
dreams             0.153884112835
only               0.147259458899
a                  0.13925153017
do                 0.136862456799
is                 0.131523519754
word: from
to                 0.383573949337
the                0.380265027285
and                0.379990100861
of                 0.37568205595
,                  0.361355930567
is                 0.312140107155
are                0.295408934355
.                  0.293807923794
has                0.288846641779
be                 0.279328733683
word: us
,                  0.174917757511
of                 0.172969341278
the                0.161747559905
to                 0.161323055625
is                 0.147454470396
at                 0.145472362638
world              0.143328234553
and                0.140111148357
but                0.139705002308
all                0.137969642878
word: for
be                 0.207442104816
the                0.206297338009
to                 0.195023596287
,                  0.189187139273
are                0.184247642756
is                 0.179054379463
and                0.168747931719
has                0.164435774088
in                 0.163196265697
of                 0.161667823792
word: their
to                 0.252972304821
and                0.247588723898
the                0.245914906263
is                 0.236248508096
you                0.230453014374
of                 0.225246325135
.                  0.217245578766
,                  0.211040452123
but                0.208693772554
not                0.201183378696
word: )
the                0.2288005054
to                 0.201515004039
and                0.200763374567
be                 0.181709811091
not                0.179643213749
of                 0.17842695117
is                 0.169994413853
but                0.167292684317
has                0.161555081606
,                  0.160573065281
word: (
,                  0.174270346761
the                0.172092020512
to                 0.158224076033
and                0.142168819904
of                 0.139695569873
be                 0.138592705131
is                 0.137768119574
death              0.133645817637
.                  0.133555412292
work               0.123201221228
word: make
and                0.296702086926
of                 0.25355347991
the                0.240503370762
be                 0.234884336591
,                  0.230605140328
with               0.217456847429
to                 0.212750434875
is                 0.208208367229
but                0.203045099974
are                0.193826675415
word: people
to                 0.242845013738
.                  0.211859464645
of                 0.205664783716
are                0.198775053024
the                0.197950363159
with               0.191838622093
,                  0.190771713853
is                 0.187064066529
and                0.186999887228
in                 0.174332588911
word: ,
to                 0.520496487617
the                0.494572520256
of                 0.446486711502
and                0.44372177124
is                 0.380440503359
are                0.377324819565
be                 0.371442079544
a                  0.370607256889
.                  0.370142042637
from               0.361355930567
word: But
to                 0.222826093435
and                0.197125345469
,                  0.179213434458
the                0.171217769384
.                  0.168816745281
is                 0.163847729564
all                0.163769334555
of                 0.1633066535
at                 0.153587788343
has                0.153386667371
word: .
to                 0.414126813412
the                0.412647902966
,                  0.370142042637
of                 0.356355816126
and                0.35586091876
is                 0.330511957407
be                 0.301420986652
are                0.299850106239
a                  0.294576942921
from               0.293807923794
word: to
the                0.546276390553
,                  0.520496487617
of                 0.492481172085
and                0.481027781963
are                0.427413761616
be                 0.423336565495
.                  0.414126813412
is                 0.402089089155
a                  0.390906065702
has                0.388678908348
word: only
of                 0.326746433973
to                 0.326146811247
the                0.272798061371
from               0.269695609808
,                  0.260250270367
and                0.254712224007
with               0.246253401041
is                 0.22117343545
a                  0.221098601818
are                0.211932957172
word: homo
,                  0.203510552645
the                0.196511134505
to                 0.189587682486
be                 0.189426809549
at                 0.166023164988
of                 0.157522425056
and                0.156040370464
.                  0.154387235641
from               0.152468651533
you                0.15063790977
word: They
of                 0.181325823069
to                 0.123872607946
death              0.12307010591
the                0.120634838939
sense              0.11916796118
fear               0.118604138494
.                  0.115055404603
as                 0.114797152579
is                 0.11260574311
people             0.110188648105
word: no
to                 0.356722891331
,                  0.343157976866
the                0.332909166813
of                 0.291906535625
and                0.287230670452
is                 0.275038957596
has                0.264884412289
are                0.261069774628
you                0.260785549879
a                  0.259472072124
word: you
the                0.359958469868
to                 0.352033257484
,                  0.345231056213
and                0.337819039822
of                 0.334112226963
be                 0.293268829584
has                0.281812667847
are                0.275213718414
from               0.268584936857
is                 0.264522492886
word: has
to                 0.388678908348
the                0.381310999393
and                0.349672198296
,                  0.340463578701
is                 0.317758321762
of                 0.302696824074
be                 0.301050782204
are                0.292726278305
from               0.288846641779
you                0.281812667847
word: is
to                 0.402089118958
,                  0.380440533161
the                0.377902299166
of                 0.376799464226
and                0.346736073494
are                0.343729436398
be                 0.342685431242
.                  0.330511987209
has                0.317758381367
from               0.312140166759
word: ?
is                 0.152206242085
to                 0.149042636156
the                0.129601597786
their              0.120390504599
machines           0.115018889308
beings             0.113221555948
not                0.104279063642
and                0.104132413864
a                  0.10257229954
,                  0.0921609252691
word: more
to                 0.231761962175
,                  0.223020479083
the                0.200265109539
of                 0.187044322491
be                 0.184760063887
work               0.175298690796
and                0.172767579556
And                0.161233663559
you                0.16044421494
are                0.159539476037
word: breakdown
.                  0.166782051325
the                0.157750576735
are                0.155004009604
,                  0.150823235512
to                 0.144173562527
with               0.139976978302
make               0.137370586395
be                 0.129605337977
from               0.127640143037
and                0.127180039883
word: do
to                 0.293994188309
,                  0.260420769453
and                0.238853916526
of                 0.231432244182
the                0.2229372859
.                  0.213959336281
we                 0.209928840399
are                0.206359773874
with               0.202089041471
in                 0.197159796953
word: we
the                0.294320911169
to                 0.280758678913
and                0.263584911823
of                 0.258613795042
,                  0.23648609221
in                 0.23152551055
are                0.222588002682
be                 0.221729442477
has                0.21975967288
a                  0.210437148809
word: his
of                 0.273242384195
to                 0.252503097057
the                0.235008627176
is                 0.226723060012
be                 0.213510721922
and                0.207723081112
,                  0.198866337538
.                  0.196790635586
in                 0.196462616324
a                  0.195792287588
word: And
to                 0.261982083321
of                 0.23355807364
,                  0.227788537741
the                0.221435412765
and                0.214784815907
but                0.197145923972
a                  0.194152489305
control            0.175345867872
all                0.170669645071
only               0.170467048883
word: that
and                0.278720587492
the                0.276061534882
,                  0.267439246178
to                 0.265912204981
of                 0.250328302383
is                 0.236544668674
you                0.235481485724
.                  0.223536983132
be                 0.212258458138
as                 0.203633591533
word: idleness
the                0.23815575242
to                 0.218859523535
and                0.199532926083
of                 0.197524577379
,                  0.183297544718
.                  0.176614791155
as                 0.176217928529
in                 0.171995773911
is                 0.170973941684
be                 0.167223647237
word: but
to                 0.355849117041
the                0.340966045856
,                  0.32596975565
and                0.296497255564
of                 0.284632325172
in                 0.276707261801
be                 0.271937042475
are                0.27084878087
.                  0.267500132322
with               0.255378603935
word: it
to                 0.29209703207
the                0.283623278141
,                  0.253649830818
and                0.237035527825
be                 0.214066654444
is                 0.210809588432
.                  0.206937134266
control            0.205507531762
of                 0.202314391732
are                0.19887752831
word: death
to                 0.296187758446
the                0.284190148115
is                 0.283044338226
of                 0.253946423531
,                  0.253592550755
be                 0.246334299445
are                0.243854016066
a                  0.219835549593
.                  0.209634393454
in                 0.209525823593
word: lives
,                  0.22670173645
the                0.226158469915
a                  0.21761059761
and                0.217357352376
to                 0.205899149179
be                 0.188465565443
is                 0.178366541862
you                0.166833147407
.                  0.165463596582
of                 0.161828905344
word: know
to                 0.247675523162
and                0.231894269586
,                  0.220349371433
the                0.217959940434
of                 0.217770323157
all                0.188776910305
a                  0.186743855476
be                 0.182750493288
from               0.182402655482
not                0.17385391891
word: they
,                  0.221771359444
and                0.194072693586
is                 0.173080891371
of                 0.170347690582
to                 0.168761909008
are                0.155369341373
but                0.147967621684
a                  0.146878033876
from               0.146606773138
world              0.139840751886
word: not
to                 0.347824752331
the                0.326972275972
and                0.30178835988
of                 0.300668537617
,                  0.293266057968
.                  0.283478528261
has                0.252695202827
but                0.249132364988
is                 0.241241008043
from               0.238879978657
word: world
to                 0.312123000622
the                0.281680732965
,                  0.273930519819
and                0.261707544327
a                  0.253092229366
be                 0.250592768192
of                 0.240803599358
are                0.239838257432
in                 0.233963906765
is                 0.230867266655
word: The
the                0.148526951671
is                 0.140687704086
of                 0.125857502222
all                0.113494977355
human              0.112308815122
make               0.109522908926
his                0.108334593475
and                0.10769508779
,                  0.106351099908
control            0.104791052639
word: with
to                 0.383751094341
and                0.378594428301
the                0.36385640502
of                 0.342487335205
,                  0.323884785175
be                 0.295020520687
.                  0.274529099464
control            0.274270892143
a                  0.271640777588
are                0.271400868893
word: by
the                0.327233493328
,                  0.309899538755
to                 0.292000710964
of                 0.285295069218
and                0.259645849466
be                 0.239271149039
are                0.234265625477
.                  0.221796512604
has                0.214887827635
is                 0.212759792805
word: dreams
to                 0.277034461498
the                0.270088940859
.                  0.233124107122
a                  0.227472543716
and                0.214899212122
of                 0.214672893286
be                 0.199451744556
are                0.196201458573
,                  0.194068729877
in                 0.193023055792
word: he
has                0.127884685993
not                0.122667238116
it                 0.122217349708
be                 0.11478357017
and                0.101888455451
devices            0.0981635376811
that               0.095162332058
sense              0.086397305131
more               0.0851002559066
you                0.0831584185362
word: a
the                0.410396873951
to                 0.390906065702
,                  0.370607256889
and                0.357245773077
be                 0.34139829874
of                 0.339447230101
are                0.308653354645
.                  0.294576942921
is                 0.292282342911
in                 0.286838680506
word: on
,                  0.20639064908
to                 0.176593959332
the                0.173716127872
not                0.145349770784
no                 0.134853810072
from               0.12882617116
human              0.12860840559
in                 0.121197640896
work               0.116838917136
more               0.11395098269
word: :
the                0.226941913366
to                 0.184541285038
of                 0.176981553435
be                 0.164805591106
you                0.163187518716
and                0.162226438522
from               0.157308399677
are                0.156124442816
,                  0.148657202721
life               0.138515859842
word: this
to                 0.199542909861
the                0.197487622499
of                 0.176143020391
and                0.165682256222
a                  0.15706628561
be                 0.152869850397
their              0.14433260262
from               0.142636626959
.                  0.140135571361
as                 0.138288855553
word: of
the                0.498151540756
to                 0.492481172085
,                  0.446486711502
and                0.423580527306
is                 0.376799404621
from               0.37568205595
.                  0.356355816126
are                0.343820005655
be                 0.343494772911
with               0.342487335205
word: also
,                  0.283052414656
the                0.271690607071
of                 0.260223180056
and                0.250075221062
from               0.233959555626
to                 0.233635649085
be                 0.232305645943
has                0.231886640191
you                0.215547129512
slowness           0.197159513831
word: computers
of                 0.139837920666
by                 0.139175355434
the                0.138319313526
and                0.134758487344
to                 0.134709820151
that               0.121800124645
with               0.117349028587
are                0.116336785257
)                  0.114481724799
only               0.112823396921
word: as
to                 0.352864772081
of                 0.313877522945
and                0.313682228327
the                0.3091340065
be                 0.285771518946
is                 0.274585902691
has                0.274523943663
.                  0.268998771906
,                  0.254726320505
are                0.231798678637
word: devices
to                 0.251266896725
and                0.225819081068
with               0.206851780415
the                0.203717857599
be                 0.179507851601
beings             0.176899135113
,                  0.176644250751
.                  0.167676374316
you                0.162311762571
of                 0.161368608475
word: will
the                0.259162068367
to                 0.246473386884
a                  0.233249083161
,                  0.216610342264
of                 0.216310411692
in                 0.208683505654
with               0.190672397614
but                0.186590224504
and                0.174856320024
no                 0.169835552573
word: future
,                  0.231803864241
the                0.218100219965
has                0.19496268034
to                 0.191036224365
and                0.173470169306
are                0.173168718815
with               0.171417459846
of                 0.168817013502
all                0.166328564286
not                0.162313744426
word: slowness
the                0.326780617237
and                0.310394912958
to                 0.298137962818
of                 0.298034310341
,                  0.290048241615
a                  0.273650795221
.                  0.26387527585
you                0.257339417934
in                 0.247618243098
is                 0.246995761991
word: time
to                 0.212277889252
of                 0.208371132612
the                0.207696378231
a                  0.180592566729
be                 0.17676448822
and                0.173515275121
in                 0.173271745443
,                  0.158856749535
is                 0.149752408266
with               0.144704431295
word: Our
the                0.25444021821
to                 0.216040223837
and                0.209363684058
be                 0.209121450782
,                  0.193985462189
not                0.182700440288
all                0.179810613394
but                0.171408966184
with               0.163706794381
is                 0.161424458027
word: the
to                 0.546276390553
of                 0.498151540756
,                  0.494572520256
and                0.475595921278
be                 0.443313956261
.                  0.412647902966
a                  0.410396873951
are                0.391164958477
has                0.381310999393
from               0.380265027285
word: He
,                  0.137386396527
a                  0.120372258127
from               0.109620958567
dreams             0.102892264724
life               0.0968786403537
all                0.0895485877991
sense              0.0885052382946
management         0.0867305696011
and                0.0862416476011
of                 0.0852643698454
word: communicans
,                  0.210726559162
to                 0.184068664908
as                 0.182584345341
of                 0.179895609617
is                 0.169137984514
with               0.165915340185
and                0.162152558565
but                0.161050379276
you                0.160940766335
only               0.158967316151
word: or
,                  0.147680819035
are                0.143157601357
as                 0.12324334681
is                 0.120452195406
to                 0.115076549351
and                0.112762361765
no                 0.111397728324
slowness           0.10952218622
do                 0.106309756637
also               0.104837760329
word: at
of                 0.264645218849
the                0.257015109062
to                 0.250918537378
,                  0.247464224696
are                0.217943102121
and                0.214142858982
but                0.212665587664
has                0.208286955953
you                0.196514606476
control            0.195777416229

In [6]:
# Sentiment analysis of the whole text file

from textblob import TextBlob
import numpy as np
import json

raw = unicode(open(file_path).read(), errors='replace')

blob = TextBlob(raw)

sentiments = []
c = 0
for sentence in blob.sentences:
    sentiments.append([sentence.sentiment.polarity,c])
    #print c,sentence
    c += 1


sen_sorted = sorted(sentiments, key= lambda s : s[0])
sen_reduced =map(lambda s : s[0],sen_sorted)


import matplotlib.pyplot as plt
%matplotlib inline
plt.figure(figsize=[30, 10])
plt.plot(sen_reduced)
plt.show()

dump_file = open('v4_combined_after_retune_sentiment_ranking.json','w')
for sen in sen_sorted:
    dump_file.write(json.dumps({'sen':sen,'text':blob.sentences[int(sen[1])].string}))
    print sen
    print blob.sentences[int(sen[1])]
dump_file.close()


/Users/raminsoleymani/anaconda2/lib/python2.7/site-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
[-0.25, 53]
If they do not need to defend themselves, people���s existence begins to seem pointless.
[-0.2, 56]
The idea of the human brain as the poor relation of the all-powerful computer has lead to a sense of powerlessness and futility.
[-0.15555555555555559, 28]
Think how people panic when their computer or television breaks down or their phone is out of order.
[-0.15555555555555559, 31]
When they break down it is like being in pain, the fear of it is a nightmare.
[-0.15, 55]
Machines do human work to perfection, while people are clumsy and hesitant and make mistakes, trying falteringly to follow a pattern.
[-0.15, 58]
Contrary to common belief, homo communicans of the future will not suffer from pressure and stress.
[-0.125, 3]
Information highways, despite the hype, are no more than a combination of telephone, video and computers, as are the gadgets telecom engineers devise for the future.
[-0.05, 25]
It seemed a strange answer.
[-0.05, 47]
We open doors and change channels on the TV remotely.
[-0.025, 12]
The long term doesn���t exist in this world, only short-term gains.
[-0.025, 48]
We are not far from spending our entire lives in a semi-dormant state.
[0.0, 0]
Internet, cell phones, videophones, virtual reality devices, computers, modems, data banks: the communications industry is taking over.
[0.0, 1]
Productivity, utility, management are the watchwords.
[0.0, 2]
But are we masters or servants of our devices?
[0.0, 8]
Even the occasional audible signal can be turned off.
[0.0, 13]
The communications industry dreams of productivity, utility and management, the watchwords of homo communicans.
[0.0, 14]
Homo communicans is inseparable from his communication devices.
[0.0, 15]
They are his life and he takes on their characteristics.
[0.0, 20]
Cyberculture uses the language of clans and communities but it does not share their reality, for to join the clan, you have to make sacrifices.
[0.0, 21]
And in cyber flatland the only thing to fear is the loss of the machines: breakdown.
[0.0, 22]
When I asked Martin Landau, an eminent researcher in organisation science at Berkeley, California, about theories of communication, he replied: ���Do you know why the 747 is the safest aircraft in the world?
[0.0, 23]
Because it has four separate control systems, one for each engine.
[0.0, 24]
And the pilot also has a manual control system separate from those four��� (2).
[0.0, 26]
In aviation, breakdown means death.
[0.0, 30]
These machines have become part of us; we have become part of them.
[0.0, 35]
In his book Anatomy of Criticism (3), Northrop Frye shows that the Apocalypse is a text that advocate union between the city, the individual and God.
[0.0, 36]
And just as fear of the Apocalypse exists to serve the Christian faith, so fear of breakdown exists to consolidate the cult of the computer.
[0.0, 37]
But homo communicans, ignorant of the sacrifices of communication, does not know this.
[0.0, 39]
He doesn���t know what he is losing.
[0.0, 41]
Men are assisted in everything, even getting to work, since with their self-guided cars they can dream at the steering wheel until the device tells them they have arrived.
[0.0, 49]
Our listlessness is encouraged by the sense of security we derive from all the surveillance devices that surround us.
[0.0, 54]
As if they are present by accident and might as well not exist.
[0.0, 59]
Why should he?
[0.0, 60]
His mistakes will be corrected by machines.
[0.0, 61]
Society with its faults of inequality, poverty, war and death, will be corrected by technology.
[0.0, 67]
He said that writing and books make for idleness, making the reader passive.
[0.0, 68]
His advice seems archaic (today���s educators would give anything to get people to read).
[0.0, 69]
But although the medium has changed, Plato���s message has not.
[0.0, 70]
We are still handing our obligations over to an external device.
[0.0, 71]
From Plato���s viewpoint, the idleness resulting from freedom from work done by machines idleness would be evidence of enslavement unworthy of human beings.

[0.024999999999999967, 62]
This world where communication is all will not be fast-moving, but slow, inactive, contemplative, full of play.
[0.027777777777777776, 43]
As technology continues to develop, homo communicans faces a future of total, profound idleness.
[0.03333333333333333, 32]
That is the system���s only contradiction, the only conceivable misfortune.
[0.044444444444444446, 5]
All are logged in to technical, social or professional networks.
[0.05, 33]
The fear of breakdown has replaced the old apocalyptic fear of the devil, and it is only the threat of that breakdown which gives life and feeling to a system that has none.
[0.05, 34]
This is the communication system���s last vital opportunity.
[0.0625, 19]
There is no price to pay and no other side of the coin in what Douglas Coupland, in his novel Microserfs (1), calls the ���flatland of cyberculture���.
[0.06666666666666667, 65]
That may be the real work assigned to human beings in the future of communication since the rest, engineering and production, will be done by machines.
[0.08333333333333333, 6]
There are no black holes, no negatives, no opposites in this joined-up world.
[0.1, 42]
The old hauliers��� slogan ���driving for you��� now applies to us all.
[0.1, 45]
We let machines remember things for us, from our address books complete with telephone numbers and email addresses to the management of bibliographies, texts, business meetings, accounts, planning.
[0.11875, 27]
But breakdown in communication, loss of relationships or position, is also a kind of death, the end of homo communicans, who lives by communication and is defined only by the links his machines give him to other machine-bound human beings.
[0.125, 44]
And the first signs of this are already visible in our daily lives.
[0.13333333333333333, 66]
Plato warned young philosophers against books, which he likened to dead memories that replaced living ones on the pretext of being more convenient.
[0.14000000000000004, 11]
Anyone using such machines is free and happy in a world of instant communication, without time to think ill of himself or of anyone else.
[0.15000000000000002, 4]
They are all really just cell phones plugged into the internet, linking with fixed stations, videophones, virtual reality devices, computers, modems, data banks, tradesmen, managers, repairmen.
[0.16666666666666666, 16]
He is their servant as much as their master, but he is unaware of his chains because he believes himself to be in control and as powerful as the machines.
[0.2, 29]
The gap in their lives causes real distress.
[0.2, 52]
Voice and face recognition, digital fingerprints and cameras with access codes free us from fear of intruders.
[0.22727272727272727, 18]
Everything is positive, everything in its place.
[0.2814814814814815, 10]
If you want to stop communicating, to enjoy your own company, all you have to do is put down the handset and switch off the screen.
[0.3, 40]
Machines are created for productivity and efficiency, and have unexpected consequences: they make men into idle and superfluous creatures who no longer do much on their own initiative.
[0.35, 63]
Not the slowness advocated by Pierre Sansot (4), the slowness of taking time out to enjoy life and savour the pleasures of fruit, fresh air and dreams, but an enforced slowness, reassuring and with no place for expectancy or surprise.
[0.4, 7]
Everything runs smoothly in electronic silence.
[0.43333333333333335, 9]
Communication is easy when all it involves is using machines to connect with machines.
[0.43333333333333335, 17]
They make his life easy.
[0.4454545454545455, 64]
Homo communicans is good at dreams and contemplation, and his dreams will probably generate new ideas for communicating machines, more invention and innovation.
[0.5, 46]
Our voice, or better still a synthetic one, answers for us, recorded once for all time.
[0.5, 51]
With sophisticated devices to watch over us, there are no enemies to worry about.
[0.5, 57]
Our memories have grown unretentive but we don���t care; the business of remembering is being safely managed.
[0.55, 50]
Idleness goes hand in hand with freedom from fear, a sense of comfort, of being safe, warm and protected.
[0.65, 38]
He thinks he is always on the winning side, not knowing that in order to win you also have to lose.

In [19]:
from nltk import Text
import lib
cool_words = []

for word in model.vocab:  
    w_tag = lib.tag(word)
    #print word, w_tag[1]
    raw = unicode(open(file_path).read(), errors='replace')
    text = Text(word_tokenize(raw))
    if w_tag[1] in ['NN','VB',"VBG",'RB','NNS','ADJ','ADV','ADP']:
        cool_words.append(word)
        #text.concordance(word)
        #nltk.help.upenn_tagset(w_tag[1])
    
print len(cool_words), 'nice words'


37 nice words

In [20]:
def scaled_dispersion_plot(text,words,ignore_case=False, title = 'LExical Dispersion Plot'):
    from matplotlib import pylab
    text = list(text)
    words.reverse()
    
    words_to_comp = words
    text_to_comp = text
    
    ignore_case = False
    points= [(x,y) for x in range(len(text_to_comp))
            for y in range(len(words_to_comp))
            if text_to_comp[x] == words_to_comp[y]]
    
    if points:
        x,y = list(zip(*points))
    else:
        x = y = ()
    
    pylab.plot(x,y,'b|',scalex = 0.1)
    pylab.yticks(list(range(len(words))), words, color='b')
    pylab.ylim(-1,len(words))
    pylab.title(title)
    pylab.xlabel('word offset')
    pylab.show()

In [21]:
scaled_dispersion_plot(text, cool_words)