コード例 #1
0
ファイル: datatables.py プロジェクト: DarjaAppelganz/apics
 def col_defs(self):
     return [
         IntegerIdCol(self, 'id'),
         LinkCol(self, 'name', sTitle='Language structure dataset'),
         ContributorsCol(self,
                         'contributors',
                         bSearchable=False,
                         bSortable=False,
                         sTitle='Authors of dataset'),
         Col(self,
             'lexifier',
             choices=get_distinct_values(Lect.lexifier,
                                         key=lambda v: 'z' + v
                                         if v == 'Other' else v),
             get_obj=lambda item: item.language,
             model_col=Lect.lexifier),
         Col(self,
             'region',
             choices=get_distinct_values(Lect.region),
             get_obj=lambda item: item.language,
             model_col=Lect.region),
         CitationCol(self, 'cite', bSearchable=False, bSortable=False),
         IntegerIdCol(self,
                      'survey',
                      get_object=lambda c: c.language.survey,
                      bSearchable=False,
                      bSortable=False,
                      sTitle='Survey'),
     ]
コード例 #2
0
ファイル: datatables.py プロジェクト: clld/tppsr
 def col_defs(self):
     return [
         IntegerIdCol(self, 'number'),
         LinkCol(self, 'name'),
         Col(
             self,
             'canton',
             sTitle='Canton',
             model_col=models.Variety.canton,
             choices=get_distinct_values(models.Variety.canton),
         ),
         Col(
             self,
             'group',
             sTitle='Dialect group',
             model_col=models.Variety.group,
             choices=get_distinct_values(models.Variety.group),
         ),
         #Col(self, 'population', model_col=models.Variety.population),
         Col(self,
             'recorded',
             model_col=models.Variety.recorded,
             sTitle='Date of recording'),
         Col(self,
             'latitude',
             sDescription='<small>The geographic latitude</small>'),
         Col(self,
             'longitude',
             sDescription='<small>The geographic longitude</small>'),
         LinkToMapCol(self, 'm'),
     ]
コード例 #3
0
 def col_defs(self):
     return [
         IntegerIdCol(self, 'id', sTitle='ID'),
         LinkCol(
             self,
             'language_name',
             route_name='language',
             sDescription=
             "This is the name of the language (or family, in the case "
             "of donor languages) that was adopted in the World Loanword Database. "
             "Alternative names can be found on the individual language pages."
         ),
         Col(self,
             'language_family',
             model_col=WoldLanguage.affiliation,
             sDescription=
             "This is the name of the highest family that is generally "
             "accepted to which the language belongs. "),
         VocabularyCol(
             self,
             'vocabulary',
             get_object=lambda i: i.vocabulary,
             sDescription="For recipient languages, this column shows the "
             "corresponding vocabulary."),
     ]
コード例 #4
0
    def col_defs(self):
        res = []

        if self.language:
            res.extend([
                IntegerIdCol(self,
                             'id',
                             model_col=Concept.id,
                             get_object=lambda x: x.valueset.parameter),
                ConceptLinkCol(self,
                               'concept',
                               model_col=Concept.name,
                               get_object=lambda x: x.valueset.parameter)
            ])

        elif self.parameter:
            res.extend([
                DoculectLinkCol(self,
                                'language',
                                model_col=Doculect.name,
                                get_object=lambda x: x.valueset.language)
            ])

        res.extend([
            Col(self, 'form', model_col=Word.name, sTitle='Orthographic form'),
            Col(self,
                'raw_ipa',
                model_col=Word.raw_ipa,
                sTitle='Automatically generated IPA'),
            # Col(self, 'norm_ipa', model_col=Word.norm_ipa, sTitle='Normalised IPA'),
            NextStepCol(self, 'next_step', model_col=Word.next_step)
        ])

        return res
コード例 #5
0
ファイル: datatables.py プロジェクト: somiyagawa/asjp
 def col_defs(self):
     res = []
     if self.parameter:
         res = [
             LinkCol(self,
                     'language',
                     model_col=Language.name,
                     get_object=lambda i: i.valueset.language),
         ]
     elif self.language:
         res = [
             IntegerIdCol(self,
                          'id',
                          input_size='mini',
                          model_col=Parameter.id,
                          get_object=lambda i: i.valueset.parameter),
             LinkCol(self,
                     'meaning',
                     model_col=Parameter.name,
                     get_object=lambda i: i.valueset.parameter),
         ]
     return res + [
         Col(self, 'name', sTitle='Word', model_col=Value.name),
         Col(self, 'loan', model_col=Word.loan),
     ]
