-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:ekocbiyik/skyz
- Loading branch information
Showing
3 changed files
with
31 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |