Thursday 23 June 2016

Natural Language Processing - learning NLTK from the NLTK book....

Psst: this article is going to grow, and reflect the topics I'm learning, as I'm learning them. So please keep referring back for new content! Constructive comments are also welcome!


NLTK resources


the book



Some important NLTK modules include the following:


coming soon!



The beginning of a list of NLP problems:


coming soon!




WHAT I LEARNED TODAY...



17/6/2016



#1 Bring back a list of occurrences of a keyword, including context - i.e. the rest of the text around it.

Just enter something like the following:


>>> text3.concordance("lived")


#2 Bring back a list of words which occur in a similar context to one another. For example


>>> text1.similar("monstrous") will bring back all words with a similar context to that of the key word "monstrous". Context is defined as words on either side of __keyword__.


#3 Bring back common contexts for two or more words. By 'contexts', we just mean the words on either side of a particular word we're interested in. See #2. So if we wanted to find out which contexts 'tea' and some other word have in common, we would first test for words with similar contexts:


>>> text2.similar("tea")

which brings back the following results:


all herself edward me them him last first family marianne her himselfcompany present same affair modesty coach gold show

Then we'd pick say, "modesty"


>>> text2.common_contexts(["tea","modesty"])



which brings back just the one result:


the_and


#4 We can determine the location of a word in the text

#5 So what is a "lexical dispersion plot"? You can display positional information using a dispersion plot.


>>> text4.dispersion_plot(["citizens","democracy","freedom",
"duties","America"])


does not work, so I had a look on stackoverflow and found this answer: dispersion_plot not working inspite of installing matplotlib. Then I entered:


>>> from nltk.draw.dispersion import dispersion_plot

>>> text4.dispersion_plot(text1, ['monstrous'])



We have a problem, alas. Can't seem to see the plot!

Friday 17 June 2016

Making Up For Lost Time

Or... the day in the life of a Freelance Software Engineer...

17/6/2016 

It has been such a long while since I added to this blog, I thought, since I'm somewhat rusty, I'd set aside a page to use as a "rough book". (Did you have to use rough books at school too?) This could be thought of as a non-linear approach to writing an index to articles I will write, and a diary of article entries as and when I think of them.

#1 Achieving the Linux/Ubuntu dual boot on an Acer laptop, or... what you'll need to learn in order to get back data from a lost windows 10 operating system, gobbled up by Ubuntu...

#2 Three years coding and working in data

#3 Navigating the Open Source Community on GitHub, and how to contribute