コード例 #6
0
 def col_defs(self):
     return [
         IntegerIdCol(
             self,
             'id',
             sDescription=
             "The number in this column is the semantic field number. It "
             "is the first part of the Loanword Typology Code of the words in the "
             "corresponding field."),
         LinkCol(
             self,
             'name',
             sDescription=
             "The first 22 fields are the fields of the Intercontinental "
             "Dictionary Series meaning list, proposed by Mary Ritchie Key, and "
             "ultimately based on Carl Darling Buck's (1949) <i>Dictionary of selected"
             " synonyms in the principal Indo-European languages</i>. The other two "
             "fields were added for the Loanword Typology project."),
         NumberOfMeanings(
             self,
             'number_of_meanings',
             sDescription=
             "This gives the number of different meanings in each "
             "semantic field."),
         SemanticFieldScoreCol(self,
                               'borrowed_score',
                               sDescription='%s' % hb_borrowed_score()),
         SemanticFieldScoreCol(self,
                               'age_score',
                               sDescription='%s' % hb_age_score()),
         SemanticFieldScoreCol(self,
                               'simplicity_score',
                               sDescription='%s' % hb_simplicity_score()),
     ]
コード例 #7
0
 def col_defs(self):
     return [
         IntegerIdCol(self, 'id'),
         LinkCol(self, 'name'),
         PortugueseCol(self, 'portuguese', model_col=Concept.portuguese),
         SemanticClassCol(self, 'semantic_class', model_col=Concept.semantic_class),
         ConcepticonCol(self, 'concepticon_class', model_col=Concept.concepticon_class),
         EolCol(self, 'eol', model_col=Concept.eol)]
コード例 #8
0
 def col_defs(self):
     return [
         IntegerIdCol(self, 'id', model_col=Concept.id),
         LinkCol(self, 'name'),
         Col(self, 'english', model_col=Concept.english_name),
         Col(self, 'german', model_col=Concept.german_name),
         Col(self, 'russian', model_col=Concept.russian_name),
         ConcepticonCol(self,
                        'concepticon',
                        model_col=Concept.concepticon_name)
     ]
コード例 #9
0
ファイル: datatables.py プロジェクト: NikolaiLab/apics
 def col_defs(self):
     return [
         IntegerIdCol(self, 'id', model_col=Parameter.id),
         WalsFeatureCol(self, 'name', sTitle='Feature name', model_col=Parameter.name),
         AreaCol(self, 'area'),
         Col(self, 'atotal',
             sTitle='APiCS total', model_col=Feature.representation),
         Col(self, 'wtotal',
             sTitle='WALS total', model_col=Feature.wals_representation),
         WalsWalsCol(
             self, 'wfeature',
             sTitle='WALS feature', input_size='mini', model_col=Feature.wals_id)]
コード例 #10
0
 def col_defs(self):
     return [
         # ID, Vocabulary, Authors, Number of words, Percentage of loanwords, cite
         IntegerIdCol(
             self,
             'id',
             sTitle="ID",
             sDescription=literal(
                 "The vocabulary ID number corresponds to the ordering to the"
                 " chapters on the book <em>Loanwords in the World's Languages</em>. "
                 "Languages are listed in rough geographical order from west to east, "
                 "from Africa via Europe to Asia and the Americas, so that "
                 "geographically adjacent languages are next to each other."
             )),
         VocabularyCol(
             self,
             'vocabulary',
             sDescription=literal(
                 "<p>Each vocabulary of WOLD is a separate electronic "
                 "publication with a separate author or team of authors. Each vocabulary "
                 "has a characteristic colour in WOLD.</p><p>Click on a vocabulary to "
                 "see the words (loanwords and nonloanwords) and their properties.</p>"
             )),
         ContributorsCol(
             self,
             'contributor',
             sDescription=
             "The authors are experts of the language and its history. "
             "They also contributed a prose chapter on the borrowing situation in "
             "their language that was published in the book "
             "Loanwords in the World's Languages."),
         Col(self,
             'n',
             sTitle='Number of words',
             model_col=Vocabulary.count_words,
             sDescription="There would be 1814 words in each vocabulary, "
             "corresponding to the 1814 Loanword Typology meanings, if each meaning "
             "had exactly one counterpart, and if all the counterparts were "
             "different words. But many (\"polysomous\") words are counterparts of "
             "several meanings, many meanings have several word counterparts "
             "(\"synonyms\", or \"subcounterparts\"), and many meanings have no "
             "counterparts at all, so the number of words in each database varies "
             "considerably."),
         PercentCol(
             self,
             'p',
             sTitle='Percentage of loanwords',
             model_col=Vocabulary.borrowed_score,
             sDescription=
             "This gives the percentage of words in each language that "
             "are \"clearly borrowed\" or \"probably borrowed\"."),
         CitationCol(self, 'cite'),
     ]
