Giter VIP home page Giter VIP logo

text-cluster's People

Contributors

shayneobrien avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

text-cluster's Issues

OnlineCluster StopIteration error

streamer = StreamData(filename='../data/talk_radio.csv', chunk=500, use_column='sentences')
init_text = streamer._init_data(10)
online = OnlineCluster(text=list(init_text.processed), method='kmeans', n_clusters=10)
num_batches = 25
for _ in tqdm(range(num_batches)):
    new_text = streamer()
    labels = online.predict(list(new_text.processed))

I run this code but I got the below error

StopIteration                             Traceback (most recent call last)
<ipython-input-91-064fb5ae967b> in <module>
     22 
     23     # Get new batch
---> 24     new_text = streamer()
     25 
     26     # Predict

~/Desktop/text-cluster-master/src/modules.py in __call__(self)
     25     def __call__(self):
     26         """ Get a batch from the generator """
---> 27         return self._process(self.stream())
     28 
     29     def stream(self):

~/Desktop/text-cluster-master/src/modules.py in stream(self)
     29     def stream(self):
     30         """ Iterate generator """
---> 31         return next(self.generator)
     32 
     33     def _init_data(self, num_chunks):

~/.local/lib/python3.8/site-packages/pandas/io/parsers.py in __next__(self)
   1027     def __next__(self):
   1028         try:
-> 1029             return self.get_chunk()
   1030         except StopIteration:
   1031             self.close()

~/.local/lib/python3.8/site-packages/pandas/io/parsers.py in get_chunk(self, size)
   1077                 raise StopIteration
   1078             size = min(size, self.nrows - self._currow)
-> 1079         return self.read(nrows=size)
   1080 
   1081     def __enter__(self):

~/.local/lib/python3.8/site-packages/pandas/io/parsers.py in read(self, nrows)
   1050     def read(self, nrows=None):
   1051         nrows = validate_integer("nrows", nrows)
-> 1052         index, columns, col_dict = self._engine.read(nrows)
   1053 
   1054         if index is None:

~/.local/lib/python3.8/site-packages/pandas/io/parsers.py in read(self, nrows)
   2054     def read(self, nrows=None):
   2055         try:
-> 2056             data = self._reader.read(nrows)
   2057         except StopIteration:
   2058             if self._first_chunk:

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader.read()

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._read_low_memory()

StopIteration: 

Untitled (1)

Please help me !!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.