FerreroJeremy / ln2sql

A tool to query a database in natural language
GNU General Public License v3.0
510 stars 200 forks source link

Fixing keyword detection #34

Closed maverickjoy closed 6 years ago

maverickjoy commented 6 years ago

The problem here is, I am trying to fix for query

1st Case :

          phrase_offset_string :  where 
          column_offset :  [1]
          phrase_offset_string :  where cityname 
          phrase_offset_string :  where cityname is 
          phrase_offset_string :  where cityname is not 
          phrase_offset_string :  where cityname is not pune 
          phrase_offset_string :  where cityname is not pune and 
          column_offset :  [1, 6]
          phrase_offset_string :  where cityname is not pune and id 
          phrase_offset_string :  where cityname is not pune and id like 
          phrase_offset_string :  where cityname is not pune and id like 1 
          interval_offset :  1  :  6
          self.negation_keyword_offset :  [3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8]

          interval_offset :  6  :  999
          self.negation_keyword_offset :  [3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8]

          SELECT *
          FROM city
          WHERE city.cityName != 'pune'
          AND city.id != '%1%';

2nd Case :

    interval_offset :  1  :  6
    self.negation_keyword_offset :  [3]

    interval_offset :  6  :  999
    self.negation_keyword_offset :  [3]

    SELECT *
    FROM city
    WHERE city.cityName != 'pune'
    AND city.id LIKE '%1%';
maverickjoy commented 6 years ago

Fixed the issue, now both type of queries work, And passed the Testcases.