コード例 #11
0
 def col_defs(self):
     return [
         Col(self, 'pk'),
         DetailsRowLinkCol(self, 'd'),
         LinkToMapCol(self, 'm'),
         LinkCol(self, 'link'),
         Col(self, 'active'),
         Col(self, 'name', model_col=None),
         Col(self, 'description', format=lambda i: 'x'),
         IntegerIdCol(self, 'id'),
         IdCol(self, 'nid',
               get_object=lambda i: i, model_col=common.Contributor.id),
         ExternalLinkCol(self, 'url')]
コード例 #12
0
ファイル: datatables.py プロジェクト: NikolaiLab/apics
 def col_defs(self):
     return [
         IntegerIdCol(self, 'id'),
         LinkCol(self, 'name', sTitle='Feature information'),
         ChapterCol(self, 'chapter', sTitle='Chapter'),
         Col(self,
             'feature_type',
             model_col=Feature.feature_type,
             sFilter='primary',
             choices=['primary', 'segment', 'sociolinguistic']),
         AreaCol(self, 'area'),
         WalsCol(self, 'WALS feature', model_col=Feature.wals_id),
         CitationCol(self, 'cite'),
     ]
コード例 #13
0
 def col_defs(self):
     return [
         IntegerIdCol(self, 'id', sTitle='ID'),
         LinkCol(self, 'name'),
         Col(self, 'description', sTitle='Definition'),
         Col(self,
             'semantic_field',
             choices=get_distinct_values(ConceptSet.semanticfield),
             model_col=ConceptSet.semanticfield),
         Col(self,
             'ontological_category',
             choices=get_distinct_values(ConceptSet.ontological_category),
             model_col=ConceptSet.ontological_category),
         Col(self,
             'representation',
             sDescription='number of concept lists this concept appears in',
             model_col=ConceptSet.representation),
     ]
コード例 #14
0
ファイル: datatables.py プロジェクト: LanguageStructure/TuLeD
    def col_defs(self):
        res = []

        if self.language:
            res.extend([
                IntegerIdCol(self,
                             'id',
                             model_col=Concept.id,
                             get_object=lambda x: x.valueset.parameter),
                ConceptLinkCol(self,
                               'concept',
                               model_col=Concept.name,
                               get_object=lambda x: x.valueset.parameter)
            ])

        elif self.parameter:
            res.extend([
                DoculectLinkCol(self,
                                'language',
                                model_col=Doculect.name,
                                get_object=lambda x: x.valueset.language)
            ])

        res.extend([
            Col(self, 'form', model_col=Word.name, sTitle='Orthographic form'),
            Col(self, 'tokens', model_col=Word.tokens, sTitle='Tokens'),
            Col(self,
                'simple_cognate',
                model_col=Word.simple_cognate,
                sTitle='Simple Cognate'),
            Col(self,
                'partial_cognate',
                model_col=Word.partial_cognate,
                sTitle='Partial Cognate'),
            Col(self,
                'morphemes',
                model_col=Word.morphemes,
                sTitle='Morphemes'),
            Col(self, 'notes', model_col=Word.notes, sTitle='Notes')
        ])

        return res
コード例 #15
0
    def col_defs(self):
        res = []

        if self.language:
            res.extend([
                IntegerIdCol(self, 'id', model_col=Concept.id,
                    get_object=lambda x: x.valueset.parameter),
                ConceptLinkCol(self, 'concept', model_col=Concept.name,
                    get_object=lambda x: x.valueset.parameter) ])

        elif self.parameter:
            res.extend([
                DoculectLinkCol(self, 'language', model_col=Doculect.name,
                    get_object=lambda x: x.valueset.language) ])

        res.extend([
            Col(self, 'form', model_col=Word.name, sTitle='Orthographic form'),
            Col(self, 'cognate', model_col=Word.cognate_class, sTitle='Cognate Class'),
            Col(self, 'notes', model_col= Word.notes, sTitle='Notes')])

        return res
コード例 #16
0
ファイル: datatables.py プロジェクト: aryamanarora/cdial
 def col_defs(self):
     return [
         IntegerIdCol(self, 'count'),
         LinkCol(self, 'name'),
         Col(self, 'count', model_col=models.Concept.count)
     ]
