├── net ├── parser │ ├── __init__.py │ └── parser.py ├── model │ ├── __init__.py │ ├── loss │ │ ├── __init__.py │ │ └── loss.py │ ├── layer │ │ ├── __init__.py │ │ ├── attention.py │ │ ├── attention_tanh.py │ │ └── svm.py │ ├── decoder │ │ ├── __init__.py │ │ ├── fc_decoder.py │ │ ├── lstm_decoder.py │ │ └── lstm_article_decoder.py │ ├── encoder │ │ ├── __init__.py │ │ ├── article_encoder.py │ │ ├── cnn_encoder.py │ │ ├── lstm_single_encoder.py │ │ └── lstm_encoder.py │ ├── model │ │ ├── __init__.py │ │ ├── cnn.py │ │ ├── lstm.py │ │ ├── multi_lstm.py │ │ ├── article.py │ │ ├── cnn_seq.py │ │ ├── multi_lstm_seq.py │ │ ├── hlstm_seq.py │ │ └── pipeline.py │ └── model_list.py ├── __init__.py ├── result │ ├── gen_law.py │ ├── gen_result.py │ ├── result_time.txt │ ├── law_result_tiao.txt │ └── crit_result.txt ├── word2vec.py ├── data_fetcher.py ├── loader.py ├── counter.py ├── data_formatter.py └── utils.py ├── meta └── model.pptx ├── result ├── art_fact_pku_crit ├── art_fact_cjo ├── CNN_dag_pku ├── CNN_mtl_pku ├── pipeline_cail ├── CNN_dag_cail ├── CNN_mtl_cail ├── CNN_none_cail ├── CNN_none_pku ├── CNN_seq_cail ├── CNN_seq_cjo ├── CNN_seq_pku ├── CNN_stl_cail ├── CNN_stl_cjo ├── CNN_stl_pku ├── CNN_tree_cail ├── CNN_tree_pku ├── HLSTM_mtl_pku ├── HLSTM_stl_pku ├── pipeline_cjo ├── pipeline_pku └── HLSTM_mtl_cail ├── config ├── cail │ ├── seq │ │ ├── dag.config │ │ ├── none.config │ │ ├── seq.config │ │ └── tree.config │ ├── other │ │ ├── pipeline.config │ │ └── art_fact.config │ ├── cnn │ │ ├── mtl.config │ │ ├── law.config │ │ ├── crit.config │ │ └── time.config │ └── hlstm │ │ ├── mtl.config │ │ ├── law.config │ │ ├── crit.config │ │ └── time.config ├── cjo │ ├── seq │ │ ├── dag.config │ │ ├── none.config │ │ ├── seq.config │ │ └── tree.config │ ├── other │ │ ├── pipeline.config │ │ └── art_fact.config │ ├── cnn │ │ ├── mtl.config │ │ ├── crit.config │ │ ├── law.config │ │ └── time.config │ └── hlstm │ │ ├── mtl.config │ │ ├── crit.config │ │ ├── law.config │ │ └── time.config ├── pku │ ├── seq │ │ ├── dag.config │ │ ├── none.config │ │ ├── seq.config │ │ └── tree.config │ ├── other │ │ ├── pipeline.config │ │ ├── art_fact.config │ │ ├── art_fact_crit.config │ │ ├── art_fact_law.config │ │ ├── art_fact_time.config │ │ └── art_fact_5000.config │ ├── cnn │ │ ├── mtl.config │ │ ├── crit.config │ │ ├── law.config │ │ └── time.config │ └── hlstm │ │ ├── mtl.config │ │ ├── crit.config │ │ ├── law.config │ │ └── time.config ├── previous │ ├── basic │ │ ├── cnn_seq.config │ │ ├── art_fact.config │ │ ├── pipeline.config │ │ ├── cnn_mtl.config │ │ ├── lstm_mtl.config │ │ ├── multi_lstm_seq.config │ │ └── multi_lstm_mtl.config │ ├── lstm │ │ ├── time │ │ │ ├── big.config │ │ │ ├── small.config │ │ │ └── test.config │ │ ├── crit │ │ │ ├── small.config │ │ │ └── big.config │ │ ├── law1 │ │ │ └── small.config │ │ └── multi │ │ │ ├── big.config │ │ │ └── small.config │ ├── baseline │ │ ├── crit │ │ │ ├── test.config │ │ │ ├── small.config │ │ │ └── big.config │ │ ├── law1 │ │ │ ├── test.config │ │ │ ├── small.config │ │ │ ├── big2.config │ │ │ └── big.config │ │ └── time │ │ │ ├── test.config │ │ │ ├── small.config │ │ │ └── big.config │ ├── cnn │ │ ├── new │ │ │ └── big.config │ │ ├── crit │ │ │ ├── test.config │ │ │ ├── small.config │ │ │ └── big.config │ │ ├── law1 │ │ │ ├── test.config │ │ │ ├── small.config │ │ │ └── big.config │ │ ├── time │ │ │ ├── small.config │ │ │ ├── test.config │ │ │ └── big.config │ │ └── multi │ │ │ ├── small.config │ │ │ ├── test.config │ │ │ └── big.config │ ├── multi_lstm │ │ ├── time │ │ │ ├── test.config │ │ │ ├── small.config │ │ │ ├── big.config │ │ │ └── big2.config │ │ ├── crit │ │ │ ├── small.config │ │ │ ├── test.config │ │ │ ├── big.config │ │ │ └── big2.config │ │ ├── law1 │ │ │ ├── big.config │ │ │ ├── big2.config │ │ │ └── small.config │ │ └── multi │ │ │ ├── small.config │ │ │ ├── small2.config │ │ │ ├── big.config │ │ │ └── big2.config │ ├── nn_fact_art_final │ │ └── law1_crit_time │ │ │ ├── test.config │ │ │ ├── small.config │ │ │ └── big.config │ ├── cnn_final │ │ ├── crit_time │ │ │ ├── small.config │ │ │ ├── test.config │ │ │ └── big.config │ │ ├── seq │ │ │ └── big.config │ │ ├── trans │ │ │ ├── big2.config │ │ │ └── big.config │ │ ├── law1_crit_time │ │ │ ├── small.config │ │ │ ├── test.config │ │ │ ├── big.config │ │ │ └── big2.config │ │ ├── reverse │ │ │ └── big2.config │ │ ├── two_to_one │ │ │ ├── big.config │ │ │ └── big2.config │ │ ├── seq_attention │ │ │ └── big2.config │ │ ├── tree_attention │ │ │ └── big2.config │ │ └── chaoba │ │ │ ├── test.config │ │ │ └── big2.config │ ├── article │ │ ├── big2.config │ │ ├── test.config │ │ ├── small.config │ │ ├── big.config │ │ ├── big_lstm.config │ │ └── big2_lstm.config │ └── multi_lstm_final │ │ ├── law1_crit_time │ │ ├── big.config │ │ ├── small.config │ │ ├── test2.config │ │ ├── small3.config │ │ ├── small2.config │ │ └── big2.config │ │ ├── trans │ │ └── big.config │ │ ├── two_to_one │ │ ├── big.config │ │ └── big2.config │ │ ├── attention_seq │ │ ├── test2.config │ │ ├── small2.config │ │ └── big2.config │ │ └── attention_tree │ │ └── big2.config └── default.config ├── .gitignore ├── data_processor └── previous │ ├── make_data.cpp │ ├── temp.py │ ├── filter.py │ ├── classifer.py │ └── analyzer.py ├── LICENSE ├── result.py ├── test.py ├── train.py ├── trans.py ├── reformat.py ├── counter.py └── README.md /net/parser/__init__.py: -------------------------------------------------------------------------------- 1 | from .parser import ConfigParser -------------------------------------------------------------------------------- /meta/model.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thunlp/TopJudge/HEAD/meta/model.pptx -------------------------------------------------------------------------------- /net/model/__init__.py: -------------------------------------------------------------------------------- 1 | from .model import * 2 | from .model_list import get_model -------------------------------------------------------------------------------- /net/__init__.py: -------------------------------------------------------------------------------- 1 | from . import utils, file_reader, data_formatter, loader, word2vec 2 | -------------------------------------------------------------------------------- /result/art_fact_pku_crit: -------------------------------------------------------------------------------- 1 | law [0, 0, 0, 0] 2 | crit [0, 0, 0, 0] 3 | time [0, 0, 0, 0] 4 | -------------------------------------------------------------------------------- /result/art_fact_cjo: -------------------------------------------------------------------------------- 1 | law [0, 0, 0, 0] 2 | crit [0.625, 0.981, 0.984, 0.982] 3 | time [0, 0, 0, 0] 4 | -------------------------------------------------------------------------------- /net/model/loss/__init__.py: -------------------------------------------------------------------------------- 1 | from .loss import cross_entropy_loss, one_cross_entropy_loss, log_regression 2 | -------------------------------------------------------------------------------- /result/CNN_dag_pku: -------------------------------------------------------------------------------- 1 | law [0.953, 0.755, 0.666, 0.675] 2 | crit [0.954, 0.75, 0.689, 0.7] 3 | time [0.576, 0.461, 0.313, 0.312] 4 | -------------------------------------------------------------------------------- /result/CNN_mtl_pku: -------------------------------------------------------------------------------- 1 | law [0.95, 0.738, 0.649, 0.66] 2 | crit [0.95, 0.707, 0.606, 0.617] 3 | time [0.584, 0.36, 0.287, 0.289] 4 | -------------------------------------------------------------------------------- /result/pipeline_cail: -------------------------------------------------------------------------------- 1 | law [0.847, 0.807, 0.688, 0.708] 2 | crit [0.836, 0.816, 0.7, 0.721] 3 | time [0.4, 0.367, 0.33, 0.326] 4 | -------------------------------------------------------------------------------- /result/CNN_dag_cail: -------------------------------------------------------------------------------- 1 | law [0.863, 0.819, 0.711, 0.734] 2 | crit [0.857, 0.834, 0.76, 0.783] 3 | time [0.383, 0.361, 0.331, 0.321] 4 | -------------------------------------------------------------------------------- /result/CNN_mtl_cail: -------------------------------------------------------------------------------- 1 | law [0.845, 0.8, 0.681, 0.703] 2 | crit [0.834, 0.816, 0.691, 0.716] 3 | time [0.395, 0.372, 0.323, 0.313] 4 | -------------------------------------------------------------------------------- /result/CNN_none_cail: -------------------------------------------------------------------------------- 1 | law [0.846, 0.762, 0.67, 0.685] 2 | crit [0.834, 0.773, 0.675, 0.694] 3 | time [0.388, 0.349, 0.317, 0.304] 4 | -------------------------------------------------------------------------------- /result/CNN_none_pku: -------------------------------------------------------------------------------- 1 | law [0.947, 0.701, 0.633, 0.644] 2 | crit [0.949, 0.651, 0.594, 0.601] 3 | time [0.578, 0.328, 0.275, 0.276] 4 | -------------------------------------------------------------------------------- /result/CNN_seq_cail: -------------------------------------------------------------------------------- 1 | law [0.856, 0.803, 0.686, 0.707] 2 | crit [0.845, 0.831, 0.735, 0.76] 3 | time [0.387, 0.373, 0.318, 0.317] 4 | -------------------------------------------------------------------------------- /result/CNN_seq_cjo: -------------------------------------------------------------------------------- 1 | law [0.946, 0.554, 0.471, 0.482] 2 | crit [0.949, 0.56, 0.481, 0.493] 3 | time [0.583, 0.386, 0.308, 0.313] 4 | -------------------------------------------------------------------------------- /result/CNN_seq_pku: -------------------------------------------------------------------------------- 1 | law [0.952, 0.732, 0.667, 0.677] 2 | crit [0.954, 0.787, 0.68, 0.703] 3 | time [0.574, 0.385, 0.315, 0.312] 4 | -------------------------------------------------------------------------------- /result/CNN_stl_cail: -------------------------------------------------------------------------------- 1 | law [0.814, 0.744, 0.641, 0.657] 2 | crit [0.807, 0.773, 0.655, 0.672] 3 | time [0.388, 0.347, 0.278, 0.286] 4 | -------------------------------------------------------------------------------- /result/CNN_stl_cjo: -------------------------------------------------------------------------------- 1 | law [0.925, 0.469, 0.384, 0.4] 2 | crit [0.923, 0.412, 0.323, 0.337] 3 | time [0.574, 0.356, 0.222, 0.227] 4 | -------------------------------------------------------------------------------- /result/CNN_stl_pku: -------------------------------------------------------------------------------- 1 | law [0.931, 0.643, 0.526, 0.543] 2 | crit [0.933, 0.619, 0.493, 0.511] 3 | time [0.576, 0.241, 0.231, 0.233] 4 | -------------------------------------------------------------------------------- /result/CNN_tree_cail: -------------------------------------------------------------------------------- 1 | law [0.847, 0.789, 0.675, 0.691] 2 | crit [0.836, 0.799, 0.706, 0.729] 3 | time [0.388, 0.363, 0.323, 0.313] 4 | -------------------------------------------------------------------------------- /result/CNN_tree_pku: -------------------------------------------------------------------------------- 1 | law [0.953, 0.718, 0.665, 0.673] 2 | crit [0.954, 0.761, 0.686, 0.699] 3 | time [0.583, 0.39, 0.288, 0.306] 4 | -------------------------------------------------------------------------------- /result/HLSTM_mtl_pku: -------------------------------------------------------------------------------- 1 | law [0.939, 0.712, 0.646, 0.651] 2 | crit [0.938, 0.678, 0.6, 0.607] 3 | time [0.554, 0.313, 0.262, 0.257] 4 | -------------------------------------------------------------------------------- /result/HLSTM_stl_pku: -------------------------------------------------------------------------------- 1 | law [0.917, 0.544, 0.534, 0.509] 2 | crit [0.919, 0.525, 0.489, 0.473] 3 | time [0.543, 0.206, 0.217, 0.19] 4 | -------------------------------------------------------------------------------- /result/pipeline_cjo: -------------------------------------------------------------------------------- 1 | law [0.937, 0.519, 0.441, 0.449] 2 | crit [0.936, 0.455, 0.391, 0.393] 3 | time [0.582, 0.382, 0.249, 0.268] 4 | -------------------------------------------------------------------------------- /result/pipeline_pku: -------------------------------------------------------------------------------- 1 | law [0.944, 0.696, 0.61, 0.622] 2 | crit [0.943, 0.651, 0.562, 0.572] 3 | time [0.582, 0.362, 0.264, 0.271] 4 | -------------------------------------------------------------------------------- /net/model/layer/__init__.py: -------------------------------------------------------------------------------- 1 | from .attention import Attention 2 | from .attention_tanh import AttentionTanH 3 | from .svm import svm 4 | -------------------------------------------------------------------------------- /result/HLSTM_mtl_cail: -------------------------------------------------------------------------------- 1 | law [0.368, 0.323, 0.285, 0.228] 2 | crit [0.322, 0.254, 0.252, 0.191] 3 | time [0.299, 0.154, 0.153, 0.139] 4 | -------------------------------------------------------------------------------- /net/model/decoder/__init__.py: -------------------------------------------------------------------------------- 1 | from .fc_decoder import FCDecoder 2 | from .lstm_article_decoder import LSTMArticleDecoder 3 | from .lstm_decoder import LSTMDecoder 4 | -------------------------------------------------------------------------------- /config/cail/seq/dag.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNNSeq 3 | 4 | [data] 5 | dataset = cail 6 | 7 | [output] 8 | model_name = CNN_dag_cail 9 | 10 | [train] 11 | train_num_process = 5 12 | test_num_process = 5 13 | -------------------------------------------------------------------------------- /config/cjo/seq/dag.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNNSeq 3 | 4 | [data] 5 | dataset = cjo 6 | 7 | [output] 8 | model_name = CNN_dag_cjo 9 | 10 | [train] 11 | train_num_process = 5 12 | test_num_process = 5 13 | -------------------------------------------------------------------------------- /config/pku/seq/dag.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNNSeq 3 | 4 | [data] 5 | dataset = pku 6 | 7 | [output] 8 | model_name = CNN_dag_pku 9 | 10 | [train] 11 | train_num_process = 5 12 | test_num_process = 5 13 | -------------------------------------------------------------------------------- /net/model/encoder/__init__.py: -------------------------------------------------------------------------------- 1 | from .cnn_encoder import CNNEncoder 2 | from .lstm_encoder import LSTMEncoder 3 | from .lstm_single_encoder import LSTMSingleEncoder 4 | from .article_encoder import ArticleEncoder 5 | -------------------------------------------------------------------------------- /config/cail/other/pipeline.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = Pipeline 3 | 4 | [data] 5 | dataset = cail 6 | 7 | [output] 8 | model_name = pipeline_cail 9 | 10 | [train] 11 | train_num_process = 5 12 | test_num_process = 5 13 | -------------------------------------------------------------------------------- /config/cjo/other/pipeline.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = Pipeline 3 | 4 | [data] 5 | dataset = cjo 6 | 7 | [output] 8 | model_name = pipeline_cjo 9 | 10 | [train] 11 | train_num_process = 5 12 | test_num_process = 5 13 | -------------------------------------------------------------------------------- /config/pku/other/pipeline.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = Pipeline 3 | 4 | [data] 5 | dataset = pku 6 | 7 | [output] 8 | model_name = pipeline_pku 9 | 10 | [train] 11 | train_num_process = 5 12 | test_num_process = 5 13 | -------------------------------------------------------------------------------- /config/cjo/cnn/mtl.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNN 3 | more_fc = True 4 | 5 | [data] 6 | dataset = cjo 7 | 8 | [output] 9 | model_name = CNN_mtl_cjo 10 | 11 | [train] 12 | train_num_process = 5 13 | test_num_process = 5 14 | -------------------------------------------------------------------------------- /config/cjo/seq/none.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNNSeq 3 | 4 | [data] 5 | dataset = cjo 6 | graph = [] 7 | 8 | [output] 9 | model_name = CNN_none_cjo 10 | 11 | [train] 12 | train_num_process = 5 13 | test_num_process = 5 14 | -------------------------------------------------------------------------------- /config/pku/cnn/mtl.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNN 3 | more_fc = True 4 | 5 | [data] 6 | dataset = pku 7 | 8 | [output] 9 | model_name = CNN_mtl_pku 10 | 11 | [train] 12 | train_num_process = 5 13 | test_num_process = 5 14 | -------------------------------------------------------------------------------- /config/pku/seq/none.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNNSeq 3 | 4 | [data] 5 | dataset = pku 6 | graph = [] 7 | 8 | [output] 9 | model_name = CNN_none_pku 10 | 11 | [train] 12 | train_num_process = 5 13 | test_num_process = 5 14 | -------------------------------------------------------------------------------- /config/cail/cnn/mtl.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNN 3 | more_fc = True 4 | 5 | [data] 6 | dataset = cail 7 | 8 | [output] 9 | model_name = CNN_mtl_cail 10 | 11 | [train] 12 | train_num_process = 5 13 | test_num_process = 5 14 | -------------------------------------------------------------------------------- /config/cail/seq/none.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNNSeq 3 | 4 | [data] 5 | dataset = cail 6 | graph = [] 7 | 8 | [output] 9 | model_name = CNN_none_cail 10 | 11 | [train] 12 | train_num_process = 5 13 | test_num_process = 5 14 | -------------------------------------------------------------------------------- /config/cjo/hlstm/mtl.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = MultiLSTM 3 | more_fc = True 4 | 5 | [data] 6 | dataset = cjo 7 | 8 | [output] 9 | model_name = HLSTM_mtl_cjo 10 | 11 | [train] 12 | train_num_process = 5 13 | test_num_process = 5 14 | -------------------------------------------------------------------------------- /config/cjo/seq/seq.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNNSeq 3 | 4 | [data] 5 | dataset = cjo 6 | graph = [(1 2),(2 3)] 7 | 8 | [output] 9 | model_name = CNN_seq_cjo 10 | 11 | [train] 12 | train_num_process = 5 13 | test_num_process = 5 14 | -------------------------------------------------------------------------------- /config/pku/hlstm/mtl.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = MultiLSTM 3 | more_fc = True 4 | 5 | [data] 6 | dataset = pku 7 | 8 | [output] 9 | model_name = HLSTM_mtl_pku 10 | 11 | [train] 12 | train_num_process = 5 13 | test_num_process = 5 14 | -------------------------------------------------------------------------------- /config/pku/seq/seq.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNNSeq 3 | 4 | [data] 5 | dataset = pku 6 | graph = [(1 2),(2 3)] 7 | 8 | [output] 9 | model_name = CNN_seq_pku 10 | 11 | [train] 12 | train_num_process = 5 13 | test_num_process = 5 14 | -------------------------------------------------------------------------------- /config/cail/hlstm/mtl.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = MultiLSTM 3 | more_fc = True 4 | 5 | [data] 6 | dataset = cail 7 | 8 | [output] 9 | model_name = HLSTM_mtl_cail 10 | 11 | [train] 12 | train_num_process = 5 13 | test_num_process = 5 14 | -------------------------------------------------------------------------------- /config/cail/seq/seq.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNNSeq 3 | 4 | [data] 5 | dataset = cail 6 | graph = [(1 2),(2 3)] 7 | 8 | [output] 9 | model_name = CNN_seq_cail 10 | 11 | [train] 12 | train_num_process = 5 13 | test_num_process = 5 14 | -------------------------------------------------------------------------------- /config/cail/seq/tree.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNNSeq 3 | 4 | [data] 5 | dataset = cail 6 | graph = [(1 2),(1 3)] 7 | 8 | [output] 9 | model_name = CNN_tree_cail 10 | 11 | [train] 12 | train_num_process = 5 13 | test_num_process = 5 14 | -------------------------------------------------------------------------------- /config/cjo/seq/tree.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNNSeq 3 | 4 | [data] 5 | dataset = cjo 6 | graph = [(1 2),(1 3)] 7 | 8 | [output] 9 | model_name = CNN_tree_cjo 10 | 11 | [train] 12 | train_num_process = 5 13 | test_num_process = 5 14 | -------------------------------------------------------------------------------- /config/pku/seq/tree.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNNSeq 3 | 4 | [data] 5 | dataset = pku 6 | graph = [(1 2),(1 3)] 7 | 8 | [output] 9 | model_name = CNN_tree_pku 10 | 11 | [train] 12 | train_num_process = 5 13 | test_num_process = 5 14 | -------------------------------------------------------------------------------- /config/previous/basic/cnn_seq.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNNSeq 3 | 4 | [data] 5 | data_path = /data/zhx/law/data/cjo 6 | 7 | [output] 8 | model_name = CNN_seq_cjo 9 | 10 | [train] 11 | train_num_process = 5 12 | test_num_process = 5 13 | -------------------------------------------------------------------------------- /config/previous/basic/art_fact.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = ArtFact 3 | 4 | [data] 5 | data_path = /data/zhx/law/data/cjo 6 | 7 | [output] 8 | model_name = art_fact_cjo 9 | 10 | [train] 11 | train_num_process = 5 12 | test_num_process = 5 13 | -------------------------------------------------------------------------------- /config/previous/basic/pipeline.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = Pipeline 3 | 4 | [data] 5 | data_path = /data/zhx/law/data/cjo 6 | 7 | [output] 8 | model_name = pipeline_cjo 9 | 10 | [train] 11 | train_num_process = 5 12 | test_num_process = 5 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea* 2 | *.swp 3 | *.swo 4 | *.un~ 5 | *~ 6 | data_processor/make_data 7 | __pycache__ 8 | data_processor/result 9 | temp 10 | net/result/result 11 | response 12 | result/result.xlsx 13 | result/~$* 14 | config/default_local.config 15 | -------------------------------------------------------------------------------- /config/previous/basic/cnn_mtl.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNN 3 | more_fc = True 4 | 5 | [data] 6 | data_path = /data/zhx/law/data/cjo 7 | 8 | [output] 9 | model_name = CNN_mtl_cjo 10 | 11 | [train] 12 | train_num_process = 5 13 | test_num_process = 5 14 | -------------------------------------------------------------------------------- /config/previous/basic/lstm_mtl.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = LSTM 3 | more_fc = True 4 | 5 | [data] 6 | data_path = /data/zhx/law/data/cjo 7 | 8 | [output] 9 | model_name = LSTM_mtl_cjo 10 | 11 | [train] 12 | train_num_process = 5 13 | test_num_process = 5 14 | -------------------------------------------------------------------------------- /config/previous/basic/multi_lstm_seq.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = MultiLSTMSeq 3 | 4 | [data] 5 | data_path = /data/zhx/law/data/cjo 6 | 7 | [output] 8 | model_name = Mutli_LSTM_seq_cjo 9 | 10 | [train] 11 | train_num_process = 5 12 | test_num_process = 5 13 | -------------------------------------------------------------------------------- /config/cail/cnn/law.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNN 3 | 4 | [data] 5 | dataset = cail 6 | type_of_label = law 7 | type_of_loss = single_classification 8 | 9 | [output] 10 | model_name = CNN_stl_cail 11 | 12 | [train] 13 | train_num_process = 5 14 | test_num_process = 5 15 | -------------------------------------------------------------------------------- /config/cjo/cnn/crit.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNN 3 | 4 | [data] 5 | dataset = cjo 6 | type_of_label = crit 7 | type_of_loss = single_classification 8 | 9 | [output] 10 | model_name = CNN_stl_cjo 11 | 12 | [train] 13 | train_num_process = 5 14 | test_num_process = 5 15 | -------------------------------------------------------------------------------- /config/cjo/cnn/law.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNN 3 | 4 | [data] 5 | dataset = cjo 6 | type_of_label = law 7 | type_of_loss = single_classification 8 | 9 | [output] 10 | model_name = CNN_stl_cjo 11 | 12 | [train] 13 | train_num_process = 5 14 | test_num_process = 5 15 | -------------------------------------------------------------------------------- /config/cjo/cnn/time.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNN 3 | 4 | [data] 5 | dataset = cjo 6 | type_of_label = time 7 | type_of_loss = single_classification 8 | 9 | [output] 10 | model_name = CNN_stl_cjo 11 | 12 | [train] 13 | train_num_process = 5 14 | test_num_process = 5 15 | -------------------------------------------------------------------------------- /config/pku/cnn/crit.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNN 3 | 4 | [data] 5 | dataset = pku 6 | type_of_label = crit 7 | type_of_loss = single_classification 8 | 9 | [output] 10 | model_name = CNN_stl_pku 11 | 12 | [train] 13 | train_num_process = 5 14 | test_num_process = 5 15 | -------------------------------------------------------------------------------- /config/pku/cnn/law.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNN 3 | 4 | [data] 5 | dataset = pku 6 | type_of_label = law 7 | type_of_loss = single_classification 8 | 9 | [output] 10 | model_name = CNN_stl_pku 11 | 12 | [train] 13 | train_num_process = 5 14 | test_num_process = 5 15 | -------------------------------------------------------------------------------- /config/pku/cnn/time.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNN 3 | 4 | [data] 5 | dataset = pku 6 | type_of_label = time 7 | type_of_loss = single_classification 8 | 9 | [output] 10 | model_name = CNN_stl_pku 11 | 12 | [train] 13 | train_num_process = 5 14 | test_num_process = 5 15 | -------------------------------------------------------------------------------- /config/cail/cnn/crit.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNN 3 | 4 | [data] 5 | dataset = cail 6 | type_of_label = crit 7 | type_of_loss = single_classification 8 | 9 | [output] 10 | model_name = CNN_stl_cail 11 | 12 | [train] 13 | train_num_process = 5 14 | test_num_process = 5 15 | -------------------------------------------------------------------------------- /config/cail/cnn/time.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = CNN 3 | 4 | [data] 5 | dataset = cail 6 | type_of_label = time 7 | type_of_loss = single_classification 8 | 9 | [output] 10 | model_name = CNN_stl_cail 11 | 12 | [train] 13 | train_num_process = 5 14 | test_num_process = 5 15 | -------------------------------------------------------------------------------- /config/previous/basic/multi_lstm_mtl.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = MultiLSTM 3 | more_fc = True 4 | 5 | [data] 6 | data_path = /data/zhx/law/data/cjo 7 | 8 | [output] 9 | model_name = Mutli_LSTM_mtl_cjo 10 | 11 | [train] 12 | train_num_process = 5 13 | test_num_process = 5 14 | -------------------------------------------------------------------------------- /config/cail/hlstm/law.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = MultiLSTM 3 | 4 | [data] 5 | dataset = cail 6 | type_of_label = law 7 | type_of_loss = single_classification 8 | 9 | [output] 10 | model_name = HLSTM_stl_cail 11 | 12 | [train] 13 | train_num_process = 5 14 | test_num_process = 5 15 | -------------------------------------------------------------------------------- /config/cjo/hlstm/crit.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = MultiLSTM 3 | 4 | [data] 5 | dataset = cjo 6 | type_of_label = crit 7 | type_of_loss = single_classification 8 | 9 | [output] 10 | model_name = HLSTM_stl_cjo 11 | 12 | [train] 13 | train_num_process = 5 14 | test_num_process = 5 15 | -------------------------------------------------------------------------------- /config/cjo/hlstm/law.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = MultiLSTM 3 | 4 | [data] 5 | dataset = cjo 6 | type_of_label = law 7 | type_of_loss = single_classification 8 | 9 | [output] 10 | model_name = HLSTM_stl_cjo 11 | 12 | [train] 13 | train_num_process = 5 14 | test_num_process = 5 15 | -------------------------------------------------------------------------------- /config/cjo/hlstm/time.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = MultiLSTM 3 | 4 | [data] 5 | dataset = cjo 6 | type_of_label = time 7 | type_of_loss = single_classification 8 | 9 | [output] 10 | model_name = HLSTM_stl_cjo 11 | 12 | [train] 13 | train_num_process = 5 14 | test_num_process = 5 15 | -------------------------------------------------------------------------------- /config/pku/hlstm/crit.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = MultiLSTM 3 | 4 | [data] 5 | dataset = pku 6 | type_of_label = crit 7 | type_of_loss = single_classification 8 | 9 | [output] 10 | model_name = HLSTM_stl_pku 11 | 12 | [train] 13 | train_num_process = 5 14 | test_num_process = 5 15 | -------------------------------------------------------------------------------- /config/pku/hlstm/law.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = MultiLSTM 3 | 4 | [data] 5 | dataset = pku 6 | type_of_label = law 7 | type_of_loss = single_classification 8 | 9 | [output] 10 | model_name = HLSTM_stl_pku 11 | 12 | [train] 13 | train_num_process = 5 14 | test_num_process = 5 15 | -------------------------------------------------------------------------------- /config/pku/hlstm/time.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = MultiLSTM 3 | 4 | [data] 5 | dataset = pku 6 | type_of_label = time 7 | type_of_loss = single_classification 8 | 9 | [output] 10 | model_name = HLSTM_stl_pku 11 | 12 | [train] 13 | train_num_process = 5 14 | test_num_process = 5 15 | -------------------------------------------------------------------------------- /config/cail/hlstm/crit.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = MultiLSTM 3 | 4 | [data] 5 | dataset = cail 6 | type_of_label = crit 7 | type_of_loss = single_classification 8 | 9 | [output] 10 | model_name = HLSTM_stl_cail 11 | 12 | [train] 13 | train_num_process = 5 14 | test_num_process = 5 15 | -------------------------------------------------------------------------------- /config/cail/hlstm/time.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = MultiLSTM 3 | 4 | [data] 5 | dataset = cail 6 | type_of_label = time 7 | type_of_loss = single_classification 8 | 9 | [output] 10 | model_name = HLSTM_stl_cail 11 | 12 | [train] 13 | train_num_process = 5 14 | test_num_process = 5 15 | -------------------------------------------------------------------------------- /net/model/model/__init__.py: -------------------------------------------------------------------------------- 1 | from .article import Article 2 | from .cnn import CNN 3 | from .cnn_seq import CNNSeq 4 | from .lstm import LSTM 5 | from .multi_lstm import MultiLSTM 6 | from .multi_lstm_seq import MultiLSTMSeq 7 | from .nn_fact_art import NNFactArt 8 | from .nn_fact_art_seq import NNFactArtSeq 9 | from .pipeline import Pipeline 10 | from .hlstm_seq import HLSTMSeq -------------------------------------------------------------------------------- /config/pku/other/art_fact.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = ArtFact 3 | hidden_size = 75 4 | fc1_feature = 150 5 | more_fc = True 6 | 7 | [data] 8 | data_path = /data/zhx/law/data 9 | dataset = pku 10 | 11 | [output] 12 | model_name = art_fact_pku_mtl 13 | model_path = /data/thu/law/model/ 14 | test_path = /data/thu/law/test_result 15 | 16 | [train] 17 | train_num_process = 5 18 | test_num_process = 5 19 | -------------------------------------------------------------------------------- /config/pku/other/art_fact_crit.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = ArtFact 3 | hidden_size = 75 4 | 5 | [data] 6 | data_path = /data/zhx/law/data 7 | dataset = pku 8 | type_of_label = crit 9 | type_of_loss = single_classification 10 | 11 | [output] 12 | model_name = art_fact_pku 13 | model_path = /data/thu/law/model/ 14 | test_path = /data/thu/law/test_result 15 | 16 | [train] 17 | train_num_process = 5 18 | test_num_process = 5 19 | -------------------------------------------------------------------------------- /config/pku/other/art_fact_law.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = ArtFact 3 | hidden_size = 75 4 | 5 | [data] 6 | data_path = /data/zhx/law/data 7 | dataset = pku 8 | type_of_label = law 9 | type_of_loss = single_classification 10 | 11 | [output] 12 | model_name = art_fact_pku 13 | model_path = /data/thu/law/model/ 14 | test_path = /data/thu/law/test_result 15 | 16 | [train] 17 | train_num_process = 5 18 | test_num_process = 5 19 | -------------------------------------------------------------------------------- /config/pku/other/art_fact_time.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = ArtFact 3 | hidden_size = 75 4 | 5 | [data] 6 | data_path = /data/zhx/law/data 7 | dataset = pku 8 | type_of_label = time 9 | type_of_loss = single_classification 10 | 11 | [output] 12 | model_name = art_fact_pku 13 | model_path = /data/thu/law/model/ 14 | test_path = /data/thu/law/test_result 15 | 16 | [train] 17 | train_num_process = 5 18 | test_num_process = 5 19 | -------------------------------------------------------------------------------- /config/cail/other/art_fact.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = ArtFact 3 | hidden_size = 256 4 | fc1_feature = 512 5 | more_fc = True 6 | 7 | [data] 8 | data_path = /data/zhx/law/data 9 | dataset = cail 10 | batch_size = 16 11 | 12 | [output] 13 | model_name = art_fact_cail_mtl_5000 14 | model_path = /data/thu/law/model/ 15 | test_path = /data/thu/law/test_result 16 | 17 | [train] 18 | train_num_process = 5 19 | test_num_process = 5 20 | -------------------------------------------------------------------------------- /config/pku/other/art_fact_5000.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = ArtFact 3 | hidden_size = 256 4 | fc1_feature = 512 5 | more_fc = True 6 | 7 | [data] 8 | data_path = /data/zhx/law/data 9 | dataset = pku 10 | batch_size = 16 11 | 12 | [output] 13 | model_name = art_fact_pku_mtl_5000 14 | model_path = /data/thu/law/model/ 15 | test_path = /data/thu/law/test_result 16 | 17 | [train] 18 | train_num_process = 5 19 | test_num_process = 5 20 | -------------------------------------------------------------------------------- /config/cjo/other/art_fact.config: -------------------------------------------------------------------------------- 1 | [net] 2 | name = ArtFact 3 | hidden_size = 256 4 | fc1_feature = 512 5 | more_fc = True 6 | 7 | [data] 8 | data_path = /data/zhx/law/data 9 | dataset = cjo 10 | batch_size = 16 11 | 12 | [output] 13 | model_name = art_fact_cjo_mtl_5000 14 | model_path = /data/thu/law/model/ 15 | test_path = /data/thu/law/test_result 16 | 17 | [train] 18 | epoch = 24 19 | train_num_process = 5 20 | test_num_process = 5 21 | -------------------------------------------------------------------------------- /net/result/gen_law.py: -------------------------------------------------------------------------------- 1 | law_dict = {} 2 | f = open("law_result.txt", "r") 3 | for line in f: 4 | data = line[:-1].split(" ") 5 | name = (int(data[0]), int(data[1])) 6 | num = int(data[3]) 7 | 8 | if not (name in law_dict): 9 | law_dict[name] = 0 10 | 11 | law_dict[name] += num 12 | 13 | f = open("law_result_tiao.txt", "w") 14 | 15 | for x in law_dict.keys(): 16 | print(x[0], x[1], law_dict[x], file=f) 17 | 18 | f.close() 19 | -------------------------------------------------------------------------------- /net/model/model_list.py: -------------------------------------------------------------------------------- 1 | from .model import * 2 | 3 | match_list = { 4 | "CNN": CNN, 5 | "MultiLSTM": MultiLSTM, 6 | "CNNSeq": CNNSeq, 7 | "MultiLSTMSeq": MultiLSTMSeq, 8 | "Article": Article, 9 | "LSTM": LSTM, 10 | "ArtFact": NNFactArt, 11 | "ArtFactSeq": NNFactArtSeq, 12 | "Pipeline": Pipeline, 13 | "HLSTMSeq": HLSTMSeq 14 | } 15 | 16 | 17 | def get_model(model_name, config, usegpu): 18 | if model_name in match_list.keys(): 19 | net = match_list[model_name](config, usegpu) 20 | return net 21 | else: 22 | gg 23 | -------------------------------------------------------------------------------- /net/model/loss/loss.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import torch.nn as nn 3 | import torch.nn.functional as F 4 | 5 | 6 | def cross_entropy_loss(outputs, labels): 7 | temp = F.sigmoid(outputs) 8 | res = - labels * torch.log(temp) - (1 - labels) * torch.log(1 - temp) 9 | res = torch.mean(torch.sum(res, dim=1)) 10 | 11 | return res 12 | 13 | 14 | def one_cross_entropy_loss(outputs, labels): 15 | criterion = nn.CrossEntropyLoss() 16 | return criterion(outputs, torch.max(labels,dim=1)[1]) 17 | 18 | 19 | def log_regression(outputs, labels): 20 | return torch.log(torch, abs(outputs - labels) + 1.0) ** 2 21 | -------------------------------------------------------------------------------- /net/model/layer/attention.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import torch.nn as nn 3 | import torch.nn.functional as F 4 | 5 | 6 | class Attention(nn.Module): 7 | def __init__(self, config): 8 | super(Attention, self).__init__() 9 | pass 10 | 11 | def forward(self, feature, hidden): 12 | feature = feature.view(feature.size(0), -1, 1) 13 | ratio = torch.bmm(hidden, feature) 14 | ratio = ratio.view(ratio.size(0), ratio.size(1)) 15 | ratio = F.softmax(ratio, dim=1).view(ratio.size(0), -1, 1) 16 | result = torch.bmm(hidden.transpose(1, 2), ratio) 17 | result = result.view(result.size(0), -1) 18 | 19 | return result 20 | -------------------------------------------------------------------------------- /config/previous/lstm/time/big.config: -------------------------------------------------------------------------------- 1 | [net] 2 | hidden_size = 256 3 | more_fc = False 4 | 5 | [data] 6 | data_path = /data/disk1/private/zhonghaoxi/law/data 7 | train_data = 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14 8 | test_data = 15,16,17,18,19 9 | word2vec = path 10 | type_of_label = time 11 | pad_length = 256 12 | batch_size = 128 13 | shuffle = False 14 | vec_size = 200 15 | 16 | [train] 17 | epoch = 256 18 | learning_rate = 1e-3 19 | momentum = 0.99 20 | optimizer = adam 21 | dropout = 0.5 22 | model_path = /data/disk1/private/zhonghaoxi/law/model/lstm_time_baseline_big 23 | test_path = /data/disk1/private/zhonghaoxi/law/test_result/lstm_time_baseline_big 24 | 25 | [debug] 26 | output_time = 128 27 | test_time = 256 28 | -------------------------------------------------------------------------------- /config/previous/lstm/time/small.config: -------------------------------------------------------------------------------- 1 | [net] 2 | hidden_size = 256 3 | more_fc = False 4 | 5 | [data] 6 | data_path = /data/disk1/private/zhonghaoxi/law/data 7 | #data_path = /home/zhonghaoxi/law/small_data 8 | train_data = 0 9 | test_data = 4 10 | word2vec = path 11 | type_of_label = time 12 | pad_length = 512 13 | batch_size = 16 14 | shuffle = False 15 | vec_size = 200 16 | 17 | [train] 18 | epoch = 256 19 | learning_rate = 3e-4 20 | momentum = 0.99 21 | optimizer = adam 22 | dropout = 0.5 23 | model_path = /data/disk1/private/zhonghaoxi/law/model/lstm_time_baseline_small 24 | test_path = /data/disk1/private/zhonghaoxi/law/test_result/lstm_time_baseline_small 25 | 26 | [debug] 27 | output_time = 128 28 | test_time = 1024 29 | -------------------------------------------------------------------------------- /net/model/model/cnn.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import torch.nn as nn 3 | 4 | from net.model.encoder import CNNEncoder 5 | from net.model.decoder import FCDecoder 6 | 7 | 8 | class CNN(nn.Module): 9 | def __init__(self, config, usegpu): 10 | super(CNN, self).__init__() 11 | 12 | self.encoder = CNNEncoder(config, usegpu) 13 | self.decoder = FCDecoder(config, usegpu) 14 | self.dropout = nn.Dropout(config.getfloat("train", "dropout")) 15 | 16 | def init_hidden(self, config, usegpu): 17 | pass 18 | 19 | def forward(self, x, doc_len, config): 20 | x = self.encoder(x, doc_len, config) 21 | x = self.dropout(x) 22 | x = self.decoder(x, doc_len, config) 23 | 24 | return x 25 | -------------------------------------------------------------------------------- /data_processor/previous/make_data.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace std; 6 | 7 | int file_num = 20; 8 | 9 | char djm[1000]; 10 | 11 | FILE *f[100]; 12 | 13 | int main() 14 | { 15 | freopen("/disk/mysql/mysql/Law1/out.txt","r",stdin); 16 | 17 | for (int a=0;a