150 likes | 161 Vues
Natural Language Processing (NLP). Lecture No 2. Institute of Southern Punjab Multan Department of Computer Science. Language Processing. Level 1 – Speech sound (Phonetics & Phonology) Level 2 – Words & their forms (Morphology, Lexicon) Level 3 – Structure of sentences (Syntax, Parsing)
E N D
Natural Language Processing (NLP) Lecture No 2 Institute of Southern Punjab Multan Department of Computer Science
Language Processing • Level 1 – Speech sound (Phonetics & Phonology) • Level 2 – Words & their forms (Morphology, Lexicon) • Level 3 – Structure of sentences (Syntax, Parsing) • Level 4 – Meaning of sentences (Semantics) • Level 5 – Meaning in context & for a purpose (Pragmatics) • Level 6 – Connected sentence processing in a larger body of text (Discourse)
Levels of Text Processing • Word Level • Words Properties • Stop-Words • Stemming • Frequent N-Grams • Thesaurus (WordNet) • Sentence Level • Document Level • Document-Collection Level • Linked-Document-Collection Level • Application Level
Phonetic/Phonological Analysis OCR/Tokenization Morphological and lexical analysis Syntactic analysis Semantic Interpretation Discourse Processing Language Processing Pipeline speech text POS tagging WSD Shallow parsing Deep Parsing Anaphora resolution Integration
Some Building Blocks 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 TreeBank Tokenizer
Natural Language ToolKit (NLTK) & Python
Python Programming language is Python 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 Easy-to-learn scripting language Similar in many aspects to Perl Object-oriented, with modules, classes, exceptions, high level dynamic data types Similar to Java Strongly typed, but without type declarations (dynamic typing) Regular Expressions and other string processing features
Natural Language Toolkit (NLTK) • NL ToolKit provides libraries of many of the common NLP processes at various language levels • A suite of Python libraries for symbolic and statistical natural language programming • 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 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 WordNet 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. cluster: clustering algorithms draw: visualize NLP structures and processes 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)
Research TaskSearch and Download Papers RegardingText Classificationand readAbstract , Introduction, Literature Reviewto IdentifyProblem Statement, Proposed Solutionand Pre-Processing Steps used.