# 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

class Relation(models.Model):
    name = models.CharField(max_length=128,unique=True)
    description = models.CharField(max_length=255, null=True, blank=True)

    def __unicode__(self):
        return self.name

    @classmethod
    def get(cls, name):
        # Check if the parameter is already a Relation. We don't use
        # isinstance in case of accidental multiple imports (e.g.,
        # conceptnet.models vs conceptnet4.models).
        if hasattr(name, 'id'):
            return name
        return cls.objects.get(name=name)

class Frame(models.Model):
    """
    A Frame is a natural-language template containing two slots, representing a
    way that a :class:`Relation` could be expressed in language.
    
    It can be used
    for pattern matching to create a :class:`RawAssertion`, or to express an
    existing :class:`RawAssertion` as a sentence.
    """
    language = models.ForeignKey(Language)
    text = models.TextField()
    relation = models.ForeignKey(Relation)
    goodness = models.IntegerField()

# 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


class Relation(models.Model):
    name = models.CharField(max_length=128,unique=True)
    description = models.CharField(max_length=255, null=True, blank=True)

    def __unicode__(self):
        return self.name

    @classmethod
    def get(cls, name):
        # Check if the parameter is already a Relation. We don't use
        # isinstance in case of accidental multiple imports (e.g.,
        # conceptnet.models vs conceptnet4.models).
        if hasattr(name, 'id'):
            return name
        return cls.objects.get(name=name)

class Frame(models.Model):
    """
    A Frame is a natural-language template containing two slots, representing a
    way that a :class:`Relation` could be expressed in language.
    
    It can be used
    for pattern matching to create a :class:`RawAssertion`, or to express an
    existing :class:`RawAssertion` as a sentence.
    """
    language = models.ForeignKey(Language)
    text = models.TextField()
    relation = models.ForeignKey(Relation)
    goodness = models.IntegerField()

    frequency = models.ForeignKey(Frequency)