Skip to content

Commit

Permalink
Merge pull request #37 from robotveradev/VJB-47
Browse files Browse the repository at this point in the history
VJB-47 Create patch for W2V.
  • Loading branch information
achievement008 authored Jul 2, 2018
2 parents 02060c5 + 077e846 commit 9145b63
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
13 changes: 1 addition & 12 deletions jobboard/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# Generated by Django 2.0.3 on 2018-05-28 10:45
# Generated by Django 2.0.3 on 2018-06-26 09:32

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import jobboard.models


class Migration(migrations.Migration):

initial = True

dependencies = [
('account', '0004_auto_20170416_1821'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

Expand Down Expand Up @@ -44,15 +42,6 @@ class Migration(migrations.Migration):
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='InviteCode',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('code', models.CharField(default=jobboard.models.random_string, max_length=32, unique=True, verbose_name='code')),
('expired', models.BooleanField(default=False)),
('signup_code', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='account.SignupCode')),
],
),
migrations.CreateModel(
name='Keyword',
fields=[
Expand Down
6 changes: 5 additions & 1 deletion quiz/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def __init__(self):
self.corrector.LoadLangModel('en.bin')

def run(self):

if not self.candidate_sentence or not self.right_sentence:
return False
self.get_similarity_euql()
Expand All @@ -95,7 +96,10 @@ def set_answers(self, right_answer, candidate_answer):

def get_similarity_euql(self):
for i in self.right_sentence:
first_vector = requests.post(self.api_url, data={"word": i}).text
try:
first_vector = requests.post(self.api_url, data={"word": i}, timeout=5).text
except Exception:
return 0.01
try:
first_vector = np.asarray(eval(first_vector), dtype=np.float32)
except SyntaxError:
Expand Down

0 comments on commit 9145b63

Please sign in to comment.