From 1572fc826b874576a9395ef00b6fb081f3a9ccca Mon Sep 17 00:00:00 2001 From: lkrsnik Date: Sat, 1 Aug 2026 20:27:51 +0200 Subject: [PATCH] Added Complexity measures --- app.py | 9 +- messages.pot | 120 ++++++++++++++---------- requirements.txt | 2 +- setup.py | 2 +- static/js/init.js | 2 +- templates/index.html | 15 +++ translations/en/LC_MESSAGES/messages.mo | Bin 8134 -> 8386 bytes translations/en/LC_MESSAGES/messages.po | 12 +++ translations/sl/LC_MESSAGES/messages.mo | Bin 10306 -> 10579 bytes translations/sl/LC_MESSAGES/messages.po | 12 +++ 10 files changed, 117 insertions(+), 57 deletions(-) diff --git a/app.py b/app.py index f6bd652..6fc083e 100755 --- a/app.py +++ b/app.py @@ -174,7 +174,9 @@ def create_app(): 'BIC': gettext('BIC'), 'MI': gettext('MI'), 'logDice': gettext('logDice'), - 't-score': gettext('t-score') + 't-score': gettext('t-score'), + 'Max depth': gettext('Max depth'), + 'MDD': gettext('MDD') } if 'Absolute frequency in second treebank' in head: table_columns2displayed_table_columns['Absolute frequency'] = gettext('Frequency in A') @@ -254,7 +256,9 @@ def create_app(): 'BIC': gettext('BIC'), 'MI': gettext('MI'), 'logDice': gettext('logDice'), - 't-score': gettext('t-score') + 't-score': gettext('t-score'), + 'Max depth': gettext('Max depth'), + 'MDD': gettext('MDD') } if 'Absolute frequency in second treebank' in head: table_columns2displayed_table_columns['Absolute frequency'] = gettext('Frequency in A') @@ -407,6 +411,7 @@ def create_app(): configs['dependency_type'] = 'labeled_trees' in form and form['labeled_trees'] == 'on' configs['node_order'] = 'fixed_order' in form and form['fixed_order'] == 'on' configs['association_measures'] = 'association_measures' in form and form['association_measures'] == 'on' + configs['complexity_measures'] = 'yes' if 'complexity_measures' in form and form['complexity_measures'] == 'on' else 'no' configs['label_whitelist'] = [] configs['root_whitelist'] = [] diff --git a/messages.pot b/messages.pot index 7d25c8a..87f3d18 100644 --- a/messages.pot +++ b/messages.pot @@ -1,14 +1,14 @@ # Translations template for PROJECT. -# Copyright (C) 2025 ORGANIZATION +# Copyright (C) 2026 ORGANIZATION # This file is distributed under the same license as the PROJECT project. -# FIRST AUTHOR , 2025. +# FIRST AUTHOR , 2026. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" -"POT-Creation-Date: 2025-05-17 13:14+0200\n" +"POT-Creation-Date: 2026-08-01 20:04+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,126 +17,134 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: Babel 2.14.0\n" -#: app.py:164 app.py:244 +#: app.py:164 app.py:246 msgid "Tree" msgstr "" -#: app.py:165 app.py:245 +#: app.py:165 app.py:247 msgid "Frequency" msgstr "" -#: app.py:166 app.py:246 +#: app.py:166 app.py:248 msgid "Frequency in B" msgstr "" -#: app.py:167 app.py:247 +#: app.py:167 app.py:249 msgid "Order" msgstr "" -#: app.py:168 app.py:248 +#: app.py:168 app.py:250 msgid "Number of nodes" msgstr "" -#: app.py:169 app.py:249 +#: app.py:169 app.py:251 msgid "Head node" msgstr "" -#: app.py:170 app.py:250 +#: app.py:170 app.py:252 msgid "Grew-match URL" msgstr "" -#: app.py:171 app.py:251 +#: app.py:171 app.py:253 +msgid "Max depth" +msgstr "" + +#: app.py:172 app.py:254 +msgid "MDD" +msgstr "" + +#: app.py:173 app.py:255 msgid "Ratio" msgstr "" -#: app.py:172 app.py:252 +#: app.py:174 app.py:256 msgid "%DIFF" msgstr "" -#: app.py:173 app.py:253 +#: app.py:175 app.py:257 msgid "OR" msgstr "" -#: app.py:174 app.py:254 +#: app.py:176 app.py:258 msgid "BIC" msgstr "" -#: app.py:175 app.py:255 +#: app.py:177 app.py:259 msgid "MI" msgstr "" -#: app.py:176 app.py:256 +#: app.py:178 app.py:260 msgid "logDice" msgstr "" -#: app.py:177 app.py:257 +#: app.py:179 app.py:261 msgid "t-score" msgstr "" -#: app.py:180 app.py:260 +#: app.py:182 app.py:264 msgid "Frequency in A" msgstr "" -#: app.py:341 app.py:342 +#: app.py:345 app.py:346 msgid "Please insert either input url or file, not both of them." msgstr "" -#: app.py:352 app.py:447 +#: app.py:356 app.py:452 msgid "Incorrect URL!" msgstr "" -#: app.py:354 app.py:355 +#: app.py:358 app.py:359 msgid "Please insert either input url or provide a file." msgstr "" -#: app.py:361 +#: app.py:365 msgid "" "Please insert an integer number or a range separated with `-`, without " "spaces. Example: 3 or 2-4." msgstr "" -#: app.py:366 +#: app.py:370 msgid "" "Please set a maximum display size to a number equal or lower to 4, when " "extracting Incomplete trees. Or search through complete trees (Complete " "trees parameter)." msgstr "" -#: app.py:375 +#: app.py:379 msgid "Please select at least one node type." msgstr "" -#: app.py:380 +#: app.py:384 msgid "Node option" msgstr "" -#: app.py:380 +#: app.py:384 msgid "is not supported. Please enter valid options." msgstr "" -#: app.py:435 app.py:436 +#: app.py:440 app.py:441 msgid "Please insert either compare url or file, not both of them." msgstr "" -#: app.py:459 +#: app.py:464 msgid "Please insert an Integer." msgstr "" -#: app.py:495 +#: app.py:500 msgid "" "Processing failed! Please recheck your settings, e.g. input format or " "head node description." msgstr "" -#: app.py:504 +#: app.py:509 msgid "Frequency " msgstr "" -#: app.py:504 +#: app.py:509 msgid "Frequency in A " msgstr "" -#: app.py:505 templates/base.html:23 templates/base.html:24 +#: app.py:510 templates/base.html:23 templates/base.html:24 #: templates/base.html:26 templates/index.html:8 templates/result.html:21 msgid "code" msgstr "" @@ -193,11 +201,11 @@ msgstr "" msgid "impressum_card_content" msgstr "" -#: templates/about.html:83 +#: templates/about.html:60 msgid "about_card_content" msgstr "" -#: templates/about.html:94 +#: templates/about.html:65 msgid "version_card_content" msgstr "" @@ -245,20 +253,20 @@ msgstr "" msgid "Upload a treebank" msgstr "" -#: templates/index.html:12 templates/index.html:20 templates/index.html:191 -#: templates/index.html:198 +#: templates/index.html:12 templates/index.html:20 templates/index.html:206 +#: templates/index.html:213 msgid "in CONLL-U format" msgstr "" #: templates/index.html:12 templates/index.html:43 templates/index.html:83 #: templates/index.html:98 templates/index.html:120 templates/index.html:126 #: templates/index.html:132 templates/index.html:142 templates/index.html:148 -#: templates/index.html:156 templates/index.html:171 templates/index.html:190 -#: templates/index.html:191 +#: templates/index.html:156 templates/index.html:186 templates/index.html:205 +#: templates/index.html:206 msgid "Help" msgstr "" -#: templates/index.html:15 templates/index.html:194 +#: templates/index.html:15 templates/index.html:209 msgid "Browse" msgstr "" @@ -266,11 +274,11 @@ msgstr "" msgid "Upload" msgstr "" -#: templates/index.html:29 templates/index.html:208 +#: templates/index.html:29 templates/index.html:223 msgid "Or" msgstr "" -#: templates/index.html:29 templates/index.html:208 +#: templates/index.html:29 templates/index.html:223 msgid "insert a URL link to a treebank in CONLL-U format" msgstr "" @@ -311,12 +319,12 @@ msgid "include names of dependency relations" msgstr "" #: templates/index.html:87 templates/index.html:102 templates/index.html:160 -#: templates/index.html:175 +#: templates/index.html:175 templates/index.html:190 msgid "No" msgstr "" #: templates/index.html:90 templates/index.html:105 templates/index.html:163 -#: templates/index.html:178 +#: templates/index.html:178 templates/index.html:193 msgid "Yes" msgstr "" @@ -381,46 +389,54 @@ msgid "print MI, logDice and t-score" msgstr "" #: templates/index.html:171 +msgid "Complexity measures" +msgstr "" + +#: templates/index.html:171 +msgid "print maximum tree depth and mean dependency distance (MDD)" +msgstr "" + +#: templates/index.html:186 msgid "Complete trees" msgstr "" -#: templates/index.html:171 +#: templates/index.html:186 msgid "extract head node with all its dependants" msgstr "" -#: templates/index.html:171 +#: templates/index.html:186 msgid "" "Note: Extracting incomplete trees ('No' option) is slow and limited to a " "maximum tree size of 4 nodes." msgstr "" -#: templates/index.html:186 +#: templates/index.html:201 msgid "Compare treebanks" msgstr "" -#: templates/index.html:190 +#: templates/index.html:205 msgid "" "Select a reference treebank to identify key phenomena (prints the " "%DIFF, BIC and OR keyness scores)." msgstr "" -#: templates/index.html:191 templates/index.html:198 +#: templates/index.html:206 templates/index.html:213 msgid "Upload a compare corpus" msgstr "" -#: templates/index.html:224 +#: templates/index.html:239 msgid "Submit" msgstr "" -#: templates/index.html:232 +#: templates/index.html:247 msgid "No results" msgstr "" -#: templates/index.html:233 +#: templates/index.html:248 msgid "Processing with your settings didnt produce any results!" msgstr "" -#: templates/index.html:249 +#: templates/index.html:264 msgid "" "Extracting incomplete trees ('No' option) is slow and limited to a " "maximum tree size of 4 nodes." diff --git a/requirements.txt b/requirements.txt index 6a9ca33..e026ba6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ Flask==3.0.0 requests==2.31.0 flask-babel==4.0.0 -stark-trees==3.1.0 +stark-trees @ git+https://github.com/clarinsi/STARK.git@f0a61fe59bdc9b123beabfcdb78544ae01c961d2 conllu==6.0.0 \ No newline at end of file diff --git a/setup.py b/setup.py index 98f9950..7afb856 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ setup(name='stark-api', 'Flask==3.0.0', 'requests==2.31.0', 'flask-babel==4.0.0', - 'stark-trees==3.1.0', + 'stark-trees @ git+https://github.com/clarinsi/STARK.git@f0a61fe59bdc9b123beabfcdb78544ae01c961d2', 'conllu==6.0.0' ], ) \ No newline at end of file diff --git a/static/js/init.js b/static/js/init.js index 5401cfe..99c24d7 100644 --- a/static/js/init.js +++ b/static/js/init.js @@ -1,5 +1,5 @@ // Global array to store input names -var globalInputList = ['display_size', 'file', 'association_measures', 'labeled_trees', 'node_type_upos', 'fixed_order', 'input_url', 'node_type_lemma', 'root_restriction', 'node_type_form', 'frequency_threshold', 'node_type_none', 'query', 'compare_url', 'compare_file', 'ignored_labels', 'complete_trees']; +var globalInputList = ['display_size', 'file', 'association_measures', 'complexity_measures', 'labeled_trees', 'node_type_upos', 'fixed_order', 'input_url', 'node_type_lemma', 'root_restriction', 'node_type_form', 'frequency_threshold', 'node_type_none', 'query', 'compare_url', 'compare_file', 'ignored_labels', 'complete_trees']; var visualInputList = ['advanced-tree-expand', 'compare-expand'] // Function to store values to local storage diff --git a/templates/index.html b/templates/index.html index 41ba260..993c95f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -166,6 +166,21 @@ +
+
+ +
+
+ +
+
+
+
diff --git a/translations/en/LC_MESSAGES/messages.mo b/translations/en/LC_MESSAGES/messages.mo index 383c390139b0bda954f6a01b3b73e22ea21d6201..8253bf3de73e79469f8ac7b90702aba33a8aee69 100644 GIT binary patch delta 1537 zcmbu-Pe@cz6vy$K|Ed{hEGNn|?WqZx3n?l~ix8C{^ACYhWYpBWa=@9y89^hO+K3=3 zF_mCo1TM@)MMl&j0wal9{w2FApAI8a{Q#Q>ckPAc5uwE=R4Vu?t<8hDsoliwAR&P*Z|SaVsX`F4X@k zP&L*pypI`E$Bi;N-~=2;CDMWlJc~*&hN`F!%W(vE;5*!eIjnXa8?Xt#;C8I1{ATP% zLd|DXV&Bli`U`0(GcT8P%s>SeqguQf)w;c?N}5n{$50hVFcmML3h6^_(IBdWw@~qq zQJs5*B{+?-)!ex0qZY`+6}Sb}fokV@BNi||g{rg{bygl>Hoif1BID?w7%LyEGyyiHJe9a9mbkW>L);8m)geOsZ z{0g;YGpM+?s5AA^c|RZHMhSd%0upHlT{Iq4U6IPjCo7;X&+Y zAIoqS&tpFAQv$=N`EH^Tjy-fTnuc@rX{-K5KEWMv?BBJ68NzQlqc(bf~q( z?g&OZt&r`Hw71!jcuw+jPi<9|sr7eQ0lPKY9543fkGWHNlgeA$g5jtY@^=J7?IA1L zX4{JqmOmWO1Yr&BaKH|q=(GaCNYo!bVOxdFRx~!?dY$l(^)|#WdanMx=2)?JB<+9J Oix0ShW92zLOMU~Ualvu` delta 1284 zcmYMyUr3Wt7{~F)KU=lUP1isFp0?Z%MkVk}4&*_{wX2?pv#27yrY{kaz!@6P9(^PY3w^E~IgJ6=4N`4X&s zWc>R0@8O@WR_p)oL#>&M<~%mw0`9;i+>IOP#vp?2}+Owz+7qJfKk;fJ(w%}J(EI*v~3TgwtQ0r-O zfbW}!iUu|#JF-?(1X1k8Qy9m)cm&_zQ(VIfIK|hxaTSxepRjpllc5TE-gOKn?thTA+d1J`AHGiK3388ml~t$XCu*m^kz|;g234y^Z8U^B(+KL$M4fgFwSg|wypu?BtRFRQ1bJ+f zq7AR%QJly)l@cDH!$rPwco;{pj6K-Nf!)Dz)CayJQ)~^j!9PyFmo(}Q>_la*6I(Eb zJl02{yOqGpM3Nb!GC@bNv2rPf$h#sP$0fXqifo{{lIl@ZL`jU{b!?~O37)1s$A#I< z92Z6zs7HOc1v~H%D)M2BfK5^1vDXw@Z~=9>YC@IBdQoS626efHa1qm(z`=0kNM0hz vvO+lPah=Py`S)d~T{GDge|!Fh`$28C97^VM-c&Vj=JG54nLxfATCe&C)@pd| diff --git a/translations/en/LC_MESSAGES/messages.po b/translations/en/LC_MESSAGES/messages.po index b4db877..2ba0852 100644 --- a/translations/en/LC_MESSAGES/messages.po +++ b/translations/en/LC_MESSAGES/messages.po @@ -425,6 +425,18 @@ msgstr "specify the minimum frequency of a tree in the treebank" msgid "Association measures" msgstr "Association measures" +msgid "Complexity measures" +msgstr "Complexity measures" + +msgid "print maximum tree depth and mean dependency distance (MDD)" +msgstr "print maximum tree depth and mean dependency distance (MDD)" + +msgid "Max depth" +msgstr "Max depth" + +msgid "MDD" +msgstr "MDD" + #: templates/index.html:156 msgid "print MI, logDice and t-score" msgstr "print MI, logDice and t-score" diff --git a/translations/sl/LC_MESSAGES/messages.mo b/translations/sl/LC_MESSAGES/messages.mo index 79d046a61be7098286bca7516f5c4dd2bfc178bf..bb056e1a34e1f652e53e2b2fee411f41e1edd8fd 100644 GIT binary patch delta 1981 zcmYM!e`u9e9LMpqyY1?9?z+2`m8Q@9k=t;#A}d`GxI1FR)hv_7}87vp5^4unMnX4PM7t_%~`oMaLk9>MueiSZVufQSlp4 z@tbVF$G-Qhd7MRl^AZj1U<~Kr9@LKCMsk|>P(}F|BX|@w@p0QfiCW+()c6aije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q#oMN}?pxMC(yk=S3xH32I|y zsEtwabDB`eG!9ZCk35sKWc%esH7T4UC9J$f=`%%)3^^k>`wn0zqK1TQlCUG#&f)D zxCN_m4Ap-Fr_p?Vbm{-!L_whop#CnGFblh}8K0v<=1Yy_Km}@oL#W6#pnh*gZpXCR z`b|{wg>3yLYTR2?guY^bkjwo+;UWz;Gb2f}ii}h8tiu=RMTPh`DunZ>37qV*2;InI zw(&}gCUwFsP8sQz*e={!2=>Mx@D{!CbtHWjKmjFp12} z$1+s^X4HlQ=)hJ~mbc*~_F@BGUKiQO9FjIBCYRwGC@jmpKHxYRE_K#NMU{t#Ty>7H WKdCP!oShOGVI=IDQJZ=&!3 diff --git a/translations/sl/LC_MESSAGES/messages.po b/translations/sl/LC_MESSAGES/messages.po index 86152e1..9ad0f4b 100644 --- a/translations/sl/LC_MESSAGES/messages.po +++ b/translations/sl/LC_MESSAGES/messages.po @@ -423,6 +423,18 @@ msgstr "najmanjše število pojavitev drevesa v korpusu" msgid "Association measures" msgstr "Mere povezovalnosti" +msgid "Complexity measures" +msgstr "Mere kompleksnosti" + +msgid "print maximum tree depth and mean dependency distance (MDD)" +msgstr "izpiše največjo globino drevesa in povprečno razdaljo odvisnosti (MDD)" + +msgid "Max depth" +msgstr "Največja globina" + +msgid "MDD" +msgstr "MDD" + #: templates/index.html:156 msgid "print MI, logDice and t-score" msgstr "izračun vrednosti MI, logDice in t-test"