pycantonese.pos_tagging.hkcancor_to_ud

pycantonese.pos_tagging.hkcancor_to_ud(tag: str | None = None)[source]

Map a part-of-speech tag from HKCanCor to Universal Dependencies.

HKCanCor uses a part-of-speech tagset of over 100 tags (46 of which are described at https://github.com/fcbond/hkcancor). For applications that would benefit from a less granular part-of-speech tagset (e.g., cross-linguistic natural language processing tasks), we can map the HKCanCor tagset to the Universal Dependencies v2 tagset with 17 tags (https://universaldependencies.org/u/pos/index.html) – the purpose of this function.

Any unrecognized tag is mapped to "X".

Added in version 3.1.0.

Parameters:

tag (str, optional) – A tag from the original HKCanCor annotated data. If not provided or None, this function returns the entire dictionary of the tagset mapping from HKCanCor to UD.

Returns:

A tag from the Universal Dependencies v2 tagset, or a dictioary from HKCanCor to UD tags if no input is given.

Return type:

str or dict[str, str]

Examples

>>> hkcancor_to_ud("v")
'VERB'