|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": 1, |
| 6 | + "metadata": {}, |
| 7 | + "outputs": [ |
| 8 | + { |
| 9 | + "name": "stdout", |
| 10 | + "output_type": "stream", |
| 11 | + "text": [ |
| 12 | + "MD: modal auxiliary\n", |
| 13 | + " can cannot could couldn't dare may might must need ought shall should\n", |
| 14 | + " shouldn't will would\n" |
| 15 | + ] |
| 16 | + } |
| 17 | + ], |
| 18 | + "source": [ |
| 19 | + "import nltk\n", |
| 20 | + "nltk.help.upenn_tagset('MD')" |
| 21 | + ] |
| 22 | + }, |
| 23 | + { |
| 24 | + "cell_type": "code", |
| 25 | + "execution_count": 2, |
| 26 | + "metadata": {}, |
| 27 | + "outputs": [ |
| 28 | + { |
| 29 | + "data": { |
| 30 | + "text/plain": [ |
| 31 | + "[('Children', 'NNP'),\n", |
| 32 | + " (\"should't\", 'VBZ'),\n", |
| 33 | + " ('drink', 'VB'),\n", |
| 34 | + " ('a', 'DT'),\n", |
| 35 | + " ('sugary', 'JJ'),\n", |
| 36 | + " ('drink', 'NN'),\n", |
| 37 | + " ('before', 'IN'),\n", |
| 38 | + " ('bed', 'NN'),\n", |
| 39 | + " ('.', '.')]" |
| 40 | + ] |
| 41 | + }, |
| 42 | + "execution_count": 2, |
| 43 | + "metadata": {}, |
| 44 | + "output_type": "execute_result" |
| 45 | + } |
| 46 | + ], |
| 47 | + "source": [ |
| 48 | + "# POS tagging with NLTK\n", |
| 49 | + "text11 = \"Children should't drink a sugary drink before bed.\"\n", |
| 50 | + "text13 = nltk.word_tokenize(text11)\n", |
| 51 | + "nltk.pos_tag(text13)" |
| 52 | + ] |
| 53 | + }, |
| 54 | + { |
| 55 | + "cell_type": "code", |
| 56 | + "execution_count": null, |
| 57 | + "metadata": { |
| 58 | + "collapsed": true |
| 59 | + }, |
| 60 | + "outputs": [], |
| 61 | + "source": [] |
| 62 | + } |
| 63 | + ], |
| 64 | + "metadata": { |
| 65 | + "kernelspec": { |
| 66 | + "display_name": "Python 3", |
| 67 | + "language": "python", |
| 68 | + "name": "python3" |
| 69 | + }, |
| 70 | + "language_info": { |
| 71 | + "codemirror_mode": { |
| 72 | + "name": "ipython", |
| 73 | + "version": 3 |
| 74 | + }, |
| 75 | + "file_extension": ".py", |
| 76 | + "mimetype": "text/x-python", |
| 77 | + "name": "python", |
| 78 | + "nbconvert_exporter": "python", |
| 79 | + "pygments_lexer": "ipython3", |
| 80 | + "version": "3.6.1" |
| 81 | + } |
| 82 | + }, |
| 83 | + "nbformat": 4, |
| 84 | + "nbformat_minor": 2 |
| 85 | +} |
0 commit comments