Code Monkey home page Code Monkey logo

victornlp_sentiment's Introduction

VictorNLP_DP: A multi-model, multi-lingual dependency parsing package.

Summary

Sentiment Analysis

Sentiment Analysis is a sentence-classification task. It may be targeting binary classes(Positive-Negative) or graded classes(VP-Positive-Neutral-Negative-VN, etc.). VictorNLP-Sentiment framework supplies various deep learning sentiment analysis models. In-depth description of resources and their implementation details are recorded right here:

VictorNLP_Sentiment Documentation

VictorNLP Framework

VictorNLP, a PyTorch-based NLP framework, provides intuitive interfaces and carefully designed code modularity for implementing and pipelining NLP modules. For more details, refer to the VictorNLP Specification page.

VictorNLP Specification

Installation

  1. Clone the repository to your local computer.
git clone https://github.com/jinulee-v/victornlp_sentiment
  1. Install victornlp_sentiment package using pip.
cd victornlp_sentiment
mkdir corpus model
pip install -e ./victornlp_sentiment

Note: All commands in this documentation should be executed in the same directory.

ls

corpus model victornlp_dp

  1. Install dependencies.
pip install -r victornlp_dp/requirements.txt
apt-get install default-jre # For KOMORAN PoS tagger
cd ..

How-to:

Prepare Datasets and pretrained embeddings

Dataset: TODO

Pretrained embeddings

Refer to VictorNLP_Utils documentation.

Add downloaded files to victornlp_dp/victornlp_utils/data as instructed.

If the script raises NotFoundError, precautious warnings containing missing dependencies are printed.

Train model

This script automatically reads config_file and starts training. However, for convenience, overriding configuration file with command line arguments is supported. However, to reduce command line bizarreness, we only support major hyper-parameters. Details like model hyperparameters(num_layers, dropout, ...) are likely to be modified directly in victornlp_dp/config.json or other config files.

python -m victornlp_sentiment.train

Refer to python -m victornlp_sentiment.train -h for more information, and train.sh for some demos.

Fine-tune model

This script also supports fine-tuning for different possible situations:

  • Re-train with another corpus.
  • Fine-tuning of pre-trained embeddings. Refer to the following code snippet or train-finetune.sh for examples. You can override any cmd line argument-supported hyperparameter just as training, and you can also modify models/Example_name/config.json for more precise and specific tuning.
python -m victornlp_sentiment.train --finetune-model models/Example_name

ls models/Example

  • model.pt
  • config.json

Test model

Use this script to test model stats or parse sentences of interest. You only require --model-dir argument which is a directory name that contains model.pt and config.json. These two files are automatically generated by the victornlp_sentiment.train script. Command line arguments can modify the script's behavior from testing to parsing. Details are given below.

python victornlp_sentiment.test --model-dir ./model/(folder name)

Optional Command line arguments:

  • -a, --analyze : Can freely select which analyzing functions(victornlp_sentiment/tools/analyze.py) to apply. Test set requires golden labels
  • --data-file : path/to/input/file. Load VictorNLP_format .json file to parse. If not provided, parses stdin inputs(line by line, PoS automatically tagged).
  • --save-result : path/to/store/parsed_file.json. Stores parsed result in the designated path.

victornlp_sentiment's People

Contributors

jinulee-v avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.