Skip to main content

Opinion Analysis Toolkit

Project description

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.

Project details


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.1a5.tar.gz (30.0 kB view details)

Uploaded Source

Built Distribution

opinionx-0.0.1a5-py3-none-any.whl (31.5 kB view details)

Uploaded Python 3

File details

Details for the file opinionx-0.0.1a5.tar.gz.

File metadata

  • Download URL: opinionx-0.0.1a5.tar.gz
  • Upload date:
  • Size: 30.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6

File hashes

Hashes for opinionx-0.0.1a5.tar.gz
Algorithm Hash digest
SHA256 c2297c17dc674f862286ae05dae86954fbc27e00c77e4673f05dd0223f93673e
MD5 e5db4aad25bed1810e55645d3fea88a6
BLAKE2b-256 312c31629ca4ad720a08d74922c48cf9260cc16a95631e4799d2409fa60b2abf

See more details on using hashes here.

File details

Details for the file opinionx-0.0.1a5-py3-none-any.whl.

File metadata

  • Download URL: opinionx-0.0.1a5-py3-none-any.whl
  • Upload date:
  • Size: 31.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6

File hashes

Hashes for opinionx-0.0.1a5-py3-none-any.whl
Algorithm Hash digest
SHA256 fd36fd295d78dc601eea1e356a95de1d4b23be4dfe186e9d0ac73531b1aeb424
MD5 cb1be45ec93e89ff0ed8e5d54c1662a9
BLAKE2b-256 a0102b27de3db45edec2a14510f191c357b3fde8edad16e02c1d34010b73bea2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page