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

Uploaded Source

Built Distribution

opinionx-0.0.1a3-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: opinionx-0.0.1a3.tar.gz
  • Upload date:
  • Size: 29.5 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.21.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6

File hashes

Hashes for opinionx-0.0.1a3.tar.gz
Algorithm Hash digest
SHA256 93676d5697a947fd458ea22aa3afb3e1439ab7fed36136e4c91f39d57450986b
MD5 01352f9379c2835b7e968d54b2badec9
BLAKE2b-256 cf7a68cb71016458a93694cf667a560cfdb333471cc9fb78eaff895d2ca79f3f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: opinionx-0.0.1a3-py3-none-any.whl
  • Upload date:
  • Size: 30.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.21.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6

File hashes

Hashes for opinionx-0.0.1a3-py3-none-any.whl
Algorithm Hash digest
SHA256 5795e9a01c9d5ae877519312a2ad53c5dd386bb66ba5eef592bede007549cd60
MD5 cca877837f0caf397e4db680f48c964e
BLAKE2b-256 6accfffcd346a223ae6f1c00be52e72b43ded8b584a5da592e156ad498d01991

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