You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SI13/LIQUID/MANIFESTO/nltk-similar-words-Copy1.ipynb

232 lines
18 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# NLTK - Similar Words"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"https://www.nltk.org/book/ch01.html#searching-text"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import nltk"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"txt = open('manifesto.txt').read()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Tokens"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['_MANIFESTO', 'LIQUID', 'LIFE', 'IS', 'AN', 'UNCERTAIN', 'REALM', '.', 'THE', 'CONCEPTS', 'NEEDED', 'TO', 'REALISE', 'ITS', 'POTENTIAL', 'HAVE', 'NOT', 'YET', 'EXISTED', 'UNTIL', 'NOW', '.', 'THE', 'HYPERCOMPLEXITY', 'AND', 'HYPEROBJECT-NESS', 'OF', 'LIQUID', 'TERRAINS', 'EXCEEDS', 'OUR', 'ABILITY', 'TO', 'OBSERVE', 'OR', 'COMPREHEND', 'THEM', 'IN', 'THEIR', 'TOTALITY', '.', 'INDEED', ',', 'WHAT', 'WE', 'TYPICALLY', 'RECOGNISE', 'AS', 'LIVING', 'THINGS', 'ARE', 'BY-PRODUCTS', 'OF', 'LIQUID', 'PROCESSES', '.', 'LIQUID', 'LIFE', 'IS', 'A', 'WORLDVIEW', '.', 'A', 'PHANTASMAGORIA', 'OF', 'EFFECTS', ',', 'DISOBEDIENT', 'SUBSTANCES', ',', 'EVASIVE', 'STRATEGIES', ',', 'DALLIANCES', ',', 'SKIRMISHES', ',', 'FLIRTATIONS', ',', 'ADDICTIONS', ',', 'QUANTUM', 'PHENOMENA', ',', 'UNEXPECTED', 'TWISTS', ',', 'SUDDEN', 'TURNS', ',', 'FURTIVE', 'EXCHANGES', ',', 'SLY', 'MANOEUVRES', ',', 'BLIND', 'ALLEYS', ',', 'AND', 'EXUBERANT', 'DIGRESSIONS', '.', 'IT', 'CAN', 'NOT', 'BE', 'REDUCED', 'INTO', 'SIMPLE', 'CIPHERS', 'OF', 'PROCESS', ',', 'SUBSTANCE', ',', 'METHOD', ',', 'OR', 'TECHNOLOGY', '.', 'IT', 'IS', 'MORE', 'THAN', 'A', 'SET', 'OF', 'PARTICULAR', 'MATERIALS', 'THAT', 'COMPRISE', 'A', 'RECOGNIZABLE', 'BODY', '.', 'IT', 'IS', 'MORE', 'THAN', 'VITAL', 'PROCESSES', 'THAT', 'ARE', 'SHAPED', 'ACCORDING', 'TO', 'SPECIFIC', 'CONTEXTS', 'AND', 'SUBJECTIVE', 'ENCOUNTERS', '.', 'YET', 'WE', 'RECOGNISE', 'ITS', 'COHERENCE', 'THROUGH', 'THE', 'LIVES', 'OF', '', 'BEINGS', '', ',', 'WHICH', 'REMAIN', 'COGENT', 'DESPITE', 'INCALCULABLE', 'PERSISTENT', 'CHANGES', 'SUCH', 'AS', 'FLOWS', ',', 'AMBIGUITIES', ',', 'TRANSITIONAL', 'STATES', 'AND', 'TIPPING', 'POINTS', 'THAT', 'BRING', 'ABOUT', 'RADICAL', 'TRANSFORMATION', 'WITHIN', 'PHYSICAL', 'SYSTEMS', '.', 'LIQUID', 'LIFE', 'IS', 'A', 'KIND', 'OF', '', 'METABOLIC', 'WEATHER', '', '.', 'IT', 'IS', 'A', 'DYNAMIC', 'SUBSTRATE', '-', 'OR', 'HYPERBODY', '-', 'THAT', 'PERMEATES', 'THE', 'ATMOSPHERE', ',', 'LIQUID', 'ENVIRONMENTS', ',', 'SOILS', 'AND', 'EARTH', '', 'S', 'CRUST', '.', '', 'METABOLIC', 'WEATHER', '', 'REFERS', 'TO', 'COMPLEX', 'PHYSICAL', ',', 'CHEMICAL', 'AND', 'EVEN', 'BIOLOGICAL', 'OUTCOMES', 'THAT', 'ARE', 'PROVOKED', 'WHEN', 'FIELDS', 'OF', 'MATTER', 'AT', 'THE', 'EDGE', 'OF', 'CHAOS', 'COLLIDE', '.', 'IT', 'IS', 'A', 'VECTOR', 'OF', 'INFECTION', ',', 'AN', 'EXPRESSION', 'OF', 'RECALCITRANT', 'MATERIALITY', 'AND', 'A', 'PRINCIPLE', 'OF', 'ECOPOIESIS', ',', 'WHICH', 'UNDERPINS', 'THE', 'PROCESS', 'OF', 'LIVING', ',', 'LIFELIKE', 'EVENTS', '', 'AND', 'EVEN', 'LIFE', 'ITSELF', '.', 'THESE', 'LIFE', 'FORMS', 'ARISE', 'FROM', 'ENERGY', 'GRADIENTS', ',', 'DENSITY', 'CURRENTS', ',', 'KATABATIC', 'FLOWS', ',', 'WHIRLWINDS', ',', 'DUST', 'CLOUDS', ',', 'POLLUTION', 'AND', 'THE', 'MYRIAD', 'EXPRESSIONS', 'OF', 'MATTER', 'THAT', 'DETAIL', 'OUR', '(', 'EARTHY', ',', 'LIQUID', ',', 'GASEOUS', ')', 'TERRAINS', '.', 'LIQUID', 'LIFE', 'IS', 'IMMORTAL', '.', 'ARISING', 'FROM', 'OUR', 'UNIQUE', 'PLANETARY', 'CONDITIONS', ',', 'ITS', 'INGREDIENTS', 'ARE', 'CONTINUALLY', 'RE-INCORPORATED', 'INTO', 'ACTIVE', 'METABOLIC', 'WEBS', 'THROUGH', 'CYCLES', 'OF', 'LIFE', 'AND', 'DEATH', '.', 'MOST', 'DECEASED', 'LIQUID', 'MATTER', 'LIES', 'QUIESCENT', ',', 'PATIENTLY', 'WAITING', 'FOR', 'ITS', 'REANIMATION', 'THROUGH', 'THE', 'PERSISTENT', 'METABOLISMS', 'WITHIN', 'OUR', 'SOILS', '.', 'LIQUID', 'LIFE', 'EXCEEDS', 'RHETORIC', '.', 'ITS', 'CONCEPTS', 'CAN', 'BE', 'EMBODIED', 'AND', 'EXPERIMENTALLY', 'TESTED', 'USING', 'A', 'TRANS-DISCIPLINARY', 'APPROACH', ',', 'WHICH', 'DRAWS', 'UPON', 'A', 'RANGE', 'OF', 'CONCEPTUAL', 'LENSES', 'AND', 'TECHNIQUES', 'TO', 'INVOLVE', 'THE', 'LIQUID', 'REALM', 'WITH', 'ITS', 'OWN', '', 'VOICE', '', '.', 'FROM', 'THESE', 'PERSPECTIVES', 'LIQUID', 'TECHNOLOGIES', 'EMERGE', 'THAT', 'ARE', 'CAPABLE', 'OF', 'GENERATING', 'NEW', 'KINDS', 'OF', 'ARTEFACTS', ',', 'LIKE', 'BÜTSCHLI', 'DROPLETS', ',', 'WHICH', 'ARE', 'LIQUID', 'CHEMICAL', 'ASSEMBLAGES', 'CAPABLE', 'OF', 'SURPRISINGLY', 'LIFELIKE', 'BEHAVIOURS', '.', 'THESE', 'AGENTS', 'EXCEED', 'RHETORIC', ',', 'AS', 'THEY', 'POSSESS', 'THEIR', 'OWN', 'AGENCY', ',', 'SEMIOTICS', ',', 'AND', 'CHOREOGRAPHIC', 'IMPULSES', ',', 'WHICH', 'ALLOW', 'US', 'TO', 'VALUE', 'AND', 'ENGAGE', 'IN', 'DISCOURSE', 'WITH', 'THEM', 'ON', 'THEIR', 'TERMS', '.', 'THE', 'DIFFICULTY', 'AND', 'SLIPPAGES', 'IN', 'MEANING', 'AND', 'VOLITION', 'BETWEEN', 'PARTICIPATING', 'BODIES', 'CREATES', 'THE', 'POSSIBILITY', 'OF', 'EN', 'EVOLVING', 'POLY-VOCAL', 'DIALECTICS', '.', 'LIQUID', 'LIFE', 'PROVOKES', 'AN', 'EXPANDED', 'NOTION', 'OF', 'CONSCIOUSNESS', '.', 'ITS', '', 'THINKING', '', 'IS', 'A', 'MOLECULAR', 'SEA', 'OF', 'POSSIBILITIES', 'THAT', 'RESIST', 'THE', 'RAPID', 'DECAY', 'TOWARDS', 'THERMODYNAMIC', 'EQUILIBRIUM', '.', 'IN', 'THESE', 'VITAL', 'MOMENTS', 'IT', 'INDULGES', 'EVERY', 'POSSIBLE', 'TACTIC', 'TO', 'PERSIST', ',', 'ACQUIRING', 'A', 'RICH', 'PALETTE', 'OF', 'NATURAL', 'RESOURCES', ',', 'FOOD', 'SOURCES', ',', 'WASTE', 'MATERIALS', ',', 'AND', 'ENERGY', 'FIELDS', '.', 'THESE', 'MATERIAL', 'ALLIANCES', 'NECESSITATE', 'DECISIONS', 'THAT', 'DO', 'NOT', 'REQUIRE', 'A', 'COORDINATING', 'CENTRE', ',', 'LIKE', 'THE', 'BRAIN', '.', 'LIQUID', 'ARE', 'NON-BODIES', '.', 'THEY', 'ARE', 'WITHOUT', 'FORMAL', 'BOUNDARIES', 'AND', 'ARE', 'CONSTANTLY', 'CHANGING', '.', 'LIQUID', 'BODIES', 'ARE', 'PARADOXICAL', 'STRUCTURES', 'THAT', 'POSSESS', 'THEIR', 'OWN', 'LOGIC', '.', 'ALTHOUGH', 'CLASSICAL', 'LAWS', 'MAY', 'APPROXIMATE', 'THEIR', 'BEHAVIOUR', ',', 'THEY', 'CAN', 'NOT', 'PREDICT', 'THEM', '.', 'THEY', 'ARE', 'TANGIBLE', 'EXPRESSIONS', 'OF', 'NONLINEAR', 'MATERIAL', 'SYSTEMS', ',', 'WHICH', 'EXIST', 'OUTSIDE', 'OF', 'THE', 'CURRENT', 'FRAMES', 'OF', 'REFERENCE', 'THAT', 'OUR', 'GLOBAL', 'INDUSTRIAL', 'CULTURE', 'IS', 'STEEPED', 'IN', '.', 'ASPECTS', 'OF', 'THEIR', 'EXISTENCE', 'STRAY', 'INTO', 'THE', 'UNCONVENTIONAL', 'AND', 'LIMINAL', 'REALMS', 'OF', 'AURAS', ',', 'QUANTUM', 'PHYSICS', ',', 'AND', 'ECTOPLASMS', '.', 'IN', 'THESE', 'REALMS', 'THEY', 'CAN', 'NOT', 'BE', 'APPRECIATED', 'BY', 'OBJECTIVE', 'MEASUREMENT', 'AND', 'INVITE', 'SUBJECTIVE', 'ENGAGEMENT', ',', 'LIKE', 'POETIC', 'TRYSTS', '.', 'THEIR', 'DIVERSIONARY', 'TACTICS', 'GIVE', 'RISE', 'TO', 'THE', 'VERY', 'ACTS', 'OF', 'LIFE', ',', 'SUCH', 'AS', 'THE', 'CAPACITY', 'TO', 'HEAL', ',', 'ADAPT', ',', 'SELF-REPAIR', ',', 'AND', 'EMPATHIZE', '.', 'LIQUID', 'BODIES', 'ARE', 'PLURI-PONTENT', '.', 'THEY', 'ARE', 'CAPABLE', 'OF', 'MANY', 'ACTS', 'OF', 'TRANSFORMATION', '.', 'THEY', 'DE-SIMPLIFY', 'THE', 'MATTER', 'OF', 'BEING', 'A', 'BODY', 'THROUGH', 'THEIR', 'VISCERAL', 'ENTANGLEMENTS', '.', 'WHILE', 'THE', 'BÊTE', 'MACHINE', 'DEPENDS', 'ON', 'AN', 'ABSTRACTED', 'UNDERSTANDING', 'OF', 'ANATOMY', 'FOUNDED', 'UPON', 'GENERALIZATIONS', 'AND', 'IDEALS', ',', 'LIQUID', 'BODIES', 'RESIST', 'THESE', 'TROPES', '.', 'LIQUID', 'BODIES', 'DISCUSS', 'A', 'MODE', 'OF', 'EXISTENCE', 'THAT', 'IS', 'CONSTANTLY', 'CHANGING', '', 'NOT', 'AS', 'THE', 'CUMULATIVE', 'OUTCOMES', 'OF', '', 'ERROR', '', '', 'BUT', 'AS', 'A', 'HIGHLY', 'CHOREOGRAPHED', 'AND', 'CONTINUOUS', 'SPECTRUM', 'STREAM', 'OF', 'EVENTS', 'THAT', 'ARISE', 'FROM', 'THE', 'PHYSICAL', 'INTERACTIONS', 'OF', 'MATTER', '.', 'THEY', 'INTERNALIZE', 'OTHER', 'BODIES', 'AS', 'MANIFOLDS', 'WITHIN', 'THEIR', 'SUBSTANCE', 'AND', 'ASSERT', 'THEIR', 'IDENTITY', 'THROUGH', 'THEIR', 'ENVIRONMENTAL', 'CONTEXTS', '.', 'SUCH', 'ENTANGLEMENTS', 'INVOKE', 'MARGINAL', 'RELATIONS', 'BETWEEN', 'MULTIPLE', 'AGENCIES', 'AND', 'EXCEED', 'THE', 'CLASSICAL', 'LOGIC', 'OF', 'OBJECTS', '.', 'THEY', 'ARE', 'INSEPARABLE', 'FROM', 'THEIR', 'CONTEXT', 'AND', 'OFFER', 'WAYS', 'OF', 'THINKING', 'AND', 'EXPERIMENTING', 'WITH', 'THE', 'CONVENTIONS', 'OF', 'MAKING', 'AND', 'BEING', 'EMBODIED', '.', 'LIQUID', 'BODIES', 'INVITE', 'US', 'TO', 'ARTICULATE', 'THE', 'FUZZINESS', ',', 'PARADOXES', 'AND', 'UNCERTAINTIES', 'OF', 'THE', 'LIVING', 'REALM', '.', 'THEY', 'ARE', 'STILL', 'INSTANTLY', 'RECOGNIZABLE', 'AND', 'CAN', 'BE', 'NAMED', 'AS', 'TORNADO', ',', 'CIRRUS', ',', 'SOIL', ',', 'EMBRYO', ',', 'OR', 'BIOFILM', '.', 'THESE', 'CONTRADICTIONS', '', 'OF', 'FORM', 'AND', 'CONSTANCY', '', 'ENCOURAGE', 'ALTERNATIVE', 'READINGS', 'OF', 'HOW', 'WE', 'ORDER', 'AND', 'SORT', 'THE', 'WORLD', ',', 'WHOSE', 'MAIN', 'METHODOLOGY', 'IS', 'THROUGH', 'RELATING', 'ONE', 'BODY', 'TO', 'ANOTHER', '.', 'INDEED', ',', 'PROTEAN', 'LIQUID', 'BODIES', 'HELP', 'US', 'UNDERSTAND', 'THAT', 'WHILE', 'UNIVERSALISMS', ',', 'AVERAGES', 'AND', 'GENERALIZATIONS', 'ARE', 'USEFUL', 'IN', 'PRODUCING', 'MAPS', 'OF', 'OUR', 'BEING', 'IN', 'THE', 'WORLD', ',', 'THEY', 'NEGLECT', 'SPECIFIC', 'DETAILS', ',', 'WHICH', '', 'BRING', 'FORTH', '', 'THE', 'MATERIALITY', 'OF', 'THE', 'ENVIRONMENT', '.', 'LIQUID', 'BODIES', 'ARE', 'POLITICAL', 'AGENTS', '.', 'THEY', 'RE-DEFINE', 'THE', 'BOUNDARIES', 'AND', 'CONDITIONS', 'FOR', 'EXISTENCE', 'IN', 'THE', 'CONTEXT', 'OF', 'DYNAMIC', ',', 'UNRULY', 'ENVIRONMENTS', '.', 'THEY', 'PROPOSE', 'ALTERNATIVE', 'MODES', 'OF', 'LIVING', 'THAT', 'ARE', 'RADICALLY', 'TRANSFORMED', ',', 'MONSTROUS', ',', 'COHERENT', ',', 'RAW', '', 'AND', 'SELECTIVELY', 'PERMEATED', 'BY', 'THEIR', 'NURTURING', 'MEDIA', '.', 'LIQUID', 'BODIES', 'INVITE', 'US', 'TO', 'UNDERSTAND', 'OUR', 'BEING', 'BEYOND', 'RELATIONAL', 'THINKING', 'AND', 'INVENT', 'MONSTERS', 'THAT', 'DEFY', 'ALL', 'EXISTING', 'FORMS', 'OF', 'CATEGORIZATION', 'TO', 'MAKE', 'POSSIBLE', 'A', 'NEW', 'KIND', 'OF', 'CORPOREALITY', '.', 'THEY', 'ARE', 'WHAT', 'REMAIN', 'WHEN', 'MECHANICAL', 'EXPLANATIONS', 'CAN', 'NO', 'LONGER', 'ACCOUNT', 'FOR', 'THE', 'EXPERIENCES', 'THAT', 'WE', 'RECOGNISE', 'AS', '', 'BEING', 'ALIVE.', '', '“', 'LIQUID', 'LIFE', 'ARISES', 'FROM', 'OUT', 'OF', 'A', 'SOUP', ',', 'SMOG', ',', 'A', 'SCAB', ',', 'FIRE', '', 'WHERE', 'THE', 'INCANDESCENT', 'HEAVENS', 'RAIN', 'MOLTEN', 'ROCK', 'AND', 'ALKALI', 'MEETS', 'OIL', '', 'A', 'CHOREOGRAPHY', 'OF', 'PRIMORDIAL', 'METABOLIC', 'FLAMES', '.', 'AMIDST', 'THE', 'REDUCING', 'ATMOSPHERE', 'OF', 'CHOKING', 'TOXIC', 'GASES', ',', 'ITS', 'COMING-INTO-BEING', 'DRAWS', 'MOMENTARILY', 'INTO', 'FOCUS', 'AND', 'RECEDES', 'AGAIN', '.', 'THE', 'UNFATHOMABLE', 'DARKNESS', 'OF', 'THE', 'HADEAN', 'EPOCH', 'IS', 'REINCARNATED', 'HERE', '.', 'IT', 'IS', 'DRENCHED', 'IN', 'THICK', 'GAS', 'CLOUDS', ',', 'UNWEATHERED', 'DUSTS', ',', 'AND', 'PUNGENT', 'VAPOURS', ',', 'WHICH', 'OBFUSCATE', 'THE', 'LIGHT', '.', 'THE', 'INSULATING', 'BLANKET', 'OF', 'GASEOUS', 'POISONS', 'PROTECTS', 'THE', 'LAND', 'AGAINST', 'THE', 'CRUEL', 'STARE', 'OF', 'ULTRAVIOLET', 'RAYS', 'AND', 'IONIZING', 'SPACE', 'RADIATION', ',', 'WHICH', 'SPITE', 'THE', 'EARTH', '', 'S', 'SURFACE', '.', 'OUT', 'OF', 'THESE', 'VOLATILE', 'CAUSTIC', 'BODIES', ',', 'A', 'SUCCESSION', 'OF', 'CHEMICAL', 'GHOSTS', 'HAUNTS', 'THE', 'HEAVY', 'ATMOSPHERE', '.', 'HERE', ',', 'IMAGINARY', 'FIGURES', ',', 'LIKE', 'THOSE', 'THAT', 'APPEAR', 'IN', 'A', 'FEVERED', 'CONDITION', ',', 'SPLIT', 'FAINT', 'LIGHT', 'AROUND', '.', 'THEY', 'WANDER', 'AMONG', 'THE', 'AURAS', 'OF', 'TURBULENT', 'INTERFACES', 'AND', 'THICKENING', 'DENSITIES', 'OF', 'MATTER', ',', 'SCUM', 'AND', 'CRUST', '.', 'OVER', 'THE', 'COURSE', 'OF', 'HALF', 'A', 'BILLION', 'YEARS', ',', 'SUDDEN', 'ECTOPLASMS', 'SPEW', 'IN', 'SUCCESSIVE', 'ACTS', 'OVER', 'THE', 'DARKENED', 'THEATRE', 'OF', 'THE', 'PLANET', '.', 'CHARGED', 'SKIES', ',', 'ENLIVENED', 'BY', 'THE', 'IONIC', 'ELECTRICITY', 'OF', 'FLUIDS', 'AND', 'PERIODICALLY', 'LIT', 'WITH', 'PHOTON', 'CUTS', ',', 'STRIKE', 'BLOWS', 'INTO', 'THE', 'GROUND', 'TO', 'BEGIN', 'THE', 'PROCESS', 'OF', 'CHEMICAL', 'EVOLUTION', '.', 'DANCING', 'UNDER', 'IONIC', 'WINDS', 'ELECTRIC', 'STORMS', 'SCRATCH', 'AT', 'THE', 'EARTH', 'AND', 'CHARGED', 'TENDRILS', 'OF', 'MATTER', 'STAND', 'ON', 'THEIR', 'END', '.', 'VULGAR', 'IN', 'ITS', 'BECOMING', ',', 'THE', 'BLUBBER', 'SLOBBERS', 'ON', 'BIOMASS', 'WITH', 'CARBOHYDRATE', 'TEETH', ',', 'DROOLING', 'ENZYMES', 'THAT', 'DIGEST', 'NOTHING', 'BUT', 'ITS', 'OWN', 'BITE', '.', 'ENERGETICALLY', 'INCONTINENT', ',', 'IT', 'ACQUIRES', 'A', 'COLD', 'METABOLISM', 'AND', 'A', 'WATERY', 'HEART', '.', 'EXPANDING', 'AND', 'CONTACTING', ',', 'IT', 'STARTS', 'TO', 'PUMP', 'UNIVERSAL', 'SOLVENT', 'THROUGH', 'ITS', 'LIQUID', 'EYES', ',', 'LENSING', 'ERRANT', 'LIGHT', 'INTO', 'ITS', 'DARK', 'THOUGHTS', '.', 'MINDLESS', ',', 'YET', 'FINELY', 'TUNED', 'TO', 'ITS', 'CONTEXT', ',', 'IT', 'WRIGGLES', 'UPON', 'TIME', '', 'S', 'COMPOST', ',', 'CHEWING', 'AND', 'CHEWING', 'WITH', 'ITS', 'BONELESS', 'JAWS', 'ON', 'NOTHING', 'BUT', 'THE', 'AGENTS', 'OF', 'DEATH', '.', 'IN', 'ITS', 'STRUCTURAL', 'DISOBEDIENCE', ',', 'THE', 'MISSHAPEN', 'MASS', 'STEADILY', 'GROWS', 'MORE', 'ORGANIZED', 'AND', 'RELUCTANT', 'TO', 'SUCCUMB', 'TO', 'DECAY', '.', 'PATTERNING', 'THE', 'AIR', ',', 'ITS', 'FINGERS', 'EXTEND', 'LIKE', 'CLAWS', ',', 'OBSTRUCTING', 'ITS', 'PASSAGE', 'BETWEEN', 'THE', 'POLES', 'OF', 'OBLIVION', '.', 'CARESSING', 'ITSELF', 'IN', 'GRATUITOUS', 'ACTS', 'OF', 'PROCREATION', ',', 'THE', 'DAUB', 'OFFERS', 'CONTEMPT', 'FOR', 'THE', 'FORCES', 'OF', 'DISORDER', ',', 'AND', 'CRAWLS', 'STEADILY', 'TOWARDS', 'BEING', '.', '”']\n"
]
}
],
"source": [
"tokens = nltk.word_tokenize(txt)\n",
"print(tokens)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## NLTK Text object"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"<Text: _MANIFESTO LIQUID LIFE IS AN UNCERTAIN REALM ....>\n"
]
}
],
"source": [
"text = nltk.Text(tokens)\n",
"print(text)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## concordance"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Displaying 25 of 25 matches:\n",
"_MANIFESTO LIQUID LIFE IS AN UNCERTAIN REALM . THE CO\n",
"RCOMPLEXITY AND HYPEROBJECT-NESS OF LIQUID TERRAINS EXCEEDS OUR ABILITY TO OBS\n",
"AS LIVING THINGS ARE BY-PRODUCTS OF LIQUID PROCESSES . LIQUID LIFE IS A WORLDV\n",
"E BY-PRODUCTS OF LIQUID PROCESSES . LIQUID LIFE IS A WORLDVIEW . A PHANTASMAGO\n",
"FORMATION WITHIN PHYSICAL SYSTEMS . LIQUID LIFE IS A KIND OF METABOLIC WEATH\n",
"Y - THAT PERMEATES THE ATMOSPHERE , LIQUID ENVIRONMENTS , SOILS AND EARTH S \n",
"F MATTER THAT DETAIL OUR ( EARTHY , LIQUID , GASEOUS ) TERRAINS . LIQUID LIFE \n",
"THY , LIQUID , GASEOUS ) TERRAINS . LIQUID LIFE IS IMMORTAL . ARISING FROM OUR\n",
"S OF LIFE AND DEATH . MOST DECEASED LIQUID MATTER LIES QUIESCENT , PATIENTLY W\n",
"TENT METABOLISMS WITHIN OUR SOILS . LIQUID LIFE EXCEEDS RHETORIC . ITS CONCEPT\n",
"ENSES AND TECHNIQUES TO INVOLVE THE LIQUID REALM WITH ITS OWN VOICE . FROM\n",
" VOICE . FROM THESE PERSPECTIVES LIQUID TECHNOLOGIES EMERGE THAT ARE CAPABL\n",
" LIKE BÜTSCHLI DROPLETS , WHICH ARE LIQUID CHEMICAL ASSEMBLAGES CAPABLE OF SUR\n",
"EN EVOLVING POLY-VOCAL DIALECTICS . LIQUID LIFE PROVOKES AN EXPANDED NOTION OF\n",
"RDINATING CENTRE , LIKE THE BRAIN . LIQUID ARE NON-BODIES . THEY ARE WITHOUT F\n",
"ARIES AND ARE CONSTANTLY CHANGING . LIQUID BODIES ARE PARADOXICAL STRUCTURES T\n",
"APT , SELF-REPAIR , AND EMPATHIZE . LIQUID BODIES ARE PLURI-PONTENT . THEY ARE\n",
"D UPON GENERALIZATIONS AND IDEALS , LIQUID BODIES RESIST THESE TROPES . LIQUID\n",
"LIQUID BODIES RESIST THESE TROPES . LIQUID BODIES DISCUSS A MODE OF EXISTENCE \n",
"IONS OF MAKING AND BEING EMBODIED . LIQUID BODIES INVITE US TO ARTICULATE THE \n",
" BODY TO ANOTHER . INDEED , PROTEAN LIQUID BODIES HELP US UNDERSTAND THAT WHIL\n",
"HE MATERIALITY OF THE ENVIRONMENT . LIQUID BODIES ARE POLITICAL AGENTS . THEY \n",
"ERMEATED BY THEIR NURTURING MEDIA . LIQUID BODIES INVITE US TO UNDERSTAND OUR \n",
" WE RECOGNISE AS BEING ALIVE. “ LIQUID LIFE ARISES FROM OUT OF A SOUP , SM\n",
" PUMP UNIVERSAL SOLVENT THROUGH ITS LIQUID EYES , LENSING ERRANT LIGHT INTO IT\n"
]
}
],
"source": [
"# This is what you did with Michael before the break ...\n",
"concordance = text.concordance(\"liquid\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## similarities"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"living\n"
]
}
],
"source": [
"# With a small next step ...\n",
"similar = text.similar(\"liquid\")"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"liquid_are liquid_invite participating_creates liquid_resist\n",
"liquid_discuss other_as liquid_help caustic_a\n"
]
}
],
"source": [
"# And searching for contexts ...\n",
"contexts = text.common_contexts([\"bodies\"])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"----------------"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Read on"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"https://www.nltk.org/book/ch01.html#searching-text (recommended!)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}