NewsMTSC: (Multi-)Target-dependent Sentiment Classification in News Articles

Overview

NewsMTSC: (Multi-)Target-dependent Sentiment Classification in News Articles

NewsMTSC is a dataset for target-dependent sentiment classification (TSC) on news articles reporting on policy issues. The dataset consists of more than 11k labeled sentences, which we sampled from news articles from online US news outlets. More information can be found in our paper published at the EACL 2021.

This repository contains the dataset for target-dependent sentiment classification in news articles reporting on policy issues. Additionally, the repository contains our model named GRU-TSC, which achieves state-of-the-art TSC classification performance on NewsMTSC. Check it out - it works out of the box :-)

This readme consists of the following parts:

If you are only looking for the dataset, you can download it here or view it here.

To make the model available also to users without programming skills, we aimed to make the installation and using the model as easy as possible. If you face any issue with using the model or notice an issue in our dataset, you are more than welcome to open an issue.

Installation

It's super easy, we promise!

To keep things easy, we use Anaconda for setting up requirements. If you do not have it yet, follow Anaconda's installation instructions. NewsMTSC was tested on MacOS and Ubuntu; other OS may work, too. Let us know :-)

1. Setup the conda environment:

conda create --yes -n newsmtsc python=3.7
conda activate newsmtsc

2. Clone the repository:

git clone [email protected]:fhamborg/NewsMTSC.git
cd NewsMTSC

3. Install pytorch:

Choose either of the following. Either use this command if your GPU supports CUDA:

conda install --yes "pytorch=1.7.1" torchvision cudatoolkit=10.1 -c pytorch

Or use this command if your GPU does not support CUDA, you don't know what CUDA is, or if the previous command gives you an error:

conda install --yes "pytorch=1.7.1" torchvision -c pytorch

4. Install remaining packages:

=2.1,<3" conda install --yes -c anaconda requests gensim openpyxl networkx pip install "transformers>=3.1.0,<4" python -m spacy download en_core_web_sm ">
conda install --yes pandas tqdm scikit-learn
conda install --yes -c conda-forge boto3 regex sacremoses jsonlines matplotlib tabulate imbalanced-learn "spacy>=2.1,<3"
conda install --yes -c anaconda requests gensim openpyxl networkx
pip install "transformers>=3.1.0,<4"
python -m spacy download en_core_web_sm

5. Download our model:

python download.py

You're all set now :-)

Target-dependent Sentiment Classification

Target-dependent sentiment classification works out-of-the-box. Have a look at infer.py or give it a try:

python infer.py

Training

There are two entry points to the system. train.py is used to train and evaluate a specific model on a specific dataset using specific hyperparameters. We call a single run an experiment. controller.py is used to run multiple experiments automatically. This is for example useful for model selection and evaluating hundreds or thousands of combinations of models, hyperparameters, and datasets.

Running a single experiment

Goal: training a model with a user-defined (hyper)parameter combination.

train.py allows fine-grained control over the training and evaluation process, yet for most command line arguments we provide useful defaults. Two arguments are required:

  • --own_model_name (which model is used, e.g., grutsc),
  • --dataset_name (which dataset is used, e.g., newsmtsc-rw).

For more information refer to train.py and combinations_absadata_0.py. If you just want to get started quickly, the command below should work out of the box.

python train.py --own_model_name grutsc --dataset_name newsmtsc-rw

Running multiple experiments

Goal: finding the (hyper)parameter combination to train a model that achieves the best performance.

controller.py takes a set of values for each argument, creates combinations of arguments, applies conditions to remove unnecessary combinations (e.g., some arguments may only be used for a specific model), and creates a multiprocessing pool to run experiments of these argument combinations in parallel. After completion, controller.py creates a summary, which contains detailed results, including evaluation performance, of all experiments. By using createoverview.py, you can export this summary into an Excel spreadsheet.

Acknowledgements

This repository is in part based on ABSA-PyTorch. We thank Song et al. for making their excellent repository open source.

How to cite

If you use the dataset or model, please cite our paper (PDF):

