# Path: conceptnet/corpus/models.py
# class ScoredModel(object):
# class Language(models.Model):
# class Sentence(models.Model, ScoredModel):
# class TaggedSentence(models.Model):
# class DependencyParse(models.Model):
# class Frequency(models.Model):
#     class Meta:
#     def get_rating(self, user):
#     def set_rating(self, user, val, activity=None):
#     def update_score(self):
# def denormalize_votes(sender, instance, created=False, **kwargs):
# def get_lang(lang_code):
#     def __str__(self):
#     def get(id):
#     def nl(self):
#     def __unicode__(self):
#     def update_consistency(self):
#     def tagged_words(self):
#     def __unicode__(self):
#     def from_string(sentence_id, depstring):
#     def __unicode__(self):
#     def __unicode__(self):
#     _PARSE_RE = re.compile(r"(.+)\((.*)-(\d+)'*, (.*)-(\d+)'*\)")


from django.db import models
from django.db.models import Q
from conceptnet.corpus.models import Language, Sentence, User, ScoredModel, Frequency
from events.models import Event, Activity
from voting.models import Vote, SCORES
from django.contrib.contenttypes import generic
from csc_utils.cache import cached
from datetime import datetime
from urllib import quote as urlquote
        from django.db.models import F
import re
        if c: assertion.save()
        raw_assertion.assertion = assertion
        
        sentence, c = Sentence.objects.get_or_create(
            text=frame.fill_in(text1, text2),
            creator=user,
            language=lang,
            activity=activity,
            defaults=dict(score=0)
        )
        if c:
            lang.sentence_count += 1
            lang.save()
            sentence.save()
        
        Event.record_event(sentence, user, activity)
        sentence.set_rating(user, vote, activity)
        raw_assertion.set_rating(user, vote, activity)
        Event.record_event(raw_assertion, user, activity)
        assertion.set_rating(user, vote, activity)
        Event.record_event(assertion, user, activity)
        
        raw_assertion.sentence = sentence
        raw_assertion.update_score()
        raw_assertion.save()
        return raw_assertion
    
    def update_score(self):
        if self.assertion is not None:
            self.assertion.update_raw_cache()

# Path: conceptnet/corpus/models.py
# class ScoredModel(object):
# class Language(models.Model):
# class Sentence(models.Model, ScoredModel):
# class TaggedSentence(models.Model):
# class DependencyParse(models.Model):
# class Frequency(models.Model):
#     class Meta:
#     def get_rating(self, user):
#     def set_rating(self, user, val, activity=None):
#     def update_score(self):
# def denormalize_votes(sender, instance, created=False, **kwargs):
# def get_lang(lang_code):
#     def __str__(self):
#     def get(id):
#     def nl(self):
#     def __unicode__(self):
#     def update_consistency(self):
#     def tagged_words(self):
#     def __unicode__(self):
#     def from_string(sentence_id, depstring):
#     def __unicode__(self):
#     def __unicode__(self):
#     _PARSE_RE = re.compile(r"(.+)\((.*)-(\d+)'*, (.*)-(\d+)'*\)")


# Path: conceptnet/models.py
from django.db import models
from django.db.models import Q
from conceptnet.corpus.models import Language, Sentence, User, ScoredModel, Frequency
from events.models import Event, Activity
from voting.models import Vote, SCORES
from django.contrib.contenttypes import generic
from csc_utils.cache import cached
from datetime import datetime
from urllib import quote as urlquote
        from django.db.models import F
import re

        if c: assertion.save()
        raw_assertion.assertion = assertion
        
        sentence, c = Sentence.objects.get_or_create(
            text=frame.fill_in(text1, text2),
            creator=user,
            language=lang,
            activity=activity,
            defaults=dict(score=0)
        )
        if c:
            lang.sentence_count += 1
            lang.save()
            sentence.save()
        
        Event.record_event(sentence, user, activity)
        sentence.set_rating(user, vote, activity)
        raw_assertion.set_rating(user, vote, activity)
        Event.record_event(raw_assertion, user, activity)
        assertion.set_rating(user, vote, activity)
        Event.record_event(assertion, user, activity)
        
        raw_assertion.sentence = sentence
        raw_assertion.update_score()
        raw_assertion.save()
        return raw_assertion
    
    def update_score(self):
        if self.assertion is not None:
            self.assertion.update_raw_cache()

        ScoredModel.update_score(self)