seriouspark commited on
Commit
7951d45
ยท
1 Parent(s): 33e9776

edit chatbot ment

Browse files
Files changed (1) hide show
  1. app.py +18 -20
app.py CHANGED
@@ -271,6 +271,7 @@ def get_similar_means(vocab):
271
 
272
  return mean_list_str_final
273
 
 
274
  #info_dict = {}
275
  def run_all(message, history):
276
  global info_dict
@@ -282,8 +283,8 @@ def run_all(message, history):
282
  info_dict[nickname] = {}
283
  return f'''์ข‹์•„์š”! ์‹œ์ž‘ํ• ๊ฒŒ์š” {nickname}๋‹˜.
284
  ์ง€๊ธˆ ๋จธ๋ฆฟ์†์— ๋– ์˜ค๋ฅด๋Š” ๋‹จ์–ด๋ฅผ ํ•˜๋‚˜ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.
285
- ๋‹จ์–ด๋ฅผ ์ž…๋ ฅํ•  ๋• \"๋‹จ์–ด: \" ๋ฅผ ํฌํ•จํ•ด์ฃผ์„ธ์š”
286
- (๋‹จ์–ด: ์ปคํ”ผ)
287
  '''
288
  try :
289
  #print(nickname)
@@ -304,14 +305,12 @@ def run_all(message, history):
304
  sentence_str = ' \n'.join([str(idx) + ") " + i for idx, i in enumerate(fixed_similar_words_final, 1)])
305
  return f'''<{clear_message}> ์„ ํ™œ์šฉํ•œ ๊ธ€์“ฐ๊ธฐ๋ฅผ ์‹œ์ž‘ํ•ด๋ณผ๊นŒ์š”?
306
  ์šฐ์„ , ์œ ์‚ฌํ•œ ๋‹จ์–ด๋ถ€ํ„ฐ ํ™•์ธํ•ด๋ณผ๊ฒŒ์š”.
307
- {word_str}
308
- \n
309
  ์œ ์‚ฌํ•œ ๋‹จ์–ด๋“ค์˜ ๋œป์€ ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค.
310
- {sentence_str}
311
- \n
312
- \n
313
-
314
- ์›ํ•˜๋Š” ๋ฌธ์žฅ์„ ๊ณจ๋ผ์„œ "๋ฌธ์žฅ:" ์„ ํฌํ•จํ•ด ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.
315
  '''
316
  else:
317
  return '\"๋‹จ์–ด:\" ๋ฅผ ํฌํ•จํ•ด์„œ ๋‹จ์–ด๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š” (๋‹จ์–ด: ์ปคํ”ผ)'
@@ -319,12 +318,10 @@ def run_all(message, history):
319
  elif message.find('๋ฌธ์žฅ:')>=0:
320
  clear_message = message.replace('๋ฌธ์žฅ','').replace(':','').strip()
321
  info_dict[nickname]['selected_sentence'] = clear_message
322
- return f'''<{clear_message}>๋ฅผ ๊ณ ๋ฅด์…จ๋„ค์š”.
323
- \n
324
- ์œ„ ๋ฌธ์žฅ์„ ํ™œ์šฉํ•ด ์งง์€ ๊ธ€์“ฐ๊ธฐ๋ฅผ ํ•ด๋ณผ๊นŒ์š”?
325
-
326
- \"์งง์€๊ธ€: \"์„ ํฌํ•จํ•ด ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”
327
- (์งง์€๊ธ€: ์ง€๊ธˆ ๋ฐฅ์„ ๋จน๊ณ  ์žˆ๋Š” ์ค‘์ด๋‹ค)
328
 
329
  '''
330
 
@@ -334,9 +331,8 @@ def run_all(message, history):
334
 
