使用 Regex 对社交媒体用户的个人资料分类和 NER 任务执行分类
项目描述
用于配置文件类别和 NER 的 NLP 分类 Python 包
包的功能
使用 Regex 对社交媒体用户的个人资料分类和 NER 任务执行分类
- 如果简介:
- 类别:政治家、信息载体、健康专业人士、科学(具有科学/学术背景的人士)、教育专业人士、艺术家、组织和记者;
- 尼尔:
- 疫苗、产品、药物、疾病、症状、科学、身体部位;返回一个数据框,其中包含实体 id、名称及其在输入文本中出现频率的信息。
该包将以下参数作为输入:
- 轮廓:
- 在通信研究语境中包含有关用户传记或频道描述信息的文本
- 尼尔:
- 文本
用法
pip install ProfileNER-classifier
例子
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
笔记
该软件包仍在进行中。如有错误,请随时与我联系。
更改日志
0.0.7.6 (04/09/2022)
- 首次发布
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
ProfileNER-classifier-0.7.7.tar.gz
(19.4 kB
查看哈希)
内置分布
关
ProfileNER_classifier- 0.7.7 -py3-none-any.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | f8b2d164d67a4fd5b0138bd046843341bcea055310510abee1725c0ab5584700 |
|
| MD5 | 493df5638b6fcd522ad3047e3eb1a687 |
|
| 布莱克2-256 | 759135ee9f75c101e6c6d98887a94b3b6a36c12d3ff42b1b4ddb5bd8409dfdf4 |