Skip to main content

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

  1. If profile:
    • Categories: Politician, Information Vehicule, Health Professional, Science, Education Professional, Artist, Organization and Journalist;
  2. 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:

  1. Profile:
    • Text containing informations about the user's biography or channel description in the context of communication reaseach porpuses
  2. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ProfileNER-classifier-0.7.1.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

ProfileNER_classifier-0.7.1-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file ProfileNER-classifier-0.7.1.tar.gz.

File metadata

  • Download URL: ProfileNER-classifier-0.7.1.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

Hashes for ProfileNER-classifier-0.7.1.tar.gz
Algorithm Hash digest
SHA256 c920f88f8bb2a32c7de071ed794f779d5e783b0aca59f2d80348fd9ec577e11c
MD5 ff7f9bab4eb5b7e894484e5557f78a89
BLAKE2b-256 79dc43d70c1743fdf1140dae8a6dc1bb93a6192ccbe505143a08aa1ac86f90af

See more details on using hashes here.

File details

Details for the file ProfileNER_classifier-0.7.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ProfileNER_classifier-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 72c4ac266eff68f765018f063ce7c251fe6eeb4b063c8f9d7c96ef39307159eb
MD5 3d6e5466b1484b259b6f66b7f0d207bf
BLAKE2b-256 08febc4ec3c091da5e9c5248bb1e47760a1915cf1af4e35d32b6a5ecc2ee2603

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page