335
  return f'''<{clear_message}>๋ผ๊ณ  ์ž…๋ ฅํ•ด์ฃผ์…จ๋„ค์š”.
336
  \n ์œ„ ๋ฌธ์žฅ์„ ํ™œ์šฉํ•ด ๊ธด ๊ธ€์“ฐ๊ธฐ๋ฅผ ํ•ด๋ณผ๊นŒ์š”? 500์ž ์ด์ƒ ์ž‘์„ฑํ•ด์ฃผ์‹œ๋ฉด ์ข‹์•„์š”.
337
- \n \"๊ธด๊ธ€: \"์„ ํฌํ•จํ•ด ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”
338
- \n (๊ธด๊ธ€: ์ง€๊ธˆ ๋ฐฅ์„ ๋จน๊ณ  ์žˆ๋Š” ์ค‘์ด๋‹ค. ๋ฐฅ์„ ๋จน์„๋•Œ ๋งˆ๋‹ค ๋‚˜๋Š” ๋ฐฅ์•Œ์„ ํ˜“๋ฐ”๋‹ฅ์œผ๋กœ ๊ตด๋ ค๋ณธ๋‹ค. ... (์ƒ๋žต) )
339
-
340
  '''
341
  elif message.find('๊ธด๊ธ€:')>=0:
342
  long_message = message.replace('๊ธด๊ธ€','').replace(':','').strip()
@@ -354,8 +350,10 @@ def run_all(message, history):
354
  elif message.find('๋ถ„์„์‹œ์ž‘')>=0:
355
  with open(f"./result/{nickname}/contents.txt",'r') as f:
356
  orign_essay = f.read()
357
- review1 = all_process(orign_essay, nickname)
358
- return review1
 
 
359
  else:
360
  return '์ฒ˜์Œ๋ถ€ํ„ฐ ์‹œ์ž‘ํ•ด์ฃผ์„ธ์š”'
361
 
 
271
 
272
  return mean_list_str_final
273
 
274
+ info_dict = {}
275
  #info_dict = {}
276
  def run_all(message, history):
277
  global info_dict
 
283
  info_dict[nickname] = {}
284
  return f'''์ข‹์•„์š”! ์‹œ์ž‘ํ• ๊ฒŒ์š” {nickname}๋‹˜.
285
  ์ง€๊ธˆ ๋จธ๋ฆฟ์†์— ๋– ์˜ค๋ฅด๋Š” ๋‹จ์–ด๋ฅผ ํ•˜๋‚˜ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.
286
+ \n\n\n๋‹จ์–ด๋ฅผ ์ž…๋ ฅํ•  ๋• \"๋‹จ์–ด: \" ๋ฅผ ํฌํ•จํ•ด์ฃผ์„ธ์š”
287
+ ์˜ˆ์‹œ <๋‹จ์–ด: ์ปคํ”ผ>
288
  '''
289
  try :
290
  #print(nickname)
 
305
  sentence_str = ' \n'.join([str(idx) + ") " + i for idx, i in enumerate(fixed_similar_words_final, 1)])
306
  return f'''<{clear_message}> ์„ ํ™œ์šฉํ•œ ๊ธ€์“ฐ๊ธฐ๋ฅผ ์‹œ์ž‘ํ•ด๋ณผ๊นŒ์š”?
307
  ์šฐ์„ , ์œ ์‚ฌํ•œ ๋‹จ์–ด๋ถ€ํ„ฐ ํ™•์ธํ•ด๋ณผ๊ฒŒ์š”.
308
+ {word_str} \n
 
309
  ์œ ์‚ฌํ•œ ๋‹จ์–ด๋“ค์˜ ๋œป์€ ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค.
310
+ {sentence_str}\n
311
+ ์œ„ ๋œป ์ค‘์— ์›ํ•˜๋Š” ๋œป์„ ๊ณจ๋ผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”
312
+ \n\n\n ์ž…๋ ฅ์‹œ์—” \"๋ฌธ์žฅ:\" ์„ ํฌํ•จํ•ด์ฃผ์„ธ์š”. ์˜ˆ์‹œ๋„ ๋ณด์—ฌ๋“œ๋ฆด๊ฒŒ์š”.
313
+ \n ์˜ˆ์‹œ <๋ฌธ์žฅ: ์ผ์ •ํ•œ ์ฃผ์ œ๋‚˜ ์ค„๊ฑฐ๋ฆฌ๋ฅผ ๊ฐ€์ง„ ์ด์•ผ๊ธฐ>
 
314
  '''
