Orange-OpenSource / conllueditor

ConllEditor is a tool to edit dependency syntax trees in CoNLL-U format.
BSD 3-Clause "New" or "Revised" License
54 stars 17 forks source link

Customised shortcuts #25

Closed Stormur closed 1 year ago

Stormur commented 1 year ago

Hi again!

I was finally tinkering with personalised shortcuts, but am wondering if I am doing this right. That is, I find that multiletter shortcuts, e. g. je for conj:expl, do not work as intended since the recogniser stops at the first letter. This happens also for capital shortcuts, e. g. NP for PROPN. Whereas shortcuts introduced by : wait for a whole matching sequence.

Is this intended? Else, is there a way to implement multicharacter shortcuts?

jheinecke commented 1 year ago

Hello! Some characters cannot be used in shortcuts since they have a hard-wired meaning (+, -, ? and =). That said, are you sure that there is no shortcut sequence which is part of another, e.g. you must not define something like

{
     "deplabel": {
        "a": "amod",
        "am": "advmod",
     ...
     },
     "xpos": {
        "a": ["adv", "ADV"],
      ...
    }
}
...

since the a would block the am (and the second definition would override the first) If not post me your shortcut file, I'll have a look.

Stormur commented 1 year ago

Ah, yes, this is exactly what is happening. I am wondering if this can be managed somehow, as it is very difficult not to have overlappings like this without getting encumbrant shortcuts. For example, this is what I had now:

 "deplabel": {
        "a": "amod",
        "v": "advmod",
        "ve": "advmod:emph",
        "vl": "advmod:lmod",
        "vt": "advmod:tmod",
        "n": "nmod",
        "u": "nummod",
        "d": "det",
        "dg": "det:gov",
        "l": "acl",
        "lr": "acl:relcl",
        "r": "advcl",
        "ra": "advcl:abs",
        "rc": "advcl:cmp",
        "rp": "advcl:pred",
        "c": "ccomp",
        "cr": "ccomp:reported",
        "cx": "xcomp",
        "s": "nsubj",
        "sp": "nsubj:pass",
        "sc": "csubj",
        "scp": "csubj:pass",
        "o": "obj",
        "b": "obl",
        "bg": "obl:arg",
        "ba": "obl:agent",
        "bc": "obl:cmp",
        "x": "aux",
        "xp": "aux:pass",
        "l": "case",
        "p": "cop",
        "m": "mark",
        "j": "conj",
        "jc": "cc",
        "je":"conj:expl",
        "pt": "parataxis",
        "f": "flat",
        "fg": "flat:gov",
        "u": "discourse",
        "h": "orphan",
        ".": "punct"
    }

For example, since advmod by itself is more frequent than the other ones, I would like to maintain it single-characterd. Would this make sense, or do you think it is it feasible?

jheinecke commented 1 year ago

For the time being only if you define "a" for advmod and no other shortcut starting with "a". Same with "l", "b", "x" in your example. The reason for this is that the shortcut is executed without a enter key or similar, so whenever a complete shortcut is detected, it is executed. In my annotation I use some one-letter-shortcuts for the frequent ones, and 2-letter shortcuts for the other (even though sometimes the shortcut is difficult to remember ...

Stormur commented 1 year ago

Now I have changed everything so as to have bi+-grams as shortcuts. It is a little clunky for the really frequent relations, though... would something based on a short timer be possible? So that it waits just the time to input other charactersm then processes them? In a way similar to how the double click works for the nodes (fast: opens the edit window; slow: changes the node to root).

jheinecke commented 1 year ago

I'll try to find something (this part is in javascript), cannot promise though :-). If you know of a javascript timer for this kind of work let me know !

jheinecke commented 1 year ago

Hi, I've just pushed a change with implements a timeout when typing shortcuts. So if you define two shortcuts like

{
   "deplabel": {
        "a": "amod",
        "am": "advmod",
     ...
     },
   ...
}

click a word, type a and just white 700ms: the first shortcut a is applied, If you manage to type the longer am shortcut in less 700ms between letters :-), the am shortcut is used. I hope this is what you're looking for.

Stormur commented 1 year ago

It's working great, thanks! I could even do with less milliseconds: could there be a way to set this time in the launch of conllueditor?

jheinecke commented 1 year ago

Yeah, I had the same impression, than I made it shorter, and I was too slow. It's currently hard-wired (700ms) in the javascript code gui/edit.js line 1086:

  }, 700);

In the meantime I'll check how to set this by an option

jheinecke commented 1 year ago

git pull, mvn install and try it (--shortcutTimeout <milliseconds>)!

Stormur commented 1 year ago

Good! Great work as always, I will soon try it!

Stormur commented 1 year ago

Hi!

Shortcuts were a turning point in my annotational practice. Now it turns out that some shortcuts for the MISC field could be very useful (there are some standard things that are preferably annotated there). Fro mreading the docs, it seems that this case is not contemplated... but is it so? And in case, is it possible to expand shortcuts to also include MISC?

Thanks again!

jheinecke commented 1 year ago

Yes, that should be easy to add, thanks for the idea!