Skip to content
/ CIAN Public

Implementation of the Character-level Intra Attention Network (CIAN) for Natural Language Inference (NLI) upon SNLI and MultiNLI corpus

License

Notifications You must be signed in to change notification settings

yanghanxy/CIAN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f4df263 · Nov 24, 2017

History

29 Commits
Jul 11, 2017
Jul 11, 2017
Jun 30, 2017
Jul 11, 2017
Jul 11, 2017
Jun 22, 2017
Nov 16, 2017
Nov 24, 2017
Jun 30, 2017
Nov 24, 2017
Jul 11, 2017

Repository files navigation

Character-level Intra Attention Network

Implementation of the paper Character-level Intra Attention Network (CIAN) in proceddings of the RepEval Workshop in The 2017 Conference on Empirical Methods on Natural Language Processing.

Architecture of the model:

Requirements

Code is written in python 2.7 and requires Keras 2.

Data

Dataset could be downloaded at MultiNLI and SNLI.

How to run

First to do a modification with Keras, see the following section.

Dataset should be be put in folder ./data

To run the model, use

python ./model.py

The result and log file will be saved in ./log folder.

Modification with keras

In #Python_Path\Lib\site-packages\keras\preprocessing\text.py, line 39,

CHANGE

    text = text.translate(maketrans(filters, split * len(filters)))

TO

    try:
        text = unicode(text, "utf-8")
    except TypeError:
        pass
    translate_table = {ord(c): ord(t) for c, t in zip(filters, split * len(filters))}
    text = text.translate(translate_table)

Result

Visualization of Attention

PairID 192997e, label Entailment

PairID 254941e, label Entailment

Reference

[1] Character-Aware Neural Language Models

[2] Intra Attention Mechanism

About

Implementation of the Character-level Intra Attention Network (CIAN) for Natural Language Inference (NLI) upon SNLI and MultiNLI corpus

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages