# Path: conceptnet/corpus/models.py
# class Language(models.Model):
#     """
#     A database object representing a language.
# 
#     Instances of Language can be used in filter expressions to select only
#     objects that apply to a particular language. For example:
#     
#     >>> en = Language.get('en')
#     >>> english_sentences = Sentence.objects.filter(language=en)
#     """
#     id = models.CharField(max_length=16,primary_key=True)
#     name = models.TextField(blank=True)
#     sentence_count = models.IntegerField(default=0)
# 
#     def __str__(self):
#         return "%s (%s)" % (self.name, self.id)
# 
#     @staticmethod
#     def get(id):
#         """
#         Get a language from its ISO language code.
# 
#         Some relevant language codes::
# 
#             en = English
#             pt = Portuguese
#             ko = Korean
#             ja = Japanese
#             nl = Dutch
#             es = Spanish
#             fr = French
#             ar = Arabic
#             zh = Chinese
#         """
#         if isinstance(id,Language): return id
#         return get_lang(id)
# 
#     @property
#     def nl(self):
#         """
#         A collection of natural language tools for a language.
# 
#         See :mod:`simplenlp` for more information on using these tools.
#         """
#         return get_nl(self.id)
# 
# Path: conceptnet/models.py
# 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)


from django.db import models
from conceptnet.corpus.models import Language
from conceptnet.models import Relation

class FunctionFamilyDetector(object):
    def __init__(self,kb,language,family):
        self.language = language
        self.kb = kb
        self.family = family

    def __str__(self):
        return '<' + self.language.id + ': ' + \
                'function words (family=' + self.family + ')>'

    def __call__(self,word):

# Path: conceptnet/corpus/models.py
# class Language(models.Model):
#     """
#     A database object representing a language.
# 
#     Instances of Language can be used in filter expressions to select only
#     objects that apply to a particular language. For example:
#     
#     >>> en = Language.get('en')
#     >>> english_sentences = Sentence.objects.filter(language=en)
#     """
#     id = models.CharField(max_length=16,primary_key=True)
#     name = models.TextField(blank=True)
#     sentence_count = models.IntegerField(default=0)
# 
#     def __str__(self):
#         return "%s (%s)" % (self.name, self.id)
# 
#     @staticmethod
#     def get(id):
#         """
#         Get a language from its ISO language code.
# 
#         Some relevant language codes::
# 
#             en = English
#             pt = Portuguese
#             ko = Korean
#             ja = Japanese
#             nl = Dutch
#             es = Spanish
#             fr = French
#             ar = Arabic
#             zh = Chinese
#         """
#         if isinstance(id,Language): return id
#         return get_lang(id)
# 
#     @property
#     def nl(self):
#         """
#         A collection of natural language tools for a language.
# 
#         See :mod:`simplenlp` for more information on using these tools.
#         """
#         return get_nl(self.id)
# 
# Path: conceptnet/models.py
# 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)


# Path: conceptnet/corpus/parse/models.py
from django.db import models
from conceptnet.corpus.models import Language
from conceptnet.models import Relation


class FunctionFamilyDetector(object):
    def __init__(self,kb,language,family):
        self.language = language
        self.kb = kb
        self.family = family

    def __str__(self):
        return '<' + self.language.id + ': ' + \
                'function words (family=' + self.family + ')>'

    def __call__(self,word):

        return (word in self.kb)