boudinfl / pke

Python Keyphrase Extraction module
GNU General Public License v3.0
1.57k stars 291 forks source link

hinglish key error #230

Closed NITHISHKUMAR2398 closed 1 year ago

NITHISHKUMAR2398 commented 1 year ago

Used pke for the first time but I got the key error I coudn't resolve it .The issue might be specific to the pke library or how it's handling language codes

Description of the error:

KeyError: 'hinglish'

ygorg commented 1 year ago

Hi, thanks for using pke. This issue is linked to #223 and #200. pke does not support 'hinglish' language, it only supports languages supported by spacy (see pke/lang.py).

If you are using pke with an unsupported language please provide custom stopwords using stoplist argument as such:

shadok_stoplist = ['ga', 'zo']
preprocessed_document = [  # Obtained via custom pos tagging tool or manual annotation
    [('ga', 'DET'), ('bu', 'NOUN'), ('zo', 'AUX'), ('meu', 'ADJ'), ('.', 'PUNCT')]
]
e = pke.unsupervised.MultipartiteRank()
e.load_document(
    preprocessed_document, language='shadok',
    stoplist=shadok_stoplist, normalization=None
)

Ps: as a general recommandation please provide more context for the error in your issues (the file, line, input data, function that triggered the error, what were you trying to achieve). Also you can format the code to look nice using 3 backticks "`".