giseldo's picture
ultima versao
d3f86a4
raw
history blame
5.03 kB
import gradio as gr
from joblib import dump, load
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_selection import SelectKBest
from sklearn.feature_selection import f_classif
import pandas as pd
from textblob import TextBlob
import textstat
titulo = """CLONE - Studio Dashboard: "default" and "Default Project" does not give clear information about Alloy and Project unless description is read."""
descricao = """Steps To Reproduce: 1. On dashboard on studio 3.0, navigate to Develop tab. 2. Notice "default" and "Default Project" & "two-tabbed" and "Tabbed Application" names. Actual: User does not get clear information from names that one is alloy project and another one is Titanium project unless he reads the description below. Expected: Naming convention or icon corresponding must suggest type"""
titulo1 = """Ti.UI.Picker has no collection binding"""
descricao1 = """h3. original discussion http://developer.appcelerator.com/question/145992/databinding-on-picker h3. problem Collection binding is not implemented for Ti.UI.Picker as it is for Ti.UI.TableView and other generic Titaniums views (View, Window, ScrollView, etc...). h3. solution Support collection binding on Ti.UI.Picker just as it is on TableView. It will need special handling as the Ti.UI.Picker requires custom parsing for columns and rows. Something like this should be how it would work for devs: {code:xml} <Alloy> <Collection src="book" /> <Window class="container"> <Picker dataCollection="book"> <PickerRow title="{title}" /> </Picker> </Window> </Alloy> {code}"""
titulo2 = """Enable more complex notation in binding"""
descricao2 = """Allow developers to use syntax like the following in collection/model bindings: {code:xml} <Alloy> <Model src=""someModel""/> <Window title=""{someModel.title} {someModel.subtitle}""/> </Alloy> {code} Basically, instead of assuming the whole property needs to be wrapped in \{\}, allow developers to put as many of them in the attribute as they want."""
def calcula_MbR(titulo, descricao):
context = titulo + descricao
d = {"context": [context]}
df = pd.DataFrame(data=d, columns=["context"])
model = load("model/model_tawos_aloy_mbr.pkl")
story_points_MbR = model.predict(df["context"])
return story_points_MbR
def calcula_neosp(titulo, descricao):
model = load("model/model_tawos_aloy_neosp.pkl")
context = titulo + descricao
d = {"context": [context]}
df = pd.DataFrame(data=d, columns=["context"])
# features de legibilidade
df["gunning_fog"] = df['context'].apply(textstat.gunning_fog)#
df["flesch_reading_ease"] = df['context'].apply(textstat.flesch_reading_ease)#
df["flesch_kincaid_grade"] = df['context'].apply(textstat.flesch_kincaid_grade)#
df["smog_index"] = df['context'].apply(textstat.smog_index)
df["coleman_liau_index"] = df['context'].apply(textstat.coleman_liau_index)#
df["automated_readability_index"] = df['context'].apply(textstat.automated_readability_index) #
df["dale_chall_readability_score"] = df['context'].apply(textstat.dale_chall_readability_score)#
df["difficult_words"] = df['context'].apply(textstat.difficult_words)
df["linsear_write_formula"] = df['context'].apply(textstat.linsear_write_formula)#
# feature de sentimento
df["polarity"] = df["context"].apply(lambda x: TextBlob(x).sentiment.polarity)
df["subjectivity"] = df["context"].apply(lambda x: TextBlob(x).sentiment.subjectivity)
X = df[["gunning_fog", "flesch_reading_ease", "flesch_kincaid_grade", "smog_index", "coleman_liau_index",
"automated_readability_index", "dale_chall_readability_score", "difficult_words", "linsear_write_formula",
"polarity", "subjectivity"]]
story_points = model.predict(X)
return story_points
def calculaTFIDFSVM(titulo, descricao):
model = load("model/model_tawos_aloy_tfidf_svm.pkl.pkl")
context = titulo + descricao
d = {"context": [context]}
df = pd.DataFrame(data=d, columns=["context"])
vectorizer = TfidfVectorizer()
X = vectorizer.fit_transform(df["context"])
#X_new = SelectKBest(f_classif, k=50).fit_transfor(X)
story_points = model.predict(X)
return story_points
def calcula(titulo, descricao):
return calcula_MbR(titulo, descricao), calcula_neosp(titulo, descricao), 0
demo = gr.Interface(fn=calcula,
inputs=[gr.Textbox(placeholder="Título", label="Título"),
gr.Textbox(lines=10, placeholder="Descrição", label="Descrição")],
outputs=[gr.Textbox(label="Story Points Estimado MbR"),
gr.Textbox(label="Story Points Estimado NEOSP"),
gr.Textbox(label="Story Points Estimado TFIDF-SVM")],
title="Agile Task Story Point Estimator - TAWOS - Alloy",
examples=[[titulo, descricao], [titulo1, descricao1], [titulo2, descricao2]]
)
demo.launch()