<jupyter_start><jupyter_text>padding<jupyter_code>encoded = tokenizer.texts_to_sequences([new_sentence])
pad_new = tf.keras.preprocessing.sequence.pad_sequences(encoded, maxlen=200)
pad_new<jupyter_output><empty_output><jupyter_text>predict<jupyter_code>score = loaded_model.predict(pad_new)
score<jupyter_output><empty_output><jupyter_text>Service<jupyter_code>def sentiment_predict(sentence):
  okt=konlpy.tag.Okt()
  new_sentence = okt.morphs(sentence, stem=True)
  new_sentence = [tok for tok in new_sentence if tok not in stopwords]
  encoded = tokenizer.texts_to_sequences([new_sentence])
  pad_new = tf.keras.preprocessing.sequence.pad_sequences(encoded, maxlen=50)
  score = loaded_model.predict(pad_new)
  return score
words = input('리뷰를 입력하세요.')
result = sentiment_predict(words)
result<jupyter_output><empty_output><jupyter_text>시각화 자료<jupyter_code>negative = (result[0][0]+result[0][1]+result[0][2])*100
positive = (result[0][3]+result[0][4])*100
negative, positive
list = [negative, positive]
import plotly.express as px

fig = px.pie(list, values= list, names=list, color=list,
             color_discrete_map={negative :'lightslategray',
                                 positive :'royalblue'})

fig.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12709832134292565, 'fraction_numerical': 0.016786570743405275, 'mean_word_length': 6.924050632911392, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '297314', 'license': 'Apache-2.0', 'n_tokens_mistral': 475, 'n_tokens_neox': 465, 'n_words': 63, 'path': 'DeepLearning/TeamProject_DL_Service.ipynb', 'repo_name': 'young-ha713/TeamProject', 'size': '1251'}