8000 Parenthesis at the end of input cause IndexError · Issue #19 · fnl/syntok · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Parenthesis at the end of input cause IndexError #19
Closed
@windreamer

Description

@windreamer

Hi folks,
I like this cool segmenter for quality and speed, but something is a bit weird.

from syntok.segmenter import analyze
text='''Alexandri Aetoli Testimonia et Fragmenta. Studi e Testi 15. (1999)'''

for p in analyze(text):
    for s in p:
        print(' '.join(str(t) for t in s))

I got:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-15-1217f364130d> in <module>
      1 for p in analyze(text):
----> 2     for s in p:
      3         print(' '.join(str(t) for t in s))
      4

~/Codebase/toolchain/__pypackages__/3.9/lib/syntok/segmenter.py in segment(tokens, bracket_skip_len)
    106         State.max_bracket_skipping_length = int(bracket_skip_len)
    107
--> 108     for state in Begin(tokens):
    109         if state.at_sentence:
    110             history = state.collect_history()

~/Codebase/toolchain/__pypackages__/3.9/lib/syntok/_segmentation_states.py in __iter__(self)
    128         while state is not None:
    129             yield state
--> 130             state = next(state, None)
    131
    132     @abstractmethod

~/Codebase/toolchain/__pypackages__/3.9/lib/syntok/_segmentation_states.py in __next__(self)
    468                 return Terminal(self._stream, self._queue, self._history)
    469
--> 470             self._move()  # Do not skip parenthesis if they open the sentence.
    471
    472             if self.next_is_a_terminal:

~/Codebase/toolchain/__pypackages__/3.9/lib/syntok/_segmentation_states.py in _move(self)
    324     def _move(self) -> bool:
    325         """Advance the queue, storing the old value in history."""
--> 326         self.__history.append(self.__queue.pop(0))
    327
    328         if not self.__queue:

IndexError: pop from empty list

Is there any one can help me on it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0