예제 #1
0
from csc.conceptnet4.models import Frame, Frequency, RawAssertion, Language,\
Relation
from events.models import Activity
from django.contrib.auth.models import User
from rhyme import sounds_like_score
from collections import defaultdict
import math, re

make = False

en = Language.get('en')
assertions = []
default = Frequency.objects.get(language=en, text='')
activity, _ = Activity.objects.get_or_create(name='Verbosity')
user = User.objects.get(username='******')

mapping = {
    "it is typically near": 'LocatedNear',
    "it is typically in": 'AtLocation',
    "it is used for": 'UsedFor',
    "it is a kind of": 'IsA',
    "it is a type of": 'IsA',
    "it is related to": 'ConceptuallyRelatedTo',
    "it has": 'HasA',
    "it is": 'HasProperty',
    "it is not": 'IsA',
    "it is about the same size as": 'SimilarSize',
    "it looks like": 'ConceptuallyRelatedTo',
}

bad_regex_no_biscuit =\
예제 #2
0
from csc.util import queryset_foreach
from csc.conceptnet4.models import Sentence, Assertion, RawAssertion, Language, Vote

pt = Language.get('pt')
def process(raw):
    if pt.nl.is_blacklisted(raw.surface1.text) or pt.nl.is_blacklisted(raw.surface2.text):
        raw.votes.delete()
    else:
        Vote.objects.record_vote(raw, raw.sentence.creator, 1)

queryset_foreach(RawAssertion.objects.filter(language=pt), process, batch_size=100)