Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This is a basic workflow to help you get started with Actions

name: Build

# Controls when the workflow will run
on: [push,pull_request, workflow_dispatch]
# Triggers the workflow on push or pull request events but only for the master branch
# *workflow_dispatch* Allows you to run this workflow manually from the Actions tab

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
CC_TEST_REPORTER_ID: f34a79c102113be355c87290141c96d62d3165d61c0b929d3bafe76c8e1c3925
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Runs a Ruby setup
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.2
bundler-cache: true
- name: Add codeclimate
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
- name: Before-build Codeclimate
run: ./cc-test-reporter before-build
- uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Run the default task
run: bundle exec rake
- name: After-build Codeclimate
run: ./cc-test-reporter after-build
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AllCops:
TargetRubyVersion: 2.4
TargetRubyVersion: 2.7

Style/StringLiterals:
Enabled: true
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![Build](https://github.com/AKGRif/sentiment/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/AKGRif/sentiment/actions/workflows/ci.yml)
<a href="https://codeclimate.com/github/AKGRif/sentiment/maintainability"><img src="https://api.codeclimate.com/v1/badges/1b6e3e773b5f04bc7231/maintainability" /></a>
<a href="https://codeclimate.com/github/AKGRif/sentiment/test_coverage"><img src="https://api.codeclimate.com/v1/badges/1b6e3e773b5f04bc7231/test_coverage" /></a>
# Sentiment

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/sentiment`. To experiment with that code, run `bin/console` for an interactive prompt.
Expand Down
6 changes: 1 addition & 5 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,4 @@ Rake::TestTask.new(:test) do |t|
t.test_files = FileList["test/**/*_test.rb"]
end

require "rubocop/rake_task"

RuboCop::RakeTask.new

task default: %i[test rubocop]
task default: %i[test]
134,363 changes: 134,363 additions & 0 deletions lib/data/negative.csv

Large diffs are not rendered by default.

159 changes: 159 additions & 0 deletions lib/data/observ.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
{
"metadata": {
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.1"
},
"orig_nbformat": 2,
"kernelspec": {
"name": "python3",
"display_name": "Python 3.9.1 64-bit",
"metadata": {
"interpreter": {
"hash": "f170553ee8f2e542d43d2af0566f7208c8986c4668303670d00c16f87656bcbb"
}
}
}
},
"nbformat": 4,
"nbformat_minor": 2,
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"n = ['id', 'date', 'name', 'text', 'typr', 'rep', 'rtw', 'faw', 'stcount', 'foll', 'frien', 'listcount']\n",
"data_positive = pd.read_csv('positive.csv', sep=';', error_bad_lines=False, names=n)\n",
"data_negative = pd.read_csv('negative.csv', sep=';', error_bad_lines=False, names=n)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id date name \\\n",
"0 408906762813579264 1386325944 dugarchikbellko \n",
"1 408906818262687744 1386325957 nugemycejela \n",
"2 408906858515398656 1386325966 4post21 \n",
"3 408906914437685248 1386325980 Poliwake \n",
"4 408906914723295232 1386325980 capyvixowe \n",
"\n",
" text typr rep rtw faw \\\n",
"0 на работе был полный пиддес :| и так каждое за... -1 0 0 0 \n",
"1 Коллеги сидят рубятся в Urban terror, а я из-з... -1 0 0 0 \n",
"2 @elina_4post как говорят обещаного три года жд... -1 0 0 0 \n",
"3 Желаю хорошего полёта и удачной посадки,я буду... -1 0 0 0 \n",
"4 Обновил за каким-то лешим surf, теперь не рабо... -1 0 0 0 \n",
"\n",
" stcount foll frien listcount \n",
"0 8064 111 94 2 \n",
"1 26 42 39 0 \n",
"2 718 49 249 0 \n",
"3 10628 207 200 0 \n",
"4 35 17 34 0 "
],
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>id</th>\n <th>date</th>\n <th>name</th>\n <th>text</th>\n <th>typr</th>\n <th>rep</th>\n <th>rtw</th>\n <th>faw</th>\n <th>stcount</th>\n <th>foll</th>\n <th>frien</th>\n <th>listcount</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>408906762813579264</td>\n <td>1386325944</td>\n <td>dugarchikbellko</td>\n <td>на работе был полный пиддес :| и так каждое за...</td>\n <td>-1</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>8064</td>\n <td>111</td>\n <td>94</td>\n <td>2</td>\n </tr>\n <tr>\n <th>1</th>\n <td>408906818262687744</td>\n <td>1386325957</td>\n <td>nugemycejela</td>\n <td>Коллеги сидят рубятся в Urban terror, а я из-з...</td>\n <td>-1</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>26</td>\n <td>42</td>\n <td>39</td>\n <td>0</td>\n </tr>\n <tr>\n <th>2</th>\n <td>408906858515398656</td>\n <td>1386325966</td>\n <td>4post21</td>\n <td>@elina_4post как говорят обещаного три года жд...</td>\n <td>-1</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>718</td>\n <td>49</td>\n <td>249</td>\n <td>0</td>\n </tr>\n <tr>\n <th>3</th>\n <td>408906914437685248</td>\n <td>1386325980</td>\n <td>Poliwake</td>\n <td>Желаю хорошего полёта и удачной посадки,я буду...</td>\n <td>-1</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>10628</td>\n <td>207</td>\n <td>200</td>\n <td>0</td>\n </tr>\n <tr>\n <th>4</th>\n <td>408906914723295232</td>\n <td>1386325980</td>\n <td>capyvixowe</td>\n <td>Обновил за каким-то лешим surf, теперь не рабо...</td>\n <td>-1</td>\n <td>0</td>\n <td>0</td>\n <td>0</td>\n <td>35</td>\n <td>17</td>\n <td>34</td>\n <td>0</td>\n </tr>\n </tbody>\n</table>\n</div>"
},
"metadata": {},
"execution_count": 10
}
],
"source": [
"data_positive.head()\n",
"data_negative.head()"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" 1 114911\n",
"-1 111923\n",
"Name: typr, dtype: int64"
]
},
"metadata": {},
"execution_count": 12
}
],
"source": [
"valid_columns = ['id', 'text', 'typr']\n",
"main_base = pd.concat([data_positive[valid_columns], data_negative[valid_columns]])\n",
"main_base['typr'].value_counts()"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" id text \\\n",
"59919 410143227896135680 RT @Soufiane_Lfid: @Vazonok просто все фотки б... \n",
"46269 409996689693736960 RT @_oksankaaaa_: @mokshinaaa лови фон Дивушка... \n",
"53594 410067217779535872 @_Evil_Anchovy если у меня будет хоть одна чет... \n",
"51398 410045469260128256 @rape______me изхизхизх ты жи знаишь што я доб... \n",
"83171 419883150597427201 Хоббит не впечатлил( стал похож на компьютерну... \n",
"\n",
" typr \n",
"59919 1 \n",
"46269 1 \n",
"53594 1 \n",
"51398 1 \n",
"83171 -1 "
],
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>id</th>\n <th>text</th>\n <th>typr</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>59919</th>\n <td>410143227896135680</td>\n <td>RT @Soufiane_Lfid: @Vazonok просто все фотки б...</td>\n <td>1</td>\n </tr>\n <tr>\n <th>46269</th>\n <td>409996689693736960</td>\n <td>RT @_oksankaaaa_: @mokshinaaa лови фон Дивушка...</td>\n <td>1</td>\n </tr>\n <tr>\n <th>53594</th>\n <td>410067217779535872</td>\n <td>@_Evil_Anchovy если у меня будет хоть одна чет...</td>\n <td>1</td>\n </tr>\n <tr>\n <th>51398</th>\n <td>410045469260128256</td>\n <td>@rape______me изхизхизх ты жи знаишь што я доб...</td>\n <td>1</td>\n </tr>\n <tr>\n <th>83171</th>\n <td>419883150597427201</td>\n <td>Хоббит не впечатлил( стал похож на компьютерну...</td>\n <td>-1</td>\n </tr>\n </tbody>\n</table>\n</div>"
},
"metadata": {},
"execution_count": 13
}
],
"source": [
"shuffled_df = main_base.sample(frac = 1)\n",
"shuffled_df.head()"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"shuffled_df.to_csv('twitter_emo_df.csv')"
]
}
]
}
Loading