Performs Classification using Regex for social media user's profile categorization and NER tasks
Project description
NLP Classification Python Package For Profile Category and NER
Functionality of the Package
Performs Classification using Regex for social media user's profile categorization and NER tasks
- If profile:
- Categories: Politician, Information Vehicule, Health Professional, Science, Education Professional, Artist, Organization and Journalist;
- NER:
- Vaccines, Products, Drugs, Diseases, Symptoms, Science, Part of the body; returns a dataframe that has information of the entity id, name and it's occurence frequency on the input text.
The package takes the following parameters as input:
- Profile:
- Text containing informations about the user's biography or channel description in the context of communication reaseach porpuses
- NER:
- Text
Usage
pip install ProfileNER-classifier
Example
from nlpclassifier_profilener import NLPClassifier
#Instatiate the classifier
#If profile classification is the task of choice
nlpc = NLPClassifier('profile')
#Preprocess the text. Its's important to lowercase and remove accents
yt['channelDesc'] = yt['channelDesc'].apply(lambda x: pipeline.preprocess(x, lower = True)).apply(lambda x: pipeline.strip_accents(x))
#Classify channelCategory
yt['channelCategory'] = yt['channelDesc'].apply(lambda x: tpc.classifier(str(x)))
#See the distribution of profile categories if Profile task
yt['channelCategory'].value_counts()
#If NER classification, there's two options
#The first is to get the entities name as you would get with Spacy, for example. For this purpose, use the classifier function with 'ner' use.
nlpc = NLPClassifier('ner')
yt['ner'] = yt['videoTranscription'].apply(lambda x: nlpc.classifier(str(x))) #already preprocessed
#The second is to get the entities occurence frequency in the text. For this purpose, use the ner_classifier function with 'ner' use. Remember that it returns the input dataframe updated with the ner entities as new columns and their frequency as their rows.
nlpc = NLPClassifier('ner')
yt = yt['videoTranscription'].apply(lambda x: nlpc.ner_classifier(str(x))) #already preprocessed
Note
The package is still a work is in progress. In case of error, feel free to contact me.
Change Log
0.0.6.6 (04/09/2022)
- First Release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ProfileNER-classifier-0.7.3.tar.gz
.
File metadata
- Download URL: ProfileNER-classifier-0.7.3.tar.gz
- Upload date:
- Size: 18.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84d6747bb05cbec3b82f32d027368130bc75f77561f238b27c4a2d737cb28c8b |
|
MD5 | a025f006dbd582e99bf20f6d0346e885 |
|
BLAKE2b-256 | 2d74b11e4d96f55740bde42354b67c9a7111023111cae62e9076dc9f2eaf39a2 |
File details
Details for the file ProfileNER_classifier-0.7.3-py3-none-any.whl
.
File metadata
- Download URL: ProfileNER_classifier-0.7.3-py3-none-any.whl
- Upload date:
- Size: 20.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42888ef044b633319188e4d5e41a3f338cc6f6beba12f8d0e9afe4fe5be65442 |
|
MD5 | d6851b21159b8ea9ef12beedd7859a32 |
|
BLAKE2b-256 | de5fda003677b666c21acf3bfe0b7da5147773b7a72e3661d680e6d44e07e246 |