Пример #1
0
from utils.insert_update import InsertUpdate
from utils.select_cols import SelectCols
from utils.create_cols import CreateCols
from tqdm import tqdm
from utils.get_disabled_status_by_repo import GetDisabledStatus

'''
    If there is no column inside your table for the word2vec vector result. 
    Uncomments the following line to `Create Column if not exist`
'''
create_column = CreateCols().create_cols(
    {
        "colName": "Disabled_Status",
        "type": "FLOAT"
    }
)


# get all repo name from mysql preload repo namae
repos_name = SelectCols().col_name('full_name')
repos_name_list = [item[0] for item in repos_name ]

# x = GetSize('twbs','bootstrap').get()
# print(x)

for repo_name in tqdm(repos_name_list):
    repo_owner_name_list = repo_name.split('/')
    Disabled_Status_list = GetDisabledStatus(repo_owner_name_list[0], repo_owner_name_list[1]).get()
    InsertUpdate('Disabled_Status').update_val(repo_name, Disabled_Status_list)
Пример #2
0
sys.path.append(
    os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')))

from utils.insert_update import InsertUpdate
from utils.select_cols import SelectCols
from utils.create_cols import CreateCols
from tqdm import tqdm
from utils.get_pages_status_by_repo import GetPagesStatus
'''
    If there is no column inside your table for the word2vec vector result. 
    Uncomments the following line to `Create Column if not exist`
'''
create_column = CreateCols().create_cols({
    "colName": "Page_Status",
    "type": "FLOAT"
})

# get all repo name from mysql preload repo namae
repos_name = SelectCols().col_name('full_name')
repos_name_list = [item[0] for item in repos_name]

# x = GetSize('twbs','bootstrap').get()
# print(x)

for repo_name in tqdm(repos_name_list):
    repo_owner_name_list = repo_name.split('/')
    Download_Status_list = GetPagesStatus(repo_owner_name_list[0],
                                          repo_owner_name_list[1]).get()
    InsertUpdate('Page_Status').update_val(repo_name, Download_Status_list)
from utils.insert_update import InsertUpdate
from utils.select_cols import SelectCols
from utils.create_cols import CreateCols
from tqdm import tqdm
from utils.get_wiki_status_by_repo import GetWikiStatus

'''
    If there is no column inside your table for the word2vec vector result. 
    Uncomments the following line to `Create Column if not exist`
'''
create_column = CreateCols().create_cols(
    {
        "colName": "Wiki_Status",
        "type": "FLOAT"
    }
)


# get all repo name from mysql preload repo namae
repos_name = SelectCols().col_name('full_name')
repos_name_list = [item[0] for item in repos_name ]

# x = GetSize('twbs','bootstrap').get()
# print(x)

for repo_name in tqdm(repos_name_list):
    repo_owner_name_list = repo_name.split('/')
    Wiki_Status_list = GetWikiStatus(repo_owner_name_list[0], repo_owner_name_list[1]).get()
    InsertUpdate('Wiki_Status').update_val(repo_name, Wiki_Status_list)
'''
    If there is no column inside your table for the word2vec vector result. 
    Uncomments the following line to `Create Column if not exist`
'''
create_column = CreateCols().create_cols(
    {
        "colName": "vader_setimental_result",
        "type": "FLOAT"
    }
)


# get all repo name from mysql preload repo namae
repos_name = SelectCols().col_name('full_name')
repos_name_list = [ item[0] for item in repos_name ]

# save issue comment to repo_name.txt
for repo_name in tqdm(repos_name_list):
    repo_owner_name_list = repo_name.split('/')
    repo_file_name = '_'.join(repo_owner_name_list)

    # open clean issue txt file
    with open('../data/clean_issue_comment/%s.txt' % repo_file_name, 'r') as file:
        # cleaned issue comment string
        clean_issue_comment = file.read()

        analyzer = SentimentIntensityAnalyzer()
        result = analyzer.polarity_scores(clean_issue_comment)
        InsertUpdate('vader_setimental_result').update_val(repo_name, result['compound'])
Пример #5
0
sys.path.append(
    os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')))

from utils.insert_update import InsertUpdate
from utils.select_cols import SelectCols
from utils.create_cols import CreateCols
from tqdm import tqdm
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
from utils.get_size_by_repo import GetSize
'''
    If there is no column inside your table for the word2vec vector result. 
    Uncomments the following line to `Create Column if not exist`
'''
create_column = CreateCols().create_cols({"colName": "Size", "type": "FLOAT"})

# get all repo name from mysql preload repo namae
repos_name = SelectCols().col_name('full_name')
repos_name_list = [item[0] for item in repos_name]

# x = GetSize('twbs','bootstrap').get()
# print(x)

for repo_name in tqdm(repos_name_list):
    repo_owner_name_list = repo_name.split('/')
    size_list = GetSize(repo_owner_name_list[0], repo_owner_name_list[1]).get()
    try:
        InsertUpdate('Size').update_val(repo_name, max(size_list))
    except:
        InsertUpdate('Size').update_val(repo_name, 0)
sys.path.append(
    os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')))

from utils.insert_update import InsertUpdate
from utils.select_cols import SelectCols
from utils.create_cols import CreateCols
from tqdm import tqdm
from utils.get_archived_status_by_repo import GetArchivedStatus
'''
    If there is no column inside your table for the word2vec vector result. 
    Uncomments the following line to `Create Column if not exist`
'''
create_column = CreateCols().create_cols({
    "colName": "Archived_Status",
    "type": "FLOAT"
})

# get all repo name from mysql preload repo namae
repos_name = SelectCols().col_name('full_name')
repos_name_list = [item[0] for item in repos_name]

# x = GetSize('twbs','bootstrap').get()
# print(x)

for repo_name in tqdm(repos_name_list):
    repo_owner_name_list = repo_name.split('/')
    archived_list = GetArchivedStatus(repo_owner_name_list[0],
                                      repo_owner_name_list[1]).get()
    InsertUpdate('Archived_Status').update_val(repo_name, archived_list)
    return round(yhat[0, 0])


repos_name = SelectCols().col_name('full_name')
repos_name_list = [item[0] for item in repos_name]

# Select github repos full name from db
repos_name = SelectCols().col_name('full_name')
repos_name_list = [item[0] for item in repos_name]

create_column = CreateCols().create_cols({
    "colName": "Good_or_Bad",
    "type": "INT"
})

for repo_name in tqdm(repos_name_list):
    # convert '/' to '_'
    repo_owner_name_list = repo_name.split('/')
    reop_txt_name = '_'.join(repo_owner_name_list)

    # read file base on repo name
    with open('../data/clean_issue_comment/%s.txt' % reop_txt_name,
              'r') as file:
        issue_comment = file.read()

        # transform text to negative(0) positive(1) label
        pos_neg_label = predict_sentiment(issue_comment, vocab, tokenizer,
                                          loaded_model)
        pos_neg_label = int(pos_neg_label)
        InsertUpdate('Good_or_Bad').update_val(repo_name, pos_neg_label)