background preloader

Language

Facebook Twitter

Linguistics. Linguistics Description With the Nodebox English Linguistics library you can do grammar inflection and semantic operations on English content.

Linguistics

You can use the library to conjugate verbs, pluralize nouns, write out numbers, find dictionary descriptions and synonyms for words, summarise texts and parse grammatical structure from sentences. The library bundles WordNet (using Oliver Steele's PyWordNet ), NLTK , Damian Conway's pluralisation rules , Bermi Ferrer's singularization rules , Jason Wiener's Brill tagger , several algorithms adopted from Michael Granger's Ruby Linguistics module, John Wiseman's implementation of the Regressive Imagery Dictionary , Charles K. Ogden's list of basic English words, and Peter Norvig's spelling corrector .

Download Documentation How to get the library up and running Put the en library folder in the same folder as your script so NodeBox can find the library. Import en Categorise words as nouns, verbs, numbers and more. Java - automatically extract text from pdf for many files. Python - text extraction project - best tool for extracting only specific rows / items out of a PDF.

NLTK

ConceptNet. Spelling - Python: check whether a word is spelled correctly. Api - how to implement python spell checker using google's "did you mean?" Www.lrec-conf.org/proceedings/lrec2012/pdf/1072_Paper.pdf. Python - How to determine semantic hierarchies / relations in using NLTK. Www.eecis.udel.edu/~trnka/CISC889-11S/lectures/greenbacker-WordNet-Similarity.pdf. Tutorial: Sentence similarity — Commonsense Computing 2012-03-13 documentation. A straightforward way to use Divisi and ConceptNet together is to determine the similarity between two sentences, based on the concepts they contain.

Tutorial: Sentence similarity — Commonsense Computing 2012-03-13 documentation

Here’s how we will do this: Use ConceptNet extract the concepts from the sentences. Convert them to vectors in AnalogySpace. Add the vectors to get a vector for the whole sentence. Normalize both vectors. A whirlwind tour: Best way to strip punctuation from a string in Python. Corpus Readers. The nltk.corpus package defines a collection of corpus reader classes, which can be used to access the contents of a diverse set of corpora.

Corpus Readers

The list of available corpora is given at: Each corpus reader class is specialized to handle a specific corpus format. In addition, the nltk.corpus package automatically creates a set of corpus reader instances that can be used to access the corpora in the NLTK data package. Section 1 ("Corpus Reader Objects") describes the corpus reader instances that can be used to read the corpora in the NLTK data package.

Section 2 ("Corpus Reader Classes") describes the corpus reader classes themselves, and discusses the issues involved in creating new corpus reader objects and new corpus reader classes. Python - To find synonyms, defintions and example sentences using WordNet. Just Enough NLP with Python. How this was made This document was created using Docutils/reStructuredText and S5.

Just Enough NLP with Python

It is the introductory NLP course given by Parsely, Inc. to the newest generation of Python hackers. Simplicity begets elegance. What do we do? Good Python modules for fuzzy string comparison. Calculating similarity between text strings in Python. Introduction Calculating similarity between two texts can be done by comparing each word of one text to each word of second text but if we had two very long texts this way could be very time consuming.

Calculating similarity between text strings in Python

Better way is that we will work with hashes instead of whole texts so we need to use hash function which is returning similar hashes for two similar texts. Example of such a function is Charikar’s hash (simhash). Calculation is performed in these steps: text is splitted into words (tokens) for each word is generated hash with common hash function weights are associated with words vector v of desired length is initialized to 0 in a cycle throught all word’s hashes, vector v is updated if the i th bit of the words’s hash is 0 i th component of vector is decreased by word’s weight, otherwise i th component of vector is increased by word’s weight signs of components of v indicates bits of the final hash Implementation.

Algorithm - String similarity metrics in Python. Www.cs.ucf.edu/courses/cap5636/fall2011/nltk.pdf. How to Write a Spelling Corrector. Python - PyEnchant without German dictionary. Python.6.x6.nabble.com/attachment/2743017/0/Python%252520Text%252520Processing%252520with%252520NLTK%2525202.0%252520Cookbook.pdf. Language detection using character trigrams. For some reason I am on the W3C's www-international mailing list, where I read this message: mentioning that people use n-grams to guess languages.

Language detection using character trigrams

That is to say, you look at the micro-structure of a block of text, and count how many times sequences of length n occur. If you count pairs it is called a 2-gram (or bigram), and so with any value of n. I have used a 3-gram, or trigram. I combined this with a vector search as described by Maciej Ceglowski in his famous O'Reilly article: It would be quicker, simpler, and more memory efficient to use a bigram, for perhaps no worse results. On the other hand, converting everything to unicode would make it slower and more complicated (because you have to be sure of the source material encoding), but would of course be more useful.

The greatest improvement is probably to be found in integrating ad-hoc short-cuts (akin to search engine stopwords), or hybridising with other techniques. Related links: Language detection in python. Detecting Language with Python and the Natural Language Toolkit (NLTK) Whether you want to catalog your mined public tweets or offer suggestions to user’s language preferences, Python can help detect a given language with a little bit of hackery around the Natural Language Toolkit (NLTK).

Detecting Language with Python and the Natural Language Toolkit (NLTK)

Let’s get going by first installing NLTK and downloading some language data to make it useful. Just a note here, the NLTK is an incredible suite of tools that can act as your swiss army knife for almost all natural language processing jobs you might have–we are just scratching the surface here.