DanielSc4 commited on
Commit
b5fc718
·
1 Parent(s): cb9a228
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -127,7 +127,7 @@ def main(choose_context):
127
  # Step 1: Clean with simple_preprocess
128
  mytext_2 = list(sent_to_words(text))
129
  # Step 2: Lemmatize
130
- mytext_3 = lemmatization(mytext_2, allowed_postags=['NOUN', 'ADJ', 'VERB', 'ADV'])
131
  # Step 3: Vectorize transform
132
  mytext_4 = vectorizer.transform(mytext_3)
133
  # Step 4: LDA Transform
@@ -142,11 +142,11 @@ def main(choose_context):
142
 
143
  # Predict the topic
144
  mytext = ["This is a test of a random topic where I talk about politics"]
145
- infer_topic, topic, prob_scores = predict_topic(text = mytext)
146
 
147
  def apply_predict_topic(text):
148
  text = [text]
149
- infer_topic, topic, prob_scores = predict_topic(text = text)
150
  return(infer_topic)
151
 
152
  df["Topic_key_word"] = df['comment'].apply(apply_predict_topic)
 
127
  # Step 1: Clean with simple_preprocess
128
  mytext_2 = list(sent_to_words(text))
129
  # Step 2: Lemmatize
130
+ mytext_3 = lemmatization(mytext_2, allowed_postags=['NOUN', 'ADJ', 'VERB', 'ADV'], nlp=nlp)
131
  # Step 3: Vectorize transform
132
  mytext_4 = vectorizer.transform(mytext_3)
133
  # Step 4: LDA Transform
 
142
 
143
  # Predict the topic
144
  mytext = ["This is a test of a random topic where I talk about politics"]
145
+ infer_topic, topic, prob_scores = predict_topic(text = mytext, nlp=nlp)
146
 
147
  def apply_predict_topic(text):
148
  text = [text]
149
+ infer_topic, topic, prob_scores = predict_topic(text = text, nlp=nlp)
150
  return(infer_topic)
151
 
152
  df["Topic_key_word"] = df['comment'].apply(apply_predict_topic)