{"cells":[{"metadata":{"_uuid":"14296a16bbcd884f844bce770fe7d724ed3aea3c"},"cell_type":"markdown","source":"# NFL Rules Wordcloud"},{"metadata":{"trusted":true,"_uuid":"d8895e5b6eb253f253c2aa9ccdf5bc0b6506ff19"},"cell_type":"code","source":"from wordcloud import WordCloud\nfrom PIL import Image\nimport numpy as np\nimport matplotlib.pyplot as plt","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"1d0986277b399a3aabecc030fe6e4b73035950b1"},"cell_type":"code","source":"egg_mask = np.array(Image.open('../input/externalnfl/egg.png'))\npunter_mask = np.array(Image.open('../input/externalnfl/punter.png'))\nwith open('../input/externalnfl/rules_nlp.txt', 'r') as txt:\n    rules = ' '.join([line for line in txt]).title()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"4f53cf799ca1832a929c5415619536f14656d551","scrolled":true},"cell_type":"code","source":"wc = WordCloud(background_color='white', max_words=2000, mask=egg_mask)\nwc.generate(rules)\nwc.to_file('ball_rule_word_cloud.png')\nwc.to_image()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"5bcc85c21965548fd35c8f3fa6a1a02b80c94262"},"cell_type":"code","source":"wc = WordCloud(background_color='white', max_words=2000, mask=punter_mask)\nwc.generate(rules)\nwc.to_file('punter_rule_word_cloud.png')\nwc.to_image()","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.6.6","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":1}