예제 #1
0
파일: adapters.py 프로젝트: clld/wold2
 def convert(self, model, item, req):
     res = CldfConfig.convert(self, model, item, req)
     if model == Parameter:
         res.update(
             SemanticField=item.semantic_field.name,
             SemanticCategory=item.semantic_category,
             IDS_code=item.ids_code,
             TypicalContext=item.typical_context,
             CoreList=item.core_list,
             BorrowedScore=item.borrowed_score,
             AgeScore=item.age_score,
             SimplicityScore=item.simplicity_score,
         )
     if model == Value:
         res['Word_ID'] = item.word.id
         res.update({p: item.word.jsondata.get(p) or '' for p in props})
         res.update(
             Source=[item.valueset.contribution.id],
             BorrowedScore=item.word.borrowed_score,
             AgeScore=item.word.age_score,
             SimplicityScore=item.word.simplicity_score,
             Borrowed=item.word.borrowed,
             Analyzability=item.word.analyzability,
             Age=item.word.age.unitdomainelement.name if item.word.age else None,
             ContactSituation=item.word.contact_situation.unitdomainelement.name if item.word.contact_situation else None,
         )
     return res
예제 #2
0
 def convert(self, model, item, req):
     res = CldfConfig.convert(self, model, item, req)
     if model == Value:
         res['Example_IDs'] = [
             sa.sentence.id for sa in item.sentence_assocs
         ]
     return res
예제 #3
0
파일: adapters.py 프로젝트: elreynol/wold2
 def convert(self, model, item, req):
     res = CldfConfig.convert(self, model, item, req)
     if model == Parameter:
         res.update(
             SemanticField=item.semantic_field.name,
             SemanticCategory=item.semantic_category,
             IDS_code=item.ids_code,
             TypicalContext=item.typical_context,
             CoreList=item.core_list,
             BorrowedScore=item.borrowed_score,
             AgeScore=item.age_score,
             SimplicityScore=item.simplicity_score,
         )
     if model == Value:
         res['Word_ID'] = item.word.id
         res.update({p: item.word.jsondata.get(p) or '' for p in props})
         res.update(
             Source=[item.valueset.contribution.id],
             BorrowedScore=item.word.borrowed_score,
             AgeScore=item.word.age_score,
             SimplicityScore=item.word.simplicity_score,
             Borrowed=item.word.borrowed,
             Analyzability=item.word.analyzability,
             Age=item.word.age.unitdomainelement.name
             if item.word.age else None,
             ContactSituation=item.word.contact_situation.unitdomainelement.
             name if item.word.contact_situation else None,
         )
     return res
예제 #4
0
    def convert(self, model, item, req):
        res = CldfConfig.convert(self, model, item, req)

        if model == Language:
            res['Macroarea'] = item.macroarea
            res['Family'] = item.family

        return res
예제 #5
0
파일: adapters.py 프로젝트: clld/sails
    def convert(self, model, item, req):
        res = CldfConfig.convert(self, model, item, req)

        if model == DomainElement:
            res['ID'] = res['ID'].replace('N/A', 'NA').replace('?', 'NN')

        if model == Value:
            res['Code_ID'] = res['Code_ID'].replace('N/A', 'NA').replace('?', 'NN')

        return res
예제 #6
0
파일: __init__.py 프로젝트: clld/ids
 def convert(self, model, item, req):
     res = CldfConfig.convert(self, model, item, req)
     if model == Value:
         res['transcription'] = item.word.description
         res['alt_form'] = item.word.alt_name
         res['alt_transcription'] = item.word.alt_description
         res['Source'] = [r.source.id for r in item.valueset.contribution.references]
     if model == Parameter:
         res['Concepticon_ID'] = item.concepticon_id
     return res
예제 #7
0
 def convert(self, model, item, req):
     res = CldfConfig.convert(self, model, item, req)
     if model == Language:
         res.update(Genus=item.genus.name)
     return res
예제 #8
0
파일: adapters.py 프로젝트: clld/apics
 def convert(self, model, item, req):
     res = CldfConfig.convert(self, model, item, req)
     if model == Value:
         res['Example_IDs'] = [sa.sentence.id for sa in item.sentence_assocs]
     return res
예제 #9
0
파일: __init__.py 프로젝트: clld/asjp
 def convert(self, model, item, req):
     res = CldfConfig.convert(self, model, item, req)
     if model == Value:
         res['Loan'] = item.loan
         res['Source'] = [s.id for s in item.valueset.language.sources]
     return res
예제 #10
0
파일: adapters.py 프로젝트: clld/wals3
 def convert(self, model, item, req):
     res = CldfConfig.convert(self, model, item, req)
     if model == Language:
         res.update(Genus=item.genus.name)
     return res