File size: 5,031 Bytes
66d63c7
4d76ff8
66d63c7
c3ee309
 
 
66d63c7
c3ee309
66d63c7
d3f86a4
 
 
1194d1e
 
 
 
 
 
d3f86a4
 
 
4d76ff8
c3ee309
 
 
4d76ff8
 
 
c3ee309
d3f86a4
 
4d76ff8
 
 
d3f86a4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4d76ff8
 
d3f86a4
 
4d76ff8
 
 
c3ee309
 
 
 
 
 
4d76ff8
d3f86a4
4d76ff8
ed10886
c3ee309
 
4d76ff8
 
 
ed10886
d3f86a4
ed10886
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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()