Term frequency using scikit-learn's CountVectorizer

2016-10-16 Thread Abdul Abdul
I have the following code snippet where I'm trying to list the term frequencies, where first_text and second_text are .tex documents: from sklearn.feature_extraction.text import CountVectorizer training_documents = (first_text, second_text) vectorizer = CountVectorizer() vectorizer.fit_transfor

Term frequency using scikit-learn's CountVectorizer

2016-10-16 Thread Abdul Abdul
Hello, I have the following code snippet where I'm trying to list the term frequencies, where first_textand second_text are .tex documents: from sklearn.feature_extraction.text import CountVectorizer training_documents = (first_text, second_text) vectorizer = CountVectorizer() vectorizer.fit_tran

Error when trying to open an image

2014-11-16 Thread Abdul Abdul
Hello, I'm trying to open an image using the `Python Imaging Library` as follows: from PIL import Image img = Image.open('xyz.jpg') But, got the following error: File "C:/Users/abc/PycharmProjects/untitled/open_image.py", line 2, in from PIL import Image File "C:\Python34\lib\site-packag

How modules work in Python

2014-11-16 Thread Abdul Abdul
Hello, I'm new to Python, and just have a small question, and thought you might have an idea on it. I came across the following example that uses the Python Imaging Library (PIL): from PIL import Image img = Image.open('xyz.jpg') I know that PIL is a module. And, I think that Image is also a mo

How to fix those errors?

2014-11-16 Thread Abdul Abdul
Hello, I'm walking through an example that goes as follows: from PIL import Image import os for inputfile in filelist outputfile = os.path.splitext(inputfile)[0]+".jpg" if inputfile != outputfile: try: Image.open(inputfile).save(outputfile) except IOEr

What does this line of code mean?

2014-11-16 Thread Abdul Abdul
I just came across the following line of code: outputfile = os.path.splitext(infile)[0] + ".jpg" Can you kindly explain to me what those parts mean? Thanks. -- https://mail.python.org/mailman/listinfo/python-list

import os

2014-11-16 Thread Abdul Abdul
I tried to refer to Python documentation for what "os" refers to, but, the explanation was not clear. When we write something like: import os What do we mean here? What is the purpose of such import? Thanks. -- https://mail.python.org/mailman/listinfo/python-list

Re: How modules work in Python

2014-11-16 Thread Abdul Abdul
on has some naming conventions here? Thanks. On Sun, Nov 16, 2014 at 11:39 PM, Dave Angel wrote: > Abdul Abdul Wrote in message: > > Hello, > > > > I'm new to Python, and just have a small question, and thought you might > have an idea on it. > > You should st

Re: Error when trying to open an image

2014-11-16 Thread Abdul Abdul
Thanks for your kind reply. Yes, it seemed it worked with an older version than 3.x I got the following output: Process finished with exit code 0 So, what is the purpose of open() here? Thanks. On Mon, Nov 17, 2014 at 12:31 AM, Terry Reedy wrote: > On 11/16/2014 2:37 PM, Abdul Abdul wr

Re: import os

2014-11-16 Thread Abdul Abdul
at 8:56 AM, Abdul Abdul wrote: > > I tried to refer to Python documentation for what "os" refers to, but, > the > > explanation was not clear. > > If it's something you import, what you want is the module of that > name. Searching the web for 'python os

from pylab import *

2014-11-16 Thread Abdul Abdul
I came across an example that uses "Matplotlib". It used the following import to use that module: from pylab import * When I tried to run the example, I got the following error: C:\Python27\python.exe C:/Users/abc/PycharmProjects/ComputerVision/plot_image.py Traceback (most recent call last):

scipy shape

2014-11-18 Thread Abdul Abdul
I came across an example that starts as follows: from scipy.ndimage import filters img = zeros(im.shape) What does the second line mean here? Is it setting the image pixels to zero? What is "shape" here? Thanks. -- https://mail.python.org/mailman/listinfo/python-list

"**" in python

2014-11-23 Thread Abdul Abdul
Hello, I came across an example that showed the following: Wxy**2 What do ** mean here? Thanks. -- https://mail.python.org/mailman/listinfo/python-list

Syntax error

2015-01-10 Thread Abdul Abdul
Hello, I have the following program that employs the dcm2jpg.exe software: import os os.system(“dcm2jpg.exe IM-0004-0004.dcm”) exit When I tried to run it, I got the following error: SyntaxError: Non-ASCII character '\xe2' in file dicomjpg.py on line 2, but no en coding declared; see http://pyt

DICOM to jpg

2015-01-11 Thread Abdul Abdul
Hello, Is there a way to convert a DICOM file to an image using Python? Thanks. -- https://mail.python.org/mailman/listinfo/python-list

Stripping in Python

2015-01-15 Thread Abdul Abdul
Hello, I have a program where I read a line input from the keyboard. If I remove this portion of code after reading the line, I get an error: line = line.rstrip() Why is that? Should stripping be always be used after reading an input in Python? Thanks. -- https://mail.python.org/mailman/listi

Opening the file in writing mode

2015-01-15 Thread Abdul Abdul
Hello, In the Python documentation, when opening the file in write mode, it mentions the following: *writing (truncating the file if it already exists)* What is meant by "truncating" here? Is it simply overwriting the file already existing? Thanks. -- https://mail.python.org/mailman/listinfo/py

Re: Opening the file in writing mode

2015-01-15 Thread Abdul Abdul
append' mode. > > Cheers, > Adnan > On Jan 15, 2015 12:08 PM, "Abdul Abdul" wrote: > >> Hello, >> >> In the Python documentation, when opening the file in write mode, it >> mentions the following: >> >> *writing (truncating the file if it

Python question

2017-03-24 Thread Abdul Abdul
Hello, I hope you are doing fine. I have added a question on StackOverflow and thought you might have an idea on it. This is the question . Thanks a lot for your kind support. Best, Abder --

Re: Python question

2017-03-25 Thread Abdul Abdul
(pickled) file looks like [label, filename, data]: [array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), array(['1.jpg', '10.jpg', '2.jpg', '3.jpg', '4.jpg', '5.jpg', '6.jpg', '7.jpg', '8.jpg', '9.jpg'],