Giter Club home page Giter Club logo

Comments (9)

sakuranew avatar sakuranew commented on June 23, 2024

some word‘s equivalences is none but original code have code like “sth in equivalences“,
so you just need to add a condition to ensure this part code doesnt execute when equivalence is none

from ln2sql.

vlevieux avatar vlevieux commented on June 23, 2024

I had this problem it seems that self.database_object.get_table_by_name(table_name).equivalences in parser.py:711&806 can be NoneType.

You can avoid the bugs by adding these two lines above:

if self.database_object.get_table_by_name(table_name).equivalences is None:
    continue

Why is this variable sometimes NoneType?

  • I have no idea.

from ln2sql.

Heernandez avatar Heernandez commented on June 23, 2024

from ln2sql.

vlevieux avatar vlevieux commented on June 23, 2024

It seems to be a problem by reading the thesaurus dictionary. In the paper, they indicated:

Ainsi si la table regroupant les informations des étudiants a par exemple pour nom ETUD_UNIV_01, et qu'aucun synonyme n'a donc été automatiquement ajouté à ce nom de table, l'utilisateur pourra rentrer manuellement le mot étudiant comme synonyme [...].

Thus, if the table containing the students' information has, for example, the name ETUD_UNIV_01, and no synonyms have been automatically added to this table name, the user can manually enter the word student as a synonym [...].

Then I tried to get the table chambre when I ask with azertyuiop (random word) to try this feature.

Then I added these lines in the thesaurus dictionary:

chambre|1
(noun)|azertyuiop|randomword

I ran the following command:

python -m ln2sql.main -d database_store/hotel.sql -l lang_store/english.csv -t thesaurus_store\th_english.dat -j output.json -i "What are the azertyuiop with nbLit greater than 3?"

The result is: (it's correct)

SELECT *
FROM chambre
WHERE chambre.nbLit > '3';

I noticed with the following lines in the thesaurus dictionary doesn't work. You need to add another value as above.

chambre|1
(noun)|azertyuiop

I need to figure out the way they retrieve values. Why does it return NoneType? Why doesn't single synonym work?

from ln2sql.

sakuranew avatar sakuranew commented on June 23, 2024

just let the equivalences =[] rather than Nonetype when initialize the database object

from ln2sql.

bdonepudi97 avatar bdonepudi97 commented on June 23, 2024

I had this problem it seems that self.database_object.get_table_by_name(table_name).equivalences in parser.py:711&806 can be NoneType.

You can avoid the bugs by adding these two lines above:

if self.database_object.get_table_by_name(table_name).equivalences is None:
    continue

Why is this variable sometimes NoneType?

  • I have no idea.

After which line of code(please put the statement) should we place the if condition?

from ln2sql.

rakesh160 avatar rakesh160 commented on June 23, 2024

I had this problem it seems that self.database_object.get_table_by_name(table_name).equivalences in parser.py:711&806 can be NoneType.
You can avoid the bugs by adding these two lines above:

if self.database_object.get_table_by_name(table_name).equivalences is None:
    continue

Why is this variable sometimes NoneType?

  • I have no idea.

After which line of code(please put the statement) should we place the if condition?

i tried adding after 709 and 805. However the output seems to be different before and after. Please refer to below screenshot

image

So, Instead of continuing when the self.database_object.get_table_by_name(table_name).equivalences is None, i have tried setting it to empty List.

if self.database_object.get_table_by_name(table_name).equivalences is None:
      self.database_object.get_table_by_name(table_name).equivalences = []

Here is the expected output:
image

from ln2sql.

rakesh160 avatar rakesh160 commented on June 23, 2024

It seems to be a problem by reading the thesaurus dictionary. In the paper, they indicated:

Ainsi si la table regroupant les informations des étudiants a par exemple pour nom ETUD_UNIV_01, et qu'aucun synonyme n'a donc été automatiquement ajouté à ce nom de table, l'utilisateur pourra rentrer manuellement le mot étudiant comme synonyme [...].

Thus, if the table containing the students' information has, for example, the name ETUD_UNIV_01, and no synonyms have been automatically added to this table name, the user can manually enter the word student as a synonym [...].

Then I tried to get the table chambre when I ask with azertyuiop (random word) to try this feature.

Then I added these lines in the thesaurus dictionary:

chambre|1
(noun)|azertyuiop|randomword

I ran the following command:

python -m ln2sql.main -d database_store/hotel.sql -l lang_store/english.csv -t thesaurus_store\th_english.dat -j output.json -i "What are the azertyuiop with nbLit greater than 3?"

The result is: (it's correct)

SELECT *
FROM chambre
WHERE chambre.nbLit > '3';

I noticed with the following lines in the thesaurus dictionary doesn't work. You need to add another value as above.

chambre|1
(noun)|azertyuiop

I need to figure out the way they retrieve values. Why does it return NoneType? Why doesn't single synonym work?

Seems like even the single word works but we have to end it with a pipe as below

chambre|1
(noun)|azertyuiop|

instead of

chambre|1
(noun)|azertyuiop

from ln2sql.

rakesh160 avatar rakesh160 commented on June 23, 2024

It seems to be a problem by reading the thesaurus dictionary. In the paper, they indicated:

Ainsi si la table regroupant les informations des étudiants a par exemple pour nom ETUD_UNIV_01, et qu'aucun synonyme n'a donc été automatiquement ajouté à ce nom de table, l'utilisateur pourra rentrer manuellement le mot étudiant comme synonyme [...].

Thus, if the table containing the students' information has, for example, the name ETUD_UNIV_01, and no synonyms have been automatically added to this table name, the user can manually enter the word student as a synonym [...].

Then I tried to get the table chambre when I ask with azertyuiop (random word) to try this feature.

Then I added these lines in the thesaurus dictionary:

chambre|1
(noun)|azertyuiop|randomword

I ran the following command:

python -m ln2sql.main -d database_store/hotel.sql -l lang_store/english.csv -t thesaurus_store\th_english.dat -j output.json -i "What are the azertyuiop with nbLit greater than 3?"

The result is: (it's correct)

SELECT *
FROM chambre
WHERE chambre.nbLit > '3';

I noticed with the following lines in the thesaurus dictionary doesn't work. You need to add another value as above.

chambre|1
(noun)|azertyuiop

I need to figure out the way they retrieve values. Why does it return NoneType? Why doesn't single synonym work?

Change the first few lines in load method in thesaurus.py file to below:

    def load(self, path):
        with open(self._generate_path(path)) as f:
            # content = f.readlines()
            content = f.read().splitlines()

Now its working even id we dont add an extra pipe at the end
ref: https://stackoverflow.com/questions/12330522/how-to-read-a-file-without-newlines

from ln2sql.

Related Issues (20)

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.