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

Uploaded Source

Built Distribution

opinionx-0.0.1a4-py3-none-any.whl (31.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: opinionx-0.0.1a4.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.1a4.tar.gz
Algorithm Hash digest
SHA256 6c8966ed7d0c3471c403a6c89744f1e83cee6f1399b96e9f198b45ce1f34624a
MD5 c5133f2987bfd21442fa0898bb7dc76e
BLAKE2b-256 60a5e4e4d94e8be6ebcb32107d89c006cd14905471be972b01d93de6839bf123

See more details on using hashes here.

File details

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

File metadata

  • Download URL: opinionx-0.0.1a4-py3-none-any.whl
  • Upload date:
  • Size: 31.4 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.1a4-py3-none-any.whl
Algorithm Hash digest
SHA256 c755a9612fc384c22b3b58cae8d969f5ff2d1e971bb268b528b70aabf8c31019
MD5 7c2f0ac78e9f8eff1aaf7acc287e2508
BLAKE2b-256 c9e9b01b0db0e0027a52e7690cf97924dc5bc210c24442a899e6e00f8e2ea6d3

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