Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ekocbiyik/skyz
Browse files Browse the repository at this point in the history
  • Loading branch information
ebrugulec committed Dec 1, 2019
2 parents c31260e + a76b83c commit 156fd4e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
10 changes: 8 additions & 2 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# skyz
https://www.acikhack.com
#Türkçe metinlerin sınıflandırılması.

## skyz
https://www.acikhack.com

----------------------------------------------------------------
Açık hack 2019 kapsamında geliştirilen bu uygulama girilen bir
türkçe metnin sınıflandırmasını yaparak ekonomi, politika, sanat, g
spor ve teknoloji konu başlıklarından hangisine ait olduğunu bulabilmektedir.
Ayrıca bir gmail hesabına bağlanarak maillerinin içeriklerine göre
sınıflandırmasını yapabilmektedir.

* virtualenv -p python3.6 env

19 changes: 19 additions & 0 deletions backend/skyz/management/commands/test_ai.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from django.core.management.base import BaseCommand
from skyz.models.model import TestDataTablosu
from skyz.rest.elastic_query import ElasticSearch

class Command(BaseCommand):

def handle(self, *args, **kwargs):
objects = TestDataTablosu.objects.all()
total_object_count = len(objects)
succes_rate = 0
for test in objects:
tmp = test.__dict__
response = ElasticSearch().post_to_elastic(' '.join(tmp['content'].translate(str.maketrans('', '', r""":"'""")).lower().split()))[0]['_source']['category']
if response == tmp['category']:
succes_rate += 1
print(str(total_object_count)+"/"+str(succes_rate))



6 changes: 4 additions & 2 deletions backend/skyz/rest/test_date_insert.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from rest_framework.views import APIView
from skyz.models.model import TestDataTablosu
from rest_framework.response import Response


class TestData(APIView):

def post(self):
def post(self, requests):
content = self.request.data['content']
category = self.request.data['category']
TestDataTablosu.objects.create(content=content, category=category)
TestDataTablosu.objects.create(content=content, category=category)
return Response('Succes')

0 comments on commit 156fd4e

Please sign in to comment.