@InProceedings{Hamborg2021b,
  author    = {Hamborg, Felix and Donnay, Karsten},
  title     = {NewsMTSC: (Multi-)Target-dependent Sentiment Classification in News Articles},
  booktitle = {Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics (EACL 2021)},
  year      = {2021},
  month     = {Apr.},
  location  = {Virtual Event},
}
Comments
  • Error in Google Colab

    Error in Google Colab

    Hello!

    I am trying to use the NewsSentiment package on Google Colab. After successful installation using !pip3 install NewsSentiment with the python version 3.7.12, I get an error just from using:

    from NewsSentiment import TargetSentimentClassifier
    tsc = TargetSentimentClassifier()
    
    usage: ipykernel_launcher.py [-h] [--training_mode [TRAINING_MODE]]
                                 [--own_model_name OWN_MODEL_NAME]
                                 [--dataset_name DATASET_NAME]
                                 [--data_format DATA_FORMAT]
                                 [--optimizer OPTIMIZER]
                                 [--initializer INITIALIZER]
                                 [--learning_rate LEARNING_RATE]
                                 [--dropout DROPOUT] [--l2reg L2REG]
                                 [--num_epoch NUM_EPOCH] [--batch_size BATCH_SIZE]
                                 [--log_step LOG_STEP] [--max_seq_len MAX_SEQ_LEN]
                                 [--polarities_dim POLARITIES_DIM]
                                 [--device DEVICE] [--seed SEED]
                                 [--local_context_focus LOCAL_CONTEXT_FOCUS]
                                 [--SRD SRD] [--snem SNEM] [--devmode [DEVMODE]]
                                 [--experiment_path EXPERIMENT_PATH]
                                 [--balancing BALANCING]
                                 [--spc_lm_representation SPC_LM_REPRESENTATION]
                                 [--spc_input_order SPC_INPUT_ORDER]
                                 [--use_early_stopping [USE_EARLY_STOPPING]]
                                 [--eval_only_after_last_epoch [EVAL_ONLY_AFTER_LAST_EPOCH]]
                                 [--pretrained_model_name PRETRAINED_MODEL_NAME]
                                 [--state_dict STATE_DICT]
                                 [--single_targets [SINGLE_TARGETS]]
                                 [--multi_targets [MULTI_TARGETS]] [--loss LOSS]
                                 [--targetclasses TARGETCLASSES]
                                 [--knowledgesources KNOWLEDGESOURCES [KNOWLEDGESOURCES ...]]
                                 [--is_use_natural_target_phrase_for_spc [IS_USE_NATURAL_TARGET_PHRASE_FOR_SPC]]
                                 [--default_lm DEFAULT_LM] [--run_id RUN_ID]
                                 [--coref_mode_in_training COREF_MODE_IN_TRAINING]
                                 [--logging LOGGING]
                                 [--ignore_parsing_errors [IGNORE_PARSING_ERRORS]]
                                 [--export_finetuned_model EXPORT_FINETUNED_MODEL]
    ipykernel_launcher.py: error: unrecognized arguments: -f /root/.local/share/jupyter/runtime/kernel-64f5d3e5-ff4d-4bab-b66d-cbdb4d4203f9.json
    An exception has occurred, use %tb to see the full traceback.
    
    SystemExit: 2
    

    Any idea what this can be?

    Thanks,

    Joan

    opened by joansc 6
  • last_hidden_states being string instead of Tensor

    last_hidden_states being string instead of Tensor

    21:40:47 INFO diskdict(20):__init__|: loaded DiskDict with 6726 items from knowledge/bingliuopinion/opinion_polarity.ddict
    21:40:47 INFO diskdict(20):__init__|: loaded DiskDict with 6886 items from knowledge/mpqasubjectivity/subjclueslen1-HLTEMNLP05.tff.ddict
    21:40:47 INFO diskdict(20):__init__|: loaded DiskDict with 6468 items from knowledge/nrcemolex/NRC-Emotion-Lexicon-Wordlevel-v0.92.txt.ddict
    21:40:49 INFO infer(25):__init__|: overwriting: own_model_name=None to grutsc
    21:40:49 INFO infer(25):__init__|: overwriting: default_lm=bert-base-uncased to roberta-base
    21:40:49 INFO infer(25):__init__|: overwriting: state_dict=None to grutsc
    21:40:49 INFO infer(25):__init__|: overwriting: knowledgesources=[] to nrc_emotions mpqa_subjectivity bingliu_opinion
    21:40:49 INFO train(1045):prepare_and_start_instructor|: set default language model to roberta-base
    21:40:49 INFO train(1038):post_process_arguments|: updated total number of categories to 10 with EKS nrc_emotions
    21:40:49 INFO train(1038):post_process_arguments|: updated total number of categories to 13 with EKS mpqa_subjectivity
    21:40:49 INFO train(1038):post_process_arguments|: updated total number of categories to 15 with EKS bingliu_opinion
    21:40:49 INFO train(1064):prepare_and_start_instructor|: set number of polarity classes to 3
    21:40:49 INFO train(1071):prepare_and_start_instructor|: no random seed was given, using system time
    21:40:49 INFO train(1072):prepare_and_start_instructor|: setting random seed: 1621885249
    21:40:49 INFO train(911):_setup_cuda|: cuda information
    21:40:49 INFO train(912):_setup_cuda|: scc SGE_GPU: None
    21:40:49 INFO train(913):_setup_cuda|: arg: cuda device: None
    21:40:49 INFO train(936):_setup_cuda|: using CPU
    21:40:49 INFO train(223):create_transformer_model|: creating model for weights name: roberta-base
    21:40:49 INFO train(239):create_transformer_model|: using model_path: roberta-base
    Some weights of the model checkpoint at roberta-base were not used when initializing RobertaModel: ['lm_head.bias', 'lm_head.decoder.weight', 'lm_head.dense.weight', 'lm_head.layer_norm.bias', 'lm_head.dense.bias', 'lm_head.layer_norm.weight']
    - This IS expected if you are initializing RobertaModel from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
    - This IS NOT expected if you are initializing RobertaModel from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
    21:40:55 INFO train(121):__init__|: initialized transformer tokenizers and models
    21:40:55 INFO train(148):__init__|: loading weights from pretrained_models/state_dicts/grutsc...
    21:40:57 INFO train(151):__init__|: done
    21:40:57 INFO train(153):__init__|: initialized own model
    21:40:57 INFO train(212):_print_args|: n_trainable_params: 153015555, n_nontrainable_params: 0
    21:40:57 INFO train(215):_print_args|: > training arguments:
    21:40:57 INFO train(217):_print_args|: >>> training_mode: False
    21:40:57 INFO train(217):_print_args|: >>> own_model_name: grutsc
    21:40:57 INFO train(217):_print_args|: >>> dataset_name: None
    21:40:57 INFO train(217):_print_args|: >>> data_format: None
    21:40:57 INFO train(217):_print_args|: >>> optimizer: adam
    21:40:57 INFO train(217):_print_args|: >>> initializer: xavier_uniform_
    21:40:57 INFO train(217):_print_args|: >>> learning_rate: 2e-05
    21:40:57 INFO train(217):_print_args|: >>> dropout: 0.1
    21:40:57 INFO train(217):_print_args|: >>> l2reg: 0.01
    21:40:57 INFO train(217):_print_args|: >>> num_epoch: 10
    21:40:57 INFO train(217):_print_args|: >>> batch_size: 64
    21:40:57 INFO train(217):_print_args|: >>> log_step: 5
    21:40:57 INFO train(217):_print_args|: >>> max_seq_len: 150
    21:40:57 INFO train(217):_print_args|: >>> polarities_dim: 3
    21:40:57 INFO train(217):_print_args|: >>> device: cpu
    21:40:57 INFO train(217):_print_args|: >>> seed: 1621885249
    21:40:57 INFO train(217):_print_args|: >>> local_context_focus: cdm
    21:40:57 INFO train(217):_print_args|: >>> SRD: 3
    21:40:57 INFO train(217):_print_args|: >>> snem: f1_macro
    21:40:57 INFO train(217):_print_args|: >>> devmode: False
    21:40:57 INFO train(217):_print_args|: >>> experiment_path: ./
    21:40:57 INFO train(217):_print_args|: >>> balancing: None
    21:40:57 INFO train(217):_print_args|: >>> spc_lm_representation: mean_last
    21:40:57 INFO train(217):_print_args|: >>> spc_input_order: text_target
    21:40:57 INFO train(217):_print_args|: >>> use_early_stopping: False
    21:40:57 INFO train(217):_print_args|: >>> eval_only_after_last_epoch: False
    21:40:57 INFO train(217):_print_args|: >>> pretrained_model_name: None
    21:40:57 INFO train(217):_print_args|: >>> state_dict: pretrained_models/state_dicts/grutsc
    21:40:57 INFO train(217):_print_args|: >>> single_targets: True
    21:40:57 INFO train(217):_print_args|: >>> multi_targets: False
    21:40:57 INFO train(217):_print_args|: >>> loss: crossentropy
    21:40:57 INFO train(217):_print_args|: >>> targetclasses: newsmtsc3
    21:40:57 INFO train(217):_print_args|: >>> knowledgesources: ('nrc_emotions', 'mpqa_subjectivity', 'bingliu_opinion')
    21:40:57 INFO train(217):_print_args|: >>> is_use_natural_target_phrase_for_spc: False
    21:40:57 INFO train(217):_print_args|: >>> default_lm: roberta-base
    21:40:57 INFO train(217):_print_args|: >>> run_id: 0
    21:40:57 INFO train(217):_print_args|: >>> coref_mode_in_training: ignore
    21:40:57 INFO train(217):_print_args|: >>> base_path: /home/moritz/Documents/Hiwi/NewsMTSC
    /home/moritz/anaconda3/envs/newsmtsc/lib/python3.7/site-packages/transformers/tokenization_utils_base.py:2110: FutureWarning: The `pad_to_max_length` argument is deprecated and will be removed in a future version, use `padding=True` or `padding='longest'` to pad to the longest sequence in the batch, or use `padding='max_length'` to pad to a max length. In this case, you can give a specific length with `max_length` (e.g. `max_length=45`) or leave max_length to None to pad to the maximal input size of the model (e.g. 512 for Bert).
      FutureWarning,
    21:40:57 WARNING dataset(194):_create_word_to_wordpiece_mapping|: overlap when mapping tokens to wordpiece (allow overwriting because Roberta is used)
    Traceback (most recent call last):
      File "/snap/pycharm-educational/38/plugins/python-ce/helpers/pydev/pydevd.py", line 1483, in _exec
        pydev_imports.execfile(file, globals, locals)  # execute the script
      File "/snap/pycharm-educational/38/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
        exec(compile(contents+"\n", file, 'exec'), glob, loc)
      File "/home/moritz/Documents/Hiwi/NewsMTSC/infer.py", line 155, in <module>
        text_right=", you have to admit that he’s an astute reader of politics.",
      File "/home/moritz/Documents/Hiwi/NewsMTSC/infer.py", line 88, in infer
        outputs = self.model(inputs)
      File "/home/moritz/anaconda3/envs/newsmtsc/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
        result = self.forward(*input, **kwargs)
      File "/home/moritz/Documents/Hiwi/NewsMTSC/models/singletarget/grutscsingle.py", line 132, in forward
        (last_hidden_states, knowledge_embedded), dim=2
    TypeError: expected Tensor as element 0 in argument 0, but got str
    

    last_hidden_states has indeed the string value “last_hidden_states” (i.e. last_hidden_states = “last_hidden_states”) after the statement in https://github.com/fhamborg/NewsMTSC/blob/aaa358baf1473ecab22585c73c6d52307e6a3179/models/singletarget/grutscsingle.py#L102-L106

    opened by movabo 4
  • Strange results on Hugging Face

    Strange results on Hugging Face

    Hello!

    I am testing your model uploaded on Hugging Face( roberta-targeted-sentiment-classification-newsarticles) and its giving some strange results. Just from inputting text on the example text box I get:

    Two children among 3 Eritrean refugees killed in Tigray air raid. - LABEL_0=0.53 LABEL_1=0.47 Gunfire heard as BBC visits scene of Kazakh clashes. - LABEL_0=0.539 LABEL_1=0.461 Trinity College Dublin begins €90m project to relocate vulnerable books - LABEL_0=0.506 LABEL_1=0.494 US economy added 199,000 new jobs in December as unemployment rate drops - LABEL_0=0.506 LABEL_1=0.494

    If I use transformers with my own python code sentiment_analysis = pipeline("sentiment-analysis", model=folder, tokenizer=folder, return_all_scores=True), I get slightly different results:

    Two children among 3 Eritrean refugees killed in Tigray air raid. - LABEL_0=0.59 LABEL_1=0.41 Gunfire heard as BBC visits scene of Kazakh clashes. - LABEL_0=0.6 LABEL_1=0.39 Trinity College Dublin begins €90m project to relocate vulnerable books - LABEL_0=0.59 LABEL_1=0.40 US economy added 199,000 new jobs in December as unemployment rate drops - LABEL_0=0.59 LABEL_1=0.41

    I assume LABEL_0 corresponds the proability the sentence is negative in sentiment...? Anyway, I do not see relevant results from the model on both cases and I am wondering if it's because I am missing something.

    Thanks and keep up with the amazing work!

    Joan

    opened by joansc 3
  • Model update

    Model update

    Hi, I recent rework the LCF-BERT model, now it is much faster and stable. If you have interest to update the model, please see PyABSA.

    Cheers,

    Yang Heng

    opened by yangheng95 3
  • Fix several bugs, prepare PyTorch hub support

    Fix several bugs, prepare PyTorch hub support

    Bugs fixed:

    • AttributeError: spacy.pipeline.DependencyParser object has no attribute 'labels' -> Allow spacy versions greater 2.0.*
    • ModuleNotFoundError: No module named 'models.singletarget.stancedetectionpaper' -> Local import in method where it's required
    • ModuleNotFoundError: No module named 'models.singletarget.knowledgesourceshosseiniatdbert' -> Local import in method where it's required
    opened by movabo 3
  • How to deal with sentence with multiple target with GRUTSC?

    How to deal with sentence with multiple target with GRUTSC?

    Hi @fhamborg,

    I am sort of confused with the implementation on how to deal with sentences with multiple target using the GRUTSC model in training time.

    Do you end you making multiple inputs for the same sentence for each target? eg. input1 = [cls,sentence,sep,target1,sep] eg. input2 = [cls,sentence,sep,target2,sep] and so on..?

    opened by Pager07 2
  • Difference between huggingface and

    Difference between huggingface and "normal" dataset

    Hello,

    Thank you for sharing your code and datasets.

    I notice there's a difference in the total number of samples between the huggingface and the normal version of the dataset. Could you explain me ?

    Also in your paper, I understand that you make several sampling of dev and test from the devtest_xx.jsonl file ? Can you confirm ?

    Thanks a lot

    opened by EvanDufraisse 1
  • download.py error

    download.py error

      ~/IdeaProjects/NewsMTSC   main ···································································································································································································  4s  CompanySentimentNews  15:54:38
    ❯ python download.py
    15:54:47 INFO diskdict(20):__init__|: loaded DiskDict with 6726 items from knowledge/bingliuopinion/opinion_polarity.ddict
    15:54:47 INFO diskdict(20):__init__|: loaded DiskDict with 6886 items from knowledge/mpqasubjectivity/subjclueslen1-HLTEMNLP05.tff.ddict
    15:54:47 INFO diskdict(20):__init__|: loaded DiskDict with 6468 items from knowledge/nrcemolex/NRC-Emotion-Lexicon-Wordlevel-v0.92.txt.ddict
    Traceback (most recent call last):
      File "download.py", line 111, in <module>
        Download.run_from_cmd()
      File "download.py", line 102, in run_from_cmd
        return cls(**args)
      File "download.py", line 19, in __init__
        from train import OWN_MODELNAME2CLASS
      File "/Users/felix/IdeaProjects/NewsMTSC/train.py", line 29, in <module>
        from dataset import FXDataset, RandomOversampler, FXEasyTokenizer
      File "/Users/felix/IdeaProjects/NewsMTSC/dataset.py", line 101, in <module>
        "aux",
    AssertionError
      ~/IdeaProjects/NewsMTSC   main
    
    opened by fhamborg 1
  • may  I want  your dataset about  train.jsonl and test_mt.jsonl,test_rw.jsonl?

    may I want your dataset about train.jsonl and test_mt.jsonl,test_rw.jsonl?

    Hello ,I am apost graduate student,I am interested in your work on news sentiment analysis, I have seen your dataset on github ,but the number of train.jsonl is 7758,test_mt is 721,test_rw is 1067,It is not same from your paper,may I want your complete dataset? my gmail is : [email protected],Thank you very much 👍

    opened by CMM915915 1
  • NewsTSC

    NewsTSC

    Hi Felix,

    I am writing to you about the NEWSTSC repo which is now archived. I ran the train script to train LCF_BERT with the following settings

    python train.py  --model_name lcf_bert --optimizer adam --initializer xavier_uniform_ --learning_rate 3e-5 --batch_size 16 --balancing lossweighting --num_epoch 4 --lsr False --use_tp_placeholders False --eval_only_after_last_epoch True --devmode False --local_context_focus cdm --SRD 3 --pretrained_model_name bert_news_ccnc_10mio_3ep --snem recall_avg --dataset_name newstsc --experiment_path ./experiments/newstsc_20191126-115759/0/ --crossval 0 --task_format newstsc --device cuda:0
    

    I found that the recall_avg score is ~0.65 after 4 epochs. (this is approximately what the paper for NEWTSC describes )

    I then downloaded the fine-tuned weights "lcf_bert_newstsc_val_recall_avg_0.5954_epoch3" and ran test on the given test set for NEWSTSC. I am getting recall_avg scores ~0.825.

    Were the provided fine-tuned weights generated from the 3k sentence dataset provided here?

    opened by Pager07 1
  • Fix UnboundLocalError thrown during training

    Fix UnboundLocalError thrown during training

    NewsSentiment/train.py --own_model_name grutsc --dataset_name newsmtsc-rw threw this error after some time during training:

    Traceback (most recent call last):
      File "NewsSentiment/train.py", line 1379, in <module>
        prepare_and_start_instructor(opt)
      File "NewsSentiment/train.py", line 1206, in prepare_and_start_instructor
        ins.run()
      File "NewsSentiment/train.py", line 866, in run
        criterion, optimizer, train_data_loader, dev_data_loader
      File "NewsSentiment/train.py", line 504, in _train
        selected_model_dev_stats,
      File "NewsSentiment/train.py", line 526, in _intraining_evaluation_and_model_save
        dev_stats = self._evaluate(dev_data_loader)
      File "NewsSentiment/train.py", line 767, in _evaluate
        stats = self.evaluator.calc_statistics(y_true, y_pred, t_outputs_confidence)
    UnboundLocalError: local variable 't_outputs_confidence' referenced before assignment
    

    Looks like an oversight when this variable was introduced in 213c1da0 as in some circumstances this variable can be referenced before assignment.

    opened by simonepstein 0
  • Package Requirements: cudatoolkit 10.1

    Package Requirements: cudatoolkit 10.1

    Hi! Thank you for bringing this work to us!

    I tried to install the NewsSentiment[cuda] package in a conda environment with cudatoolkit installed. Cudatoolkit version is 10.1.243. I keep getting the error that the version is not satisfied. Below is the command and error statement.

    (newsmtsc) C:\Users\nguye>pip install NewsSentiment[cuda]==1.1.9
    ERROR: Could not find a version that satisfies the requirement cudatoolkit==10.1; extra == "cuda" (from newssentiment[cuda]) (from versions: none)
    ERROR: No matching distribution found for cudatoolkit==10.1; extra == "cuda"
    

    My environment:

    (newsmtsc) C:\Users\nguye>conda list
    # packages in environment at C:\Users\nguye\anaconda3\envs\newsmtsc:
    #
    # Name                    Version                   Build  Channel
    ca-certificates           2022.10.11           haa95532_0
    certifi                   2022.12.7        py38haa95532_0
    cudatoolkit               10.1.243             h74a9793_0
    libffi                    3.4.2                hd77b12b_6
    openssl                   1.1.1s               h2bbff1b_0
    pip                       22.3.1           py38haa95532_0
    python                    3.8.15               h6244533_2
    setuptools                65.5.0           py38haa95532_0
    sqlite                    3.40.0               h2bbff1b_0
    vc                        14.2                 h21ff451_1
    vs2015_runtime            14.27.29016          h5e58377_2
    wheel                     0.37.1             pyhd3eb1b0_0
    wincertstore              0.2              py38haa95532_2
    

    For the cudatoolkit installation. There's no way on top of my mind to prevent conda to install the exact 10.1 version.

    (newsmtsc) C:\Users\nguye>conda install cudatoolkit=10.1
    Collecting package metadata (current_repodata.json): done
    Solving environment: done
    
    ## Package Plan ##
    
      environment location: C:\Users\nguye\anaconda3\envs\newsmtsc
    
      added / updated specs:
        - cudatoolkit=10.1
    
    
    The following NEW packages will be INSTALLED:
    
      cudatoolkit        pkgs/main/win-64::cudatoolkit-10.1.243-h74a9793_0
    
    
    Proceed ([y]/n)? y
    
    
    Downloading and Extracting Packages
    
    Preparing transaction: done
    Verifying transaction: done
    Executing transaction: done
    

    I could be wrong somewhere in the installation process. Please let me know how did you deal with this.

    Thanks in advance.

    opened by anng217 0
  • Question on sentiment output

    Question on sentiment output

    Hi there authors, really impressive work with much ease to use, thanks for sharing this :)

    I have a silly question regarding the template example provided:

    • sentiment = tsc.infer_from_text("I like " ,"Peter", " but I don't like Robert.") => [{'class_id': 1, 'class_label': 'neutral', 'class_prob': 0.44148460030555725}, {'class_id': 2, 'class_label': 'positive', 'class_prob': 0.4068439304828644}, {'class_id': 0, 'class_label': 'negative', 'class_prob': 0.15167152881622314}]

    In this case, why is the output neutral? I thought it should be positive. Just to clarify, the input should be [before target] [target] [after target]?

    opened by ipheiman 1
  • Let's turn multilingual!

    Let's turn multilingual!

    Okay, so, I have decided that I want to use this amazing IMPRESSIVE work of art for predicting sentiments in spanish. I noticed that the SentimentAnalysis tool runs on Spacy and uses a English news training dataset. I just can't find the folder were spacy or the dataset are loaded. Is changing these parameters enough? Any further ideas?

    EDIT: I forked the code, edited dataset.py and made a simple way of requiring a different spacy model from the coder's input. I changed the order in FXBaseModel to require RoBERTa before the XLNET model. I plan to make new training datasets (but i just don't know how yet).

    opened by diegopaucarv 1
  • TextTooLongException not thrown when text is too long in specific case

    TextTooLongException not thrown when text is too long in specific case

    When attempting to classify sentiment with the following input, I get a misleading exception. Generally TextTooLongException seems to be thrown appropriately, but this seemed to be the one exception to that:)

    To reproduce:

    left = "market eye-sgx nifty flat; bharti infratel debuts. * nifty futures on the singapore exchange unchanged. the msci-asia pacific index, excluding japan gains 0.43 percent. * bharti infratel ltd debuts after raising about $760 million in india's biggest ipo in two years. traders expect shares to come under pressure due to concerns about the outlook for mobile tower operators. * foreign investors sold 1.33 billion rupees of stocks, while domestic institutions bought 1.33 billion rupees of stocks on thursday, when india's bse index fell 0.48 percent. * traders expect market to trade in a narrow range, with select "
    centre = "oil"
    right = " marketing companies shares to be traced on talks of hike in diesel prices."
    tsc = TargetSentimentClassifier()
    sentiment = tsc.infer_from_text(left, centre, right)
    

    I get the exception:

    TargetNotFoundException
    no target found: [market, eye, -, sgx, nifty, flat, ;, bharti, infratel, debuts, ., *, nifty, futures, on, the, singapore, exchange, unchanged, ., the, msci, -, asia, pacific, index, ,, excluding, japan, gains, 0.43, percent, ., *, bharti, infratel, ltd, debuts, after, raising, about, $, 760, million, in, india, 's, biggest, ipo, in, two, years, ., traders, expect, shares, to, come, under, pressure, due, to, concerns, about, the, outlook, for, mobile, tower, operators, ., *, foreign, investors, sold, 1.33, billion, rupees, of, stocks, ,, while, domestic, institutions, bought, 1.33, billion, rupees, of, stocks, on, thursday, ,, when, india, 's, bse, index, fell, 0.48, percent, ., *, traders, expect, market, to, trade, in, a, narrow, range, ,, with], 615, oil
    

    With package version 1.1.21

    Thanks, love the library!

    opened by bendavidsteel 1