315
  else:
316
  return '\"๋‹จ์–ด:\" ๋ฅผ ํฌํ•จํ•ด์„œ ๋‹จ์–ด๋ฅผ ์ž…๋ ฅํ•ด์ฃผ์„ธ์š” (๋‹จ์–ด: ์ปคํ”ผ)'
 
318
  elif message.find('๋ฌธ์žฅ:')>=0:
319
  clear_message = message.replace('๋ฌธ์žฅ','').replace(':','').strip()
320
  info_dict[nickname]['selected_sentence'] = clear_message
321
+ return f'''[{clear_message}]๋ฅผ ๊ณ ๋ฅด์…จ๋„ค์š”.
322
+ \n ์œ„ ๋ฌธ์žฅ์„ ํ™œ์šฉํ•ด ์งง์€ ๊ธ€์“ฐ๊ธฐ๋ฅผ ํ•ด๋ณผ๊นŒ์š”?
323
+ \n\n\n ์ž…๋ ฅ์‹œ์—”\"์งง์€๊ธ€: \"์„ ํฌํ•จํ•ด์ฃผ์„ธ์š”. ์˜ˆ์‹œ๋„ ๋ณด์—ฌ๋“œ๋ฆด๊ฒŒ์š”.
324
+ \n ์˜ˆ์‹œ <์งง์€๊ธ€: ์ง€๊ธˆ ๋ฐฅ์„ ๋จน๊ณ  ์žˆ๋Š” ์ค‘์ด๋‹ค>
 
 
325
 
326
  '''
327
 
 
331
 
332
  return f'''<{clear_message}>๋ผ๊ณ  ์ž…๋ ฅํ•ด์ฃผ์…จ๋„ค์š”.
333
  \n ์œ„ ๋ฌธ์žฅ์„ ํ™œ์šฉํ•ด ๊ธด ๊ธ€์“ฐ๊ธฐ๋ฅผ ํ•ด๋ณผ๊นŒ์š”? 500์ž ์ด์ƒ ์ž‘์„ฑํ•ด์ฃผ์‹œ๋ฉด ์ข‹์•„์š”.
334
+ \n\n\n ์ž…๋ ฅ์‹œ์—”\"๊ธด๊ธ€: \"์„ ํฌํ•จํ•ด์ฃผ์„ธ์š”. ์˜ˆ์‹œ๋„ ๋ณด์—ฌ๋“œ๋ฆด๊ฒŒ์š”.
335
+ \n ์˜ˆ์‹œ <๊ธด๊ธ€: ์ง€๊ธˆ ๋ฐฅ์„ ๋จน๊ณ  ์žˆ๋Š” ์ค‘์ด๋‹ค. ๋ฐฅ์„ ๋จน์„๋•Œ ๋งˆ๋‹ค ๋‚˜๋Š” ๋ฐฅ์•Œ์„ ํ˜“๋ฐ”๋‹ฅ์œผ๋กœ ๊ตด๋ ค๋ณธ๋‹ค. ... (์ƒ๋žต) >
 
336
  '''
337
  elif message.find('๊ธด๊ธ€:')>=0:
338
  long_message = message.replace('๊ธด๊ธ€','').replace(':','').strip()
 
350
  elif message.find('๋ถ„์„์‹œ์ž‘')>=0:
351
  with open(f"./result/{nickname}/contents.txt",'r') as f:
352
  orign_essay = f.read()
353
+ summary = all_process(orign_essay, nickname)
354
+
355
+ #print(summary)
356
+ return summary
357
  else:
358
  return '์ฒ˜์Œ๋ถ€ํ„ฐ ์‹œ์ž‘ํ•ด์ฃผ์„ธ์š”'
359