GateNLP/python-gatenlp

TokenGazetteer - ValueError: not enough values to unpack (expected 2, got 1)

Closed this issue · 2 comments

Hi Johann,
Today I updated one of the lists which I'm using for TokenGazetteer. Then I got this error:

<ipython-input-4-3f5752b84418> in GazDet(doc)
    225     doc = Annie(doc, port2)
    226     for detail in details:
--> 227         tgaz = TokenGazetteer(Details_path + "/" + detail + ".def", fmt="gate-def", annset="", all=False, skip=True, outset="Resume", outtype=detail)
    228         gazdoc = tgaz(doc)
    229     return gazdoc

c:\users\moham\appdata\local\programs\python\python39\lib\site-packages\gatenlp\processing\gazetteer.py in __init__(self, source, fmt, source_sep, source_encoding, tokenizer, all, skip, outset, outtype, annset, tokentype, feature, septype, splittype, withintype, mapfunc, ignorefunc, getterfunc, listfeatures, listtype)
    172         self.source_sep = source_sep
    173         self.source_encoding = source_encoding
--> 174         self.append(source, fmt=fmt, listfeatures=listfeatures, listtype=listtype, source_sep=source_sep,
    175                     source_encoding=source_encoding
    176                     )

c:\users\moham\appdata\local\programs\python\python39\lib\site-packages\gatenlp\processing\gazetteer.py in append(self, source, fmt, source_sep, source_encoding, listfeatures, listtype)
    289                                 feats = {}
    290                                 for fspec in fields[1:]:
--> 291                                     fname, fval = fspec.split("=")
    292                                     feats[fname] = fval
    293                             else:

ValueError: not enough values to unpack (expected 2, got 1)

Would you please help on this?

Could it be that some lines in a lst file does not conform to the proper format?
This should be: the gazetteer entry, optionally followed by one or more times: a tab, then a featurename, then an equal sign, then a feature value.
E.g.

some gaz entry->feature1=value1->feature2=value2

It is not possible to have a feature entry where the feature name or the value or the equal sign is missing and there must be no tab if it is not followed by a feature entry.

No feedback for 29 days, closing, feel free to reopen.