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.4.2 (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.0.4.2.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

ProfileNER_classifier-0.0.4.2-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for ProfileNER-classifier-0.0.4.2.tar.gz
Algorithm Hash digest
SHA256 1392b0b4600ad04e387ef4a81658ef95b414c14e1cc3550eb680a18b52f79835
MD5 ff4b11b388be3aef7772f81b1ab96ee9
BLAKE2b-256 5f6a39b61e9b832e57445ec634bd145648bd5c495ec2b3cedf058ec860a9ac1a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ProfileNER_classifier-0.0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e5dce93016af57a100151ad11f65c2fa00a29e1b6c7d0c2f0d32c36dd8dcac10
MD5 e292602f3f9eda585490ddd58824fc78
BLAKE2b-256 0cb114818f6d16c3c42bb7936b3eaba8ef07e844a20b5b2f7c1d51471d7bc70e

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