From e8be27b82517bf90d0456dd03686b033df02021f Mon Sep 17 00:00:00 2001 From: igagansingh Date: Mon, 20 Mar 2017 01:01:57 +0530 Subject: [PATCH] Code Ported to Python2 --- notebooks/textbrew-examples.ipynb | 43 ++++++++++++++++++++---------- textbrew/__init__.pyc | Bin 0 -> 110 bytes textbrew/format.py | 27 ++++++++++--------- textbrew/regex/__init__.py | 2 ++ textbrew/regex/studio.py | 31 ++++++++++----------- textbrew/regex/transforms.py | 4 ++- textbrew/regex/utils.py | 8 ++---- 7 files changed, 66 insertions(+), 49 deletions(-) create mode 100644 textbrew/__init__.pyc diff --git a/notebooks/textbrew-examples.ipynb b/notebooks/textbrew-examples.ipynb index 79b1148..4cf69f2 100644 --- a/notebooks/textbrew-examples.ipynb +++ b/notebooks/textbrew-examples.ipynb @@ -2,7 +2,21 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, + "metadata": { + "collapsed": true, + "deletable": true, + "editable": true + }, + "outputs": [], + "source": [ + "import sys\n", + "sys.path.insert(0, '../')" + ] + }, + { + "cell_type": "code", + "execution_count": 36, "metadata": { "collapsed": false, "deletable": true, @@ -11,12 +25,13 @@ "outputs": [], "source": [ "from textbrew.format import Format\n", - "from textbrew.regex import RegexStudio , transforms" + "from textbrew.regex import transforms\n", + "from textbrew.regex.studio import RegexStudio\n" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 37, "metadata": { "collapsed": true, "deletable": true, @@ -30,7 +45,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 38, "metadata": { "collapsed": false, "deletable": true, @@ -43,7 +58,7 @@ "'@microsoft Bill Gates is the richest man on Wall Street 09, who also does most charity (or so he claims)!'" ] }, - "execution_count": 4, + "execution_count": 38, "metadata": {}, "output_type": "execute_result" } @@ -57,7 +72,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 43, "metadata": { "collapsed": false, "deletable": true, @@ -67,10 +82,10 @@ { "data": { "text/plain": [ - "'@microsoft bill_gates is the|richest|man on wall_street 09 , who also does most|charity ( or so he claims ) ! '" + "u'@microsoft bill_gates is the|richest|man on wall_street 09 , who also does most|charity ( or so he claims ) ! '" ] }, - "execution_count": 5, + "execution_count": 43, "metadata": {}, "output_type": "execute_result" } @@ -78,7 +93,7 @@ "source": [ "# Create compund nouns out out of text(probable applications - Training Compound Word Vectors)\n", "formatter = Format()\n", - "formatter.compound_nouns(cleaned_text)" + "formatter.compound_nouns(unicode(cleaned_text))" ] }, { @@ -93,21 +108,21 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 2", "language": "python", - "name": "python3" + "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", - "version": 3 + "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.5.2+" + "pygments_lexer": "ipython2", + "version": "2.7.12" } }, "nbformat": 4, diff --git a/textbrew/__init__.pyc b/textbrew/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fa738c2ae733bc28eea7576633d1739415dbe681 GIT binary patch literal 110 zcmZSn%*%Cb#<_@O1}I95b>FMd0q*jz96{VKz h$H!;pWtPOp>lIX%Z~*0Oa`RJ4b5iX