Opinion Analysis Toolkit
A toolkit to extract opinions and useful information from text
Installation
pip install opinionx
Example Usage
- Find opinions
from opinionx.text import get_opinion
text=open("test.txt",'r',encoding='utf-8').read()
opinion_words=['表示','认为','说','介绍','提出','透露','指出','强调',':']
list_opinion,_,_=get_opinion(text,lang='zh',opinion_words=opinion_words)
for opinion in list_opinion:
print(opinion)
- Find Leader's Opinions
from opinionx.text import get_leader_opinions
text=open("test.txt",'r',encoding='utf-8').read()
list_opinion = get_leader_opinions(text,save_path="", search_keywords_path="data/search_keywords.csv",leader_path="data/g20_leaders.csv")
print()
for opinion in list_opinion:
print(opinion)
print(opinion["opinion"])
print(opinion["first_found_keyword"])
print(opinion["first_found_leader"])
print()
- run tf-idf and tf models for massive text files
from opinionx.tfidf_shell import *
run_tfidf_shell(input_folder="tfidf_folder/raw_data", # a list of text files
output_folder="tfidf_folder/output", # output folder
user_dict_path="tfidf_folder/user_dictionaries", # the folder contains csv files with each line as a word
font_path="utils/fonts/SimHei.ttf",# use it when analysis Chinese text
is_html=True
)
Credits & References
License
The opinionx project is provided by Donghua Chen.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
opinionx-0.0.2.tar.gz
(32.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
opinionx-0.0.2-py3-none-any.whl
(33.4 kB
view details)
File details
Details for the file opinionx-0.0.2.tar.gz.
File metadata
- Download URL: opinionx-0.0.2.tar.gz
- Upload date:
- Size: 32.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44123163a2364fd459d496603cec64ce4c2bede87adbe263808dab997b236c21
|
|
| MD5 |
7e68eb42f45865b95257f1b98581f840
|
|
| BLAKE2b-256 |
4b4669fa1d446c82fcc9769242aa94b2059eb3dd07cc9f3b010b2151cd20e5c0
|
File details
Details for the file opinionx-0.0.2-py3-none-any.whl.
File metadata
- Download URL: opinionx-0.0.2-py3-none-any.whl
- Upload date:
- Size: 33.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23056b2468b7a8599d69d76f53541c44ba2190f801c6b5eedbe3daae86cb657c
|
|
| MD5 |
c956bead1f381bc6ad532a4a7eceb8ad
|
|
| BLAKE2b-256 |
6901d26a958fed16c023f7d8e94245f4d2aa07918c12cbcf0fa12d232aaaf06f
|