当前位置:网站首页>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 :)
边栏推荐
- Digital commerce cloud DMS dealer management system solution: DMS system realizes business Omni channel and sales data collection
- 如何根据登录测试的需求设计测试用例?
- MySQL教程:MySQL数据库学习宝典(从入门到精通)
- Win11 hide input method status bar method
- 1. Software testing ----- the basic concept of software testing
- STM32——PWM学习笔记
- 软件测试岗:阿里三面,幸好做足了准备,已拿offer
- Cycle and branch (I)
- [steering wheel] use the 60 + shortcut keys of idea to share with you, in order to improve efficiency (reconstruction)
- canvas——绘制曲线——挂钟,饼图,五角星
猜你喜欢

如何正确计算 Kubernetes 容器 CPU 使用率

【尤里复裂人】带你轻松理解——深拷贝和浅拷贝

Influence of middle tap change on ZVS oscillation circuit

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

Chen Yili, China Academy of communications technology: cost reduction and efficiency increase are the greatest value of Enterprise Cloud native applications

图像识别(七)| 池化层是什么?有什么作用?

Win11隐藏输入法状态栏方法

Opencv报错:(parameter or structure field))Unrecognized or unsupported array type in functon ‘cvGetMat‘

VR panoramic shooting and production of business center helps businesses effectively attract people

移位距离和假设的应用
随机推荐
Teach you to rely on management hand in hand
STM32——串口学习笔记(一个字节、16位数据、字符串、数组)
图像识别(六)| 激活函数
Image recognition (VI) | activation function
Self-supervised learning method to solve the inverse problem of Fokker-Planck Equation
Shardingsphere data slicing
STM——EXTI外部中断学习笔记
Safety margin of mass consumption
Jsd-2204-cool shark Mall (Management Commodity module) -day02
AMD64 (x86_64) architecture ABI document: medium
小测(一)
Wechat official account mutual aid, open white groups, and small white newspaper groups to keep warm
[sql] usage of self connection
Arthas view the source code of the loaded class (JAD)
[steering wheel] use the 60 + shortcut keys of idea to share with you, in order to improve efficiency (live template & postfix completion)
STM - exti external interrupt learning notes
Execution process behind shell commands
YOLOv3: An Incremental Improvement
[NOIP2001 普及组]装箱问题
Convert rich text to normal text

