integreat-cms icon indicating copy to clipboard operation
integreat-cms copied to clipboard

Add abbreviations count to HIX feedback

Open seluianova opened this issue 9 months ago • 0 comments

Motivation

Follow up to #2358

As part of #2358, we added a display of HIX feedback extracted from the Textlab API response. Currently we display the following feedback categories:

Schachtelsätze
Lange Sätze
Lange Wörter
Sätze im Passiv
Infinitiv-Konstruktionen
Sätze im Nominalstil
Sätze im Futur

All of them are extracted from the root properties from the response. For example, to count the number of sentences in the nominative case, we read the property "countNominalStyle", where the number of arrays means the number of sentences. 1 array - means 1 matching sentence:

    "countNominalStyle": [
        [
            34,
            41,
            0
        ]
    ],

2 arrays mean 2 sentences:

    "countNominalStyle": [
        [
            2,
            65,
            56
        ],
        [
            70,
            133,
            56
        ]
    ],

Besides that, there is another "source" of feedback that can be extracted from the "dataTerms" properties. For example:

    "dataTerms": {
        "1289": {
            "category": {
                "category_type": "negative",
                "description": {
                    "de": "Abkürzungen erschweren den Lesefluss und werden häufig auch nicht verstanden. <br>Deshalb markiert TextLab alle Abkürzungen im Text. <br>Tipp: Verwenden Sie Abkürzungen möglichst selten. <br>Falls Sie wenig gebräuchliche Abkürzungen verwenden wollen, <br>erklären Sie sie dem Leser.",
                    "en": "Abbreviations make it harder to read and understand your text.<br>Tip: Try to use abbreviations spraringly. <br>If you need to use lesser known abbreviations, explain them to your readers."
                },
                "id": 1289,
                "locale_name": "de_DE",
                "name": {
                    "de": "Abkürzungen",
                    "en": "Abbreviations for Cockpit Integreat"
                },
                "settings": {}
            },
            "result": [
                {
                    "length": [
                        1,
                        1
                    ],
                    "position": [
                        9,
                        38
                    ],
                    "priority": 6,
                    "replacement": [
                        {
                            "description": "",
                            "global_visible": 1,
                            "id": 358272,
                            "lemma": [
                                "zu+die",
                                "Beispiel"
                            ],
                            "settings": {},
                            "tag": [
                                "APPRART",
                                "NN"
                            ],
                            "wordcount": 2,
                            "words": [
                                "zum",
                                "Beispiel"
                            ]
                        }
                    ],
                    "term": {
                        "check_words": 1,
                        "description": "Verwenden Sie so wenige Abkürzungen im Text wie möglich.|Nicht alle Abkürzungen sind Ihren Lesern bekannt.",
                        "lemma": [
                            "z.{0,1} {0,1}B.{0,1}"
                        ],
                        "settings": {
                            "syllcount": 2
                        },
                        "tag": [
                            ""
                        ],
                        "term_id": 669,
                        "wordcount": 1,
                        "words": [
                            "z.{0,1} {0,1}B.{0,1}"
                        ]
                    }
                }
            ]
        },

We would like to implement the ability to handle this type of feedback as well.

Currently the category "Abkürzungen" is requested, but I believe this should be an extensible solution.

Proposed Solution

  • Implement the ability to display feedback based on data from the "dataTerms" response property.
  • Add feedback for the "Abkürzungen" category to the HIX widget

User Story

As a user I want to see the feedback for the category "Abkürzungen" in the HIX widget. E.g.:

Der Text enthält 2 Abkürzungen.

seluianova avatar May 06 '24 10:05 seluianova