Showing preview only (274K chars total). Download the full file or copy to clipboard to get everything.
Repository: thunlp/WantWords
Branch: main
Commit: 2d4a238c72b6
Files: 17
Total size: 265.4 KB
Directory structure:
gitextract__e9ilabv/
├── README.md
├── README_ZH.md
├── manage.py
├── model.py
├── model_en.py
├── static/
│ ├── css/
│ │ └── zzsc.css
│ └── js/
│ ├── home.js
│ └── zzsc.js
├── templates/
│ ├── about.html
│ ├── about_en.html
│ └── home.html
├── uwsgi.ini
└── website_RD/
├── __init__.py
├── settings.py
├── urls.py
├── views.py
└── wsgi.py
================================================
FILE CONTENTS
================================================
================================================
FILE: README.md
================================================
### [中](README_ZH.md)|En
<p align="center">
<a href="https://wantwords.thunlp.org/">
<img src="resources/wantwords_logo.svg" width = "300" alt="WantWords Logo" />
</a>
</p>
<h3 align="center">An Open-source Online Reverse Dictionary [<a href="https://wantwords.net/">link</a>] </h3>
## News
The WantWords MiniProgram has been launched. Welcome to scan the following QR code to try it!
<div align=center>
<img src="resources/miniprogram.jpg" width = "300" alt="MiniProgram QR code"/>
</div>
## What Is a Reverse Dictionary?
Opposite to a regular (forward) dictionary that provides definitions for query words, a reverse dictionary returns words semantically matching the query descriptions.
<div align=center>
<img src="resources/rd_example.png" alt="rd_example" width = "600"/>
</div>
## What Can a Reverse Dictionary Do?
* Solve the *tip-of-the-tongue problem*, the phenomenon of failing to retrieve a word from memory
* Help new language learners
* Help word selection (or word dictionary) anomia patients, people who can recognize and describe an object but fail to name it due to neurological disorder
## Our System
### Workflow
<div align=center>
<img src="resources/workflow.png" alt="workflow" width = "500" />
</div>
### Core Model
The core model of WantWords is based on our proposed **Multi-channel Reverse Dictionary Model** [[paper](https://ojs.aaai.org/index.php/AAAI/article/view/5365/5221)] [[code](https://github.com/thunlp/MultiRD)], as illustrate in the following figure.
<div align=center>
<img src="resources/MRD_model.png" alt="model" width = "500" />
</div>
### Pre-trained Models and Data
You can [download](https://cloud.tsinghua.edu.cn/d/811dcb428ed24480bc60/) and decompress the pre-trained models and data to `BASE_PATH/website_RD/` to reimplement the system.
### Key Requirements
* Django==2.2.5
* django-cors-headers==3.5.0
* numpy==1.17.2
* pytorch-transformers==1.2.0
* requests==2.22.0
* scikit-learn==0.22.1
* scipy==1.4.1
* thulac==0.2.0
* torch==1.2.0
* urllib3==1.25.6
* uWSGI==2.0.18
* uwsgitop==0.11
## Cite
If the code or data help you, please cite the following two papers.
```
@inproceedings{qi2020wantwords,
title={WantWords: An Open-source Online Reverse Dictionary System},
author={Qi, Fanchao and Zhang, Lei and Yang, Yanhui and Liu, Zhiyuan and Sun, Maosong},
booktitle={Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations},
pages={175--181},
year={2020}
}
@inproceedings{zhang2020multi,
title={Multi-channel reverse dictionary model},
author={Zhang, Lei and Qi, Fanchao and Liu, Zhiyuan and Wang, Yasheng and Liu, Qun and Sun, Maosong},
booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
pages={312--319},
year={2020}
}
```
================================================
FILE: README_ZH.md
================================================
### 中|[En](README.md)
<p align="center">
<a href="https://wantwords.thunlp.org/">
<img src="resources/wantwords_logo.svg" width = "300" alt="WantWords Logo"/>
</a>
</p>
<h3 align="center">首个支持中文及跨语言查询的开源在线反向词典 [<a href="https://wantwords.net/">点击访问</a>] </h3>
## 新闻
WantWords小程序已上线,欢迎扫码体验!
<div align=center>
<img src="resources/miniprogram.jpg" width = "300" alt="MiniProgram QR code"/>
</div>
## 什么是反向词典?
普通的词典告诉你某个词语的定义,而反向词典恰好相反,可以告诉你哪些词语符合你输入描述的意思。下图为WantWords在线反向词典的页面截图,其中演示了反向查词的一个示例,输入“山非常高”,系统将返回一系列模型认为表达“山非常高”意思的词语,例如“高峻”、“巍峨”等。
<div align=center>
<img src="resources/screenshot.png" alt="rd_example" width = "700" />
</div>
## 反向词典可以用来做什么?
* 解决“舌尖现象”(*tip-of-the-tongue*,又称话到嘴边说不出来),即暂时性忘词的问题
* 帮助语言学习者学习、巩固词汇
* 改善选词性失语者患者的生活质量,该病的症状是可以识别并描述一个物体,但是无法记起该物体的名字
## 系统架构
### 工作流
<div align=center>
<img src="resources/workflow_ZH.png" alt="workflow" width = "500"/>
</div>
### 核心模型
WantWords的核心模型为我们此前发表在AAAI-20上的一篇论文提出的多通道反向词典模型:**Multi-channel Reverse Dictionary Model** [[论文](https://ojs.aaai.org/index.php/AAAI/article/view/5365/5221)] [[代码](https://github.com/thunlp/MultiRD)],其模型架构如下所示。
<div align=center>
<img src="resources/MRD_model_ZH.png" alt="model" width = "500" />
</div>
### 模型和数据
可从[此处](https://cloud.tsinghua.edu.cn/d/811dcb428ed24480bc60/)下载并解压模型和数据到 `BASE_PATH/website_RD/` 以构建此系统。
### 关键依赖
* Django==2.2.5
* django-cors-headers==3.5.0
* numpy==1.17.2
* pytorch-transformers==1.2.0
* requests==2.22.0
* scikit-learn==0.22.1
* scipy==1.4.1
* thulac==0.2.0
* torch==1.2.0
* urllib3==1.25.6
* uWSGI==2.0.18
* uwsgitop==0.11
## 引用
如果本项目的代码或者数据帮到你,请引用以下两篇论文:
```
@inproceedings{qi2020wantwords,
title={WantWords: An Open-source Online Reverse Dictionary System},
author={Qi, Fanchao and Zhang, Lei and Yang, Yanhui and Liu, Zhiyuan and Sun, Maosong},
booktitle={Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations},
pages={175--181},
year={2020}
}
@inproceedings{zhang2020multi,
title={Multi-channel reverse dictionary model},
author={Zhang, Lei and Qi, Fanchao and Liu, Zhiyuan and Wang, Yasheng and Liu, Qun and Sun, Maosong},
booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
pages={312--319},
year={2020}
}
```
================================================
FILE: manage.py
================================================
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'website_RD.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()
================================================
FILE: model.py
================================================
import torch
class Encoder(torch.nn.Module):
def __init__(self, vocab_size, embed_dim, hidden_dim, layers, class_num, encoder, sememe_num, chara_num, mode):
super().__init__()
self.vocab_size = vocab_size
self.embed_dim = 200
self.hidden_dim = 768
self.layers = layers
self.class_num = class_num
self.sememe_num = sememe_num
self.chara_num = chara_num
self.embedding = torch.nn.Embedding(self.vocab_size, self.embed_dim, padding_idx=0, max_norm=5, sparse=True)
self.embedding.weight.requires_grad = False
self.embedding_dropout = torch.nn.Dropout(0.2)
self.encoder = encoder
self.fc = torch.nn.Linear(self.hidden_dim, self.embed_dim)
self.loss = torch.nn.CrossEntropyLoss()
self.relu = torch.nn.ReLU()
if 'P' in mode:
self.fc2 = torch.nn.Linear(self.hidden_dim, 13)
if 's' in mode:
self.fc1 = torch.nn.Linear(self.hidden_dim, self.sememe_num)
if 'c' in mode:
self.fc3 = torch.nn.Linear(self.hidden_dim, self.chara_num)
if 'C' in mode:
self.fc_C1 = torch.nn.Linear(self.hidden_dim, 12)
self.fc_C2 = torch.nn.Linear(self.hidden_dim, 95)
self.fc_C3 = torch.nn.Linear(self.hidden_dim, 1425)
def forward(self, operation, x=None, w=None, ws=None, wP=None, wc=None, wC=None, msk_s=None, msk_c=None, mode=None):
# x: T(bat, max_word_num)
# w: T(bat)
# x_embedding: T(bat, max_word_num, embed_dim)
x = x.long()
attention_mask = torch.gt(x, 0).to(torch.int64)
h = self.encoder(x, attention_mask=attention_mask)[0]
h_1 = self.embedding_dropout(h[:,0,:])
vd = self.fc(h_1)
# score0: T(bat, 30000) = [bat, emb] .mm [class_num, emb].t()
score0 = vd.mm(self.embedding.weight.data[[range(self.class_num)]].t())
score = score0
if 'C' in mode:
# scC[i]: T(bat, Ci_size)
# 词林的层次分类训练的慢,其实这样不公平,不平衡,因为词预测先收敛了,而cilin的分类还没效果,其他信息的利用也有同样的问题,不一定同时收敛!!!
scC = [self.fc_C1(h_1), self.fc_C2(h_1), self.fc_C3(h_1)]
score2 = torch.zeros((score0.shape[0], score0.shape[1]), dtype=torch.float32)
rank = 0.6
for i in range(3):
# wC[i]: T(class_num, Ci_size)
# C_sc: T(bat, class_num)
score2 += self.relu(scC[i].mm(wC[i].t())*(rank**i))
#----------add mean cilin-class score to those who have no cilin-class
mean_cilin_sc = torch.mean(score2, 1)
score2 = score2*(1-msk_c) + mean_cilin_sc.unsqueeze(1).mm(msk_c.unsqueeze(0))
#----------
score = score + score2/2
if 'P' in mode:
## POS prediction
# score_POS: T(bat, 13) pos_num=12+1
score_POS = self.fc2(h_1)
# s: (class_num, 13) multi-hot
# weight_sc: T(bat, class_num) = [bat, 13] .mm [class_num, 13].t()
weight_sc = self.relu(score_POS.mm(wP.t()))
#print(torch.max(weight_sc), torch.min(weight_sc))
score = score + weight_sc
if 's' in mode:
## sememe prediction
# pos_score: T(bat, max_word_num, sememe_num)
pos_score = self.fc1(h)
# sem_score: T(bat, sememe_num)
sem_score, _ = torch.max(pos_score, dim=1)
# score: T(bat, class_num) = [bat, sememe_num] .mm [class_num, sememe_num].t()
score1 = self.relu(sem_score.mm(ws.t()))
#----------add mean sememe score to those who have no sememes
# mean_sem_sc: T(bat)
mean_sem_sc = torch.mean(score1, 1)
# msk: T(class_num)
score1 = score1 + mean_sem_sc.unsqueeze(1).mm(msk_s.unsqueeze(0))
#----------
score = score + score1
if 'c' in mode:
## character prediction
# pos_score: T(bat, max_word_num, sememe_num)
pos_score = self.fc3(h)
# chara_score: T(bat, chara_num)
chara_score, _ = torch.max(pos_score, dim=1)
#chara_score = torch.sum(pos_score * alpha, 1)
# score: T(bat, class_num) = [bat, sememe_num] .mm [class_num, sememe_num].t()
score3 = self.relu(chara_score.mm(wc.t()))
score = score + score3
'''
if RD_mode == 'CC':
# fine-tune depended on the target word shouldn't exist in the definition.
#score_res = score.clone().detach()
mask1 = torch.lt(x, self.class_num).to(torch.int64)
mask2 = torch.ones((score.shape[0], score.shape[1]), dtype=torch.float32)
for i in range(x.shape[0]):
mask2[i][x[i]*mask1[i]] = 0.
score = score * mask2 + (-1e6)*(1-mask2)
'''
#_, indices = torch.sort(score, descending=True)
if operation == 'train':
loss = self.loss(score, w.long())
return loss, score, indices
elif operation == 'test':
return score #, indices
================================================
FILE: model_en.py
================================================
import torch
class Encoder(torch.nn.Module):
def __init__(self, vocab_size, embed_dim, hidden_dim, layers, class_num, sememe_num, lexname_num, rootaffix_num, encoder):
super().__init__()
self.vocab_size = vocab_size
self.embed_dim = 300
self.hidden_dim = 768
self.layers = layers
self.class_num = class_num
self.sememe_num = sememe_num
self.lexname_num = lexname_num
self.rootaffix_num = rootaffix_num
self.embedding = torch.nn.Embedding(self.vocab_size, self.embed_dim, padding_idx=0, max_norm=5, sparse=True)
self.embedding.weight.requires_grad = False
self.embedding_dropout = torch.nn.Dropout(0.2)
self.encoder = encoder
self.fc = torch.nn.Linear(self.hidden_dim, self.embed_dim)
self.fc_s = torch.nn.Linear(self.hidden_dim, self.sememe_num)
self.fc_l = torch.nn.Linear(self.hidden_dim, self.lexname_num)
self.fc_r = torch.nn.Linear(self.hidden_dim, self.rootaffix_num)
self.loss = torch.nn.CrossEntropyLoss()
self.relu = torch.nn.ReLU()
def forward(self, operation, x=None, w=None, ws=None, wl=None, wr=None, msk_s=None, msk_l=None, msk_r=None, mode=None):
# x: T(bat, max_word_num)
# w: T(bat)
# h: T(bat, max_word_num, 768)
attention_mask = torch.gt(x, 0).to(torch.int64)
h = self.encoder(x, attention_mask=attention_mask)[0]
#h = self.encoder(x)[0]
#h = self.embedding_dropout(h)
## word prediction
# vd: T(bat, embed_dim)
#h_1 = torch.max(h, dim=1)[0]
#h_1 = h[:,0,:] # The first token of every sequence is always a special classification token ([CLS]). The final hidden state corresponding to this token is used as the aggregate sequence representation for classification tasks.
h_1 = self.embedding_dropout(h[:,0,:])
vd = self.fc(h_1)
# score0: T(bat, 30000) = [bat, emb] .mm [class_num, emb].t()
score0 = vd.mm(self.embedding.weight.data[[range(self.class_num)]].t())
# BertVec: 30000, class_num: 50477+2
score = score0
if 's' in mode:
## sememe prediction
# pos_score: T(bat, max_word_num, sememe_num)
pos_score = self.fc_s(h)
# sem_score: T(bat, sememe_num)
sem_score, _ = torch.max(pos_score, dim=1)
#sem_score = torch.sum(pos_score * alpha, 1)
# score: T(bat, class_num) = [bat, sememe_num] .mm [class_num, sememe_num].t()
score_s = self.relu(sem_score.mm(ws.t()))
#----------add mean sememe score to those who have no sememes
# mean_sem_sc: T(bat)
mean_sem_sc = torch.mean(score_s, 1)
# msk: T(class_num)
score_s = score_s + mean_sem_sc.unsqueeze(1).mm(msk_s.unsqueeze(0))
#----------
score = score + score_s
if 'r' in mode:
## root-affix prediction
pos_score_ = self.fc_r(h)
ra_score, _ = torch.max(pos_score_, dim=1)
score_r = self.relu(ra_score.mm(wr.t()))
mean_ra_sc = torch.mean(score_r, 1)
score_r = score_r + mean_ra_sc.unsqueeze(1).mm(msk_r.unsqueeze(0))
score = score + score_r
if 'l' in mode:
## lexname prediction
lex_score = self.fc_l(h_1)
score_l = self.relu(lex_score.mm(wl.t()))
mean_lex_sc = torch.mean(score_l, 1)
score_l = score_l + mean_lex_sc.unsqueeze(1).mm(msk_l.unsqueeze(0))
score = score + score_l
#_, indices = torch.sort(score, descending=True)
if operation == 'train':
loss = self.loss(score, w)
return loss, score, indices
elif operation == 'test':
return score#, indices
================================================
FILE: static/css/zzsc.css
================================================
@charset "utf-8";
/*容器*/
#xzw_starSys {}/*{width:400px;border:1px solid #ccc;padding:50px;margin:100px auto}*/
#xzw_starBox{position:relative;width:75px;float:left}
/**/
#xzw_starSys .description{clear:both;padding:10px 0px}
#xzw_starSys .star{height:20px;width:70px;position:relative;background:url(../images/123.png) repeat-x;cursor:pointer}
#xzw_starSys .star li{list-style:none;float:left;padding:0px;margin:0px}
#xzw_starSys .star li a{color:#09f;display:block;width:24px;height:20px;overflow:hidden;text-indent:-9999px;position:absolute;z-index:3}
#xzw_starSys .star li a:hover{background:url(../images/123.png) 0 -25px repeat-x;z-index:2;left:0}
#xzw_starSys .star a.one-star{left:0}
#xzw_starSys .star a.one-star:hover{width:24px}
#xzw_starSys .star a.two-stars{left:24px}
#xzw_starSys .star a.two-stars:hover{width:48px}
#xzw_starSys .star a.three-stars{left:48px}
#xzw_starSys .star a.three-stars:hover{width:72px}
#xzw_starSys .current-rating{background:url(../images/123.png) 0 -25px repeat-x;position:absolute;height:20px;z-index:1;top:0;left:0}
================================================
FILE: static/js/home.js
================================================
$(function() {
$( "#tabs" ).tabs();
});
$(function() {
$( "#tabs_inter" ).tabs({
collapsible: true
});
});
$(function() {
$( document ).tooltip({
track: true, hide: {duration: 0}
,position: { my: "left-20 top+25", at: "right bottom" }
});
});
$(document).ready(function(){ // 必须有这一行,在页面加载之后执行,否则无效(不加的时候真的无效,已尝试)。
$('a.pop0').unbind("click").click(function(){ //.unbind("click") 部分解决(点词条重复触发的问题解决,但重新查询后重新触发还存在)重复绑定click从而重复触发click事件的问题【解决不易,这个很重要】
$('a.pop0').popover({ trigger: "manual" , html: true, animation:false})
.on("mouseover", function () {
var _this = this;
$(this).unbind("click").click(function () { //.unbind("click") 部分解决(同上)重复绑定click从而重复触发click事件的问题【解决不易,这个很重要】
$(this).popover("show");
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 记录点击结果。
var description = $("#description").val();
//console.log($(_this).text()+"||"+description);
$.get("/feedback/", { 'content': $(_this).text()+"||"+description, 'mode': 'FBW' });
$(".popover").on("mouseleave", function () { //【解决不易,这个很重要】
$(_this).popover('hide');
});
});
}).on("mouseout", function () { //mouseleave也有问题,在弹框里出现tip时,指针移到tip上就相当于离开目标了,此时弹框会消失(按需求是不应该消失的)
var _this = this;
setTimeout(function () {
if (!$(".popover:hover").length) {
$(_this).popover("hide");
if ($(window).width()>768) { //手机端不能加这一条,会发生框只闪一下而不显示的问题。【解决不易,这个很重要】
$("div.popover").hide(); //清理卡死的popover弹框
}
}
}, 200);
});
});
$('a.pop1').unbind("click").click(function(){ //.unbind("click") 部分解决(点词条重复触发的问题解决,但重新查询后重新触发还存在)重复绑定click从而重复触发click事件的问题【解决不易,这个很重要】
$('a.pop1').popover({ trigger: "manual" , html: true, animation:false})
.on("mouseover", function () {
var _this = this;
$(this).unbind("click").click(function () { //.unbind("click") 部分解决(同上)重复绑定click从而重复触发click事件的问题【解决不易,这个很重要】
$(this).popover("show");
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 记录点击结果。
var description = $("#description_EE").val();
//console.log($(_this).text()+"||"+description);
$.get("/feedback/", { 'content': $(_this).text()+"||"+description, 'mode': 'FBW' });
$(".popover").on("mouseleave", function () { //【解决不易,这个很重要】
$(_this).popover('hide');
});
});
}).on("mouseout", function () { //mouseleave也有问题,在弹框里出现tip时,指针移到tip上就相当于离开目标了,此时弹框会消失(按需求是不应该消失的)
var _this = this;
setTimeout(function () {
if (!$(".popover:hover").length) {
$(_this).popover("hide");
if ($(window).width()>768) { //手机端不能加这一条,会发生框只闪一下而不显示的问题。【解决不易,这个很重要】
$("div.popover").hide(); //清理卡死的popover弹框
}
}
}, 200);
});
});
$('a.pop2').unbind("click").click(function(){ //.unbind("click") 部分解决(点词条重复触发的问题解决,但重新查询后重新触发还存在)重复绑定click从而重复触发click事件的问题【解决不易,这个很重要】
$('a.pop2').popover({ trigger: "manual" , html: true, animation:false})
.on("mouseover", function () {
var _this = this;
$(this).unbind("click").click(function () { //.unbind("click") 部分解决(同上)重复绑定click从而重复触发click事件的问题【解决不易,这个很重要】
$(this).popover("show");
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 记录点击结果。
var description = $("#description_CE").val();
//console.log($(_this).text()+"||"+description);
$.get("/feedback/", { 'content': $(_this).text()+"||"+description, 'mode': 'FBW' });
$(".popover").on("mouseleave", function () { //【解决不易,这个很重要】
$(_this).popover('hide');
});
});
}).on("mouseout", function () { //mouseleave也有问题,在弹框里出现tip时,指针移到tip上就相当于离开目标了,此时弹框会消失(按需求是不应该消失的)
var _this = this;
setTimeout(function () {
if (!$(".popover:hover").length) {
$(_this).popover("hide");
if ($(window).width()>768) { //手机端不能加这一条,会发生框只闪一下而不显示的问题。【解决不易,这个很重要】
$("div.popover").hide(); //清理卡死的popover弹框
}
}
}, 200);
});
});
$('a.pop3').unbind("click").click(function(){ //.unbind("click") 部分解决(点词条重复触发的问题解决,但重新查询后重新触发还存在)重复绑定click从而重复触发click事件的问题【解决不易,这个很重要】
$('a.pop3').popover({ trigger: "manual" , html: true, animation:false})
.on("mouseover", function () {
var _this = this;
$(this).unbind("click").click(function () { //.unbind("click") 部分解决(同上)重复绑定click从而重复触发click事件的问题【解决不易,这个很重要】
$(this).popover("show");
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 记录点击结果。
var description = $("#description_EC").val();
//console.log($(_this).text()+"||"+description);
$.get("/feedback/", { 'content': $(_this).text()+"||"+description, 'mode': 'FBW' });
$(".popover").on("mouseleave", function () { //【解决不易,这个很重要】
$(_this).popover('hide');
});
});
}).on("mouseout", function () { //mouseleave也有问题,在弹框里出现tip时,指针移到tip上就相当于离开目标了,此时弹框会消失(按需求是不应该消失的)
var _this = this;
setTimeout(function () {
if (!$(".popover:hover").length) {
$(_this).popover("hide");
if ($(window).width()>768) { //手机端不能加这一条,会发生框只闪一下而不显示的问题。【解决不易,这个很重要】
$("div.popover").hide(); //清理卡死的popover弹框
}
}
}, 200);
});
});
});
//<!--反馈信息的获取-->
var getSelectedTabId = 0;
$(function () {
$('#tabs').tabs({
activate: function (event, ui) {
var activeTab = $('#tabs').tabs('option', 'active');
getSelectedTabId = activeTab;
// 适配英文界面
if (getSelectedTabId%2==1) {
$("#id_clk1").attr("value","Propose Appropriate Words");
$("#id_clk2").attr("value","Make Suggestions");
$("#id_home").text("Home Page");
$("#id_about").attr("href","../about_en/").text("About Us");
$("#id_link").text("GitHub Link");
$("#idm_home").html('<span class="glyphicon glyphicon-home"></span> Home');
$("#idm_about").attr("href","../about_en/").text("About Us");
$("#idm_link").text("GitHub Link");
}
else {
$("#id_clk1").attr("value","点此反馈推荐词");
$("#id_clk2").attr("value","点此反馈意见建议");
$("#id_home").text("反向词典主页");
$("#id_about").attr("href","../about/").text("关于我们");
$("#id_link").text("GitHub链接");
$("#idm_home").html('<span class="glyphicon glyphicon-home"></span> 主页');
$("#idm_about").attr("href","../about/").text("关于我们");
$("#idm_link").text("GitHub链接");
};
}
});
})
function diagWord() {
if (getSelectedTabId%2==0) {
var str=prompt("未能帮您找到想要的词?\n您认为与您描述相近的词:(多词可用标点分隔)","");
}
else {
var str=prompt("Any appropriate words in your opinion:","");
};
if (str!="" && str!=null) {
if (getSelectedTabId%2==0) {
alert("谢谢您的指导,本站希望与您一起学习,共同提升自然语言理解和应用能力!");
}
else {
alert("Thank you for your advice!");
};
if (getSelectedTabId==0) {
var description = $("#description").val();
}
else if (getSelectedTabId==1) {
var description = $("#description_EE").val();
}
else if (getSelectedTabId==2) {
var description = $("#description_CE").val();
}
else if (getSelectedTabId==3) {
var description = $("#description_EC").val();
}
else {
var description = "unkown tabs";
};
$.get("/feedback/", { 'content': str+"|||"+description, 'mode': 'FBW' });
}
}
function diagSuggest() {
if (getSelectedTabId%2==0) {
var str=prompt("您对网站有何意见或建议?","");
if(str!="" && str!=null)
{
alert("感谢您的反馈!");
$.get("/feedback/", { 'content': str, 'mode': 'FBS' });
}
}
else {
var str=prompt("Any suggestions about this website?","");
if(str!="" && str!=null)
{
alert("Thanks for your feedback!");
$.get("/feedback/", { 'content': str, 'mode': 'FBS' });
}
};
}
function diagError(i) {
if (getSelectedTabId==0) {
var word = $("#tabs-1 #li"+i).text();
}
else if (getSelectedTabId==1) {
var word = $("#tabs-2 #li"+i).text();
}
else if (getSelectedTabId==2) {
var word = $("#tabs-3 #li"+i).text();
}
else if (getSelectedTabId==3) {
var word = $("#tabs-4 #li"+i).text();
}
else {
var word = "unkown word";
};
if (getSelectedTabId%2==0) {
var str=prompt("关于词“"+word+"”的相关错误描述:","");
}
else {
var str=prompt('Please describe mistakes about the word "'+word+'":',"");
};
if (str!="" && str!=null) {
if (getSelectedTabId%2==0) {
alert("感谢您的反馈!");
}
else {
alert("Thanks for your feedback!");
};
str = "ERROR: " + word + ": " + str;
$.get("/feedback/", { 'content': str, 'mode': 'FBS' });
}
}
function addTag(i, m) {
if (getSelectedTabId==0) {
var word = $("#tabs-1 #li"+i).text();
var description = $("#description").val();
var elemA = $("#tabs-1 #li"+i);
var elemD = $("#tabs-1 #li"+i+" span");
}
else if (getSelectedTabId==1) {
var word = $("#tabs-2 #li"+i).text();
var description = $("#description_EE").val();
var elemA = $("#tabs-2 #li"+i);
var elemD = $("#tabs-2 #li"+i+" span");
}
else if (getSelectedTabId==2) {
var word = $("#tabs-3 #li"+i).text();
var description = $("#description_CE").val();
var elemA = $("#tabs-3 #li"+i);
var elemD = $("#tabs-3 #li"+i+" span");
}
else if (getSelectedTabId==3) {
var word = $("#tabs-4 #li"+i).text();
var description = $("#description_EC").val();
var elemA = $("#tabs-4 #li"+i);
var elemD = $("#tabs-4 #li"+i+" span");
}
else {
return null;
};
if (m==2) {elemA.append("<span style=\"color: red\" class=\"glyphicon glyphicon-thumbs-up\"></span>")}
else if (m==1) {elemD.remove()}
else if (m==0) {elemA.append("<span class=\"glyphicon glyphicon-thumbs-down\"></span>")};
str = word + "|" + m;
$.get("/feedback/", { 'content': str+"|||"+description, 'mode': 'FBW' });
}
function clearAlert() {
var selID = getSelectedTabId + 1;
var elem = $("#tabs-" + selID +" .alert");
elem.remove();
//elem.slideUp("fast");
$("div.popover").hide(); //清理卡死的popover弹框
}
function clearFilter() {
var selID = getSelectedTabId + 1;
clearAlert();
if (selID==1) {
try {
$("#filter_CN div").find("*").removeAttr("disabled");
if ($("#description").val()=="") {
$('#result').html("");
}
else {
if ($("#description").val()==description_backup) {
showTable(retData_backup, $('#result'));
}
else {
modelProcecss();
};
};
}
catch(err) {
$('#result').html("");
};
$("#filter_CN div").find("*").val(this.defaultValue).css("background-color", "");
$("#filter_CN div.visible-xs").find("#POS_select_CC")[0].selectedIndex = 0;
$("#filter_CN div.visible-lg").find("#POS_select_CC")[0].selectedIndex = 0;
$("#filter_CN div.visible-xs").find("#main_select")[0].selectedIndex = 0;
$("#filter_CN div.visible-lg").find("#main_select")[0].selectedIndex = 0;
$("#filter_CN div.visible-xs").find("#rhyme_select_CC")[0].selectedIndex = 0;
$("#filter_CN div.visible-lg").find("#rhyme_select_CC")[0].selectedIndex = 0;
}
else if (selID==2) {
try {
$("#filter_EE div").find("*").removeAttr("disabled");
if ($("#description_EE").val()=="") {
$('#result_EE').html("");
}
else {
if ($("#description_EE").val()==description_backup_EE) {
showTable(retData_backup_EE, $('#result_EE'));
}
else {
modelProcecss_EE();
};
};
}
catch(err) {
$('#result_EE').html("");
};
$("#filter_EE div").find("*").val(this.defaultValue).css("background-color", "");
$("#filter_EE div.visible-xs").find("#POS_select_EE")[0].selectedIndex = 0;
$("#filter_EE div.visible-lg").find("#POS_select_EE")[0].selectedIndex = 0;
$("#filter_EE div.visible-xs").find("#main_select_EE")[0].selectedIndex = 0;
$("#filter_EE div.visible-lg").find("#main_select_EE")[0].selectedIndex = 0;
}
else if (selID==3) {
try {
$("#filter_CE div").find("*").removeAttr("disabled");
if ($("#description_CE").val()=="") {
$('#result_CE').html("");
}
else {
if ($("#description_CE").val()==description_backup_CE) {
showTable(retData_backup_CE, $('#result_CE'));
}
else {
modelProcecss_CE();
};
};
}
catch(err) {
$('#result_CE').html("");
};
$("#filter_CE div").find("*").val(this.defaultValue).css("background-color", "");
$("#filter_CE div.visible-xs").find("#POS_select_CE")[0].selectedIndex = 0;
$("#filter_CE div.visible-lg").find("#POS_select_CE")[0].selectedIndex = 0;
$("#filter_CE div.visible-xs").find("#main_select_CE")[0].selectedIndex = 0;
$("#filter_CE div.visible-lg").find("#main_select_CE")[0].selectedIndex = 0;
}
else if (selID==4) {
try {
$("#filter_EC div").find("*").removeAttr("disabled");
if ($("#description_EC").val()=="") {
$('#result_EC').html("");
}
else {
if ($("#description_EC").val()==description_backup_EC) {
showTable(retData_backup_EC, $('#result_EC'));
}
else {
modelProcecss_EC();
};
};
}
catch(err) {
$('#result_EC').html("");
};
$("#filter_EC div").find("*").val(this.defaultValue).css("background-color", "");
$("#filter_EC div.visible-xs").find("#POS_select_EC")[0].selectedIndex = 0;
$("#filter_EC div.visible-lg").find("#POS_select_EC")[0].selectedIndex = 0;
$("#filter_EC div.visible-xs").find("#main_select_EC")[0].selectedIndex = 0;
$("#filter_EC div.visible-lg").find("#main_select_EC")[0].selectedIndex = 0;
$("#filter_EC div.visible-xs").find("#rhyme_select_EC")[0].selectedIndex = 0;
$("#filter_EC div.visible-lg").find("#rhyme_select_EC")[0].selectedIndex = 0;
};
};
<!----------------------------全局--------------------------------->
var itemsPerCol = 20;
function htmlSuccess(str) {
return '<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>' + str + '</div>';
};
function htmlInfo(str) {
return '<div class="alert alert-info alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true"><span class="glyphicon glyphicon-info-sign"></span></button><strong>信息:</strong>' + str + '</div>';
};
function htmlWarning(str) {
return '<div class="alert alert-warning alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true"><span class="glyphicon glyphicon-eye-open"></span></button><strong>警告!</strong>' + str + '</div>';
};
function htmlDanger(str) {
return '<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true"><span class="glyphicon glyphicon-warning-sign"></button><strong>错误!</strong>' + str + '</div>';
};
function htmlInfo_E(str) {
return '<div class="alert alert-info alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true"><span class="glyphicon glyphicon-info-sign"></span></button><strong>Info: </strong>' + str + '</div>';
};
function htmlWarning_E(str) {
return '<div class="alert alert-warning alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true"><span class="glyphicon glyphicon-eye-open"></span></button><strong>Caution! </strong>' + str + '</div>';
};
function htmlDanger_E(str) {
return '<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true"><span class="glyphicon glyphicon-warning-sign"></button><strong>Error! </strong>' + str + '</div>';
};
function getContent(wdData, defi, i) {
var reg = /[āáǎàōóǒòêēéěèīíǐìūúǔùǖǘǚǜü]/g; //[āáǎàōóǒòêēéěèīíǐìūúǔùǖǘǚǜüńňǹĀÅÀö∥ɡa-zA-Z•ɑ’]
if (defi.replace(/br/g,'').replace(/strong/g,'').search(reg)>-1) {
var htmlCont = '<h4><strong>' + wdData['w'] + '</strong></h4>' + defi + '<HR/><label title=\'在openhownet中查看该词的义原。\'><button class="btn btn-default btn-sm" onclick="window.open(\'https://openhownet.thunlp.org/search_list.html?keyword=' + wdData['w'] + '\')">查看义原</button></label>' + ' <label title=\'查看百度汉语中的释义。\'><button class="btn btn-default btn-sm" onclick="window.open(\'https://hanyu.baidu.com/s?wd=' + wdData['w'] + '\')">百度汉语</button></label>' + ' <label title=\'如果您发现定义、拼音等存在错误时点此反馈。\'><button class="btn btn-default btn-sm" onclick="diagError(' + i + ')">上报错误</button></label>';
}
else {
var htmlCont = '<h4><strong>' + wdData['w'] + '</strong></h4>' + wdData['p'] + '<br>' + defi + '<HR/><label title=\'在openhownet中查看该词的义原。\'><button class="btn btn-default btn-sm" onclick="window.open(\'https://openhownet.thunlp.org/search_list.html?keyword=' + wdData['w'] + '\')">查看义原</button></label>' + ' <label title=\'查看百度汉语中的释义。\'><button class="btn btn-default btn-sm" onclick="window.open(\'https://hanyu.baidu.com/s?wd=' + wdData['w'] + '\')">百度汉语</button></label>' + ' <label title=\'如果您发现定义、拼音等存在错误时点此反馈。\'><button class="btn btn-default btn-sm" onclick="diagError(' + i + ')">上报错误</button></label>';
};
return htmlCont;
};
function getTitle(i) {
//var htmlTitle = '<div class="btn-group" data-toggle="buttons"><label title=\'非常匹配\' class="btn btn-primary" onclick="addTag(' + i + ', 2' + ')" style="background-color: #eee; color: #333;"><input type="radio"> 😃</span></label><label title=\'基本相关\' class="btn btn-primary" onclick="addTag(' + i + ', 1' + ')" style="background-color: #eee; color: #333;"><input type="radio">😐</span></label><label title=\'完全无关\' class="btn btn-primary" onclick="addTag(' + i + ', 0' + ')" style="background-color: #eee; color: #333;"><input type="radio"> 🙁</span></label></div>';
var htmlTitle = '<div class="btn-group" data-toggle="buttons"><label title=\'非常匹配\' class="btn btn-primary" onclick="addTag(' + i + ', 2' + ')" style="background-color: #eee; color: #333;"><input type="radio"> <span class="glyphicon glyphicon-thumbs-up"></span></label><label title=\'完全无关\' class="btn btn-primary" onclick="addTag(' + i + ', 0' + ')" style="background-color: #eee; color: #333;"><input type="radio"> <span class="glyphicon glyphicon-thumbs-down"></span></label></div>';
return htmlTitle;
};
function getContent_E(wdData, defi, i) {
var htmlCont = '<h4><strong>' + wdData['w'] + '</strong></h4>' + defi + '<HR/><label title=\'View sememes in OpenHownet.\'><button class="btn btn-default btn-sm" onclick="window.open(\'https://openhownet.thunlp.org/search_list.html?keyword=' + wdData['w'] + '\')">sememes</button></label>' + ' <label title=\'Look up the word in Wiktionary.\'><button class="btn btn-default btn-sm" onclick="window.open(\'https://en.wiktionary.org/wiki/' + wdData['w'] + '\')">Wiki</button></label>' + ' <label title=\'If there are any mistakes, you can tell us.\'><button class="btn btn-default btn-sm" onclick="diagError(' + i + ')">Report errors</button></label>';
//var htmlCont = '<h4><strong>' + wdData['word'] + '</strong></h4>' + '1. <strong>adj. </strong>' + wdData['definition'] + '<br><HR/><label title=\'View sememes in OpenHownet.\'><button class="btn btn-default btn-sm" onclick="window.open(\'https://openhownet.thunlp.org/search_list.html?keyword=' + wdData['word'] + '\')">sememes</button></label>' + ' <label title=\'Look up the word in Wiktionary.\'><button class="btn btn-default btn-sm" onclick="window.open(\'https://en.wiktionary.org/wiki/' + wd_data['word'] + '\')">Wikipedia</button></label>' + ' <label title=\'If there are any mistakes, you can tell us.\'><button class="btn btn-default btn-sm" onclick="diagError(' + i + ')">Report errors</button></label>';
return htmlCont;
};
function getTitle_E(i) {
//var htmlTitle = '<div class="btn-group" data-toggle="buttons"><label title=\'Matched well\' class="btn btn-primary" onclick="addTag(' + i + ', 2' + ')" style="background-color: #eee; color: #333;"><input type="radio"> 😃</span></label><label title=\'So-so\' class="btn btn-primary" onclick="addTag(' + i + ', 1' + ')" style="background-color: #eee; color: #333;"><input type="radio">😐</span></label><label title=\'Not matched\' class="btn btn-primary" onclick="addTag(' + i + ', 0' + ')" style="background-color: #eee; color: #333;"><input type="radio"> 🙁</span></label></div>';
var htmlTitle = '<div class="btn-group" data-toggle="buttons"><label title=\'Matched well\' class="btn btn-primary" onclick="addTag(' + i + ', 2' + ')" style="background-color: #eee; color: #333;"><input type="radio"> <span class="glyphicon glyphicon-thumbs-up"></span></label><label title=\'Not matched\' class="btn btn-primary" onclick="addTag(' + i + ', 0' + ')" style="background-color: #eee; color: #333;"><input type="radio"> <span class="glyphicon glyphicon-thumbs-down"></span></label></div>';
return htmlTitle;
};
function getContent_CE(wdData, defi, i) {
var htmlCont = '<h4><strong>' + wdData['w'] + '</strong></h4>' + defi + '<HR/><label title=\'在openhownet中查看该词的义原。\'><button class="btn btn-default btn-sm" onclick="window.open(\'https://openhownet.thunlp.org/search_list.html?keyword=' + wdData['w'] + '\')">查看义原</button></label>' + ' <label title=\'查看维基词典中的释义。\'><button class="btn btn-default btn-sm" onclick="window.open(\'https://en.wiktionary.org/wiki/' + wdData['w'] + '\')">维基词典</button></label>' + ' <label title=\'如果您发现错误时请点此反馈。\'><button class="btn btn-default btn-sm" onclick="diagError(' + i + ')">上报错误</button></label>';
return htmlCont;
};
function getContent_EC(wdData, defi, i) {
var reg = /[āáǎàōóǒòêēéěèīíǐìūúǔùǖǘǚǜüńňǹĀÅÀö∥ɡa-zA-Z•ɑ’]/g;
if (defi.replace(/br/g,'').replace(/strong/g,'').search(reg)>-1) {
var htmlCont = '<h4><strong>' + wdData['w'] + '</strong></h4>' + defi + '<HR/><label title=\'View sememes in OpenHownet.\'><button class="btn btn-default btn-sm" onclick="window.open(\'https://openhownet.thunlp.org/search_list.html?keyword=' + wdData['w'] + '\')">sememes</button></label>' + ' <label title=\'Look up the word in Baidu.\'><button class="btn btn-default btn-sm" onclick="window.open(\'https://hanyu.baidu.com/s?wd=' + wdData['w'] + '\')">Baidu</button></label>' + ' <label title=\'If there are any mistakes, you can tell us.\'><button class="btn btn-default btn-sm" onclick="diagError(' + i + ')">Report errors</button></label>';
}
else {
var htmlCont = '<h4><strong>' + wdData['w'] + '</strong></h4>' + wdData['p'] + '<br>' + defi + '<HR/><label title=\'View sememes in OpenHownet.\'><button class="btn btn-default btn-sm" onclick="window.open(\'https://openhownet.thunlp.org/search_list.html?keyword=' + wdData['w'] + '\')">sememes</button></label>' + ' <label title=\'Look up the word in Baidu.\'><button class="btn btn-default btn-sm" onclick="window.open(\'https://hanyu.baidu.com/s?wd=' + wdData['w'] + '\')">Baidu</button></label>' + ' <label title=\'If there are any mistakes, you can tell us.\'><button class="btn btn-default btn-sm" onclick="diagError(' + i + ')">Report errors</button></label>';
};
return htmlCont;
};
function showTable(dictList, res_elem) {
//$('div.popover').children().hide();
var words = '';
for (var d in dictList) {
words = words + ' ' + dictList[d].w;
};
var desti = "/GetEnDefis/";
if ('p' in dictList[0]) {
desti = "/GetChDefis/";
};
$.post(desti, {'w': words}, function (ret) {
var defis = ret.slice(0);
var block_start = '<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">';
var block_end = '</ol></div>';
var html = '<div class="container"><div class="row" >';
var i = 0;
var num = dictList.length>100 ? 100 : dictList.length;
for (; i<num; ){
wd_data = dictList[i];
if (i%itemsPerCol==0) {
html += block_start;
html = html + '<ol start="' + ((parseInt(i/itemsPerCol))*itemsPerCol).toString() + '" style="color:grey">';
}
if (getSelectedTabId==0) {
if ($(window).width()<751 || window.innerWidth<768) {
html = html + '<li id=\"li' + i + '\" style=\"background-color: #005aff' + wd_data['c'] + ';"><a title="' + getTitle(i) + '" class="pop0" data-container="body" data-placement="auto bottom" data-toggle="popover" data-content="' + getContent(wd_data, defis[i], i) + '" style="color:black"><strong style="cursor:pointer">' + wd_data['w'] + '</strong></a></li>';
}
else {
html = html + '<li id=\"li' + i + '\" style=\"background-color: #005aff' + wd_data['c'] + ';"><a title="' + getTitle(i) + '" class="pop0" data-container="body" data-placement="auto right" data-toggle="popover" data-content="' + getContent(wd_data, defis[i], i) + '" style="color:black"><strong style="cursor:pointer">' + wd_data['w'] + '</strong></a></li>';
};
}
else if (getSelectedTabId==1) {
if ($(window).width()<751 || window.innerWidth<768) {
html = html + '<li id=\"li' + i + '\" style=\"background-color: #005aff' + wd_data['c'] + ';"><a title="' + getTitle_E(i) + '" class="pop1" data-container="body" data-placement="auto bottom" data-toggle="popover" data-content="' + getContent_E(wd_data, defis[i], i) + '" style="color:black"><strong style="cursor:pointer">' + wd_data['w'] + '</strong></a></li>';
}
else {
html = html + '<li id=\"li' + i + '\" style=\"background-color: #005aff' + wd_data['c'] + ';"><a title="' + getTitle_E(i) + '" class="pop1" data-container="body" data-placement="auto right" data-toggle="popover" data-content="' + getContent_E(wd_data, defis[i], i) + '" style="color:black"><strong style="cursor:pointer">' + wd_data['w'] + '</strong></a></li>';
};
}
else if (getSelectedTabId==2) {
if ($(window).width()<751 || window.innerWidth<768) {
html = html + '<li id=\"li' + i + '\" style=\"background-color: #005aff' + wd_data['c'] + ';"><a title="' + getTitle(i) + '" class="pop2" data-container="body" data-placement="auto bottom" data-toggle="popover" data-content="' + getContent_CE(wd_data, defis[i], i) + '" style="color:black"><strong style="cursor:pointer">' + wd_data['w'] + '</strong></a></li>';
}
else {
html = html + '<li id=\"li' + i + '\" style=\"background-color: #005aff' + wd_data['c'] + ';"><a title="' + getTitle(i) + '" class="pop2" data-container="body" data-placement="auto right" data-toggle="popover" data-content="' + getContent_CE(wd_data, defis[i], i) + '" style="color:black"><strong style="cursor:pointer">' + wd_data['w'] + '</strong></a></li>';
};
}
else {
if ($(window).width()<751 || window.innerWidth<768) {
html = html + '<li id=\"li' + i + '\" style=\"background-color: #005aff' + wd_data['c'] + ';"><a title="' + getTitle_E(i) + '" class="pop3" data-container="body" data-placement="auto bottom" data-toggle="popover" data-content="' + getContent_EC(wd_data, defis[i], i) + '" style="color:black"><strong style="cursor:pointer">' + wd_data['w'] + '</strong></a></li>';
}
else {
html = html + '<li id=\"li' + i + '\" style=\"background-color: #005aff' + wd_data['c'] + ';"><a title="' + getTitle_E(i) + '" class="pop3" data-container="body" data-placement="auto right" data-toggle="popover" data-content="' + getContent_EC(wd_data, defis[i], i) + '" style="color:black"><strong style="cursor:pointer">' + wd_data['w'] + '</strong></a></li>';
};
};
i += 1;
if (i%itemsPerCol==0) {
html += block_end;
}
};
clearAlert();
res_elem.html(html);
if (getSelectedTabId==0) {
$('a.pop0').click();
}
else if (getSelectedTabId==1) {
$('a.pop1').click();
}
else if (getSelectedTabId==2) {
$('a.pop2').click();
}
else {
$('a.pop3').click();
}
//$('a.pop').click(); // 这里是用于对新生成的html进行绑定,因为HTML是静态代码,页面生成时绑定了js和html的关系(执行了js代码一次),但是这个新生成的html不被当时的js代码绑定,所以这里再执行一次js代码。
//$('div.popover').children().hide();
$('div.popover').hide();
if (getSelectedTabId%2==0) {
res_elem.before('<div class="alert alert-success alert-dismissable" style="font-family:STZhongsong;font-size:15px;"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><strong>使用建议:</strong><br>1、配合筛选器使用,效果更佳。<br>2、按相关性排序或聚类排列可以把更相关的词排在前面。<br>3、点击词语显示详情,在详情框顶部可对该词点“赞”或“踩”。<br><span class="glyphicon glyphicon-heart" style="color:red;"></span> 欢迎多点评,将有助于为大家做出更精准的推荐服务 : )</div>');
$(".alert").on("click", function(){$(this).slideUp("fast");});
}
else {
res_elem.before('<div class="alert alert-success alert-dismissable" style="font-family:STZhongsong;font-size:15px;"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><strong>Suggestions: </strong><br>1. Better results with filtering.<br>2. More relevant words can be ranked in the first place by ranking by relevance or clustering.<br>3. Click on a word to see details. You can mark a word <i>good</i> or <i>bad</i> at the top of the details box.<br><span class="glyphicon glyphicon-heart" style="color:red;"></span> Welcome to mark more words, which is helpful for more accurate recommendation : )</div>');
$(".alert").on("click", function(){$(this).slideUp("fast");});
};
});
};
function showTable_Cluster(dictList, res_elem) {
var block_start = '<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2">';
var block_end = '</ul></div>';
var html = '<div class="container"><div class="row" >';
var i = 0;
var num = dictList.length;
var itemsPerCol_ = 10;
var count = 0;
var Class = 0;
var addFlag = true;
for (; i<num; ){
wd_data = dictList[i];
/*if (count==itemsPerCol_){
if (addFlag) {
html += block_end;
};
if (Class-1==wd_data['C']) {
i += 1;
addFlag = false;
continue;
}
else {
addFlag = true;
count = 0;
};
};*/
if (Class==wd_data['C']) {
if (Class>0) {
html += block_end;
count = 0;
};
Class += 1;
html += block_start;
html = html + '<ul style="color:grey;">';
}
//if ('p' in wd_data) { // 中文里有 wd_data['pinyin']。
if (getSelectedTabId==0) {
$("#filter_CN div").find("input").attr("disabled", "disabled");
$("#filter_CN div.visible-xs").find("#POS_select_CC").attr("disabled", "disabled");
$("#filter_CN div.visible-lg").find("#POS_select_CC").attr("disabled", "disabled");
$("#filter_CN div.visible-xs").find("#rhyme_select_CC").attr("disabled", "disabled");
$("#filter_CN div.visible-lg").find("#rhyme_select_CC").attr("disabled", "disabled");
if ($(window).width()<751 || window.innerWidth<768) {
html = html + '<li id=\"li' + i + '\" style=\"background-color: #005aff' + wd_data['c'] + ';"><a title="' + getTitle(i) + '" class="pop0" data-container="body" data-placement="auto bottom" data-toggle="popover" data-content="' + getContent(wd_data, wd_data['d'], i) + '" style="color:black"><strong style="cursor:pointer">' + wd_data['w'] + '</strong></a></li>';
}
else {
html = html + '<li id=\"li' + i + '\" style=\"background-color: #005aff' + wd_data['c'] + ';"><a title="' + getTitle(i) + '" class="pop0" data-container="body" data-placement="auto right" data-toggle="popover" data-content="' + getContent(wd_data, wd_data['d'], i) + '" style="color:black"><strong style="cursor:pointer">' + wd_data['w'] + '</strong></a></li>';
}
}
else if (getSelectedTabId==1) {
$("#filter_EE div").find("input").attr("disabled", "disabled");
$("#filter_EE div.visible-xs").find("#POS_select_EE").attr("disabled", "disabled");
$("#filter_EE div.visible-lg").find("#POS_select_EE").attr("disabled", "disabled");
if ($(window).width()<751 || window.innerWidth<768) {
html = html + '<li id=\"li' + i + '\" style=\"background-color: #005aff' + wd_data['c'] + ';"><a title="' + getTitle_E(i) + '" class="pop1" data-container="body" data-placement="auto bottom" data-toggle="popover" data-content="' + getContent_E(wd_data, wd_data['d'], i) + '" style="color:black"><strong style="cursor:pointer">' + wd_data['w'] + '</strong></a></li>';
}
else {
html = html + '<li id=\"li' + i + '\" style=\"background-color: #005aff' + wd_data['c'] + ';"><a title="' + getTitle_E(i) + '" class="pop1" data-container="body" data-placement="auto right" data-toggle="popover" data-content="' + getContent_E(wd_data, wd_data['d'], i) + '" style="color:black"><strong style="cursor:pointer">' + wd_data['w'] + '</strong></a></li>';
};
}
else if (getSelectedTabId==2) {
$("#filter_CE div").find("input").attr("disabled", "disabled");
$("#filter_CE div.visible-xs").find("#POS_select_CE").attr("disabled", "disabled");
$("#filter_CE div.visible-lg").find("#POS_select_CE").attr("disabled", "disabled");
if ($(window).width()<751 || window.innerWidth<768) {
html = html + '<li id=\"li' + i + '\" style=\"background-color: #005aff' + wd_data['c'] + ';"><a title="' + getTitle(i) + '" class="pop2" data-container="body" data-placement="auto bottom" data-toggle="popover" data-content="' + getContent_CE(wd_data, wd_data['d'], i) + '" style="color:black"><strong style="cursor:pointer">' + wd_data['w'] + '</strong></a></li>';
}
else {
html = html + '<li id=\"li' + i + '\" style=\"background-color: #005aff' + wd_data['c'] + ';"><a title="' + getTitle(i) + '" class="pop2" data-container="body" data-placement="auto right" data-toggle="popover" data-content="' + getContent_CE(wd_data, wd_data['d'], i) + '" style="color:black"><strong style="cursor:pointer">' + wd_data['w'] + '</strong></a></li>';
};
}
else {
$("#filter_EC div").find("input").attr("disabled", "disabled");
$("#filter_EC div.visible-xs").find("#POS_select_EC").attr("disabled", "disabled");
$("#filter_EC div.visible-lg").find("#POS_select_EC").attr("disabled", "disabled");
$("#filter_EC div.visible-xs").find("#rhyme_select_EC").attr("disabled", "disabled");
$("#filter_EC div.visible-lg").find("#rhyme_select_EC").attr("disabled", "disabled");
if ($(window).width()<751 || window.innerWidth<768) {
html = html + '<li id=\"li' + i + '\" style=\"background-color: #005aff' + wd_data['c'] + ';"><a title="' + getTitle_E(i) + '" class="pop3" data-container="body" data-placement="auto bottom" data-toggle="popover" data-content="' + getContent_EC(wd_data, wd_data['d'], i) + '" style="color:black"><strong style="cursor:pointer">' + wd_data['w'] + '</strong></a></li>';
}
else {
html = html + '<li id=\"li' + i + '\" style=\"background-color: #005aff' + wd_data['c'] + ';"><a title="' + getTitle_E(i) + '" class="pop3" data-container="body" data-placement="auto right" data-toggle="popover" data-content="' + getContent_EC(wd_data, wd_data['d'], i) + '" style="color:black"><strong style="cursor:pointer">' + wd_data['w'] + '</strong></a></li>';
};
};
i += 1;
count += 1;
};
clearAlert();
res_elem.html(html);
if (getSelectedTabId==0) {
$('a.pop0').click();
}
else if (getSelectedTabId==2) {
$('a.pop1').click();
}
else if (getSelectedTabId==2) {
$('a.pop2').click();
}
else {
$('a.pop3').click();
}
//$('a.pop').click(); // 这里是用于对新生成的html进行绑定,因为HTML是静态代码,页面生成时绑定了js和html的关系(执行了js代码一次),但是这个新生成的html不被当时的js代码绑定,所以这里再执行一次js代码。
$('div.popover').hide();
};
<!----------------------------汉汉CC--------------------------------->
var retData_backup; //全局变量保存返回值原始数据。
var description_backup;
//filterRes();
function filterRes(dictList) {
//console.log("filterRes");
//var filter_POS = $("#filter1").val(); //document.getElementById("filter1").value
if ($(window).width()<751 || window.innerWidth<768) {
var POS_select_CC=$("#filter_CN div.visible-xs").find("#POS_select_CC");
var filter2=$("#filter_CN div.visible-xs").find("#filter2");
var filter3=$("#filter_CN div.visible-xs").find("#filter3");
var filter4=$("#filter_CN div.visible-xs").find("#filter4");
var filter5=$("#filter_CN div.visible-xs").find("#filter5");
var main_select=$("#filter_CN div.visible-xs").find("#main_select");
var rhyme_select_CC=$("#filter_CN div.visible-xs").find("#rhyme_select_CC");
}
else {
var POS_select_CC=$("#filter_CN div.visible-lg").find("#POS_select_CC");
var filter2=$("#filter_CN div.visible-lg").find("#filter2");
var filter3=$("#filter_CN div.visible-lg").find("#filter3");
var filter4=$("#filter_CN div.visible-lg").find("#filter4");
var filter5=$("#filter_CN div.visible-lg").find("#filter5");
var main_select=$("#filter_CN div.visible-lg").find("#main_select");
var rhyme_select_CC=$("#filter_CN div.visible-lg").find("#rhyme_select_CC");
};
//var filter_POS = document.getElementById("POS_select_CC").options.selectedIndex;
var filter_POS = POS_select_CC[0].selectedIndex;
var filter_len = filter2.val();
var filter_1stPY = filter3.val();
var filter_strok = filter4.val();
var filter_shape = filter5.val();
var sort_rule = main_select[0].selectedIndex;
var filter_rhyme = rhyme_select_CC[0].selectedIndex;
if (filter_POS>0) {
POS_select_CC.css("background-color", "#fffdef");
}
else {
POS_select_CC.css("background-color", "");
};
if (filter_len!="") {
filter2.css("background-color", "#fffdef");
}
else {
filter2.css("background-color", "");
};
if (filter_1stPY!="") {
filter3.css("background-color", "#fffdef");
}
else {
filter3.css("background-color", "");
};
if (filter_strok!="") {
filter4.css("background-color", "#fffdef");
}
else {
filter4.css("background-color", "");
};
if (filter_shape!="") {
filter5.css("background-color", "#fffdef");
}
else {
filter5.css("background-color", "");
};
if (sort_rule>0) {
main_select.css("background-color", "#fffdef");
}
else {
main_select.css("background-color", "");
};
if (filter_rhyme>0) {
rhyme_select_CC.css("background-color", "#fffdef");
}
else {
rhyme_select_CC.css("background-color", "");
};
switch (filter_POS) {
case 0:
var dictList_filtered = dictList.slice(0);
break;
case 1:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("名")>-1});
break;
case 2:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("动")>-1});
break;
case 3:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("形")>-1});
break;
case 4:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("副")>-1});
break;
case 5:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("介")>-1});
break;
case 6:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("数")>-1});
break;
case 7:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("连")>-1});
break;
case 8:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("助")>-1});
break;
case 9:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("量")>-1});
break;
case 10:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("叹")>-1});
break;
case 11:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("代")>-1});
break;
case 12:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("拟声")>-1});
break;
case 13:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("无")>-1});
break;
};
if (dictList_filtered.length == 0) {
//信息框
$("#filter_CN").after(htmlInfo("无筛选结果,请修改筛选条件。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
if (filter_rhyme>0) {
var dictList_filtered = dictList_filtered.filter(function (value) {return value.r.indexOf(filter_rhyme)>-1});
};
if (dictList_filtered.length == 0) {
//信息框
$("#filter_CN").after(htmlInfo("无筛选结果,请修改筛选条件。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
if (filter_len != "") {
if (filter_len>0 && filter_len<=8) {
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.l == filter_len;
};
}
else if (filter_len.indexOf('>')>-1 && filter_len.slice(filter_len.indexOf('>')+1)>0) {
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.l > filter_len.slice(filter_len.indexOf('>')+1);
};
filter2.val(">" + filter_len.slice(filter_len.indexOf('>')+1));
}
else if (filter_len.indexOf('<')>-1 && filter_len.slice(filter_len.indexOf('<')+1)>0) {
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.l < filter_len.slice(filter_len.indexOf('<')+1);
};
filter2.val("<" + filter_len.slice(filter_len.indexOf('<')+1));
}
else {
//警告框
$("#filter_CN").after(htmlWarning("字数筛选条件 “"+filter_len+"” 超出范围或无法识别。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
filter2.val(this.defaultValue);
return false;
};
};
if (dictList_filtered.length == 0) {
//信息框
$("#filter_CN").after(htmlInfo("无筛选结果,请修改筛选条件。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
if (filter_1stPY != "") {
/*if (filter_1stPY>='A' && filter_1stPY<='z') {
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.w[0] == filter_1stPY[0];
};
document.getElementById("filter3").value = filter_1stPY[0].toLowerCase();
}*/
filter_1stPY = filter_1stPY.toLowerCase();
var reg = /[a-z]/g;
if (filter_1stPY.replace(reg, "")=="") { //证明只有英文字母
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
var pyszm = value.s.split(" ");
for (var i=0;i<filter_1stPY.length;i++) {
if (pyszm[i]!=filter_1stPY[i]) {return false;};
};
return true;
};
filter3.val(filter_1stPY);
}
else {
//警告框
$("#filter_CN").after(htmlWarning("拼音首字母筛选条件 “"+filter_1stPY+"” 无法识别。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
filter3.val(this.defaultValue);
return false;
};
};
if (dictList_filtered.length == 0) {
//信息框
$("#filter_CN").after(htmlInfo("无筛选结果,请修改筛选条件。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
if (filter_strok != "") {
if (filter_strok>0) {
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.b == filter_strok;
};
}
else if (filter_strok.indexOf('>')>-1 && filter_strok.slice(filter_strok.indexOf('>')+1)>0) {
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.b > filter_strok.slice(filter_strok.indexOf('>')+1);
};
filter4.val(">" + filter_strok.slice(filter_strok.indexOf('>')+1));
}
else if (filter_strok.indexOf('<')>-1 && filter_strok.slice(filter_strok.indexOf('<')+1)>0) {
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.b < filter_strok.slice(filter_strok.indexOf('<')+1);
};
filter4.val("<" + filter_strok.slice(filter_strok.indexOf('<')+1));
}
else {
//警告框
$("#filter_CN").after(htmlWarning("笔画筛选条件 “"+filter_strok+"” 无法识别。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
filter4.val(this.defaultValue);
return false;
};
};
if (dictList_filtered.length == 0) {
//信息框
$("#filter_CN").after(htmlInfo("无筛选结果,请修改筛选条件。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
//*为匹配0到多字;?匹配1字;+为且;[...]匹配集合内任一字;[^...]不匹配集合内任何字
if (filter_shape != "") {
var reg = /[\u4e00-\u9fa5]/g;
var ruleStr = "或********或????????或????????或++++++++或[^]或[]"; //多次匹配模式(第一个“或”字占位符必须加,因为如果搜索目标是空的则搜索结果是位置0)
//var ruleStr = "或*或?或?或+或[^]或[]"; //单次匹配模式
var ruleInd = ruleStr.indexOf(filter_shape.replace(reg, ""));
var tmp = filter_shape.match(reg);
try {
var hanziStr = tmp.join("");
}
catch(err) {
var hanziStr = "";
};
if (ruleInd>-1) {
if (ruleStr[ruleInd]=='*') {
var hanziArr = filter_shape.split('*');
var dictList_filtered = dictList_filtered.filter(function (value) {
var tmp = [];
for (var i=0;i<this.length;i++) { // 山*水* --> ["山","水",""],有一个空,因为*在边上的原因。
if (this[i].length>0) {
tmp.push(this[i]);
};
};
if (tmp.length==0) { return true;}; //没有汉字,则都算符合。
if (this[0]!="") { // 开头不是*而是字时,必须匹配第一个字/词
if (value.w[0]!=this[0]) {return false;};
};
if (this[this.length-1]!="") { // 结尾不是*而是字时,必须匹配最后一个字/词
if (value.w[value.w.length-1]!=this[this.length-1]) {return false;};
};
if (tmp.length==1) { //一个字或词,找到就符合。
if (value.w.indexOf(tmp[0])>-1) {
return true;
}
else {
return false;
};
}
else {
var ind = value.w.indexOf(tmp[0]);
if (ind<0) {return false;};
for (var i=1;i<tmp.length;i++) { //多个字或词,从上一次找到的点往后找,以保证按顺序。
if (value.w.indexOf(tmp[i], ind+1)<0) {
return false;
}
else {
ind = value.w.indexOf(tmp[i]);
};
};
return true;
};
}, hanziArr);
}
else if (ruleStr[ruleInd]=='?' || ruleStr[ruleInd]=='?') {
var dictList_filtered = dictList_filtered.filter(function (value) {
if (filter_shape.length!=value.w.length) {return false};
for (var i=0;i<filter_shape.length;i++) {
if (filter_shape[i]==ruleStr[ruleInd]) {continue;}
else {
if (filter_shape[i]!=value.w[i]) {return false;};
};
};
return true;
});
}
else if (ruleStr[ruleInd]=='+') {
var hanziArr = filter_shape.split('+');
var dictList_filtered = dictList_filtered.filter(function (value) {
for (var i=0;i<this.length;i++) {
if (value.w.indexOf(this[i])<0) {return false;};
};
return true;
}, hanziArr);
}
else if (ruleStr[ruleInd]=='[' && ruleStr[ruleInd+1]=='^') {
var dictList_filtered = dictList_filtered.filter(function (value) {
for (var i=0;i<this.length;i++) {
if (value.w.indexOf(this[i])>-1) {return false;};
};
return true;
}, hanziStr);
}
else if (ruleStr[ruleInd]=='[') {
var dictList_filtered = dictList_filtered.filter(function (value) {
for (var i=0;i<this.length;i++) {
if (value.w.indexOf(this[i])>-1) {return true;};
};
return false;
}, hanziStr);
}
else {
//警告框
$("#filter_CN").after(htmlWarning("词形筛选条件 “"+filter_shape+"” 无法识别。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
filter5.val(this.defaultValue);
return false;
};
}
else {
//警告框
$("#filter_CN").after(htmlWarning("词形筛选条件 “"+filter_shape+"” 无法识别。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
filter5.val(this.defaultValue);
return false;
};
};
if (dictList_filtered.length == 0) {
//信息框
$("#filter_CN").after(htmlInfo("无筛选结果,请修改筛选条件。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
dictList_filtered = dictList_filtered.slice(0,100);
switch (sort_rule) {
case 1:
dictList_filtered.sort(function(a, b){
if (a.s[0] > b.s[0]) {
return 1;
}
else if (a.s[0] < b.s[0]) {
return -1;
}
else {
return 0;
}
});
break;
case 2:
dictList_filtered.sort(function(a, b){
if (a.s[0] > b.s[0]) {
return -1;
}
else if (a.s[0] < b.s[0]) {
return 1;
}
else {
return 0;
}
});
break;
case 3:
dictList_filtered.sort(function(a, b){return a.b - b.b});
break;
case 4:
dictList_filtered.sort(function(a, b){return b.b - a.b});
break;
case 5:
dictList_filtered.sort(function(a, b){return a.B - b.B});
break;
case 6:
dictList_filtered.sort(function(a, b){return b.B - a.B});
break;
};
showTable(dictList_filtered, $('#result'));
};
function modelProcecss() {
clearAlert();
var description = $("#description").val();
if (description.length==0) {
$("#filter_CN").after(htmlDanger("输入描述不能为空。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return true;
};
var reg = /[\u4e00-\u9fa5]/g;
if (description.search(reg)<0) {
$("#filter_CN").after(htmlDanger("输入字符无法识别。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return true;
};
//聚类功能
if ($(window).width()<751 || window.innerWidth<768) {
var main_select=$("#filter_CN div.visible-xs").find("#main_select");
}
else {
var main_select=$("#filter_CN div.visible-lg").find("#main_select");
};
var sort_rule = main_select[0].selectedIndex;
if (sort_rule==7) {
$.get("/ChineseRDCluster/", { 'description': description, 'mode': 'CC' }, function (ret) {
showTable_Cluster(ret, $('#result'));
});
return true;
}
$("#filter_CN div").find("*").removeAttr("disabled");
//console.log('modelProcecss');
if ($("#description").val()==description_backup) {
filterRes(retData_backup);
}
else {
$.get("/ChineseRD/", { 'description': description, 'mode': 'CC' }, function (ret) {
try {
retData_backup = ret.slice(0);
description_backup = description.slice(0);
filterRes(retData_backup);
$("#filter_CN").show();
}
catch(err) {
$('#result').html("");
switch (ret['error']){
case 0: //错误框
$("#filter_CN").after(htmlDanger("输入描述不能为空。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
break;
case 1: //错误框
$("#filter_CN").after(htmlDanger("输入字符无法识别。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
break;
default: //报出明确的错误类型。
$("#filter_CN").after(htmlDanger(err.name));
$(".alert").on("click", function(){$(this).slideUp("fast");});
}
}
});
}
};
function onkeySearch() {
$('#result').html("");
clearAlert();
modelProcecss();
};
$(document).ready(function () {
$("#description").keypress(function(e) {
if(e.keyCode == 13)
{
$('#result').html("");
clearAlert();
modelProcecss();
}
});
});
<!----------------------------英英EE--------------------------------->
var retData_backup_EE; //全局变量保存返回值原始数据。
var description_backup_EE;
function filterRes_EE(dictList) {
if ($(window).width()<751 || window.innerWidth<768) {
var POS_select_EE=$("#filter_EE div.visible-xs").find("#POS_select_EE");
var filter1=$("#filter_EE div.visible-xs").find("#filter1_EE");
var filter2=$("#filter_EE div.visible-xs").find("#filter2_EE");
var filter3=$("#filter_EE div.visible-xs").find("#filter3_EE");
var main_select=$("#filter_EE div.visible-xs").find("#main_select_EE");
}
else {
var POS_select_EE=$("#filter_EE div.visible-lg").find("#POS_select_EE");
var filter1=$("#filter_EE div.visible-lg").find("#filter1_EE");
var filter2=$("#filter_EE div.visible-lg").find("#filter2_EE");
var filter3=$("#filter_EE div.visible-lg").find("#filter3_EE");
var main_select=$("#filter_EE div.visible-lg").find("#main_select_EE");
};
var filter_POS = POS_select_EE[0].selectedIndex;
var filter_len = filter1.val();
var filter_initial = filter2.val();
var filter_shape = filter3.val();
var sort_rule = main_select[0].selectedIndex;
if (filter_POS>0) {
POS_select_EE.css("background-color", "#fffdef");
}
else {
POS_select_EE.css("background-color", "");
};
if (filter_len!="") {
filter1.css("background-color", "#fffdef");
}
else {
filter1.css("background-color", "");
};
if (filter_initial!="") {
filter2.css("background-color", "#fffdef");
}
else {
filter2.css("background-color", "");
};
if (filter_shape!="") {
filter3.css("background-color", "#fffdef");
}
else {
filter3.css("background-color", "");
};
if (sort_rule>0) {
main_select.css("background-color", "#fffdef");
}
else {
main_select.css("background-color", "");
};
switch (filter_POS) {
case 1:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("n")>-1});
break;
case 2:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("v")>-1});
break;
case 3:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("adj")>-1});
break;
case 4:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("adv")>-1});
break;
case 5:
var dictList_filtered = dictList.filter(function (value) {return value.P.length==0});
break;
case 0:
var dictList_filtered = dictList.slice(0);
break;
};
if (dictList_filtered.length == 0) {
//信息框
$("#filter_EE").after(htmlInfo_E("No screening results, please modify the POS screening condition."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
if (filter_len != "") {
if (filter_len>0) {
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.w.length == filter_len;
};
}
else if (filter_len.indexOf('>')>-1 && filter_len.slice(filter_len.indexOf('>')+1)>0) {
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.w.length > filter_len.slice(filter_len.indexOf('>')+1);
};
filter1.val(">" + filter_len.slice(filter_len.indexOf('>')+1));
}
else if (filter_len.indexOf('<')>-1 && filter_len.slice(filter_len.indexOf('<')+1)>0) {
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.w.length < filter_len.slice(filter_len.indexOf('<')+1);
};
filter1.val("<" + filter_len.slice(filter_len.indexOf('<')+1));
}
else {
//警告框
$("#filter_EE").after(htmlWarning_E("Word length screening condition '"+filter_len+"' is out of range or unrecognizable."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
filter1.val(this.defaultValue);
return false;
};
};
if (dictList_filtered.length == 0) {
//信息框
$("#filter_EE").after(htmlInfo_E("No screening results, please modify the word length screening condition."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
if (filter_initial != "") {
var reg = /[a-zA-Z]/g;
if (filter_initial.replace(reg, "")=="") { //证明只有英文字母
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.w[0] == filter_initial[0].toLowerCase();
};
filter2.val(filter_initial[0]);
}
else {
//警告框
$("#filter_EE").after(htmlWarning_E("Word initial screening condition '"+filter_initial+"' is not recognizable."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
filter2.val(this.defaultValue);
return false;
};
};
if (dictList_filtered.length == 0) {
//信息框
$("#filter_EE").after(htmlInfo_E("No screening results, please modify the initial screening condition."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
//*为匹配0到多字;?匹配1字
if (filter_shape != "") {
var reg = /[a-zA-Z]/g;
var ruleStr = "或****************或????????????????或????????????????"; //多次匹配模式(第一个“或”字占位符必须加,因为如果搜索目标是空的则搜索结果是位置0)
var ruleInd = ruleStr.indexOf(filter_shape.replace(reg, ""));
if (ruleInd>-1) {
if (ruleStr[ruleInd]=='*') {
var charArr = filter_shape.split('*');
var dictList_filtered = dictList_filtered.filter(function (value) {
var tmp = [];
for (var i=0;i<this.length;i++) { // dic*on* --> ["dic","on",""],有一个空,因为*在边上的原因。
if (this[i].length>0) {
tmp.push(this[i]);
};
};
if (tmp.length==0) { return true;}; //没有字母,则都算符合。
if (this[0]!="") { // 开头不是*而是字时,必须匹配第一个字母片段。########0814修改BUG:value.w[0]!=this[0]错在字母和字母片段进行对比。而是匹配第一个字母片段的首字母。
if (value.w[0]!=this[0][0]) {return false;};
};
if (this[this.length-1]!="") { // 结尾不是*而是字时,必须匹配最后一个字母片段。########0814修改BUG:value.w[0]!=this[0]错在字母和字母片段进行对比。而是匹配末字母片段的末字母。
if (value.w[value.w.length-1]!=this[this.length-1][this[this.length-1].length-1]) {return false;};
};
if (tmp.length==1) { //一个字母片段,找到就符合。
if (value.w.indexOf(tmp[0])>-1) {
return true;
}
else {
return false;
};
}
else {
var ind = value.w.indexOf(tmp[0]);
if (ind<0) {return false;};
for (var i=1;i<tmp.length;i++) { //多个字母片段,从上一次找到的点往后找,以保证按顺序。
if (value.w.indexOf(tmp[i], ind+1)<0) {
return false;
}
else {
ind = value.w.indexOf(tmp[i]);
};
};
return true;
};
}, charArr);
}
else if (ruleStr[ruleInd]=='?' || ruleStr[ruleInd]=='?') {
var dictList_filtered = dictList_filtered.filter(function (value) {
if (filter_shape.length!=value.w.length) {return false};
for (var i=0;i<filter_shape.length;i++) {
if (filter_shape[i]==ruleStr[ruleInd]) {continue;}
else {
if (filter_shape[i]!=value.w[i]) {return false;};
};
};
return true;
});
}
else {
//警告框
$("#filter_EE").after(htmlWarning_E("Wildcard patterns screening condition '"+filter_shape+"' is not recognizable."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
filter3.val(this.defaultValue);
return false;
};
}
else {
//警告框
$("#filter_EE").after(htmlWarning_E("Wildcard patterns screening condition '"+filter_shape+"' is not recognizable."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
filter3.val(this.defaultValue);
return false;
};
};
if (dictList_filtered.length == 0) {
//信息框
$("#filter_EE").after(htmlInfo_E("No screening results, please modify the Wildcard patterns screening condition."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
dictList_filtered = dictList_filtered.slice(0,100);
switch (sort_rule) {
case 1:
dictList_filtered.sort(function(a, b){
if (a.w[0] > b.w[0]) {
return 1;
}
else if (a.w[0] < b.w[0]) {
return -1;
}
else {
if (a.w[1] > b.w[1]) {
return 1;
}
else if (a.w[1] < b.w[1]) {
return -1;
}
else {
return 0;
}
}
});
break;
case 2:
dictList_filtered.sort(function(a, b){
if (a.w[0] > b.w[0]) {
return -1;
}
else if (a.w[0] < b.w[0]) {
return 1;
}
else {
if (a.w[1] > b.w[1]) {
return -1;
}
else if (a.w[1] < b.w[1]) {
return 1;
}
else {
return 0;
}
}
});
break;
case 3:
dictList_filtered.sort(function(a, b){return a.w.length - b.w.length});
break;
case 4:
dictList_filtered.sort(function(a, b){return b.w.length - a.w.length});
break;
};
showTable(dictList_filtered, $('#result_EE'));
};
function modelProcecss_EE() {
clearAlert();
var description = $("#description_EE").val();
if (description.length==0) {
$("#filter_EE").after(htmlDanger_E("The input description cannot be empty."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return true;
};
var reg = /[a-zA-Z]/;
if (description.search(reg)<0) {
$("#filter_EE").after(htmlDanger_E("The input characters are unrecognizable."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return true;
};
// 聚类功能
if ($(window).width()<751 || window.innerWidth<768) {
var main_select=$("#filter_EE div.visible-xs").find("#main_select_EE");
}
else {
var main_select=$("#filter_EE div.visible-lg").find("#main_select_EE");
};
var sort_rule = main_select[0].selectedIndex;
if (sort_rule==5) {
$.get("/EnglishRDCluster/", { 'description': description, 'mode': 'EE' }, function (ret) {
showTable_Cluster(ret, $('#result_EE'));
});
return true;
}
$("#filter_EE div").find("*").removeAttr("disabled");
if ($("#description_EE").val()==description_backup_EE) {
filterRes_EE(retData_backup_EE);
}
else {
$.get("/EnglishRD/", { 'description': description, 'mode': 'EE' }, function (ret) {
try {
retData_backup_EE = ret.slice(0);
description_backup_EE = description.slice(0);
//console.log(ret);
filterRes_EE(retData_backup_EE);
$("#filter_EE").show();
}
catch(err) {
$('#result_EE').html("");
switch (ret['error']){
case 0: //错误框
$("#filter_EE").after(htmlDanger_E("The input description cannot be empty."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
break;
case 1: //错误框
$("#filter_EE").after(htmlDanger_E("The input characters are unrecognizable."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
break;
default: //报出明确的错误类型。
$("#filter_EE").after(htmlDanger_E(err.name));
$(".alert").on("click", function(){$(this).slideUp("fast");});
}
}
});
}
};
function onkeySearch_EE() {
$('#result_EE').html("");
clearAlert();
modelProcecss_EE();
};
$(document).ready(function () {
$("#description_EE").keypress(function(e) {
if(e.keyCode == 13)
{
$('#result_EE').html("");
clearAlert();
modelProcecss_EE();
}
});
});
<!----------------------------汉英CE--------------------------------->
var retData_backup_CE; //全局变量保存返回值原始数据。
var description_backup_CE;
function filterRes_CE(dictList) {
if ($(window).width()<751 || window.innerWidth<768) {
var POS_select_CE=$("#filter_CE div.visible-xs").find("#POS_select_CE");
var filter1=$("#filter_CE div.visible-xs").find("#filter1_CE");
var filter2=$("#filter_CE div.visible-xs").find("#filter2_CE");
var filter3=$("#filter_CE div.visible-xs").find("#filter3_CE");
var main_select=$("#filter_CE div.visible-xs").find("#main_select_CE");
}
else {
var POS_select_CE=$("#filter_CE div.visible-lg").find("#POS_select_CE");
var filter1=$("#filter_CE div.visible-lg").find("#filter1_CE");
var filter2=$("#filter_CE div.visible-lg").find("#filter2_CE");
var filter3=$("#filter_CE div.visible-lg").find("#filter3_CE");
var main_select=$("#filter_CE div.visible-lg").find("#main_select_CE");
};
var filter_POS = POS_select_CE[0].selectedIndex;
var filter_len = filter1.val();
var filter_initial = filter2.val();
var filter_shape = filter3.val();
var sort_rule = main_select[0].selectedIndex;
if (filter_POS>0) {
POS_select_CE.css("background-color", "#fffdef");
}
else {
POS_select_CE.css("background-color", "");
};
if (filter_len!="") {
filter1.css("background-color", "#fffdef");
}
else {
filter1.css("background-color", "");
};
if (filter_initial!="") {
filter2.css("background-color", "#fffdef");
}
else {
filter2.css("background-color", "");
};
if (filter_shape!="") {
filter3.css("background-color", "#fffdef");
}
else {
filter3.css("background-color", "");
};
if (sort_rule>0) {
main_select.css("background-color", "#fffdef");
}
else {
main_select.css("background-color", "");
};
switch (filter_POS) {
case 1:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("n")>-1});
break;
case 2:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("v")>-1});
break;
case 3:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("adj")>-1});
break;
case 4:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("adv")>-1});
break;
case 5:
var dictList_filtered = dictList.filter(function (value) {return value.P.length==0});
break;
case 0:
var dictList_filtered = dictList.slice(0);
break;
};
if (dictList_filtered.length == 0) {
//信息框
$("#filter_CE").after(htmlInfo("无筛选结果,请修改筛选条件。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
if (filter_len != "") {
if (filter_len>0 && filter_len<=30) {
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.w.length == filter_len;
};
}
else if (filter_len.indexOf('>')>-1 && filter_len.slice(filter_len.indexOf('>')+1)>0) {
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.w.length > filter_len.slice(filter_len.indexOf('>')+1);
};
filter1.val(">" + filter_len.slice(filter_len.indexOf('>')+1));
}
else if (filter_len.indexOf('<')>-1 && filter_len.slice(filter_len.indexOf('<')+1)>0) {
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.w.length < filter_len.slice(filter_len.indexOf('<')+1);
};
filter1.val("<" + filter_len.slice(filter_len.indexOf('<')+1));
}
else {
//警告框
$("#filter_CE").after(htmlWarning("单词长度筛选条件 '"+filter_len+"' 超出范围或无法识别。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
filter1.val(this.defaultValue);
return false;
};
};
if (dictList_filtered.length == 0) {
//信息框
$("#filter_CE").after(htmlInfo("无筛选结果,请修改筛选条件。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
if (filter_initial != "") {
var reg = /[a-zA-Z]/g;
if (filter_initial.replace(reg, "")=="") { //证明只有英文字母
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.w[0] == filter_initial[0].toLowerCase();
};
filter2.val(filter_initial[0]);
}
else {
//警告框
$("#filter_CE").after(htmlWarning("单词首字母筛选条件 '"+filter_initial+"' 无法识别。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
filter2.val(this.defaultValue);
return false;
};
};
if (dictList_filtered.length == 0) {
//信息框
$("#filter_CE").after(htmlInfo("无筛选结果,请修改筛选条件。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
//*为匹配0到多字;?匹配1字
if (filter_shape != "") {
var reg = /[a-zA-Z]/g;
var ruleStr = "或****************或????????????????或????????????????"; //多次匹配模式(第一个“或”字占位符必须加,因为如果搜索目标是空的则搜索结果是位置0)
var ruleInd = ruleStr.indexOf(filter_shape.replace(reg, ""));
if (ruleInd>-1) {
if (ruleStr[ruleInd]=='*') {
var charArr = filter_shape.split('*');
var dictList_filtered = dictList_filtered.filter(function (value) {
var tmp = [];
for (var i=0;i<this.length;i++) { // dic*on* --> ["dic","on",""],有一个空,因为*在边上的原因。
if (this[i].length>0) {
tmp.push(this[i]);
};
};
if (tmp.length==0) { return true;}; //没有字母,则都算符合。
if (this[0]!="") { // 开头不是*而是字时,必须匹配第一个字母片段。########0814修改BUG:value.w[0]!=this[0]错在字母和字母片段进行对比。而是匹配第一个字母片段的首字母。
if (value.w[0]!=this[0][0]) {return false;};
};
if (this[this.length-1]!="") { // 结尾不是*而是字时,必须匹配最后一个字母片段。########0814修改BUG:value.w[0]!=this[0]错在字母和字母片段进行对比。而是匹配末字母片段的末字母。
if (value.w[value.w.length-1]!=this[this.length-1][this[this.length-1].length-1]) {return false;};
};
if (tmp.length==1) { //一个字母片段,找到就符合。
if (value.w.indexOf(tmp[0])>-1) {
return true;
}
else {
return false;
};
}
else {
var ind = value.w.indexOf(tmp[0]);
if (ind<0) {return false;};
for (var i=1;i<tmp.length;i++) { //多个字母片段,从上一次找到的点往后找,以保证按顺序。
if (value.w.indexOf(tmp[i], ind+1)<0) {
return false;
}
else {
ind = value.w.indexOf(tmp[i]);
};
};
return true;
};
}, charArr);
}
else if (ruleStr[ruleInd]=='?' || ruleStr[ruleInd]=='?') {
var dictList_filtered = dictList_filtered.filter(function (value) {
if (filter_shape.length!=value.w.length) {return false};
for (var i=0;i<filter_shape.length;i++) {
if (filter_shape[i]==ruleStr[ruleInd]) {continue;}
else {
if (filter_shape[i]!=value.w[i]) {return false;};
};
};
return true;
});
}
else {
//警告框
$("#filter_CE").after(htmlWarning("词形筛选条件 '"+filter_shape+"' 无法识别。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
filter3.val(this.defaultValue);
return false;
};
}
else {
//警告框
$("#filter_CE").after(htmlWarning("词形筛选条件 '"+filter_shape+"' 无法识别。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
filter3.val(this.defaultValue);
return false;
};
};
if (dictList_filtered.length == 0) {
//信息框
$("#filter_CE").after(htmlInfo("无筛选结果,请修改筛选条件。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
dictList_filtered = dictList_filtered.slice(0,100);
switch (sort_rule) {
case 1:
dictList_filtered.sort(function(a, b){
if (a.w[0] > b.w[0]) {
return 1;
}
else if (a.w[0] < b.w[0]) {
return -1;
}
else {
if (a.w[1] > b.w[1]) {
return 1;
}
else if (a.w[1] < b.w[1]) {
return -1;
}
else {
return 0;
}
}
});
break;
case 2:
dictList_filtered.sort(function(a, b){
if (a.w[0] > b.w[0]) {
return -1;
}
else if (a.w[0] < b.w[0]) {
return 1;
}
else {
if (a.w[1] > b.w[1]) {
return -1;
}
else if (a.w[1] < b.w[1]) {
return 1;
}
else {
return 0;
}
}
});
break;
case 3:
dictList_filtered.sort(function(a, b){return a.w.length - b.w.length});
break;
case 4:
dictList_filtered.sort(function(a, b){return b.w.length - a.w.length});
break;
};
showTable(dictList_filtered, $('#result_CE'));
};
function modelProcecss_CE() {
clearAlert();
var description = $("#description_CE").val();
if (description.length==0) {
$("#filter_CE").after(htmlDanger("输入描述不能为空。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return true;
};
var reg = /[\u4e00-\u9fa5]/g;
if (description.search(reg)<0) {
$("#filter_CE").after(htmlDanger("输入字符无法识别。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return true;
};
// 聚类功能
if ($(window).width()<751 || window.innerWidth<768) {
var main_select=$("#filter_CE div.visible-xs").find("#main_select_CE");
}
else {
var main_select=$("#filter_CE div.visible-lg").find("#main_select_CE");
};
var sort_rule = main_select[0].selectedIndex;
if (sort_rule==5) {
$.get("/EnglishRDCluster/", { 'description': description, 'mode': 'CE' }, function (ret) {
showTable_Cluster(ret, $('#result_CE'));
});
return true;
}
$("#filter_CE div").find("*").removeAttr("disabled");
if ($("#description_CE").val()==description_backup_CE) {
filterRes_CE(retData_backup_CE);
}
else {
$.get("/EnglishRD/", { 'description': description, 'mode': 'CE' }, function (ret) {
try {
retData_backup_CE = ret.slice(0);
description_backup_CE = description.slice(0);
//console.log(ret);
filterRes_CE(retData_backup_CE);
$("#filter_CE").show();
}
catch(err) {
$('#result_CE').html("");
switch (ret['error']){
case 0: //错误框
$("#filter_CE").after(htmlDanger("输入描述不能为空。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
break;
case 1: //错误框
$("#filter_CE").after(htmlDanger("输入字符无法识别。"));
$(".alert").on("click", function(){$(this).slideUp("fast");});
break;
default: //报出明确的错误类型。
$("#filter_CE").after(htmlDanger(err.name));
$(".alert").on("click", function(){$(this).slideUp("fast");});
}
}
});
}
};
function onkeySearch_CE() {
$('#result_CE').html("");
clearAlert();
modelProcecss_CE();
};
$(document).ready(function () {
$("#description_CE").keypress(function(e) {
if(e.keyCode == 13)
{
$('#result_CE').html("");
clearAlert();
modelProcecss_CE();
}
});
});
<!----------------------------英汉EC--------------------------------->
var retData_backup_EC; //全局变量保存返回值原始数据。
var description_backup_EC;
//filterRes_EC();
function filterRes_EC(dictList) {
//console.log("filterRes_EC");
//var filter_POS = $("#filter1_EC").val(); //document.getElementById("filter1").value
if ($(window).width()<751 || window.innerWidth<768) {
var POS_select_EC=$("#filter_EC div.visible-xs").find("#POS_select_EC");
var filter2=$("#filter_EC div.visible-xs").find("#filter2_EC");
var filter3=$("#filter_EC div.visible-xs").find("#filter3_EC");
var filter4=$("#filter_EC div.visible-xs").find("#filter4_EC");
var filter5=$("#filter_EC div.visible-xs").find("#filter5_EC");
var main_select=$("#filter_EC div.visible-xs").find("#main_select_EC");
var rhyme_select_EC=$("#filter_EC div.visible-xs").find("#rhyme_select_EC");
}
else {
var POS_select_EC=$("#filter_EC div.visible-lg").find("#POS_select_EC");
var filter2=$("#filter_EC div.visible-lg").find("#filter2_EC");
var filter3=$("#filter_EC div.visible-lg").find("#filter3_EC");
var filter4=$("#filter_EC div.visible-lg").find("#filter4_EC");
var filter5=$("#filter_EC div.visible-lg").find("#filter5_EC");
var main_select=$("#filter_EC div.visible-lg").find("#main_select_EC");
var rhyme_select_EC=$("#filter_EC div.visible-lg").find("#rhyme_select_EC");
};
//var filter_POS = document.getElementById("POS_select_CC").options.selectedIndex;
var filter_POS = POS_select_EC[0].selectedIndex;
var filter_len = filter2.val();
var filter_1stPY = filter3.val();
var filter_strok = filter4.val();
var filter_shape = filter5.val();
var sort_rule = main_select[0].selectedIndex;
var filter_rhyme = rhyme_select_EC[0].selectedIndex;
if (filter_POS>0) {
POS_select_EC.css("background-color", "#fffdef");
}
else {
POS_select_EC.css("background-color", "");
};
if (filter_len!="") {
filter2.css("background-color", "#fffdef");
}
else {
filter2.css("background-color", "");
};
if (filter_1stPY!="") {
filter3.css("background-color", "#fffdef");
}
else {
filter3.css("background-color", "");
};
if (filter_strok!="") {
filter4.css("background-color", "#fffdef");
}
else {
filter4.css("background-color", "");
};
if (filter_shape!="") {
filter5.css("background-color", "#fffdef");
}
else {
filter5.css("background-color", "");
};
if (sort_rule>0) {
main_select.css("background-color", "#fffdef");
}
else {
main_select.css("background-color", "");
};
if (filter_rhyme>0) {
rhyme_select_EC.css("background-color", "#fffdef");
}
else {
rhyme_select_EC.css("background-color", "");
};
switch (filter_POS) {
case 0:
var dictList_filtered = dictList.slice(0);
break;
case 1:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("名")>-1});
break;
case 2:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("动")>-1});
break;
case 3:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("形")>-1});
break;
case 4:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("副")>-1});
break;
case 5:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("介")>-1});
break;
case 6:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("数")>-1});
break;
case 7:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("连")>-1});
break;
case 8:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("助")>-1});
break;
case 9:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("量")>-1});
break;
case 10:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("叹")>-1});
break;
case 11:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("代")>-1});
break;
case 12:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("拟声")>-1});
break;
case 13:
var dictList_filtered = dictList.filter(function (value) {return value.P.indexOf("无")>-1});
break;
};
if (dictList_filtered.length == 0) {
//信息框
$("#filter_EC").after(htmlInfo_E("No screening results, please modify the POS screening condition."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
if (filter_rhyme>0) {
var dictList_filtered = dictList_filtered.filter(function (value) {return value.r.indexOf(filter_rhyme)>-1});
};
if (dictList_filtered.length == 0) {
//信息框
$("#filter_EC").after(htmlInfo_E("No screening results, please modify the rhyme screening condition."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
if (filter_len != "") {
if (filter_len>0 && filter_len<=8) {
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.l == filter_len;
};
}
else if (filter_len.indexOf('>')>-1 && filter_len.slice(filter_len.indexOf('>')+1)>0) {
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.l > filter_len.slice(filter_len.indexOf('>')+1);
};
filter2.val(">" + filter_len.slice(filter_len.indexOf('>')+1));
}
else if (filter_len.indexOf('<')>-1 && filter_len.slice(filter_len.indexOf('<')+1)>0) {
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.l < filter_len.slice(filter_len.indexOf('<')+1);
};
filter2.val("<" + filter_len.slice(filter_len.indexOf('<')+1));
}
else {
//警告框
$("#filter_EC").after(htmlWarning_E("Word length screening condition '"+filter_len+"' is out of range or unrecognizable."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
filter2.val(this.defaultValue);
return false;
};
};
if (dictList_filtered.l == 0) {
//信息框
$("#filter_EC").after(htmlInfo_E("No screening results, please modify the word length screening condition."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
if (filter_1stPY != "") {
filter_1stPY = filter_1stPY.toLowerCase()
var reg = /[a-z]/g;
if (filter_1stPY.replace(reg, "")=="") { //证明只有英文字母
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
var pyszm = value.s.split(" ");
for (var i=0;i<filter_1stPY.length;i++) {
if (pyszm[i]!=filter_1stPY[i]) {return false;};
};
return true;
};
filter3.val(filter_1stPY);
}
else {
//警告框
$("#filter_EC").after(htmlWarning_E("Initial Pinyin screening condition '"+filter_1stPY+"' is not recognizable."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
filter3.val(this.defaultValue);
return false;
};
};
if (dictList_filtered.length == 0) {
//信息框
$("#filter_EC").after(htmlInfo_E("No screening results, please modify the initial Pinyin screening condition."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
if (filter_strok != "") {
if (filter_strok>0) {
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.b == filter_strok;
};
}
else if (filter_strok.indexOf('>')>-1 && filter_strok.slice(filter_strok.indexOf('>')+1)>0) {
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.b > filter_strok.slice(filter_strok.indexOf('>')+1);
};
document.getElementById("filter4_EC").value = ">" + filter_strok.slice(filter_strok.indexOf('>')+1);
}
else if (filter_strok.indexOf('<')>-1 && filter_strok.slice(filter_strok.indexOf('<')+1)>0) {
var dictList_filtered = dictList_filtered.filter(localFunc);
function localFunc(value) {
return value.b < filter_strok.slice(filter_strok.indexOf('<')+1);
};
document.getElementById("filter4_EC").value = "<" + filter_strok.slice(filter_strok.indexOf('<')+1);
}
else {
//警告框
$("#filter_EC").after(htmlWarning_E("Number of strokes screening condition '"+filter_strok+"' is not recognizable."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
document.getElementById("filter4_EC").value = "";
return false;
};
};
if (dictList_filtered.length == 0) {
//信息框
$("#filter_EC").after(htmlInfo_E("No screening results, please modify the number of strokes screening condition."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
//*为匹配0到多字;?匹配1字;+为且;[...]匹配集合内任一字;[^...]不匹配集合内任何字
if (filter_shape != "") {
var reg = /[\u4e00-\u9fa5]/g;
var ruleStr = "或********或????????或????????或++++++++或[^]或[]"; //多次匹配模式(第一个“或”字占位符必须加,因为如果搜索目标是空的则搜索结果是位置0)
//var ruleStr = "或*或?或?或+或[^]或[]"; //单次匹配模式
var ruleInd = ruleStr.indexOf(filter_shape.replace(reg, ""));
var tmp = filter_shape.match(reg);
try {
var hanziStr = tmp.join("");
}
catch(err) {
var hanziStr = "";
};
if (ruleInd>-1) {
if (ruleStr[ruleInd]=='*') {
var hanziArr = filter_shape.split('*');
var dictList_filtered = dictList_filtered.filter(function (value) {
var tmp = [];
for (var i=0;i<this.length;i++) { // 山*水* --> ["山","水",""],有一个空,因为*在边上的原因。
if (this[i].length>0) {
tmp.push(this[i]);
};
};
if (tmp.length==0) { return true;}; //没有汉字,则都算符合。
if (this[0]!="") { // 开头不是*而是字时,必须匹配第一个字/词
if (value.w[0]!=this[0]) {return false;};
};
if (this[this.length-1]!="") { // 结尾不是*而是字时,必须匹配最后一个字/词
if (value.w[value.w.length-1]!=this[this.length-1]) {return false;};
};
if (tmp.length==1) { //一个字或词,找到就符合。
if (value.w.indexOf(tmp[0])>-1) {
return true;
}
else {
return false;
};
}
else {
var ind = value.w.indexOf(tmp[0]);
if (ind<0) {return false;};
for (var i=1;i<tmp.length;i++) { //多个字或词,从上一次找到的点往后找,以保证按顺序。
if (value.w.indexOf(tmp[i], ind+1)<0) {
return false;
}
else {
ind = value.w.indexOf(tmp[i]);
};
};
return true;
};
}, hanziArr);
}
else if (ruleStr[ruleInd]=='?' || ruleStr[ruleInd]=='?') {
var dictList_filtered = dictList_filtered.filter(function (value) {
if (filter_shape.length!=value.w.length) {return false};
for (var i=0;i<filter_shape.length;i++) {
if (filter_shape[i]==ruleStr[ruleInd]) {continue;}
else {
if (filter_shape[i]!=value.w[i]) {return false;};
};
};
return true;
});
}
else if (ruleStr[ruleInd]=='+') {
var hanziArr = filter_shape.split('+');
var dictList_filtered = dictList_filtered.filter(function (value) {
for (var i=0;i<this.length;i++) {
if (value.w.indexOf(this[i])<0) {return false;};
};
return true;
}, hanziArr);
}
else if (ruleStr[ruleInd]=='[' && ruleStr[ruleInd+1]=='^') {
var dictList_filtered = dictList_filtered.filter(function (value) {
for (var i=0;i<this.length;i++) {
if (value.w.indexOf(this[i])>-1) {return false;};
};
return true;
}, hanziStr);
}
else if (ruleStr[ruleInd]=='[') {
var dictList_filtered = dictList_filtered.filter(function (value) {
for (var i=0;i<this.length;i++) {
if (value.w.indexOf(this[i])>-1) {return true;};
};
return false;
}, hanziStr);
}
else {
//警告框
$("#filter_EC").after(htmlWarning_E("Wildcard patterns screening condition '"+filter_shape+"' is not recognizable."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
filter5.val(this.defaultValue);
return false;
};
}
else {
//警告框
$("#filter_EC").after(htmlWarning_E("Wildcard patterns screening condition '"+filter_shape+"' is not recognizable."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
filter5.val(this.defaultValue);
return false;
};
};
if (dictList_filtered.length == 0) {
//信息框
$("#filter_EC").after(htmlInfo_E("No screening results, please modify the Wildcard patterns screening condition."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return false;
};
dictList_filtered = dictList_filtered.slice(0,100);
switch (sort_rule) {
case 1:
dictList_filtered.sort(function(a, b){
if (a.s[0] > b.s[0]) {
return 1;
}
else if (a.s[0] < b.s[0]) {
return -1;
}
else {
return 0;
}
});
break;
case 2:
dictList_filtered.sort(function(a, b){
if (a.s[0] > b.s[0]) {
return -1;
}
else if (a.s[0] < b.s[0]) {
return 1;
}
else {
return 0;
}
});
break;
case 3:
dictList_filtered.sort(function(a, b){return a.b - b.b});
break;
case 4:
dictList_filtered.sort(function(a, b){return b.b - a.b});
break;
case 5:
dictList_filtered.sort(function(a, b){return a.B - b.B});
break;
case 6:
dictList_filtered.sort(function(a, b){return b.B - a.B});
break;
};
showTable(dictList_filtered, $('#result_EC'));
};
function modelProcecss_EC() {
clearAlert();
var description = $("#description_EC").val();
if (description.length==0) {
$("#filter_EC").after(htmlDanger_E("The input description cannot be empty."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return true;
};
var reg = /[a-zA-Z]/;
if (description.search(reg)<0) {
$("#filter_EC").after(htmlDanger_E("The input characters are unrecognizable."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
return true;
};
// 聚类功能
if ($(window).width()<751 || window.innerWidth<768) {
var main_select=$("#filter_EC div.visible-xs").find("#main_select_EC");
}
else {
var main_select=$("#filter_EC div.visible-lg").find("#main_select_EC");
};
var sort_rule = main_select[0].selectedIndex;
if (sort_rule==7) {
$.get("/ChineseRDCluster/", { 'description': description, 'mode': 'EC' }, function (ret) {
showTable_Cluster(ret, $('#result_EC'));
});
return true;
}
$("#filter_EC div").find("*").removeAttr("disabled");
if ($("#description_EC").val()==description_backup_EC) {
filterRes_EC(retData_backup_EC);
}
else {
$.get("/ChineseRD/", { 'description': description, 'mode': 'EC' }, function (ret) {
retData_backup_EC = ret.slice(0);
description_backup_EC = description.slice(0);
//console.log(ret);
try {
filterRes_EC(retData_backup_EC);
$("#filter_EC").show();
}
catch(err) {
$('#result_EC').html("");
switch (ret['error']){
case 0: //错误框
$("#filter_EC").after(htmlDanger_E("The input description cannot be empty."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
break;
case 1: //错误框
$("#filter_EC").after(htmlDanger_E("The input characters are unrecognizable."));
$(".alert").on("click", function(){$(this).slideUp("fast");});
break;
default: //报出明确的错误类型。
$("#filter_EC").after(htmlDanger(err.name));
$(".alert").on("click", function(){$(this).slideUp("fast");});
}
}
});
}
};
function onkeySearch_EC() {
$('#result_EC').html("");
clearAlert();
modelProcecss_EC();
};
$(document).ready(function () {
$("#description_EC").keypress(function(e) {
if(e.keyCode == 13)
{
$('#result_EC').html("");
clearAlert();
modelProcecss_EC();
}
});
});
<!----------------------------英Outlook--------------------------------->
$(document).ready(function () {
$("#description_EO").keypress(function(e) {
if(e.keyCode == 13)
{
var description = $("#description_EO").val();
$.get("/EnglishRD/", { 'description': description, 'mode': 'EO' }, function (ret) {
$('#result_EO').html(ret)
})
}
});
});
<!--------筛选和排序--------->
$(document).ready(function(){
$("#flip_EE").click(function(){
$("#panel_EE").slideToggle("fast", function(){
if($(this).is(":visible")){
$("#flip_EE").html('Clear and Hide Filter <span class="glyphicon glyphicon-off"></span>')} <!--和排序<span class="glyphicon glyphicon-sort"></span>-->
else{
clearAlert();
$("#filter_EE div").find("*").removeAttr("disabled");
try {
if ($("#description_EE").val()=="") {
$('#result_EE').html("");
}
else {
if ($("#description_EE").val()==description_backup_EE) {
showTable(retData_backup_EE, $('#result_EE'));
}
else {
modelProcecss_EE();
};
};
}
catch(err) {
$('#result_EE').html("");
};
$("#filter_EE.panel").find("*").val(this.defaultValue).css("background-color", "");
$("#flip_EE").html('Open Filter <span class="glyphicon glyphicon-filter"></span>')}
document.getElementById("main_select_EE").options.selectedIndex = 0;
document.getElementById("POS_select_EE").options.selectedIndex = 0;
});
});
});
$(document).ready(function(){
$("#flip_CE").click(function(){
$("#panel_CE").slideToggle("fast", function(){
if($(this).is(":visible")){
$("#flip_CE").html('清除并收起 筛选器 <span class="glyphicon glyphicon-off"></span>')} <!--和排序<span class="glyphicon glyphicon-sort"></span>-->
else{
clearAlert();
$("#filter_CE div").find("*").removeAttr("disabled");
try {
if ($("#description_CE").val()=="") {
$('#result_CE').html("");
}
else {
if ($("#description_CE").val()==description_backup_CE) {
showTable(retData_backup_CE, $('#result_CE'));
}
else {
modelProcecss_CE();
};
};
}
catch(err) {
$('#result_CE').html("");
};
$("#filter_CE.panel").find("*").val(this.defaultValue).css("background-color", "");
$("#flip_CE").html('开启 筛选器 <span class="glyphicon glyphicon-filter"></span>')}
document.getElementById("main_select_CE").options.selectedIndex = 0;
document.getElementById("POS_select_CE").options.selectedIndex = 0;
});
});
});
$(document).ready(function(){
$("#flip_EC").click(function(){
$("#panel_EC").slideToggle("fast", function(){
if($(this).is(":visible")){
$("#flip_EC").html('Clear and Hide Filter <span class="glyphicon glyphicon-off"></span>')}
else{
clearAlert();
$("#filter_EC div").find("*").removeAttr("disabled");
try {
if ($("#description_EC").val()=="") {
$('#result_EC').html("");
}
else {
if ($("#description_EC").val()==description_backup_EC) {
showTable(retData_backup_EC, $('#result_EC'));
}
else {
modelProcecss_EC();
};
};
}
catch(err) {
$('#result_EC').html("");
};
$("#filter_EC div.panel").find("*").val(this.defaultValue).css("background-color", "");
$("#flip_EC").html('Open Filter <span class="glyphicon glyphicon-filter"></span>')}
document.getElementById("main_select_EC").options.selectedIndex = 0;
document.getElementById("POS_select_EC").options.selectedIndex = 0;
document.getElementById("rhyme_select_EC").options.selectedIndex = 0;
});
});
});
$(document).ready(function(){
$("#flip").click(function(){
$("#panel").slideToggle("fast", function(){
if($(this).is(":visible")){
$("#flip").html('清除并收起 筛选器 <span class="glyphicon glyphicon-off"></span>')} <!--和排序<span class="glyphicon glyphicon-sort"></span>-->
else{
clearAlert();
$("#filter_CN div").find("*").removeAttr("disabled");
try {
if ($("#description").val()=="") { //收起筛选器后,若输入为空(可能一开始就是空,或改为空但没按回车)则清空 输出区。
$('#result').html("");
}
else {
if ($("#description").val()==description_backup) { //输入框中没变化,则因为没有筛选条件而直接显示上一次的结果。
showTable(retData_backup, $('#result'));
}
else {
modelProcecss(); //输入框里有变化,则重新计算结果(没有筛选条件,filterRes中的判断都会跳过的,不慢)。
};
};
}
catch(err) {
$('#result').html("");
};
$("#filter_CN div.panel").find("*").val(this.defaultValue);
$("#flip").html('开启 筛选器 <span class="glyphicon glyphicon-filter"></span>')}
document.getElementById("main_select").options.selectedIndex = 0;
document.getElementById("POS_select_CC").options.selectedIndex = 0;
document.getElementById("rhyme_select_CC").options.selectedIndex = 0;
});
});
});
================================================
FILE: static/js/zzsc.js
================================================
//star
$(document).ready(function(){
var stepW = 24;
var starRes = new Array("毫无关系","基本相关","非常匹配");
var stars = $("#star > li");
var starResTemp;
$("#showb").css("width",0);
stars.each(function(i){
$(stars[i]).click(function(e){
var n = i+1;
$("#showb").css({"width":stepW*n});
starResTemp = starRes[i];
$(this).find('a').blur();
return stopDefault(e);
return starResTemp;
});
});
stars.each(function(i){
$(stars[i]).hover(
function(){
$(".starRes").text(starRes[i]);
},
function(){
if(starResTemp != null)
$(".starRes").text(starResTemp);
else
$(".starRes").text("");
}
);
});
});
function stopDefault(e){
if(e && e.preventDefault)
e.preventDefault();
else
window.event.returnValue = false;
return false;
};
================================================
FILE: templates/about.html
================================================
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
<link rel="shortcut icon" href="../static/image/zm2.ico">
<link rel="bookmark" href="../static/image/zm2.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
<title>万词王 关于我们</title>
<link rel="stylesheet" href="http://apps.bdimg.com/libs/jqueryui/1.10.4/css/jquery-ui.min.css">
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="http://apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<style>
html {
height: 100%;
}
body {
min-height: 100%;
display: flex;
flex-direction: column;
}
.content {
flex: 1;
}
.navbar-nav>li>a {
padding-top: 22.5px;
padding-bottom: 22.5px;
}
.container-fluid {
background-color: #f8f8f8;
}
div p.justify {
text-align:justify;
}
</style>
<style>
/* Custom Styles */
ul.nav-tabs{
width: 140px;
margin-top: 20px;
border-radius: 4px;
border: 1px solid #ddd;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.067);
}
ul.nav-tabs li{
margin: 0;
border-top: 1px solid #ddd;
}
ul.nav-tabs li:first-child{
border-top: none;
}
ul.nav-tabs li a{
margin: 0;
padding: 8px 16px;
border-radius: 0;
}
ul.nav-tabs li.active a, ul.nav-tabs li.active a:hover{
color: #fff;
background: #0088cc;
border: 1px solid #0088cc;
}
ul.nav-tabs li:first-child a{
border-radius: 4px 4px 0 0;
}
ul.nav-tabs li:last-child a{
border-radius: 0 0 4px 4px;
}
ul.nav-tabs.affix{
top: 50px; /* Set the top position of pinned element */
}
</style>
<script>
$(document).ready(function(){
$("#myNav").affix({
offset: {
top: 125
}
});
});
$(function() {
$(".navbar-nav>li.active>a").css("background-color", "#f3f3f3");
});
</script>
</head>
<body data-spy="scroll" data-target="#myScrollspy">
<!--WebPageHead-->
<div class="visible-lg visible-md visible-sm">
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header" style="height: 65px;">
<a class="navbar-brand" href="../home" style="padding-top: 0px;"><img src="../static/image/logo.png" alt="反向词典" style="height:55px;margin-left: 20px;margin-top: 5px;"/></a>
</div>
<ul class="nav navbar-nav" style="float: right;">
<li><a href="../home">反向词典主页</a></li>
<!--<li><a href="../papers/">相关研究</a></li> -->
<li class="active"><a href="../about/">关于我们</a></li>
<li><a href="https://github.com/thunlp/MultiRD" style="margin-right: 50px;">GitHub链接</a></li>
<!--<li><a href="../help/" style="margin-right: 50px;">使用帮助</a></li> -->
</ul>
</div>
</nav>
</div>
<div class="visible-xs">
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header" style="height: 65px;">
<a class="navbar-brand" href="../home" style="padding-top: 0px;"><img src="../static/image/logo.png" alt="反向词典" style="height:55px;margin-left: 0px;margin-top: 5px;"/></a>
<div class="btn-group" style="float: right; margin-right: 50px;">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" style="color: #286090;border-color: #f8f8f8;background-color: #f8f8f8;font-size: 1.5em;margin-top: 10px;">
<span class="glyphicon glyphicon-align-justify"></span> <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="../home"><span class="glyphicon glyphicon-home"></span> 主页</a></li>
<li class="active"><a href="../about/">关于我们</a></li>
<li><a href="https://github.com/thunlp/MultiRD">GitHub链接</a></li>
</ul>
</div>
</div>
</div>
</nav>
</div>
<div class="content">
<div class="container">
<div class="page-header" style="margin-top: 100px;">
<h1>关于我们</h1>
</div>
<div class="visible-lg visible-md visible-sm">
<div class="row">
<div class="col-xs-3" id="myScrollspy">
<ul class="nav nav-tabs nav-stacked" id="myNav" style="width: 200px;">
<li class="active"><a href="#section-1">清华大学人工智能研究院</a></li>
<!--<li><a href="#section-2">知识智能研究中心</a></li>-->
<li><a href="#section-3">清华大学自然语言处理与社会人文计算实验室</a></li>
<li><a href="#section-4">THUNLP学术带头人孙茂松教授简介</a></li>
<li><a href="#section-5">联系方式</a></li>
</ul>
</div>
<div class="col-xs-9">
<h2 id="section-1">清华大学人工智能研究院</h2>
<table>
<tbody>
<tr>
<td>
<div id="THUAI">
<p style="padding-right:10vh;padding-top:3vh" class="justify">
清华大学人工智能研究院为校级跨学科交叉科研机构,成立于2018年6月28日。研究院以“一个核心、两个融合”作为发展战略,即以人工智能基础理论和基本方法研究为核心,积极推进大跨度的学科交叉融合,积极推进大范围的技术与产业、学校与企业融合,充分发挥清华大学在多学科综合、优秀人才汇聚、高水平国际合作等方面的独特优势,在人工智能的基础理论和基本方法上开展源头性和颠覆性创新,力争将人工智能研究院打造成为一个具有全球影响力的人工智能高端研究机构。院长为清华大学计算机系教授、中国科学院院士张钹,学术委员会主任为清华大学交叉信息研究院院长、图灵奖获得者姚期智。</p>
</div>
</td>
<td>
<img src="https://openhownet.thunlp.org/static/img/thuai.png" align="right" style="height:18vh;margin-top:0vh;padding-right:7vh">
</td>
</tr>
</tbody>
</table>
<hr>
<!--<h2 id="section-2">知识智能研究中心</h2>
<table>
<tbody>
<tr>
<td>
<div id="knowledge_center">
<p style="padding-right:10vh;padding-top:3vh">
清华大学人工智能研究院知识智能研究中心(以下简称“知识中心”)成立于2019年1月21日,是清华大学人工智能研究院成立的首个研究中心,由清华大学教授李涓子担任主任。知识中心旨在:(1)开展理论研究。研究支持鲁棒可解释人工智能的大规模知识的表示、获取、推理与计算的基础理论和有效方法。(2)构建知识平台。建设中英平衡的、涵盖语言知识、常识知识、世界知识、认知知识与典型行业知识的大规模知识图谱,建成知识计算服务平台。(3)促进交流合作。经常性地组织知识智能有关学术活动,增进学术交流;普及知识智能技术,促进产学合作。知识中心将以促进清华和国家知识智能研究与发展为宗旨,最终建设成为国际先进、国内领先、具有广泛影响力的学术研究高地、知识计算平台与学术交流中心。</p>
</div>
</td>
<td>
<img src="https://openhownet.thunlp.org/static/img/knowledge_center.png" align="right" style="height:17vh;margin-top:0vh;margin-right:2vh">
</td>
</tr>
</tbody>
</table>
<hr>-->
<h2 id="section-3">清华大学自然语言处理与社会人文计算实验室</h2>
<table>
<tbody>
<tr>
<td>
<p style="padding-right:10vh;padding-top:3vh" class="justify"> 清华大学计算机系自然语言处理与社会人文计算实验室(<a href="http://www.thunlp.org">THUNLP</a>)成立于20世纪70年代末,最初在黄昌宁教授的带领下从事中文信息处理方面的研究工作,是国内开展自然语言处理研究最早、深具影响力的科研单位,同时也是中国中文信息学会(全国一级学会)计算语言学专业委员会的挂靠单位。实验室学术带头人为孙茂松教授,实验室教师队伍还包括刘洋教授和刘知远副教授。实验室面向以中文为核心的自然语言处理前沿基础课题开展系统深入的研究工作,研究领域涵盖计算语言学的核心问题以及社会计算和人文计算,近年来在973、863、国家自然科学基金等项目的支持下,实验室师生在IJCAI、AAAI、ACL、EMNLP等国际顶级会议和期刊上发表多篇高水平学术论文,与CMU、NUS、Google等国际名校和企业有长期良好的合作关系,培养的优秀毕业生大多到清华大学、谷歌、百度、阿里、微软等著名高校和企业工作。
</p>
<p style="padding-right:10vh" class="justify">
<b>WantWords</b>由THUNLP开发和维护,项目指导教师为孙茂松教授和刘知远副教授,开发团队成员包括岂凡超,张磊,杨延辉。</p>
</td>
<td>
<img src="https://openhownet.thunlp.org/static/img/THUNLP.png" style="height:21vh;padding-right:6vh;" align="right">
</td>
</tr>
</tbody>
</table>
<hr>
<h2 id="section-4">THUNLP学术带头人孙茂松教授简介</h2>
<table>
<tbody>
<tr>
<td>
<div id="sms">
<p style="padding-right:10vh;padding-top:3vh" class="justify">
孙茂松,清华大学计算机系教授,清华大学人工智能研究院常务副院长,博士生导师。主要研究领域为自然语言处理、互联网智能、机器学习、社会计算和计算教育学。国家重点基础研究发展计划(973计划)项目首席科学家,国家社会科学基金重大项目首席专家。在国际和国内学术期刊及会议上共发表论文400余篇,近三年发表60余篇,是大陆研究机构中最早在自然语言处理国际顶级会议ACL(1998年)和顶级期刊CL(2009年)发表论文的学者,Google
Scholar引用10000余次,主持完成文本信息处理领域ISO国际标准2项。2013年带领团队研发全球第一个中文慕课平台“学堂在线”,为我国和清华的在线教育事业作出了重要贡献。曾获2007年全国语言文字先进工作者,2016年全国优秀科技工作者,2016年首都市民学习之星等荣誉。</p>
</div>
</td>
<td>
<img src="https://openhownet.thunlp.org/static/img/sms.jpeg" align="right" style="height:21vh;margin-top:0px;padding-right:5vh">
</td>
</tr>
</tbody>
</table>
<hr>
<h2 id="section-5">联系方式</h2>
<table>
<tbody>
<tr>
<td>
<div id="Contact">
<br>
<ul>
<li><p>电话:(+8610) 62777701</p></li>
<li><p>地址:北京市海淀区清华大学FIT楼4-505</p></li>
<li><p>邮编:100094</p></li>
</ul>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="visible-xs">
<br>
<h2 id="section-1" align="center">清华大学人工智能研究院</h2>
<div align="center"><img src="https://openhownet.thunlp.org/static/img/thuai.png" style="height:18vh;margin-top:2vh"></div>
<div id="THUAI">
<p style="padding-top:3vh" class="justify">
清华大学人工智能研究院为校级跨学科交叉科研机构,成立于2018年6月28日。研究院以“一个核心、两个融合”作为发展战略,即以人工智能基础理论和基本方法研究为核心,积极推进大跨度的学科交叉融合,积极推进大范围的技术与产业、学校与企业融合,充分发挥清华大学在多学科综合、优秀人才汇聚、高水平国际合作等方面的独特优势,在人工智能的基础理论和基本方法上开展源头性和颠覆性创新,力争将人工智能研究院打造成为一个具有全球影响力的人工智能高端研究机构。院长为清华大学计算机系教授、中国科学院院士张钹,学术委员会主任为清华大学交叉信息研究院院长、图灵奖获得者姚期智。</p>
</div>
<!--<hr>
<h2 id="section-2" align="center">知识智能研究中心</h2>
<div align="center"><img src="https://openhownet.thunlp.org/static/img/knowledge_center.png" style="height:17vh;margin-top:2vh"></div>
<div id="knowledge_center">
<p style="padding-top:3vh">
清华大学人工智能研究院知识智能研究中心(以下简称“知识中心”)成立于2019年1月21日,是清华大学人工智能研究院成立的首个研究中心,由清华大学教授李涓子担任主任。知识中心旨在:(1)开展理论研究。研究支持鲁棒可解释人工智能的大规模知识的表示、获取、推理与计算的基础理论和有效方法。(2)构建知识平台。建设中英平衡的、涵盖语言知识、常识知识、世界知识、认知知识与典型行业知识的大规模知识图谱,建成知识计算服务平台。(3)促进交流合作。经常性地组织知识智能有关学术活动,增进学术交流;普及知识智能技术,促进产学合作。知识中心将以促进清华和国家知识智能研究与发展为宗旨,最终建设成为国际先进、国内领先、具有广泛影响力的学术研究高地、知识计算平台与学术交流中心。</p>
</div>-->
<hr>
<h2 id="section-3" align="center">清华大学自然语言处理与社会人文计算实验室</h2>
<div align="center"><img src="https://openhownet.thunlp.org/static/img/THUNLP.png" style="height:21vh;margin-top:2vh"></div>
<p style="padding-top:3vh" class="justify"> 清华大学计算机系自然语言处理与社会人文计算实验室(<a href="http://www.thunlp.org">THUNLP</a>)成立于20世纪70年代末,最初在黄昌宁教授的带领下从事中文信息处理方面的研究工作,是国内开展自然语言处理研究最早、深具影响力的科研单位,同时也是中国中文信息学会(全国一级学会)计算语言学专业委员会的挂靠单位。实验室学术带头人为孙茂松教授,实验室教师队伍还包括刘洋教授和刘知远副教授。实验室面向以中文为核心的自然语言处理前沿基础课题开展系统深入的研究工作,研究领域涵盖计算语言学的核心问题以及社会计算和人文计算,近年来在973、863、国家自然科学基金等项目的支持下,实验室师生在IJCAI、AAAI、ACL、EMNLP等国际顶级会议和期刊上发表多篇高水平学术论文,与CMU、NUS、Google等国际名校和企业有长期良好的合作关系,培养的优秀毕业生大多到清华大学、谷歌、百度、阿里、微软等著名高校和企业工作。
</p>
<p class="justify"><b>WantWords</b>由THUNLP开发和维护,项目指导教师为孙茂松教授和刘知远副教授,开发团队成员包括岂凡超,张磊,杨延辉。</p>
<hr>
<h2 id="section-4" align="center">THUNLP学术带头人孙茂松教授简介</h2>
<div align="center"><img src="https://openhownet.thunlp.org/static/img/sms.jpeg" style="height:21vh;margin-top:2vh"></div>
<div id="sms">
<p style="padding-top:3vh" class="justify">
孙茂松,清华大学计算机系教授,清华大学人工智能研究院常务副院长,博士生导师。主要研究领域为自然语言处理、互联网智能、机器学习、社会计算和计算教育学。国家重点基础研究发展计划(973计划)项目首席科学家,国家社会科学基金重大项目首席专家。在国际和国内学术期刊及会议上共发表论文400余篇,近三年发表60余篇,是大陆研究机构中最早在自然语言处理国际顶级会议ACL(1998年)和顶级期刊CL(2009年)发表论文的学者,Google
Scholar引用10000余次,主持完成文本信息处理领域ISO国际标准2项。2013年带领团队研发全球第一个中文慕课平台“学堂在线”,为我国和清华的在线教育事业作出了重要贡献。曾获2007年全国语言文字先进工作者,2016年全国优秀科技工作者,2016年首都市民学习之星等荣誉。</p>
</div>
<hr>
<h2 id="section-5">联系方式</h2>
<table>
<tbody>
<tr>
<td>
<div id="Contact">
<br>
<ul>
<li><p>电话:(+8610) 62777701</p></li>
<li><p>地址:北京市海淀区清华大学FIT楼4-505</p></li>
<li><p>邮编:100094</p></li>
</ul>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<footer>
<center style="padding-top: 15px; padding-bottom: 10px; width: 100%; font-size: 17px;"> <!--background: #fff url(http://apps.bdimg.com/libs/jqueryui/1.10.4/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x;-->
<div class="container">
<p><strong>Copyright © </strong><a href="http://www.thunlp.org"><strong>THUNLP</strong></a> <strong>2020</strong></p>
</div>
</center>
</footer>
</body>
</html>
================================================
FILE: templates/about_en.html
================================================
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
<link rel="shortcut icon" href="../static/image/zm2.ico">
<link rel="bookmark" href="../static/image/zm2.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
<title>WantWords About Us</title>
<link rel="stylesheet" href="http://apps.bdimg.com/libs/jqueryui/1.10.4/css/jquery-ui.min.css">
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="http://apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<style>
html {
height: 100%;
}
body {
min-height: 100%;
display: flex;
flex-direction: column;
}
.content {
flex: 1;
}
.navbar-nav>li>a {
padding-top: 22.5px;
padding-bottom: 22.5px;
}
.container-fluid {
background-color: #f8f8f8;
}
div p.justify {
text-align:justify;
}
</style>
<style>
/* Custom Styles */
ul.nav-tabs{
width: 140px;
margin-top: 20px;
border-radius: 4px;
border: 1px solid #ddd;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.067);
}
ul.nav-tabs li{
margin: 0;
border-top: 1px solid #ddd;
}
ul.nav-tabs li:first-child{
border-top: none;
}
ul.nav-tabs li a{
margin: 0;
padding: 8px 16px;
border-radius: 0;
}
ul.nav-tabs li.active a, ul.nav-tabs li.active a:hover{
color: #fff;
background: #0088cc;
border: 1px solid #0088cc;
}
ul.nav-tabs li:first-child a{
border-radius: 4px 4px 0 0;
}
ul.nav-tabs li:last-child a{
border-radius: 0 0 4px 4px;
}
ul.nav-tabs.affix{
top: 50px; /* Set the top position of pinned element */
}
</style>
<script>
$(document).ready(function(){
$("#myNav").affix({
offset: {
top: 125
}
});
});
$(function() {
$(".navbar-nav>li.active>a").css("background-color", "#f3f3f3");
});
</script>
</head>
<body data-spy="scroll" data-target="#myScrollspy">
<!--WebPageHead-->
<div class="visible-lg visible-md visible-sm">
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header" style="height: 65px;">
<a class="navbar-brand" href="../home" style="padding-top: 0px;"><img src="../static/image/logo.png" alt="反向词典" style="height:55px;margin-left: 20px;margin-top: 5px;"/></a>
</div>
<ul class="nav navbar-nav" style="float: right;">
<li><a href="../home">Home Page</a></li>
<!--<li><a href="../papers/">相关研究</a></li> -->
<li class="active"><a href="../about_en/">About Us</a></li>
<li><a href="https://github.com/thunlp/MultiRD" style="margin-right: 50px;">GitHub Link</a></li>
<!--<li><a href="../help/" style="margin-right: 50px;">使用帮助</a></li> -->
</ul>
</div>
</nav>
</div>
<div class="visible-xs">
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header" style="height: 65px;">
<a class="navbar-brand" href="../home" style="padding-top: 0px;"><img src="../static/image/logo.png" alt="反向词典" style="height:55px;margin-left: 0px;margin-top: 5px;"/></a>
<div class="btn-group" style="float: right; margin-right: 50px;">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" style="color: #286090;border-color: #f8f8f8;background-color: #f8f8f8;font-size: 1.5em;margin-top: 10px;">
<span class="glyphicon glyphicon-align-justify"></span> <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="../home"><span class="glyphicon glyphicon-home"></span> Home</a></li>
<li class="active"><a href="../about_en/">About Us</a></li>
<li><a href="https://github.com/thunlp/MultiRD">GitHub Link</a></li>
</ul>
</div>
</div>
</div>
</nav>
</div>
<div class="content">
<div class="container">
<div class="page-header" style="margin-top: 100px;">
<h1>About Us</h1>
</div>
<div class="visible-lg visible-md visible-sm">
<div class="row">
<div class="col-xs-3" id="myScrollspy">
<ul class="nav nav-tabs nav-stacked" id="myNav" style="width: 200px;">
<li class="active"><a href="#section-1">Institute for Artificial Intelligence, Tsinghua University</a></li>
<!--<li><a href="#section-2">知识智能研究中心</a></li>-->
<li><a href="#section-3">The Natural Language Processing Group, Tsinghua University</a></li>
<li><a href="#section-4">Professor Maosong Sun, the Principal Investigator of THUNLP</a></li>
<li><a href="#section-5">Contact Us</a></li>
</ul>
</div>
<div class="col-xs-9">
<h2 id="section-1">Institute for Artificial Intelligence, Tsinghua University</h2>
<table>
<tbody>
<tr>
<td>
<div id="THUAI">
<p style="padding-right:10vh;padding-top:3vh" class="justify">
Institute for Artificial Intelligence, Tsinghua University, built in June 2018, is a university-level cross-disciplinary research institute. The institute has formed the development strategy of "one core, two fusions", namely taking basic theories and research methods of artificial intelligence as the core and facilitating the fusions of different disciplines and the fusions of technology and industry together with university and enterprise. The institute will make full use of Tsinghua University's unique advantages in multidisciplinary integration, outstanding talents gathering and high-level international cooperation and foster radical innovation in the basic theories and methods of artificial intelligence, aiming to become a high-end artificial intelligence research institute with global influence. Director of the institute is Dr. Bo Zhang, professor of Department of Computer Science and Technology at Tsinghua University and academician of Chinese Academy of Sciences. Chairman of the academic committee is Dr. Andrew Chi-Chih Yao, Dean of the Institute for Interdisciplinary Information Sciences at Tsinghua University and the Turing Award winner.</p>
</div>
</td>
<td>
<img src="https://openhownet.thunlp.org/static/img/thuai.png" align="right" style="height:18vh;margin-top:0vh;padding-right:7vh">
</td>
</tr>
</tbody>
</table>
<hr>
<h2 id="section-3">The Natural Language Processing Group, Tsinghua University</h2>
<table>
<tbody>
<tr>
<td>
<p style="padding-right:10vh;padding-top:3vh" class="justify"> The Natural Language Processing Group, Tsinghua University, short for <a href="http://www.thunlp.org">THUNLP</a>, was established in the 1970s. It was first led by Professor Changning Huang, carrying out research on Chinese information processing. It conducted natural language processing (NLP) research earliest and is very influential in China. THUNLP is also the linked unit of the computational linguistics technical committee of Chinese Information Processing Society of China. The faculty members include Professor Maosong Sun, the principal investigator of THUNLP, Professor Yang Liu and Associate Professor Zhiyuan Liu. The group conducts systematic and in-depth research on the front-line basic topics of natural language processing, whose research areas cover the core issues of computational linguistics, social computing and human computing. With the support of programs including 973, 863 and NSFC, members of THUNLP have published many high-level academic papers on international top conferences and journals including AAAI, IJCAI, ACL and EMNLP. In addition, THUNLP has developed long-term cooperations with famous universities and enterprises in the world such as CMU, NUS and Google. The alumni work for well-known higher educational institutions and companies like Tsinghua University, Google, Baidu, Alibaba and Microsoft.
</p>
<p style="padding-right:10vh" class="justify">
<b>WantWords</b> is developed and maintained by THUNLP. Project instructors are Professor Maosong Sun and Zhiyuan Liu, and members comprise Fanchao Qi, Lei Zhang and Yanhui Yang.</p>
</td>
<td>
<img src="https://openhownet.thunlp.org/static/img/THUNLP.png" style="height:21vh;padding-right:6vh;" align="right">
</td>
</tr>
</tbody>
</table>
<hr>
<h2 id="section-4">Professor Maosong Sun, the Principal Investigator of THUNLP</h2>
<table>
<tbody>
<tr>
<td>
<div id="sms">
<p style="padding-right:10vh;padding-top:3vh" class="justify">
Maosong Sun is a full professor of Department of Computer Science and Technology at Tsinghua University and executive deputy director of the Institute for Artificial Intelligence, Tsinghua University. His research interests mainly lie in NLP, web intelligence, machine learning, social computing and computational pedagogy. Professor Sun is the chief scientist of the National Basic Research Program (973 Program) and the chief expert of major projects of the National Social Science Fund. He has published more than 400 academic papers on international and domestic journals and conferences. He is the first among scholars of mainland China who published papers on ACL, the top conference of NLP, and CL, the top journal of NLP. His citations have exceeded 10,000 according to Google Scholar. In 2013, he led a team to develop the world's first Chinese MOOC platform xuetangX and made an important contribution to the development of China's online learning. He was awarded the National Advanced Worker in Language in 2007, the National Excellent Science and Technology Worker in 2016 and Learning Star of Beijing Citizens in 2016.</p>
</div>
</td>
<td>
<img src="https://openhownet.thunlp.org/static/img/sms.jpeg" align="right" style="height:21vh;margin-top:0px;padding-right:5vh">
</td>
</tr>
</tbody>
</table>
<hr>
<h2 id="section-5">Contact Us</h2>
<table>
<tbody>
<tr>
<td>
<div id="Contact">
<br>
<ul>
<li><p>Phone:(+8610) 62777701</p></li>
<li><p>Address:Room 4-505, FIT Building, Tsinghua University, Haidian District, Beijing City, China 100084</p></li>
</ul>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="visible-xs">
<br>
<h2 id="section-1" align="center">Institute for Artificial Intelligence, Tsinghua University</h2>
<div align="center"><img src="https://openhownet.thunlp.org/static/img/thuai.png" style="height:18vh;margin-top:2vh"></div>
<div id="THUAI">
<p style="padding-top:3vh" class="justify">
Institute for Artificial Intelligence, Tsinghua University, built in June 2018, is a university-level cross-disciplinary research institute. The institute has formed the development strategy of "one core, two fusions", namely taking basic theories and research methods of artificial intelligence as the core and facilitating the fusions of different disciplines and the fusions of technology and industry together with university and enterprise. The institute will make full use of Tsinghua University's unique advantages in multidisciplinary integration, outstanding talents gathering and high-level international cooperation and foster radical innovation in the basic theories and methods of artificial intelligence, aiming to become a high-end artificial intelligence research institute with global influence. Director of the institute is Dr. Bo Zhang, professor of Department of Computer Science and Technology at Tsinghua University and academician of Chinese Academy of Sciences. Chairman of the academic committee is Dr. Andrew Chi-Chih Yao, Dean of the Institute for Interdisciplinary Information Sciences at Tsinghua University and the Turing Award winner.</p>
</div>
<hr>
<h2 id="section-3" align="center">The Natural Language Processing Group, Tsinghua University</h2>
<div align="center"><img src="https://openhownet.thunlp.org/static/img/THUNLP.png" style="height:21vh;margin-top:2vh"></div>
<p style="padding-top:3vh" class="justify"> The Natural Language Processing Group, Tsinghua University, short for <a href="http://www.thunlp.org">THUNLP</a>, was established in the 1970s. It was first led by Professor Changning Huang, carrying out research on Chinese information processing. It conducted natural language processing (NLP) research earliest and is very influential in China. THUNLP is also the linked unit of the computational linguistics technical committee of Chinese Information Processing Society of China. The faculty members include Professor Maosong Sun, the principal investigator of THUNLP, Professor Yang Liu and Associate Professor Zhiyuan Liu. The group conducts systematic and in-depth research on the front-line basic topics of natural language processing, whose research areas cover the core issues of computational linguistics, social computing and human computing. With the support of programs including 973, 863 and NSFC, members of THUNLP have published many high-level academic papers on international top conferences and journals including AAAI, IJCAI, ACL and EMNLP. In addition, THUNLP has developed long-term cooperations with famous universities and enterprises in the world such as CMU, NUS and Google. The alumni work for well-known higher educational institutions and companies like Tsinghua University, Google, Baidu, Alibaba and Microsoft.
</p><p class="justify">
<b>WantWords</b> is developed and maintained by THUNLP. Project instructors are Professor Maosong Sun and Zhiyuan Liu, and members comprise Fanchao Qi, Lei Zhang and Yanhui Yang.
</p>
<hr>
<h2 id="section-4" align="center">Professor Maosong Sun, the Principal Investigator of THUNLP</h2>
<div align="center"><img src="https://openhownet.thunlp.org/static/img/sms.jpeg" style="height:21vh;margin-top:2vh"></div>
<div id="sms">
<p style="padding-top:3vh" class="justify">
Maosong Sun is a full professor of Department of Computer Science and Technology at Tsinghua University and executive deputy director of the Institute for Artificial Intelligence, Tsinghua University. His research interests mainly lie in NLP, web intelligence, machine learning, social computing and computational pedagogy. Professor Sun is the chief scientist of the National Basic Research Program (973 Program) and the chief expert of major projects of the National Social Science Fund. He has published more than 400 academic papers on international and domestic journals and conferences. He is the first among scholars of mainland China who published papers on ACL, the top conference of NLP, and CL, the top journal of NLP. His citations have exceeded 10,000 according to Google Scholar. In 2013, he led a team to develop the world's first Chinese MOOC platform xuetangX and made an important contribution to the development of China's online learning. He was awarded the National Advanced Worker in Language in 2007, the National Excellent Science and Technology Worker in 2016 and Learning Star of Beijing Citizens in 2016.</p>
</div>
<hr>
<h2 id="section-5">Contact Us</h2>
<table>
<tbody>
<tr>
<td>
<div id="Contact">
<br>
<ul>
<li><p>Phone:(+8610) 62777701</p></li>
<li><p>Address:Room 4-505, FIT Building, Tsinghua University, Haidian District, Beijing City, China 100084</p></li>
</ul>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<footer>
<center style="padding-top: 15px; padding-bottom: 10px; width: 100%; font-size: 17px;"> <!--background: #fff url(http://apps.bdimg.com/libs/jqueryui/1.10.4/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x;-->
<div class="container">
<p><strong>Copyright © </strong><a href="http://www.thunlp.org"><strong>THUNLP</strong></a> <strong>2020</strong></p>
</div>
</center>
</footer>
</body>
</html>
================================================
FILE: templates/home.html
================================================
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta name="baidu-site-verification" content="dZIvpHcMuj" />
<meta baidu-gxt-verify-token="2edaaf8500440997a3b3b52a91b3e43e">
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
<link rel="shortcut icon" href="../static/image/zm2.ico">
<link rel="bookmark" href="../static/image/zm2.ico">
<meta name="keywords" content="万词王; wordwants; 反向; 词典; 语言; 写作; 助手; 查询; 清华大学; 自然语言; 实验室; 双语; 汉语; 英语; English; Chinese; word; corpus; reverse; dictionary; look up; search; find">
<meta name="description" content="万词王wordwants是一个反向词典系统,由清华大学自然语言处理实验室出品,广泛收录了多部词典数据,通过深度学习算法,实现通过描述意思来查询词语,解决您的用词烦恼。">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
<title>万词王 wantwords</title>
<link rel="stylesheet" href="http://apps.bdimg.com/libs/jqueryui/1.10.4/css/jquery-ui.min.css">
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="http://apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<script language="javascript" type="text/javascript" src="../static/js/home.js"></script>
<style>
.ui-tabs .ui-tabs-nav {
background: #fbfbfb;
}
.ui-tabs-anchor {
background-color: #f8f8f8;
}
.container-fluid {
background-color: #f8f8f8;
}
.navbar-nav>li>a {
padding-top: 22.5px;
padding-bottom: 22.5px;
}
.btn {
background-color: #fbfbfb;
}
.ui-widget-header {
border: 1px solid #ddd;
}
.elem-center {
margin-left: 10%;
margin-right: 10%;
}
h1 {
font-size: 40px;
text-align: center;
font-weight:600;
color: #000000b0;
}
.clear {display: none;position: absolute;width: 16px;height: 16px; right: 84px; margin: 19px 0 0 -25px;background:url(../static/images/clear.png) no-repeat;outline: none; z-index: 3;}
</style>
<style>
html {
height: 100%;
}
body {
min-height: 100%;
display: flex;
flex-direction: column;
}
.content {
flex: 1;
}
</style>
<script>
$(function() {
$("#filter_CN").hide();
$("#filter_EE").hide();
$("#filter_EC").hide();
$("#filter_CE").hide();
if ($(window).width()<751 || window.innerWidth<768) {
$(".elem-center").css("margin", 0)
}
$(".clear").on("click",function () {
$(this).prev("input").val("").focus();
});
var input_id = $(".input-group .form-control"); //$("#description")
input_id.on("focus",function () {
$(this).parent().addClass("active");
if( $(this).val().length > 0){
$(this).next(".clear").show();
}else{
$(this).next(".clear").hide();
}
});
input_id.on("blur",function () {
var $this = $(this);
$this.parent().removeClass("active");
$this.next(".clear").hide();
});
input_id.keyup(function(){
if( $(this).val().length > 0){
$(this).next(".clear").show();
}else{
$(this).next(".clear").hide();
}
});
$(".clear").on("mousedown",function(e) {
e.preventDefault();
});
});
window.onload=function(){
document.getElementById("description").focus();
}
//$(function() {
$(document).ready(function() {
$(".navbar-nav>li.active>a").css("background-color", "#f3f3f3");
$('.panel-heading').css("background-color","#fbfbfb");
$(".ui-tabs-anchor").css("background-color", "white").css("color", "#005aa5");
});
</script>
</head>
<body>
<!--<a title="" class="pop" data-container="body" data-toggle="hide" data-content=""></a>-->
<a title="" class="pop0" data-container="body" data-toggle="hide" data-content=""></a>
<a title="" class="pop1" data-container="body" data-toggle="hide" data-content=""></a>
<a title="" class="pop2" data-container="body" data-toggle="hide" data-content=""></a>
<a title="" class="pop3" data-container="body" data-toggle="hide" data-content=""></a>
<div class="visible-lg visible-md visible-sm">
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header" style="height: 65px;">
<a class="navbar-brand" href="../home" style="padding-top: 0px;"><img src="https://wantwords.thunlp.org/static/image/logo.png" alt="反向词典" style="height:55px;margin-left: 20px;margin-top: 5px;"/></a>
</div>
<ul class="nav navbar-nav" style="float: right;">
<li class="active"><a href="../home" id="id_home">反向词典主页</a></li>
<!--<li><a href="../papers/">相关研究</a></li> -->
<li><a href="../about/" id="id_about">关于我们</a></li>
<li><a href="https://github.com/thunlp/MultiRD" style="margin-right: 50px;" id="id_link">GitHub链接</a></li>
<!--<li><a href="../help/" style="margin-right: 50px;">使用帮助</a></li> -->
</ul>
</div>
</nav>
</div>
<div class="visible-xs">
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header" style="height: 65px;">
<a class="navbar-brand" href="../home" style="padding-top: 0px;"><img src="https://wantwords.thunlp.org/static/image/logo.png" alt="反向词典" style="height:55px;margin-left: 0px;margin-top: 5px;"/></a>
<div class="btn-group" style="float: right; margin-right: 50px;">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" style="color: #286090;border-color: #f8f8f8;background-color: #f8f8f8;font-size: 1.5em;margin-top: 10px;">
<span class="glyphicon glyphicon-align-justify"></span> <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li class="active"><a href="../home" id="idm_home"><span class="glyphicon glyphicon-home"></span> 主页</a></li>
<li><a href="../about/" id="idm_about">关于我们</a></li>
<li><a href="https://github.com/thunlp/MultiRD" id="idm_link">GitHub链接</a></li>
</ul>
</div>
</div>
</div>
</nav>
</div>
<div id="tabs" class="content" style="top: 64px;">
<ul>
<li><a href="#tabs-1" style="font-family: STZhongsong">汉语</a></li>
<li><a href="#tabs-2">English</a></li>
<li><a href="#tabs-3" style="font-family: STZhongsong">汉-英</a></li>
<li><a href="#tabs-4">En-Zh</a></li>
</ul>
<div id="tabs-1">
<br>
<h1 style="font-family: STZhongsong,STKaiti,Microsoft YaHei;">反向词典</h1>
<br>
<br>
<br>
<div class="row elem-center">
<div class="input-group">
<input type="text" style="height: 54px; font-size: 1.3em;" class="form-control" id="description" placeholder="请输入您的描述" autocomplete='off'><a href="javascript:;" class="clear"></a>
<span class="input-group-btn" style="font-size: 1.3em;">
<button onclick="onkeySearch()" class="btn btn-default" type="button" style="color: grey;height: 54px; width: 76px;"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div><!-- /input-group -->
</div><!-- /.row -->
<br/>
<div id="filter_CN">
<div class="panel panel-default visible-xs">
<div id="flip" class="panel-heading" style="text-align:center;">开启 筛选器 <span class="glyphicon glyphicon-filter"></span></div>
<div id="panel" class="panel-collapse collapse in" style="display:none; padding=50px">
<form role="form">
<div class="row" style="margin:10px;">
<div class="col-xs-6 col-sm-3 col-md-2 col-lg-1" style="margin-top:2px; margin-bottom:2px;">
<label for="filter2"><input type="text" id="filter2" onchange="modelProcecss()" class="form-control" placeholder="字数" title="词的字数通常为1到8,可用具体数字“n”或范围“>n”、“<n”来筛选。"></label>
</div>
<div class="col-xs-6 col-sm-3 col-md-2 col-lg-1" style="margin-top:2px; margin-bottom:2px;">
<label for="filter4"><input type="text" id="filter4" onchange="modelProcecss()" class="form-control" placeholder="笔画数" title="词的总笔画数,可用具体数字“n”或范围“>n”、“<n”来筛选。"></label>
</div>
<div class="col-xs-6 col-sm-3 col-md-2 col-lg-1" style="margin-top:2px; margin-bottom:2px;">
<label for="filter5"><input type="text" id="filter5" onchange="modelProcecss()" class="form-control" placeholder="词形" title="*为匹配0到多字;?匹配1字;+为且;[...]匹配集合内任一字;[^...]不匹配集合内任何字。每次仅支持1种模式。"></label>
</div>
<div class="col-xs-6 col-sm-3 col-md-2 col-lg-1" style="margin-top:2px; margin-bottom:2px;">
<label for="filter3"><input type="text" id="filter3" onchange="modelProcecss()" class="form-control" placeholder="拼音字母" title="用首字母表示。如“字典”为“zd”。"></label>
</div>
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2" style="margin-top:2px; margin-bottom:2px;">
<select class="form-control" id="POS_select_CC" onchange="modelProcecss()">
<option value="0" selected="selected">全部词性</option>
<option value="1">名词</option>
<option value="2">动词</option>
<option value="3">形容词</option>
<option value="4">副词</option>
<option value="5">介词</option>
<option value="6">数词</option>
<option value="7">连词</option>
<option value="8">助词</option>
<option value="9">量词</option>
<option value="10">叹词</option>
<option value="11">代词</option>
<option value="12">拟声词</option>
<option value="13">未标注</option>
</select>
</div>
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2" style="margin-top:2px; margin-bottom:2px;">
<select class="form-control" id="rhyme_select_CC" onchange="modelProcecss()" title="根据《中华通韵》2019.01.01版。">
<option value="0" selected="selected">全部韵脚</option>
<option value="1">啊 a,ia,ua 阴平</option>
<option value="2">啊 a,ia,ua 阳平</option>
<option value="3">啊 a,ia,ua 上声</option>
<option value="4">啊 a,ia,ua 去声</option>
<option value="5">喔 o,uo 阴平</option>
<option value="6">喔 o,uo 阳平</option>
<option value="7">喔 o,uo 上声</option>
<option value="8">喔 o,uo 去声</option>
<option value="9">鹅 e,ie,üe 阴平</option>
<option value="10">鹅 e,ie,üe 阳平</option>
<option value="11">鹅 e,ie,üe 上声</option>
<option value="12">鹅 e,ie,üe 去声</option>
<option value="13">衣 i 阴平</option>
<option value="14">衣 i 阳平</option>
<option value="15">衣 i 上声</option>
<option value="16">衣 i 去声</option>
<option value="17">乌 u 阴平</option>
<option value="18">乌 u 阳平</option>
<option value="19">乌 u 上声</option>
<option value="20">乌 u 去声</option>
<option value="21">迂 ü 阴平</option>
<option value="22">迂 ü 阳平</option>
<option value="23">迂 ü 上声</option>
<option value="24">迂 ü 去声</option>
<option value="25">哀 ai,uai 阴平</option>
<option value="26">哀 ai,uai 阳平</option>
<option value="27">哀 ai,uai 上声</option>
<option value="28">哀 ai,uai 去声</option>
<option value="29">欸 ei,ui 阴平</option>
<option value="30">欸 ei,ui 阳平</option>
<option value="31">欸 ei,ui 上声</option>
<option value="32">欸 ei,ui 去声</option>
<option value="33">熬 ao,iao 阴平</option>
<option value="34">熬 ao,iao 阳平</option>
<option value="35">熬 ao,iao 上声</option>
<option value="36">熬 ao,iao 去声</option>
<option value="37">欧 ou,iu 阴平</option>
<option value="38">欧 ou,iu 阳平</option>
<option value="39">欧 ou,iu 上声</option>
<option value="40">欧 ou,iu 去声</option>
<option value="41">安 an,ian,uan,üan 阴平</option>
<option value="42">安 an,ian,uan,üan 阳平</option>
<option value="43">安 an,ian,uan,üan 上声</option>
<option value="44">安 an,ian,uan,üan 去声</option>
<option value="45">恩 en,in,un,ün 阴平</option>
<option value="46">恩 en,in,un,ün 阳平</option>
<option value="47">恩 en,in,un,ün 上声</option>
<option value="48">恩 en,in,un,ün 去声</option>
<option value="49">昂 ang,iang,uang 阴平</option>
<option value="50">昂 ang,iang,uang 阳平</option>
<option value="51">昂 ang,iang,uang 上声</option>
<option value="52">昂 ang,iang,uang 去声</option>
<option value="53">英 eng,ing 阴平</option>
<option value="54">英 eng,ing 阳平</option>
<option value="55">英 eng,ing 上声</option>
<option value="56">英 eng,ing 去声</option>
<option value="57">雍 ong,iong 阴平</option>
<option value="58">雍 ong,iong 阳平</option>
<option value="59">雍 ong,iong 上声</option>
<option value="60">雍 ong,iong 去声</option>
<option value="61">儿 er 阳平</option>
<option value="62">儿 er 上声</option>
<option value="63">儿 er 去声</option>
<option value="64">未标注</option>
</select>
</div>
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2" style="margin-top:2px; margin-bottom:2px;">
<select class="form-control" id="main_select" onchange="modelProcecss()" title="请选择排序方式,默认按相关性排序。">
<option value="0" selected="selected">按相关性排序</option>
<option value="1">按拼音排序</option>
<option value="2">按拼音倒序</option>
<option value="3">按总笔画数排序</option>
<option value="4">按总笔画数倒序</option>
<option value="5">按首字笔画数排序</option>
<option value="6">按首字笔画数倒序</option>
<option value="7">聚类排列</option>
</select>
</div>
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2" style="margin-top:2px; margin-bottom:2px;">
<button onclick="clearFilter()" class="btn btn-default" type="button">清空 <span class="glyphicon glyphicon-repeat"></span></button>
</div>
</div>
</form>
</div>
</div>
<div class="visible-lg visible-md visible-sm">
<form role="form">
<div class="row" style="margin:0">
<div class="col-xs-6 col-sm-3 col-md-2 col-lg-1" style="margin-top:2px; margin-bottom:2px;">
<span class="glyphicon glyphicon-filter"> </span><span style="font-size: 1.2em;"> 筛选:</span>
</div>
<div class="col-xs-6 col-sm-3 col-md-2 col-lg-1" style="margin-top:2px; margin-bottom:2px;">
<label for="filter2"><input type="text" id="filter2" onchange="modelProcecss()" class="form-control" placeholder="字数" title="词的字数通常为1到8,可用具体数字“n”或范围“>n”、“<n”来筛选。"></label>
</div>
<div class="col-xs-6 col-sm-3 col-md-2 col-lg-1" style="margin-top:2px; margin-bottom:2px;">
<label for="filter4"><input type="text" id="filter4" onchange="modelProcecss()" class="form-control" placeholder="笔画数" title="词的总笔画数,可用具体数字“n”或范围“>n”、“<n”来筛选。"></label>
</div>
<div class="col-xs-6 col-sm-3 col-md-2 col-lg-1" style="margin-top:2px; margin-bottom:2px;">
<label for="filter5"><input type="text" id="filter5" onchange="modelProcecss()" class="form-control" placeholder="词形" title="*为匹配0到多字;?匹配1字;+为且;[...]匹配集合内任一字;[^...]不匹配集合内任何字。每次仅支持1种模式。"></label>
</div>
<div class="col-xs-6 col-sm-3 col-md-2 col-lg-1" style="margin-top:2px; margin-bottom:2px;">
<label for="filter3"><input type="text" id="filter3" onchange="modelProcecss()" class="form-control" placeholder="拼音字母" title="用首字母表示。如“字典”为“zd”。"></label>
</div>
<div class="col-sm-4 col-md-3 col-lg-2" style="margin-top:2px; margin-bottom:2px;">
<select class="form-control" id="POS_select_CC" onchange="modelProcecss()">
<option value="0" id="default_select_CC" selected="selected">全部词性</option>
<option value="1">名词</option>
<option value="2">动词</option>
<option value="3">形容词</option>
<option value="4">副词</option>
<option value="5">介词</option>
<option value="6">数词</option>
<option value="7">连词</option>
<option value="8">助词</option>
<option value="9">量词</option>
<option value="10">叹词</option>
<option value="11">代词</option>
<option value="12">拟声词</option>
<option value="13">未标注</option>
</select>
</div>
<div class="col-xs-6 col-sm-4 col-md-3 col-lg-2" style="margin-top:2px; margin-bottom:2px;">
<select class="form-control" id="rhyme_select_CC" onchange="modelProcecss()" title="根据《中华通韵》2019.01.01版。">
<option value="0" selected="selected">全部韵脚</option>
<option value="1">啊 a,ia,ua 阴平</option>
<option value="2">啊 a,ia,ua 阳平</option>
<option value="3">啊 a,ia,ua 上声</option>
<option value="4">啊 a,ia,ua 去声</option>
<option value="5">喔 o,uo 阴平</option>
<option value="6">喔 o,uo 阳平</option>
<option value="7">喔 o,uo 上声</option>
<option value="8">喔 o,uo 去声</option>
<option value="9">鹅 e,ie,üe 阴平</option>
<option value="10">鹅 e,ie,üe 阳平</option>
<option value="11">鹅 e,ie,üe 上声</option>
<option value="12">鹅 e,ie,üe 去声</option>
<option value="13">衣 i 阴平</option>
<option value="14">衣 i 阳平</option>
<option value="15">衣 i 上声</option>
<option value="16">衣 i 去声</option>
<option value="17">乌 u 阴平</option>
<option value="18">乌 u 阳平</option>
<option value="19">乌 u 上声</option>
<option value="20">乌 u 去声</option>
<option value="21">迂 ü 阴平</option>
<option value="22">迂 ü 阳平</option>
<option value="23">迂 ü 上声</option>
<option value="24">迂 ü 去声</option>
<option value="25">哀 ai,uai 阴平</option>
<option value="26">哀 ai,uai 阳平</option>
<option value="27">哀 ai,uai 上声</option>
<option value="28">哀 ai,uai 去声</option>
<option value="29">欸 ei,ui 阴平</option>
<option value="30">欸 ei,ui 阳平</option>
<option value="31">欸 ei,ui 上声</option>
<option value="32">欸 ei,ui 去声</option>
<option value="33">熬 ao,iao 阴平</option>
<option value="34">熬 ao,iao 阳平</option>
<option value="35">熬 ao,iao 上声</option>
<option value="36">熬 ao,iao 去声</option>
<option value="37">欧 ou,iu 阴平</option>
<option value="38">欧 ou,iu 阳平</option>
<option value="39">欧 ou,iu 上声</option>
<option value="40">欧 ou,iu 去声</option>
<option value="41">安 an,ian,uan,üan 阴平</option>
<option value="42">安 an,ian,uan,üan 阳平</option>
<option value="43">安 an,ian,uan,üan 上声</option>
<option value="44">安 an,ian,uan,üan 去声</option>
<option value="45">恩 en,in,un,ün 阴平</option>
<option value="46">恩 en,in,un,ün 阳平</option>
<option value="47">恩 en,in,un,ün 上声</option>
<option value="48">恩 en,in,un,ün 去声</option>
<option value="49">昂 ang,iang,uang 阴平</option>
<option value="50">昂 ang,iang,uang 阳平</option>
<option value="51">昂 ang,iang,uang 上声</option>
<option value="52">昂 ang,iang,uang 去声</option>
<option value="53">英 eng,ing 阴平</option>
<option value="54">英 eng,ing 阳平</option>
<option value="55">英 eng,ing 上声</option>
<option value="56">英 eng,ing 去声</option>
<option value="57">雍 ong,iong 阴平</option>
<option value="58">雍 ong,iong 阳平</option>
<option value="59">雍 ong,iong 上声</option>
<option value="60">雍 ong,iong 去声</option>
<option value="61">儿 er 阳平</option>
<option value="62">儿 er 上声</option>
<option value="63">儿 er 去声</option>
<option value="64">未标注</option>
</select>
</div>
<div class="col-sm-4 col-md-3 col-lg-2" style="margin-top:2px; margin-bottom:2px;">
<select class="form-control" id="main_select" onchange="modelProcecss()" title="请选择排序方式,默认按相关性排序。">
<option value="0" id="default_select" selected="selected">按相关性排序</option>
<option value="1">按拼音排序</option>
<option value="2">按拼音倒序</option>
<option value="3">按总笔画数排序</option>
<option value="4">按总笔画数倒序</option>
<option value="5">按首字笔画数排序</option>
<option value="6">按首字笔画数倒序</option>
<option value="7">聚类排列</option>
</select>
</div>
<div class="col-xs-6 col-sm-3 col-md-2 col-lg-1" style="margin-top:2px; margin-bottom:2px;">
<button onclick="clearFilter()" class="btn btn-default" type="button">清空 <span class="glyphicon glyphicon-repeat"></span></button>
</div>
</div>
</form>
<HR/>
</div>
</div>
<div style="font-family:KaiTi,Verdana,Arial,sans-serif;font-size:1.2em;">
<div id='result'></div>
</div>
</div>
<div id="tabs-2">
<br>
<h1 style="font-weight:normal;">Reverse Dictionary</h1>
<br>
<br>
<br>
<div class="row elem-center">
<div class="input-group">
<input type="text" style="height: 54px; font-size: 1.3em;" class="form-control" id="description_EE" placeholder="Please input a description" autocomplete='off'><a href="javascript:;" class="clear"></a>
<span class="input-group-btn" style="font-size: 1.3em;">
<button onclick="onkeySearch_EE()" class="btn btn-default" type="button" style="color: grey;height: 54px; width: 76px;"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div><!-- /input-group -->
</div><!-- /.row -->
<br>
<div id="filter_EE">
<div class="panel panel-default visi
gitextract__e9ilabv/
├── README.md
├── README_ZH.md
├── manage.py
├── model.py
├── model_en.py
├── static/
│ ├── css/
│ │ └── zzsc.css
│ └── js/
│ ├── home.js
│ └── zzsc.js
├── templates/
│ ├── about.html
│ ├── about_en.html
│ └── home.html
├── uwsgi.ini
└── website_RD/
├── __init__.py
├── settings.py
├── urls.py
├── views.py
└── wsgi.py
SYMBOL INDEX (64 symbols across 6 files)
FILE: manage.py
function main (line 7) | def main():
FILE: model.py
class Encoder (line 3) | class Encoder(torch.nn.Module):
method __init__ (line 4) | def __init__(self, vocab_size, embed_dim, hidden_dim, layers, class_nu...
method forward (line 31) | def forward(self, operation, x=None, w=None, ws=None, wP=None, wc=None...
FILE: model_en.py
class Encoder (line 3) | class Encoder(torch.nn.Module):
method __init__ (line 4) | def __init__(self, vocab_size, embed_dim, hidden_dim, layers, class_nu...
method forward (line 26) | def forward(self, operation, x=None, w=None, ws=None, wl=None, wr=None...
FILE: static/js/home.js
function diagWord (line 154) | function diagWord() {
function diagSuggest (line 186) | function diagSuggest() {
function diagError (line 204) | function diagError(i) {
function addTag (line 237) | function addTag(i, m) {
function clearAlert (line 271) | function clearAlert() {
function clearFilter (line 279) | function clearFilter() {
function htmlSuccess (line 389) | function htmlSuccess(str) {
function htmlInfo (line 392) | function htmlInfo(str) {
function htmlWarning (line 395) | function htmlWarning(str) {
function htmlDanger (line 398) | function htmlDanger(str) {
function htmlInfo_E (line 401) | function htmlInfo_E(str) {
function htmlWarning_E (line 404) | function htmlWarning_E(str) {
function htmlDanger_E (line 407) | function htmlDanger_E(str) {
function getContent (line 411) | function getContent(wdData, defi, i) {
function getTitle (line 421) | function getTitle(i) {
function getContent_E (line 426) | function getContent_E(wdData, defi, i) {
function getTitle_E (line 431) | function getTitle_E(i) {
function getContent_CE (line 436) | function getContent_CE(wdData, defi, i) {
function getContent_EC (line 440) | function getContent_EC(wdData, defi, i) {
function showTable (line 451) | function showTable(dictList, res_elem) {
function showTable_Cluster (line 540) | function showTable_Cluster(dictList, res_elem) {
function filterRes (line 650) | function filterRes(dictList) {
function modelProcecss (line 1042) | function modelProcecss() {
function onkeySearch (line 1103) | function onkeySearch() {
function filterRes_EE (line 1122) | function filterRes_EE(dictList) {
function modelProcecss_EE (line 1390) | function modelProcecss_EE() {
function onkeySearch_EE (line 1451) | function onkeySearch_EE() {
function filterRes_CE (line 1471) | function filterRes_CE(dictList) {
function modelProcecss_CE (line 1739) | function modelProcecss_CE() {
function onkeySearch_CE (line 1800) | function onkeySearch_CE() {
function filterRes_EC (line 1820) | function filterRes_EC(dictList) {
function modelProcecss_EC (line 2205) | function modelProcecss_EC() {
function onkeySearch_EC (line 2266) | function onkeySearch_EC() {
method if (line 2305) | if ($("#description_EE").val()=="") {
method if (line 2336) | if ($("#description_CE").val()=="") {
method if (line 2399) | if ($("#description").val()=="") { //收起筛选器后,若输入为空(可能一开始就是空,或改为空但没按回车)则清空...
FILE: static/js/zzsc.js
function stopDefault (line 32) | function stopDefault(e){
FILE: website_RD/views.py
function md5 (line 11) | def md5(str):
function load_data (line 34) | def load_data():
function label_multihot (line 88) | def label_multihot(labels, num):
function word2feature (line 97) | def word2feature(dataset, word_num, feature_num, feature_name):
function mask_noFeature (line 108) | def mask_noFeature(label_size, wd2fea, feature_num):
function home (line 148) | def home(request):
function admin (line 151) | def admin(request):
function about (line 173) | def about(request):
function about_en (line 176) | def about_en(request):
function papers (line 179) | def papers(request):
function help (line 182) | def help(request):
function Score2Hexstr (line 185) | def Score2Hexstr(score, maxsc):
function ChineseRD (line 197) | def ChineseRD(request):
function getClass2Class (line 280) | def getClass2Class(r, score):
function ChineseRDCluster (line 294) | def ChineseRDCluster(request):
function EnglishRDCluster (line 387) | def EnglishRDCluster(request):
function EnglishRD (line 484) | def EnglishRD(request):
function feedback (line 570) | def feedback(request):
function GetChDefis (line 582) | def GetChDefis(request):
function GetEnDefis (line 592) | def GetEnDefis(request):
Condensed preview — 17 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (288K chars).
[
{
"path": "README.md",
"chars": 2808,
"preview": "### [中](README_ZH.md)|En\n<p align=\"center\">\n <a href=\"https://wantwords.thunlp.org/\">\n \t<img src=\"resources/wantwords_"
},
{
"path": "README_ZH.md",
"chars": 2275,
"preview": "### 中|[En](README.md)\n<p align=\"center\">\n <a href=\"https://wantwords.thunlp.org/\">\n \t<img src=\"resources/wantwords_log"
},
{
"path": "manage.py",
"chars": 630,
"preview": "#!/usr/bin/env python\n\"\"\"Django's command-line utility for administrative tasks.\"\"\"\nimport os\nimport sys\n\n\ndef main():\n "
},
{
"path": "model.py",
"chars": 5221,
"preview": "import torch\r\n\r\nclass Encoder(torch.nn.Module):\r\n def __init__(self, vocab_size, embed_dim, hidden_dim, layers, class"
},
{
"path": "model_en.py",
"chars": 3863,
"preview": "import torch\n\nclass Encoder(torch.nn.Module):\n def __init__(self, vocab_size, embed_dim, hidden_dim, layers, class_nu"
},
{
"path": "static/css/zzsc.css",
"chars": 1076,
"preview": "@charset \"utf-8\";\r\n/*容器*/\r\n#xzw_starSys {}/*{width:400px;border:1px solid #ccc;padding:50px;margin:100px auto}*/\r\n#xzw_s"
},
{
"path": "static/js/home.js",
"chars": 116936,
"preview": "$(function() {\r\n $( \"#tabs\" ).tabs();\r\n});\r\n$(function() {\r\n $( \"#tabs_inter\" ).tabs({\r\n collapsible: true\r"
},
{
"path": "static/js/zzsc.js",
"chars": 1058,
"preview": "//star\r\n$(document).ready(function(){\r\n var stepW = 24;\r\n var starRes = new Array(\"毫无关系\",\"基本相关\",\"非常匹配\");\r\n var "
},
{
"path": "templates/about.html",
"chars": 15947,
"preview": "<!DOCTYPE html>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n <meta charset=\"utf-8\">\r\n <meta http-equiv=\"Cont"
},
{
"path": "templates/about_en.html",
"chars": 19848,
"preview": "<!DOCTYPE html>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n <meta charset=\"utf-8\">\r\n <meta http-equiv=\"Cont"
},
{
"path": "templates/home.html",
"chars": 69424,
"preview": "<!DOCTYPE html>\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n <meta charset=\"utf-8\">\r\n <meta name=\"baidu-site"
},
{
"path": "uwsgi.ini",
"chars": 488,
"preview": "# website_RD_uwsgi.ini file\n[uwsgi]\n\n# Django-related settings\n\nsocket = 127.0.0.1:8000\n\n# the base directory (full path"
},
{
"path": "website_RD/__init__.py",
"chars": 1,
"preview": "#"
},
{
"path": "website_RD/settings.py",
"chars": 3402,
"preview": "\"\"\"\nDjango settings for website_RD project.\n\nGenerated by 'django-admin startproject' using Django 2.2.3.\n\nFor more info"
},
{
"path": "website_RD/urls.py",
"chars": 1415,
"preview": "\"\"\"website_RD URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n https"
},
{
"path": "website_RD/views.py",
"chars": 26989,
"preview": "import torch, gc, json, os, thulac, string, re, requests, hashlib, urllib.parse \nimport numpy as np\nfrom django.shortcut"
},
{
"path": "website_RD/wsgi.py",
"chars": 397,
"preview": "\"\"\"\nWSGI config for website_RD project.\n\nIt exposes the WSGI callable as a module-level variable named ``application``.\n"
}
]
About this extraction
This page contains the full source code of the thunlp/WantWords GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 17 files (265.4 KB), approximately 67.1k tokens, and a symbol index with 64 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.