Coder Social home page Coder Social logo

fudannlp16 / cws_dict Goto Github PK

View Code? Open in Web Editor NEW
91.0 4.0 32.0 40.24 MB

Source codes for paper "Neural Networks Incorporating Dictionaries for Chinese Word Segmentation", AAAI 2018

Python 98.93% Shell 1.07%
cws chinese-word-segmentation deep-learning word-segmentation tensorflow

cws_dict's Introduction

Neural Networks Incorporating Dictionaries for Chinese Word Segmentation

Source codes and corpora for the Chinese word segmentation algorithm proposed in the following paper.

Qi Zhang, Xiaoyu Liu, Jinlan Fu. Neural Networks Incorporating Dictionaries for Chinese Word Segmentation. AAAI 2018

Dependencies

Directory structure

CWS_dict
    same-domain:  In-domain evaluation for CWS (SIGHAN2005,CTB6)
    cross-domain: Cross-domain evaluation for CWS (SIGHAN2010)

Introduction

Although neural network based methods achieved great success for Chinese word segmentation task, these methods typically lack the capability of processing rare words and data whose domains are different from training data. However, dictionaries contains both rare words and domain-specific words. In this paper, we study the problem of integrating dictionaries into neural networks based methods for the Chinese word segmentation task. To integrate dictionaries, we define several feature templates to construct feature vectors for each character based on dictionaries and contexts. Then, two different methods that extend the Bi-LSTM-CRF are proposed to perform the task.

Experiments show our methods can achieve better performance than other state-of-the-art neural network methods and domain adaptation approaches in most cases. In particular, when applying the trained model on different domains, we only need to add extra domain specific dictionaries. The other learned parameters can remain unchanged with no need for retraining.

cws_dict's People

Contributors

fudannlp16 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cws_dict's Issues

Converting sparse IndexedSlices to a dense Tensor of unknown shape

I use Tensorflow 1.3.1. When I run train_dict.py. A warning has been shown:

/opt/anaconda2/envs/tf1p3py27/lib/python2.7/site-packages/tensorflow/python/ops/gradients_impl.py:95: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory.
"Converting sparse IndexedSlices to a dense Tensor of unknown shape. "

Do you have this situation?

dev_step() takes exactly 5 arguments (4 given)

When I run:
python train_dict.py --dataset msr --model DictHyperModel --model_path mymsr
After a long epoch info log, an error has been shown:

('epoch:0>>99.32%', 'completed in 959.34 (sec) <<\r')
('epoch:0>>99.48%', 'completed in 960.52 (sec) <<\r')
('epoch:0>>99.64%', 'completed in 961.96 (sec) <<\r')
('epoch:0>>99.81%', 'completed in 963.57 (sec) <<\r')
Train Epoch 0 loss 14.632959
Traceback (most recent call last):
File "train_dict.py", line 183, in
train()
File "train_dict.py", line 104, in train
loss, predict= model.dev_step(sess, input_x, y)
TypeError: dev_step() takes exactly 5 arguments (4 given)

Thanks.

train_baseline error:IndexError: index 0 is out of bounds for axis 0 with size 0

Train Epoch 0 loss 63.578703 855.35 (sec) <<
Valid Epoch 0 loss 24.911499
P:0.920358 R:0.946347 F:0.933171

Traceback (most recent call last):
File "train_baseline.py", line 176, in
train()
File "train_baseline.py", line 118, in train
predict= model.predict_step(sess, input_x)
File "/home/bigdata/CWS_Dict/same-domain/models/BaselineModel.py", line 126, in predict_step
viterbi_sequence, _=crf.viterbi_decode(unary_score[:length],transition_param)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/crf/python/ops/crf.py", line 299, in viterbi_decode
trellis[0] = score[0]
IndexError: index 0 is out of bounds for axis 0 with size 0

score not right

i have run you code,and the result not right. in your result :Model I on PKU is 0.962 msr is 0.976 cityu is 0.960 and i run the result on PKU is0.9697 msr is 0.9734 and cityu is 0.9675.why have i get this better result?

CTB data

How can I get CTB dataset? Thank you!

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.