These are chat archives for ipython/ipython

26th
Jul 2016
Chris Christodoulou
@chr7stos
Jul 26 2016 08:14
Hi, I want to inspect a class in an ipython notebook.
I am running the following in this case:
from nltk.stem import PorterStemmer
inspect.getsourcelines(PorterStemmer)
but the format of the text I get is not nice to read:
(['class PorterStemmer(StemmerI):\n', '\n', ' ## --NLTK--\n', ' ## Add a module docstring\n', ' """\n', ' A word stemmer based on the Porter stemming algorithm.\n', '\n', ' Porter, M. \\"An algorithm for suffix stripping.\\"\n', ' Program 14.3 (1980): 130-137.\n',
Do you know a way to fix the formatting? Thanks!
Min RK
@minrk
Jul 26 2016 09:18
IPython provides its own tools for calling this sort of thing, so you can do PorterStemmer? to get summary info, or PorterStemmer?? to see the source.
Chris Christodoulou
@chr7stos
Jul 26 2016 09:37
thanks @minrk , it works PorterStemmer??shows the source