From 8315da395a2a99111bf3e9d0ab3846f7ddbf9732 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Tue, 19 Oct 2021 14:33:15 +0200 Subject: report: Remove example sentences. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I feel they don’t really convey which parts of a layout are difficult to use and the sentences used were quite arbitrary. They should be replaced by something better. --- lulua/data/report/index.html | 17 ---------------- lulua/data/report/style.css | 5 ----- lulua/report.py | 16 --------------- lulua/stats.py | 48 -------------------------------------------- 4 files changed, 86 deletions(-) diff --git a/lulua/data/report/index.html b/lulua/data/report/index.html index 4923e98..5d08c5b 100644 --- a/lulua/data/report/index.html +++ b/lulua/data/report/index.html @@ -415,23 +415,6 @@ {% endif %} {% endfor %} -
-

Examples:

- -
{% endmacro %}
diff --git a/lulua/data/report/style.css b/lulua/data/report/style.css index ed0d32d..879114e 100644 --- a/lulua/data/report/style.css +++ b/lulua/data/report/style.css @@ -157,11 +157,6 @@ div.fingerhandstats .fingers .index { div.fingerhandstats .fingers .thumb { border: 0.1em solid var(--finger-thumb); } -div.sentencestats ul { - list-style-type: none; - margin: 1em 0; - padding: 0; -} .table-overflow { overflow-x: auto; diff --git a/lulua/report.py b/lulua/report.py index b25201d..7d0294a 100644 --- a/lulua/report.py +++ b/lulua/report.py @@ -60,21 +60,6 @@ def arabnum (s): m = {'0': '٠', '1': '١', '2': '٢', '3': '٣', '4': '٤', '5': '٥', '6': '٦', '7': '٧', '8': '٨', '9': '٩', ',': '٬', '.': '٫'} return ''.join (map (lambda x: m.get (x, x), s)) -def clamp (v, lower, upper): - return max (min (v, upper), lower) - -def blend (v, a, b): - v = clamp (v, 0, 1) - return (b-a)*v+a - -def blendn (v, *l): - assert 0 <= v <= 1 - n = len (l) - step = 1/(n-1) - i = min (int (math.floor (v/step)), n-2) - stretchedv = (v-i*step)/step - return [blend (stretchedv, x, y) for x, y in zip (l[i], l[i+1])] - def render (): parser = argparse.ArgumentParser(description='Create lulua report.') parser.add_argument('-c', '--corpus', nargs='+', metavar='FILE', help='Corpus metadata files') @@ -88,7 +73,6 @@ def render (): env.filters['approx'] = approx env.filters['numspace'] = numspace env.filters['arabnum'] = arabnum - env.filters['blendn'] = blendn env.filters['fraction'] = fraction corpus = [] diff --git a/lulua/stats.py b/lulua/stats.py index 1d051b3..0925c0d 100644 --- a/lulua/stats.py +++ b/lulua/stats.py @@ -315,47 +315,6 @@ def keyHeatmap (args): buttons[k.name] = v yaml.dump (data, sys.stdout) -def sentenceStats (keyboard, layout, text): - """ - Calculate effort for every character (button) in a text - """ - - writer = Writer (layout) - - effort = Carpalx (models['mod01'], writer) - _ignored = frozenset (keyboard[x] for x in ('Fl_space', 'Fr_space', 'CD_ret', 'Cl_tab')) - writtenText = [] - skipped = 0 - for match, event in writer.type (StringIO (text)): - if isinstance (event, SkipEvent): - skipped += 1 - writtenText.append ([event.char, None, 0]) - if not isinstance (event, ButtonCombination): - continue - - writtenText.append ([match, event, 0]) - - triad = list (filter (lambda x: x[1] is not None and first (x[1].buttons) not in _ignored, writtenText))[-3:] - if len (triad) == 3: - matchTriad, buttonTriad, _ = zip (*triad) - triadEffort = effort._triadEffort (tuple (buttonTriad)) - - # now walk the existing text backwards to find the original matches and add the computed effort - writtenTextIt = iter (reversed (writtenText)) - matchTriad = list (matchTriad) - while matchTriad: - t = next (writtenTextIt) - if t[0] == matchTriad[-1]: - matchTriad.pop () - t[2] += triadEffort - - effort.addTriad (buttonTriad, 1) - - # normalize efforts to [0, 1] - s = max (map (lambda x: x[2], writtenText)) - writtenText = list (map (lambda x: (x[0], x[2]/s if x[1] is not None else None), writtenText)) - return (writtenText, effort.effort, skipped) - from .text import mapChars, charMap def layoutstats (args): @@ -378,12 +337,6 @@ def layoutstats (args): asymmetry = hands[LEFT]/buttonPresses - hands[RIGHT]/buttonPresses - sentences = [ - 'أَوْ كَصَيِّبٍ مِّنَ السَّمَاءِ فِيهِ ظُلُمَاتٌ وَرَعْدٌ وَبَرْقٌ يَجْعَلُونَ أَصَابِعَهُمْ فِي آذَانِهِم مِّنَ الصَّوَاعِقِ حَذَرَ الْمَوْتِ وَاللَّهُ مُحِيطٌ بِالْكَافِرِينَ', - 'اللغة العربية هي أكثرُ اللغاتِ السامية تحدثاً، وإحدى أكثر اللغات انتشاراً في العالم، يتحدثُها أكثرُ من 467 مليون نسمة.', - ] - sentences = [sentenceStats (keyboard, layout, mapChars (s, charMap).replace ('\r\n', '\n')) for s in sentences] - # Impact of hamza yah = '\u064a' waw = '\u0648' @@ -411,7 +364,6 @@ def layoutstats (args): fingers=dict (fingers), buttonPresses=buttonPresses, asymmetry=asymmetry, - sentences=sentences, hamzaImpact=hamzaImpact, hamzaOnAlef=hamzaOnAlef, ), sys.stdout.buffer) -- cgit v1.2.3