Natural Language Processing NLP Institute of Southern Punjab
Natural Language Processing (NLP) Institute of Southern Punjab Multan Department of Computer Science
(Phonetics & Phonology) (Morphology, Lexicon) (Syntax, Parsing) (Semantics) (Pragmatics) (Discourse)
• • • Words Properties Stop-Words Stemming Frequent N-Grams Thesaurus (Word. Net)
speech text Phonetic/Phonological Analysis OCR/Tokenization Morphological and lexical analysis Shallow parsing POS tagging WSD Syntactic analysis Deep Parsing Semantic Interpretation Anaphora resolution Discourse Processing Integration
Source Language Analysis Target Language Generation Text Normalization Text Rendering Morphological Analysis Morphological Synthesis POS Tagging Phrase Generation Parsing Role Ordering Semantic Analysis Lexical Choice Discourse Analysis Discourse Planning
Stages in a Comprehensive NLP System • • Tokenization Morphological Analysis Syntactic Analysis Semantic Analysis (lexical and compositional) Pragmatics and Discourse Analysis Knowledge-Based Reasoning Text generation
Tokenization-Overview Tokenization is the process of breaking up the given text into units called tokens. • The tokens may be words or number or punctuation mark. • Tokenization does this task by locating word boundaries. Ending point of a word and beginning of the next word is called word boundaries. • Tokenization is also known as word segmentation.
Tokenizer A tokenizer that divides a string into substrings by splitting on the specified string. • • • Whitespace Tokenizer Whitespace And Punctuation Tokenizer Classifier Based Tokenizer Regex Tokenizer Penn Tree. Bank Tokenizer
Natural Language Tool. Kit (NLTK) & Python
Python 1. Programming language is Python 2. Python is freely available for many platforms from the Python Software Foundation: – http: //www. python. org/ – Named for the group Monty Python Characteristics of Python 1. Easy-to-learn scripting language 2. Similar in many aspects to Perl 3. Object-oriented, with modules, classes, exceptions, high level dynamic data types 4. Similar to Java 5. Strongly typed, but without type declarations (dynamic typing) 6. Regular Expressions and other string processing features
Natural Language Toolkit (NLTK) 1. NL Tool. Kit provides libraries of many of the common NLP processes at various language levels 2. A suite of Python libraries for symbolic and statistical natural language programming 3. Developed at the University of Pennsylvania - http: //www. nltk. org NLTK provides: - • Basic classes for representing data relevant to Natural Language Processing. • Standard interfaces for performing NLP tasks such as tokenization, tagging and parsing • Standard implementation of each task which can be combined to solve complex problems
NLTK Modules 1. 2. 3. 4. 5. 6. 7. 8. 9. corpora: a package containing modules of example text tokenize: functions to separate text strings probability: for modeling frequency distributions and probabilistic systems stem – package of functions to stem words of text wordnet – interface to the Word. Net lexical resource chunk – identify short non-nested phrases in text etree: for hierarchical structure over text tag: tagging each word with part-of-speech, sense, etc. parse: building trees over text - recursive descent, shift-reduce, probabilistic, etc. 10. cluster: clustering algorithms 11. draw: visualize NLP structures and processes 12. contrib: various pieces of software from outside contributors
Lab Session / Pracical Activity 1 - Python and NLTK Download and Installation 2 - Tokenization Demo in Python (Word Level Tokenization)
Text Classification and read Problem Statement, Proposed Solution Pre-Processing Steps used.
- Slides: 15