当前位置:网站首页>Functions and usage of snownlp Library
Functions and usage of snownlp Library
2022-07-26 03:06:00 【Love to eat dog repair bags】
Catalog
6 front n The key ( center ) sentence
9 Transformation of traditional and simplified style
Import library first
from snownlp import SnowNLP
s = SnowNLP(' The words are too small , And the paper is not good , It's a little dark , But the content should be good . There is still a little distance from the expectation ...')
1 Chinese word segmentation
print(s.words)2 Part of speech tagging
print(list(s.tags))3 Emotional score
print(s.sentiments)
4 Convert Pinyin
print(s.pinyin)
5 front n Key words
print(s.keywords(4))
6 front n The key ( center ) sentence
print(s.summary(1))
7 TF value
print(s.tf)
8 IDF value
print(s.idf)
9 Transformation of traditional and simplified style
print(s.han)
10 Split sentences
print(s.sentences)
Only non English statement separators can be used to separate statements , When Chinese and English separators are mixed, the effect is not good =^=
It can be used re modular Specify at one time Multiple Chinese English separator
import re
t = ' The words are too small , And the paper is not good , It's a little dark , But the content should be good . There is still a little distance from the expectation ...'
t_list = re.split('[,.;!,.;!]', t)
for i in range(t_list.count('')): # Remove empty string elements
t_list.remove('')
print(t_list)
Flag: I want to be a day watcher :)
边栏推荐
- ENVI_ Idl: create HDF5 file and write data (take writing GeoTIFF file to HDF file as an example) + detailed parsing
- Opencv 以指定格式保存图片
- cmd cpm 命令汇总
- 1. Software testing ----- the basic concept of software testing
- Design of golang lottery system
- Software testing post: Ali has three sides. Fortunately, he has made full preparations and has been offered
- 一篇文章让你理解 云原生 容器化相关
- 事半功倍:学会WEB性能测试用例设计模型
- LeetCode·每日一题·剑指 Offer || 115.重建序列·拓扑排序
- Personally test five efficient and practical ways to get rid of orders, and quickly collect them to help you quickly find high-quality objects!
猜你喜欢

How to install with USB flash disk?
![[SQL] CASE表达式](/img/05/1bbb0b5099443f7ce5f5511703477e.png)
[SQL] CASE表达式

图像识别(六)| 激活函数

How to reinstall win7 system?
![[SQL] 自连接的用法](/img/92/92474343b4b4e6ea60453b4799cb55.jpg)
[SQL] 自连接的用法
![[C Advanced] deeply explore the storage of data (in-depth analysis + interpretation of typical examples)](/img/1e/33f9cc9446dcad8cdb78babbb5a22c.jpg)
[C Advanced] deeply explore the storage of data (in-depth analysis + interpretation of typical examples)

Image recognition (VII) | what is the pooling layer? What's the effect?

多线程编程

Machine learning foundation plan 0-2: what is machine learning? What does it have to do with AI?

STM32 - DMA notes
随机推荐
My friend took 25koffer as soon as he learned automation test. When will my function test end?
一篇文章让你理解 云原生 容器化相关
MySQL教程:MySQL数据库学习宝典(从入门到精通)
信息系统项目管理师必背核心考点(五十)合同内容约定不明确规定
MySQL tutorial: MySQL database learning classic (from getting started to mastering)
【C语言】深入理解 整型提升 和 算术转换
Summary of Huawei virtualization fusioncompute knowledge points
Service gateway (zuul)
Self-supervised learning method to solve the inverse problem of Fokker-Planck Equation
Image recognition (VII) | what is the pooling layer? What's the effect?
Opencv 以指定格式保存图片
STM - exti external interrupt learning notes
Information system project managers must recite the core examination site (50). The contract content is not clearly stipulated
STM32 - serial port learning notes (one byte, 16 bit data, string, array)
Cloud native guide what is cloud native infrastructure
Win11更改磁盘驱动器号的方法
The source of everything, the choice of code branching strategy
朋友刚学完自动化测试就拿25Koffer,我功能测试何时才能到头?
How to install with USB flash disk?
Qt 信号在多层次对象间传递 多层嵌套类对象之间信号传递

