Skip to main content

Opinion Analysis Toolkit

A toolkit to extract opinions and useful information from text

Installation

pip install opinionx

Example Usage

  1. 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)
  1. 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()
  1. 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.

Release files for opinionx 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opinionx 0.0.2
File Size Uploaded
opinionx-0.0.2.tar.gz 32.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for opinionx 0.0.2
File Interpreter ABI Platform
opinionx-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 65.9 kB

Release files / opinionx-0.0.2.tar.gz

Download URL opinionx-0.0.2.tar.gz
Size 32.5 kB
Tags Source
SHA-256 checksum
How to use checksums
44123163a2364fd459d496603cec64ce4c2bede87adbe263808dab997b236c21
BLAKE2b-256 checksum
How to use checksums
4b4669fa1d446c82fcc9769242aa94b2059eb3dd07cc9f3b010b2151cd20e5c0
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / opinionx-0.0.2-py3-none-any.whl

Download URL opinionx-0.0.2-py3-none-any.whl
Size 33.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23056b2468b7a8599d69d76f53541c44ba2190f801c6b5eedbe3daae86cb657c
BLAKE2b-256 checksum
How to use checksums
6901d26a958fed16c023f7d8e94245f4d2aa07918c12cbcf0fa12d232aaaf06f
Upload date
Uploaded using Trusted Publishing?
What is 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
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page