Format: application/octet-stream
1 {
2 "nbformat": 4,
3 "nbformat_minor": 0,
4 "metadata": {
5 "colab": {
6 "name": "Course 3 - Week 1 - Lesson 1.ipynb",
7 "provenance": [],
8 "collapsed_sections": [],
9 "toc_visible": true
10 },
11 "kernelspec": {
12 "display_name": "Python 3",
13 "name": "python3"
14 }
15 },
16 "cells": [
17 {
18 "cell_type": "code",
19 "metadata": {
20 "id": "zX4Kg8DUTKWO"
21 },
22 "source": [
23 "#@title Licensed under the Apache License, Version 2.0 (the \"License\");\n",
24 "# you may not use this file except in compliance with the License.\n",
25 "# You may obtain a copy of the License at\n",
26 "#\n",
27 "# https://www.apache.org/licenses/LICENSE-2.0\n",
28 "#\n",
29 "# Unless required by applicable law or agreed to in writing, software\n",
30 "# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
31 "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
32 "# See the License for the specific language governing permissions and\n",
33 "# limitations under the License."
34 ],
35 "execution_count": null,
36 "outputs": []
37 },
38 {
39 "cell_type": "markdown",
40 "metadata": {
41 "id": "view-in-github"
42 },
43 "source": [
44 "<a href=\"https://colab.research.google.com/github/lmoroney/dlaicourse/blob/master/TensorFlow%20In%20Practice/Course%203%20-%20NLP/Course%203%20-%20Week%201%20-%20Lesson%201.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
45 ]
46 },
47 {
48 "cell_type": "markdown",
49 "metadata": {
50 "id": "rX8mhOLljYeM"
51 },
52 "source": [
53 "##### Copyright 2019 The TensorFlow Authors."
54 ]
55 },
56 {
57 "cell_type": "code",
58 "metadata": {
59 "cellView": "form",
60 "id": "BZSlp3DAjdYf"
61 },
62 "source": [
63 "#@title Licensed under the Apache License, Version 2.0 (the \"License\");\n",
64 "# you may not use this file except in compliance with the License.\n",
65 "# You may obtain a copy of the License at\n",
66 "#\n",
67 "# https://www.apache.org/licenses/LICENSE-2.0\n",
68 "#\n",
69 "# Unless required by applicable law or agreed to in writing, software\n",
70 "# distributed under the License is distributed on an \"AS IS\" BASIS,\n",
71 "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n",
72 "# See the License for the specific language governing permissions and\n",
73 "# limitations under the License."
74 ],
75 "execution_count": null,
76 "outputs": []
77 },
78 {
79 "cell_type": "code",
80 "metadata": {
81 "id": "zaCMcjMQifQc"
82 },
83 "source": [
84 "from tensorflow.keras.preprocessing.text import Tokenizer\n",
85 "\n",
86 "sentences = [\n",
87 " 'i love my dog',\n",
88 " 'I, love my cat',\n",
89 " 'You love my dog!'\n",
90 "]\n",
91 "\n",
92 "tokenizer = Tokenizer(num_words = 100)\n",
93 "tokenizer.fit_on_texts(sentences)\n",
94 "word_index = tokenizer.word_index\n",
95 "print(word_index)"
96 ],
97 "execution_count": null,
98 "outputs": []
99 }
100 ]
101 }