microsoft / IRNet

An algorithm for cross-domain NL2SQL
MIT License
264 stars 81 forks source link

RuntimeError: generator raised StopIteration #29

Closed anshudaur closed 4 years ago

anshudaur commented 4 years ago

Hi, I am getting the below error during testing :

Sketch Acc: 0.777237, Acc: 0.499027 Traceback (most recent call last): File "C:\Users..\Anaconda3\lib\site-packages\pattern\text__init__.py", line 609, in _read raise StopIteration StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "sem2SQL.py", line 671, in alter_not_in(datas, schemas=schemas) File "..\IRNET microsoft\src\rule\sem_utils.py", line 137, in alter_not_in h_table = find_table(cur_table, origin_table_names, question_arg_type, question_arg) File "..\IRNET microsoft\src\rule\sem_utils.py", line 105, in find_table if partial_match(question_arg[i], table_name) is True and t_id != h_table: File "..\IRNET microsoft\src\rule\sem_utils.py", line 33, in partial_match query = [lemma(x) for x in query] File "..\IRNET microsoft\src\rule\sem_utils.py", line 33, in query = [lemma(x) for x in query] File "C:\Users..\Anaconda3\lib\site-packages\pattern\text__init.py", line 2172, in lemma self.load() File "C:\Users..\Anaconda3\lib\site-packages\pattern\text\init__.py", line 2127, in load for v in _read(self._path): RuntimeError: generator raised StopIteration

How can we fix this error ?

Thanks

shubhamk16 commented 4 years ago

Hey @anshudaur, this is because your system can't find path for the library pattern, try to reinstall it or this will look funny but add try: lemma= lemma( ) except: lemma= lemma( ) at start of sem_utills.py

anshudaur commented 4 years ago

Hi @shubhamk16 ,

Thanks for your suggestion . I tried reinstalling, it didn't work for me. And for above mentioned snippet : do i need to pass any parameter to lemma method ?

Because i got this error :

File ".....\IRNET microsoft\src\rule\sem_utils.py", line 23, in lemma= lemma( ) TypeError: lemma() missing 1 required positional argument: 'verb'

Thanks

madcpt commented 4 years ago

Hi @anshudaur,

I think we had the same problem. It seems that pattern has an incompatibility issue with python 3.7+.

I solved the problem by going directly into the pattern source code path-to-packages/pattern/text/__init__.py line 609, you will see

raise StopIteration

comment this line and the pattern package works fine.

Note that this is only a temporary solution (may cause other unseen problems), but I think this package is out of maintenance and your problem won't be properly addressed unless you witch to python 3.6.

shubhamk16 commented 4 years ago

Hi @anshudaur, just add this in sem_utils, try: lemma= lemma except: lemma= print(lemma)

anshudaur commented 4 years ago

HI @madcpt , Thank you so much :) 👍