https://github.com/apmoore1/bella

Target Dependent Sentiment Analysis (TDSA) framework.

https://github.com/apmoore1/bella

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    2 of 3 committers (66.7%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.4%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

Target Dependent Sentiment Analysis (TDSA) framework.

Basic Info
Statistics
  • Stars: 20
  • Watchers: 3
  • Forks: 2
  • Open Issues: 2
  • Releases: 4
Created about 8 years ago · Last pushed about 3 years ago
Metadata Files
Readme License

README.md

Bella

Build Status PyPI - Downloads

Target Dependent Sentiment Analysis (TDSA) framework. The paper associated with this repository is the following: @InProceedings{C18-1097, author = "Moore, Andrew and Rayson, Paul", title = "Bringing replication and reproduction together with generalisability in NLP: Three reproduction studies for Target Dependent Sentiment Analysis", booktitle = "Proceedings of the 27th International Conference on Computational Linguistics", year = "2018", publisher = "Association for Computational Linguistics", pages = "1132--1144", location = "Santa Fe, New Mexico, USA", url = "http://aclweb.org/anthology/C18-1097" }

Requirements and Installation

  1. Python 3.6
  2. pip install bella-tdsa
  3. Install docker
  4. Start Stanford CoreNLP server: docker run -p 9000:9000 -d --rm mooreap/corenlp
  5. Start the TweeboParser API server: docker run -p 8000:8000 -d --rm mooreap/tweeboparserdocker

If you want to use the moses tokeniser that has been taken from the Moses project the following will need to be installed: 1. python -m nltk.downloader perluniprops 2. python -m nltk.downloader nonbreaking_prefixes

The docker Stanford and Tweebo server are only required if you are going to use the TDParse methods/models or if you are going to use any of the Stanford Tools else you do not need them.

To stop the docker servers running:

  1. Find the name assigned to the docker image using: docker ps
  2. Then stop the relevant docker image: docker stop nameofimage

NOTE Both of these servers will run with as many threads as your machine has CPUs to limit this do the following: 1. For stanford: docker run -p 9000:9000 -d --rm mooreap/corenlp -threads 6 will run it with 6 threads 2. For TweeboParser: docker run -p 8000:8000 -d --rm mooreap/tweeboparserdocker --threads 6 will run it with 6 threads

Dataset

All of the dataset are required to be downloaded and are not stored in this repository. We recomend using the config file to state where the datasets are stored like we did but this is not a requirement as you can state where they are stored explictly in the code. For more details on the datasets and downloading them see the dataset notebook The datasets used: 1. SemEval 2014 Resturant dataset. We used Train dataset version 2 and the test dataset of which the gold standatd test can be found here. 2. SemEval 2014 Laptop dataset. We used Train dataset version2 and the test dataset of which the gold standard test can be found here. 3. Election dataset 4. Dong et al. Twitter dataset 5. Youtubean dataset by Marrese-Taylor et al. 6. Mitchell dataset which was released with this paper.

NOTE Before using Mitchell and YouTuBean datasets please go through these pre-processing notebooks: Mitchell YouTuBean for splitting their data and also in Mitchell case which train test split to use.

Lexicons

These lexicons are required to be downloaded if you use any methods that require them. Please see the use of the config file for storing the location of the lexicons: 1. MPQA can be found here 2. NRC here 3. Hu and Liu here

Word Vectors

All the word vectors are automatically downloaded for you and they are stored in the root directory called .Bella/Vectors which is created in your user directory e.g. on Linux that would be ~/.Bella/Vectors/. The word vectors included in this repository are the following: 1. SSWE 2. Word Vectors trained on sentences that contain emojis 3. Glove Common Crawl 4. Glove Twitter 5. Glove Wiki Giga

Model Zoo

The model zoo can be found on the Git Lab repository here.

These models can be automatically downloaded through the code like the word vectors and stored in the .Bella/Models directory which is automatically placed in your home directory for instance on Linux that would be ~/.Bella/Models. An example of how to download and use a model is shown below: ```python from bella import helper from bella.models.target import TargetDep

targetdep = helper.downloadmodel(TargetDep, 'SemEval 14 Restaurant') testexamplemulti = [{'text' : 'This bread is tasty but the sauce is too rich', 'target': 'sauce', 'spans': [(28, 33)]}]

targetdep.predict(testexample_multi) ``` This example will download the Target Dependent model which is from Vo and Zhang paper that has been trained on the SemEval 2014 Resturant data and predict the sentiment of sauce from that example. As you can see the example is not simple as it has two different sentiments within the same sentence with two targets; 1. bread with a positive sentiment and 2. sauce which has a negative sentiment of which that target is the one being predicted for in this example.

To see a more in depth guide to the pre-trained models and output from them go to this notebook.

The notebooks

Can be found here

The best order to look at the notebooks is first look at the data with this notebook. Then looking at the notebook that describes how to load and use the saved models from the model zoo. Then go and explore the rest if you would like:

  1. The Mass evaluation notebooks are the following
  2. For the analysis of the reproduction of the Target Dependent model of Vo and Zhang see this notebook
  3. For the analysis of the reproduction of the TDParse model of Wang et al. see this notebook
  4. For the analysis of the reproduction of the LSTM models of Tang et al. see this notebook
  5. For the statistics of the datasets and where to find them see this notebook
  6. For the code on creating training and test splits for the YouTuBean dataset see this notebook
  7. For the code on creating training and test splits for Mitchell et al. dataset see this notebook
  8. Pre-Trained Model examples notebook

Docker Servers

Both Tweebo and Stanford by default will run on your localhost and port 8000 and 9000 respectively by default. If you would like to run them on a different port or hostname you can change the .Bella/config.yaml file which is created in your local home directory the first time you run something successfully through the Stanford or Tweebo tools. The file once created which is only done automatically for you when you successfully run something through the Stanford or Tweebo tools will look like this which is a yaml formatted file: yaml tweebo_parser: hostname: 0.0.0.0 port: 7000 stanford_core_nlp: hostname: http://localhost port: 8000 If you want Tweebo or Stanford to run on a different port or hostname just change this file. For instance the example shown above is different to default as Stanford is running on port 8000 and not 9000 and Tweebo is running on port 7000 instead of 8000.

If you would like the tools to run on different hostname and port from the start without having to successfully run them through the tools before hand just create this file .Bella/config.yaml in your local home directory with the same structure as the example but with the hostname and port you want to use.

Different Licenses

As we use a lot of tools we list here if any of the tools that we use are licensed under a different license to that of this repository: 1. The Moses tokeniser is licensed under GNU Lesser General Public License version 2.1 or, at your option, any later version.

Owner

  • Name: Andrew Moore
  • Login: apmoore1
  • Kind: user
  • Location: Lancaster
  • Company: Lancaster University

PhD student and researcher. Main interests: Target/Aspect based sentiment analysis, Semi-Supervised Learning.

GitHub Events

Total
Last Year

Committers

Last synced: over 3 years ago

All Time
  • Total Commits: 392
  • Total Committers: 3
  • Avg Commits per committer: 130.667
  • Development Distribution Score (DDS): 0.454
Top Committers
Name Email Commits
Andrew Moore a****4@g****m 214
Andrew Moore a****e@l****k 176
Andrew Moore a****w@u****k 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 5
  • Total pull requests: 3
  • Average time to close issues: 21 days
  • Average time to close pull requests: 7 minutes
  • Total issue authors: 2
  • Total pull request authors: 2
  • Average comments per issue: 0.6
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 1
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • apmoore1 (4)
  • kanihal (1)
Pull Request Authors
  • apmoore1 (2)
  • dependabot[bot] (1)
Top Labels
Issue Labels
enhancement (2) models (1)
Pull Request Labels
dependencies (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 189 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 24
  • Total maintainers: 1
pypi.org: bella-tdsa

Target Dependent Sentiment Analysis (TDSA) framework.

  • Versions: 24
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 189 Last month
Rankings
Dependent packages count: 10.0%
Stargazers count: 13.6%
Average: 17.6%
Forks count: 19.1%
Dependent repos count: 21.7%
Downloads: 23.4%
Maintainers (1)
Last synced: 11 months ago

Dependencies

requirements.txt pypi
  • Keras >=2.1.3
  • Sphinx ==1.6.5
  • filelock >=3.0.10
  • ftfy >=5.2.0
  • gensim >=3.0.1
  • google-compute-engine >=2.8.3
  • graphviz >=0.8.4
  • networkx >=2.0
  • nltk >=3.2.5
  • pandas >=0.21.0
  • pydot >=1.2.4
  • pylint >=2.2.2
  • pytest ==3.2.3
  • requests >=2.18.4
  • ruamel.yaml >=0.15.34
  • scikit-learn ==0.19.1
  • scipy ==1.4.1
  • seaborn >=0.8.1
  • spacy >=2.0.18,<2.2
  • sphinx-autodoc-typehints ==1.3.0
  • sphinx-rtd-theme ==0.2.4
  • stanfordcorenlp ==3.7.0.2
  • tensorflow >=1.3.0
  • tqdm >=4.23.4
  • tweebo-parser-python-api >=1.0.4
  • twokenize >=1.0.0
setup.py pypi
  • Keras >=2.1.3
  • filelock >=3.0.10
  • ftfy >=5.2.0
  • gensim >=3.0.1
  • graphviz >=0.8.4
  • networkx >=2.0
  • nltk >=3.2.5
  • pandas >=0.21.0
  • pydot >=1.2.4
  • requests >=2.18.4
  • ruamel.yaml >=0.15.34
  • scikit-learn ==0.19.1
  • scipy ==1.4.1
  • seaborn >=0.8.1
  • spacy >=2.0.18,<2.2
  • stanfordcorenlp ==3.7.0.2
  • tensorflow >=1.3.0
  • tqdm >=4.23.4
  • tweebo-parser-python-api >=1.0.4
  • twokenize >=1.0.0