コード例 #17
0
    def col_defs(self):
        get_word = lambda item: item.word
        get_vocabulary = lambda item: item.valueset.contribution
        get_meaning = lambda item: item.valueset.parameter
        word_form_col = LinkCol(
            self,
            'word_form',
            model_col=Word.name,
            get_object=get_word,
            sDescription=literal(
                "<p>The word is given in the usual orthography or "
                "transcription, and in the usual citation form.</p><p>Click on a word to "
                "get more information than is shown in this table.</p>"))
        borrowed_col = Col(
            self,
            'borrowed',
            sTitle='Borrowed status',
            model_col=Word.borrowed,
            get_object=get_word,
            choices=get_distinct_values(Word.borrowed),
            sDescription=literal(
                "<p>There are five borrowed statuses, reflecting decreasing "
                "likelihood that the word is a loanword:</p><ol>"
                "<li>clearly borrowed</li><li>probably borrowed</li><li>perhaps borrowed</li>"
                "<li>very little evidence for borrowing</li>"
                "<li>no evidence for borrowing</li></ol>"))

        if self.parameter:
            return [
                IntegerIdCol(
                    self,
                    'vocid',
                    sTitle='Voc. ID',
                    model_col=common.Contribution.id,
                    get_object=get_vocabulary,
                    sDescription=
                    "The vocabulary ID corresponds to the ordering to the "
                    "chapters on the book <em>Loanwords in the World's Languages</em>. "
                    "Languages are listed in rough geographical order from west to east, "
                    "from Africa via Europe to Asia and the Americas, so that "
                    "geographically adjacent languages are next to each other."
                ),
                VocabularyCol(self, 'vocabulary', get_object=get_vocabulary),
                word_form_col,
                borrowed_col,
                CounterpartScoreCol(self, 'borrowed_score'),
                CounterpartScoreCol(self, 'age_score'),
                CounterpartScoreCol(self, 'simplicity_score'),
            ]
        if self.contribution:
            return [
                word_form_col,
                LWTCodeCol(self, 'lwt_code', get_object=get_meaning),
                LinkCol(
                    self,
                    'meaning',
                    model_col=common.Parameter.name,
                    get_object=get_meaning,
                    sDescription=
                    "This column shows the labels of the Loanword Typology "
                    "meanings. By clicking on a meaning label, you get more information "
                    "about the meaning, as well as a list of all words that are "
                    "counterparts of that meaning."),
                CoreListCol(self, 'core_list', get_object=get_meaning),
                borrowed_col,
                SourceWordsCol(
                    self,
                    'source_words',
                    bSearchable=False,
                    bSortable=False,
                    sDescription=
                    "For (possible) loanwords, this column shows the words "
                    "in the source languages that served as models."),
            ]

        return []  # pragma: no cover
コード例 #18
0
ファイル: datatables.py プロジェクト: NikolaiLab/apics
    def col_defs(self):
        kw = {}
        if self.language:
            kw['bSearchable'] = False
            kw['bSortable'] = False
        name_col = ApicsValueNameCol(self, 'value', **kw)
        if self.parameter and self.parameter.domain:
            name_col.choices = [de.name for de in self.parameter.domain]

        class ValueLanguageCol(LinkCol):
            def search(self, qs):
                if self.dt.language:
                    return ValueSet.language_pk == int(qs)
                if self.dt.parameter:
                    return icontains(self.dt.vs_lang.name, qs)

            def order(self):
                if self.dt.parameter:
                    return cast(self.dt.vs_lang.id, Integer)
                if self.dt.language:
                    return ValueSet.language_pk

        lang_col = ValueLanguageCol(
            self,
            'language',
            model_col=Language.name,
            get_obj=lambda item: item.valueset.language,
            bSearchable=bool(self.parameter or self.language),
            bSortable=bool(self.parameter or self.language))
        if self.language:
            if self.language.lects:
                lang_col.choices = [
                    (l.pk, l.name) for l in [self.language] + self.language.lects]
                lang_col.js_args['sTitle'] = 'lect'
            else:
                lang_col = None

        get_param = lambda i: i.valueset.parameter
        if self.parameter:
            return nfilter([
                lang_col,
                name_col,
                Col(self,
                    'lexifier',
                    format=lambda i: i.valueset.language.lexifier,
                    model_col=self.vs_lect.lexifier,
                    choices=get_distinct_values(
                        Lect.lexifier,
                        key=lambda v: 'z' + v if v == 'Other' else v)),
                LinkToMapCol(
                    self, 'm', get_object=lambda i: None
                    if i.valueset.language.language_pk else i.valueset.language),
                DetailsRowLinkCol(self, 'more')
                if self.parameter.feature_type != 'sociolinguistic' else None,
                RefsCol(self, 'source')
                if self.parameter.feature_type != 'segment' else None,
            ])
        if self.language:
            return nfilter([
                IntegerIdCol(self, 'id', get_obj=get_param, model_col=Parameter.id),
                LinkCol(self, 'parameter', get_obj=get_param, model_col=Parameter.name),
                name_col,
                lang_col,
                DetailsRowLinkCol(self, 'more'),
                RefsCol(self, 'source'),
            ])
        return [
            LinkCol(self, 'parameter', get_obj=get_param, model_col=Parameter.name),
            name_col,
            lang_col,
            DetailsRowLinkCol(self, 'more'),
            RefsCol(self, 'source'),
        ]