# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# +

import pandas as pd
import nltk
from nltk.stem.porter import *
from sklearn.feature_extraction.text import TfidfVectorizer
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer as VS
from textstat.textstat import *
import string
import re
from joblib import load
import numpy as np
# import functions
# from functions import clean
# from functions import tokenize
from functions import wrangle2


def predict(text):
    text = [text]
    text = wrangle2(text)
    y_pred = model.predict(text)
    if y_pred == 0:
        y_pred = 'hateful'
    if y_pred == 1:
        y_pred = 'offensive'
    if y_pred == 2:
        y_pred = 'normal'
    df = pd.DataFrame(model.predict_proba(text), columns=["Hateful", "Offensive", "Normal"])
    return f'This tweet contains {y_pred} language'


# +

model = load('../assets/model.joblib')
vectorizer = load('../assets/vectorizer_final.joblib')
# -

type(vectorizer)

predict("<NAME> is shit tremendous of amounts of Wall Street money on false ads against me. She is a very dishonest person!")

data = np.array([10,11,12])
ser = pd.DataFrame(data,columns=['g','e','e'])

ser

((ser.max().values[0])*100).round(2)



StarcoderdataJupyterScriptsDedupFiltered