Package: bella-tdsa
BellaTarget Dependent Sentiment Analysis (TDSA) framework. The paper associated with this repository is thefollowing:@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 InstallationPython 3.6pip install bella-tdsaInstalldockerStart Stanford CoreNLP server:docker run -p 9000:9000 -d --rm mooreap/corenlpStart the TweeboParser API server:docker run -p 8000:8000 -d --rm mooreap/tweeboparserdockerIf you want to use the moses tokeniser that has been taken from theMoses projectthe following will need to be installed:python -m nltk.downloader perlunipropspython -m nltk.downloader nonbreaking_prefixesThe 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:Find the name assigned to the docker image using: docker psThen stop the relevant docker image: docker stop name_of_imageNOTEBoth of these servers will run with as many threads as your machine has CPUs to limit this do the following:For stanford:docker run -p 9000:9000 -d --rm mooreap/corenlp -threads 6will run it with 6 threadsFor TweeboParser:docker run -p 8000:8000 -d --rm mooreap/tweeboparserdocker --threads 6will run it with 6 threadsDatasetAll of the dataset are required to be downloaded and are not stored in this repository. We recomend using theconfig fileto 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 thedataset notebookThe datasets used:SemEval 2014 Resturant dataset. We used Train dataset version 2 and the test dataset of which the gold standatd test can be foundhere.SemEval 2014 Laptop dataset. We used Train dataset version2 and the test dataset of which the gold standard test can be foundhere.Election datasetDong et al.Twitter datasetYoutubean datasetby Marrese-Taylor et al.Mitchell datasetwhich was released with thispaper.NOTEBefore using Mitchell and YouTuBean datasets please go through these pre-processing notebooks:MitchellYouTuBeanfor splitting their data and also in Mitchell case which train test split to use.LexiconsThese lexicons are required to be downloaded if you use any methods that require them. Please see the use of theconfig filefor storing the location of the lexicons:MPQA can be foundhereNRChereHu and LiuhereWord VectorsAll the word vectors are automatically downloaded for you and they are stored in the root directory called.Bella/Vectorswhich 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:SSWEWord Vectors trained on sentences that contain emojisGlove Common CrawlGlove TwitterGlove Wiki GigaModel ZooThe model zoo can be found on the Git Lab repositoryhere.These models can be automatically downloaded through the code like the word vectors and stored in the.Bella/Modelsdirectory 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:frombellaimporthelperfrombella.models.targetimportTargetDeptarget_dep=helper.download_model(TargetDep,'SemEval 14 Restaurant')test_example_multi=[{'text':'This bread is tasty but the sauce is too rich','target':'sauce','spans':[(28,33)]}]target_dep.predict(test_example_multi)This example will download the Target Dependent model which is fromVo and Zhangpaper that has been trained on the SemEval 2014 Resturant data and predict the sentiment ofsaucefrom 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.breadwith a positive sentiment and 2.saucewhich 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 tothis notebook.The notebooksCan be foundhereThe best order to look at the notebooks is first look at the data with thisnotebook. Then looking at thenotebookthat describes how to load and use the saved models from themodel zoo. Then go and explore the rest if you would like:The Mass evaluation notebooks are the followingMass Evaluation - TDParsefor the Target dependent modelsMass Evaluation - Target Dependentfor the TDParse modelsMass Evaluation LSTMfor the LSTM models
All of these do not contain any analysis just demostartes how we gathered the results. Lastly they also create the model zoo. For the analysis of the Mass evaluations seeMass Evaluation Result AnalysisnotebookFor the analysis of the reproduction of the Target Dependent model ofVo and Zhangsee thisnotebookFor the analysis of the reproduction of the TDParse model ofWang et al.see thisnotebookFor the analysis of the reproduction of the LSTM models ofTang et al.see thisnotebookFor the statistics of the datasets and where to find them see thisnotebookFor the code on creating training and test splits for the YouTuBean dataset see thisnotebookFor the code on creating training and test splits forMitchell et al.dataset see thisnotebookPre-Trained Model examplesnotebookDocker ServersBoth 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 differentportorhostnameyou can change the.Bella/config.yamlfile which is created in your local home directory the first time you run somethingsuccessfullythrough the Stanford or Tweebo tools. The file once created which is only done automatically for you when yousuccessfullyrun something through the Stanford or Tweebo tools will look like this which is a yaml formatted file:tweebo_parser:hostname:0.0.0.0port:7000stanford_core_nlp:hostname:http://localhostport:8000If you want Tweebo or Stanford to run on a differentportorhostnamejust change this file. For instance the example shown above is different to default as Stanford is running onport8000 and not 9000 and Tweebo is running onport7000 instead of 8000.If you would like the tools to run on differenthostnameandportfrom the start without having tosuccessfullyrun them through the tools before hand just create this file.Bella/config.yamlin your local home directory with the same structure as the example but with thehostnameandportyou want to use.Different LicensesAs 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:The Moses tokeniser is licensed underGNU Lesser General Public License version 2.1or, at your option, any later version.