Commit 8afdc5a02c5b2caae3eb8ddb098ba4fd2da0b4e2

Authored by Bartłomiej Nitoń
2 parents aa996d50 f3b0badd

Merge branch 'bartek' into dev

dictionary/teixml.py
... ... @@ -127,6 +127,13 @@ def write_schema(parent_elem, schema, lemma):
127 127 schema_fs_elem = etree.SubElement(parent_elem, 'fs')
128 128 schema_fs_elem.attrib[etree.QName(XML_NAMESPACE, 'id')] = schema_xml_id
129 129 schema_fs_elem.attrib['type'] = 'schema'
  130 +
  131 + # reprezentacja tekstowa
  132 + text_rep_f_elem = etree.SubElement(schema_fs_elem, 'f')
  133 + text_rep_f_elem.attrib['name'] = 'text_rep'
  134 + text_rep_string = etree.SubElement(text_rep_f_elem, 'string')
  135 + text_rep_string.text = schema.get_position_spaced_text_rep().replace(':',': ')
  136 +
130 137 # opinia o schemacie
131 138 try:
132 139 schema_opinion = lemma.frame_opinions.filter(frame=schema).all()[0].value.short
... ...
semantics/management/commands/count_semantic_stats.py 0 → 100644
  1 +#-*- coding:utf-8 -*-
  2 +
  3 +from django.core.management.base import BaseCommand
  4 +
  5 +from dictionary.models import Lemma
  6 +
  7 +class Command(BaseCommand):
  8 + args = 'none'
  9 + help = ""
  10 +
  11 + def handle(self, **options):
  12 + count_semantic_stats()
  13 +
  14 +def count_semantic_stats():
  15 + count = {'frames': 0,
  16 + 'arguments': 0}
  17 + lemmas = Lemma.objects.filter(old=False).order_by('entry_obj__name')
  18 + for lemma in lemmas:
  19 + if lemma.semantics_ready():
  20 + print lemma
  21 + frames = lemma.entry_obj.actual_frames()
  22 + count['frames'] += frames.count()
  23 + for frame in frames.all():
  24 + count['arguments'] += frame.complements.count()
  25 + print u'Frames:\t%d' % count['frames']
  26 + print u'Arguments:\t%d' % count['arguments']
... ...