Releases(v1.0.0)
  • v1.0.0(Apr 26, 2021)

Owner
Felix Hamborg
Loves to work on real-world issues
Felix Hamborg
Snowball compiler and stemming algorithms

Snowball is a small string processing language for creating stemming algorithms for use in Information Retrieval, plus a collection of stemming algori

Snowball Stemming language and algorithms 613 Jan 07, 2023
原神抽卡记录数据集-Genshin Impact gacha data

提要 持续收集原神抽卡记录中 可以使用抽卡记录导出工具导出抽卡记录的json,将json文件发送至[email protected],我会在清除个人信息后

117 Dec 27, 2022
Create a machine learning model which will predict if the mortgage will be approved or not based on 5 variables

Mortgage-Application-Analysis Create a machine learning model which will predict if the mortgage will be approved or not based on 5 variables: age, in

1 Jan 29, 2022
AI Assistant for Building Reliable, High-performing and Fair Multilingual NLP Systems

AI Assistant for Building Reliable, High-performing and Fair Multilingual NLP Systems

Microsoft 37 Nov 29, 2022
Deal or No Deal? End-to-End Learning for Negotiation Dialogues

Introduction This is a PyTorch implementation of the following research papers: (1) Hierarchical Text Generation and Planning for Strategic Dialogue (

Facebook Research 1.4k Dec 29, 2022
Journalism AI – Quotes extraction for modular journalism

Quote extraction for modular journalism (JournalismAI collab 2021)

Journalism AI collab 2021 207 Dec 25, 2022
MEDIALpy: MEDIcal Abbreviations Lookup in Python

A small python package that allows the user to look up common medical abbreviations.

Aberystwyth Systems Biology 7 Nov 09, 2022
Creating an Audiobook (mp3 file) using a Ebook (epub) using BeautifulSoup and Google Text to Speech

epub2audiobook Creating an Audiobook (mp3 file) using a Ebook (epub) using BeautifulSoup and Google Text to Speech Input examples qual a pasta do seu

7 Aug 25, 2022
NLP codes implemented with Pytorch (w/o library such as huggingface)

NLP_scratch NLP codes implemented with Pytorch (w/o library such as huggingface) scripts ├── models: Neural Network models ├── data: codes for dataloa

3 Dec 28, 2021
jiant is an NLP toolkit

jiant is an NLP toolkit The multitask and transfer learning toolkit for natural language processing research Why should I use jiant? jiant supports mu

ML² AT CILVR 1.5k Jan 04, 2023
Sentence Embeddings with BERT & XLNet

Sentence Transformers: Multilingual Sentence Embeddings using BERT / RoBERTa / XLM-RoBERTa & Co. with PyTorch This framework provides an easy method t

Ubiquitous Knowledge Processing Lab 9.1k Jan 02, 2023
Generate product descriptions, blogs, ads and more using GPT architecture with a single request to TextCortex API a.k.a Hemingwai

TextCortex - HemingwAI Generate product descriptions, blogs, ads and more using GPT architecture with a single request to TextCortex API a.k.a Hemingw

TextCortex AI 27 Nov 28, 2022
PyTorch Language Model for 1-Billion Word (LM1B / GBW) Dataset

PyTorch Large-Scale Language Model A Large-Scale PyTorch Language Model trained on the 1-Billion Word (LM1B) / (GBW) dataset Latest Results 39.98 Perp

Ryan Spring 114 Nov 04, 2022
Just a Basic like Language for Zeno INC

zeno-basic-language Just a Basic like Language for Zeno INC This is written in 100% python. this is basic language like language. so its not for big p

Voidy Devleoper 1 Dec 18, 2021
SimpleChinese2 集成了许多基本的中文NLP功能,使基于 Python 的中文文字处理和信息提取变得简单方便。

SimpleChinese2 SimpleChinese2 集成了许多基本的中文NLP功能,使基于 Python 的中文文字处理和信息提取变得简单方便。 声明 本项目是为方便个人工作所创建的,仅有部分代码原创。

Ming 30 Dec 02, 2022
Model for recasing and repunctuating ASR transcripts

Recasing and punctuation model based on Bert Benoit Favre 2021 This system converts a sequence of lowercase tokens without punctuation to a sequence o

Benoit Favre 88 Dec 29, 2022
Visual Automata is a Python 3 library built as a wrapper for Caleb Evans' Automata library to add more visualization features.

Visual Automata Copyright 2021 Lewi Lie Uberg Released under the MIT license Visual Automata is a Python 3 library built as a wrapper for Caleb Evans'

Lewi Uberg 55 Nov 17, 2022
VMD Audio/Text control with natural language

This repository is a proof of principle for performing Molecular Dynamics analysis, in this case with the program VMD, via natural language commands.

Andrew White 13 Jun 09, 2022
Translators - is a library which aims to bring free, multiple, enjoyable translation to individuals and students in Python

Translators - is a library which aims to bring free, multiple, enjoyable translation to individuals and students in Python

UlionTse 907 Dec 27, 2022
A large-scale (194k), Multiple-Choice Question Answering (MCQA) dataset designed to address realworld medical entrance exam questions.

MedMCQA MedMCQA : A Large-scale Multi-Subject Multi-Choice Dataset for Medical domain Question Answering A large-scale, Multiple-Choice Question Answe

MedMCQA 24 Nov 30, 2022