i want to print a vector (148K length) in python (Jupyter). but only 8-10 characters of it showed. like this: [0 0 0 ... 0 0 0] i want to see the result fully.
import re
import nltk
import numpy
import pandas
from nltk.corpus import stopwords
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
vocab=numpy.array(pandas.read_excel('E:\\for_bow.xlsx'))
def word_extraction(sentence):
ignore = set(stopwords.words('english'))
words = re.sub("[^\w]", " ", sentence).split()
cleaned_text = [w.lower() for w in words
if w not in ignore]
return cleaned_text
def generate_bow(allsentences):
for sentence in allsentences:
words = word_extraction(sentence)
bag_vector = numpy.zeros(len(vocab),int)
for w in words:
for i,word in enumerate(vocab):
if word == w:
bag_vector[i] += 1
print("{0}\n{1}\n".format(sentence,numpy.array(bag_vector)))
input_text=["text1", "text2", "text3"]
generate_bow(input_text)
i read in another post here that i should use this code:
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
i tried this, but didn't work.