UPOS string rather than int and HEAD int rather than string

#2
by lweissweiler - opened
universal-dependencies org

See title

universal-dependencies org

Hi @ellepannitto , I found the dataset class definition here:

        # Define features
        features = datasets.Features(
            {
                ...
                "lemmas": datasets.Sequence(datasets.Value("string")),
                "upos": datasets.Sequence(
                    datasets.features.ClassLabel(
                        names=[
                            "NOUN",
                            "PUNCT",
                            "ADP",
                            "NUM",
                            "SYM",
                            "SCONJ",
                            "ADJ",
                            "PART",
                            "DET",
                            "CCONJ",
                            "PROPN",
                            "PRON",
                            "X",
                            "_",
                            "ADV",
                            "INTJ",
                            "VERB",
                            "AUX",
                        ]
                    )
                ),
                "xpos": datasets.Sequence(datasets.Value("string")),
                ...

...and @lweissweiler , I think, I intended to implement something along the lines of ClassLabels (which should have int2str() and str2int():

and is advertised as a "feature" ;):

The ClassLabel feature informs 🤗 Datasets the label column contains two classes. The classes are labeled not_equivalent and equivalent. Labels are stored as integers in the dataset. When you retrieve the labels, ClassLabel.int2str() and ClassLabel.str2int() carries out the conversion from integer value to label name, and vice versa.

Overall, I'm getting the impression that the general idea of implementing this with ClassLabels is "the right" way to go about this; but something is not quite working, just yet: apparently, the ClassLabels should not be displayed as integers in the Dateset Viewer, right @christopher ?

universal-dependencies org

I would plan things on the parquet level rather than the datasets library level, and not use the ClassLabel feature at all. Parquet will compress the data just fine without it, and it would make it accessible to people loading the parquet in pandas, R, or Julia for example.

universal-dependencies org

ok, so we're back to making upos a sequence of strings; @ellepannitto if you want to look into this...

slightly misusing the discussion: for a moment, I think, there was the idea of changing the type of head, currently string and making it int? i think, the string data type comes from before mwt and empty_nodes existed, that is, "_" was a possible value and needed to be represented. is it absolutely certain that no other value than int will ever make it into head - and, considering that we would also have to go back to UD v2.7, no other value ever made it into this field?

universal-dependencies org

yes

iiegn changed discussion title from UPOS string rather than int to UPOS string rather than int and HEAD int rather than string
universal-dependencies org

great! i changed the title to reflect both type changes since, there will be overlap in code changes and tests, etc.

universal-dependencies org

Hey, sorry for the late reply.
I tried something this morning, I opened a PR here: https://github.com/bot-zen/ud-hf-parquet-tools/pull/1

I then realized I tested it with the (possibly) old metadata.json file, but the rest should be ok. @iiegn can you take a look when you have the chance? :)

Sign up or log in to comment