@@ -14,46 +14,47 @@ def __init__(
14
14
self ,
15
15
database_path ,
16
16
language_path ,
17
- input_sentence ,
18
17
json_output_path = None ,
19
18
thesaurus_path = None ,
20
19
stopwords_path = None ,
21
20
):
22
21
23
22
database = Database ()
24
- stopwordsFilter = None
23
+ self . stopwordsFilter = None
25
24
26
25
if thesaurus_path :
27
26
thesaurus = Thesaurus ()
28
27
thesaurus .load (thesaurus_path )
29
28
database .set_thesaurus (thesaurus )
30
29
31
30
if stopwords_path :
32
- stopwordsFilter = StopwordFilter ()
33
- stopwordsFilter .load (stopwords_path )
31
+ self . stopwordsFilter = StopwordFilter ()
32
+ self . stopwordsFilter .load (stopwords_path )
34
33
35
34
database .load (database_path )
36
35
# database.print_me()
37
36
38
37
config = LangConfig ()
39
38
config .load (language_path )
40
39
41
- parser = Parser (database , config )
40
+ self .parser = Parser (database , config )
41
+ self .json_output_path = json_output_path
42
42
43
- queries = parser .parse_sentence (input_sentence , stopwordsFilter )
43
+ def get_query (self , input_sentence ):
44
+ queries = self .parser .parse_sentence (input_sentence , self .stopwordsFilter )
44
45
45
- if json_output_path :
46
+ if self . json_output_path :
46
47
self .remove_json (json_output_path )
47
48
for query in queries :
48
- query .print_json (json_output_path )
49
+ query .print_json (self .json_output_path )
50
+
51
+ full_query = ''
49
52
50
- self .full_query = ''
51
53
for query in queries :
52
- self . full_query += str (query )
54
+ full_query += str (query )
53
55
print (query )
54
56
55
- def get_query (self ):
56
- return self .full_query
57
+ return full_query
57
58
58
59
def remove_json (self , filename = "output.json" ):
59
60
if os .path .exists (filename ):
0 commit comments