Linguistic corpora 种子语料库-待分析对象-分析与更新语料库

Computational Linguistics

http://matplotlib.org/

https://github.com/matplotlib/matplotlib/blob/master/INSTALL#L59

http://www.nltk.org/book/ch01.html#id9

Linguistic corpora   种子语料库-待分析对象-分析与更新语料库

 C:\Users\w>python -m pip install --upgrade pip
Collecting pip
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.reque
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 14kB/s
Installing collected packages: pip
Found existing installation: pip 8.1.1
Uninstalling pip-8.1.1:
Successfully uninstalled pip-8.1.1
Successfully installed pip-9.0.1 C:\Users\w>python -m pip install matplotlib
Collecting matplotlib
Downloading matplotlib-1.5.3-cp35-cp35m-win_amd64.whl (6.5MB)
100% |████████████████████████████████| 6.5MB 30kB/s
Collecting pytz (from matplotlib)
Downloading pytz-2016.10-py2.py3-none-any.whl (483kB)
100% |████████████████████████████████| 491kB 35kB/s
Collecting pyparsing!=2.0.4,!=2.1.2,>=1.5.6 (from matplotlib)
Downloading pyparsing-2.1.10-py2.py3-none-any.whl (56kB)
100% |████████████████████████████████| 61kB 29kB/s
Collecting numpy>=1.6 (from matplotlib)
Downloading numpy-1.11.2-cp35-none-win_amd64.whl (7.6MB)
100% |████████████████████████████████| 7.6MB 32kB/s
Collecting cycler (from matplotlib)
Downloading cycler-0.10.0-py2.py3-none-any.whl
Collecting python-dateutil (from matplotlib)
Downloading python_dateutil-2.6.0-py2.py3-none-any.whl (194kB)
100% |████████████████████████████████| 194kB 46kB/s
Collecting six (from cycler->matplotlib)
Downloading six-1.10.0-py2.py3-none-any.whl
Installing collected packages: pytz, pyparsing, numpy, six, cycler, python-dateutil, matplotlib
Successfully installed cycler-0.10.0 matplotlib-1.5.3 numpy-1.11.2 pyparsing-2.1.10 python-dateutil-2.6.0 pytz-2016.10 six-1.10.0
 text4.dispersion_plot(["kate","he","she","jack"])
 <p id="w_last" style="color: red; font-size: 6em;">w-WAITING---</p><br>
<?php
include('conn.php');
//http://www.baidu.com/s?wd=%E5%8F%96%E8%8B%B1%E6%96%87%E5%90%8D
$w_db_incr_girl = 0;
for ($w = 0; $w < 153; $w++) {
$wgirl = 'http://api.open.baidu.com/pae/channel/data/asyncqury?appid=4036&srcid=4036&from_mid=1&format=json&ie=utf-8&oe=utf-8&subtitle=%E8%8B%B1%E6%96%87%E5%90%8D&query=%E8%8B%B1%E6%96%87%E5%90%8D&rn=5&stat1=%E5%A5%B3%E7%94%9F&pn=' . (5 * $w) . '&srcid=4036&cb=jQuery110205654252001601794_1481004786057&_=' . (1481004786059 + $w);
$w_file = file_get_contents($wgirl);
$partten = '/\"englishname\"\:\"\w{0,}\"/';
$w_name = preg_match_all($partten, $w_file, $matches, PREG_SET_ORDER);
$tmp = 0;
foreach ($matches AS $one) {
if ($tmp % 3 == 2) {
$given_name = substr($one[0], 15, strlen($one[0]) - 15 - 1);
$sql = 'INSERT INTO namelist (given_name,grab_url,isboy) VALUES ("' . $given_name . '","' . $wgirl . '",0)';
if (mysqli_query($link, $sql)) {
$w_db_incr_girl++;
};
}
$tmp++;
}
} $w_db_incr_boy = 0;
for ($w = 0; $w < 153; $w++) { // $wgirl = 'http://api.open.baidu.com/pae/channel/data/asyncqury?appid=4036&srcid=4036&from_mid=1&format=json&ie=utf-8&oe=utf-8&subtitle=%E8%8B%B1%E6%96%87%E5%90%8D&query=%E8%8B%B1%E6%96%87%E5%90%8D&rn=5&stat1=%E5%A5%B3%E7%94%9F&pn='.(5*$w).'&srcid=4036&cb=jQuery110205654252001601794_1481004786057&_='.(1481004786059+$w); $wboy = 'http://api.open.baidu.com/pae/channel/data/asyncqury?appid=4036&srcid=4036&from_mid=1&format=json&ie=utf-8&oe=utf-8&subtitle=%E8%8B%B1%E6%96%87%E5%90%8D&query=%E8%8B%B1%E6%96%87%E5%90%8D&rn=5&pn=' . (5 * $w) . '&srcid=4036&stat1=%E7%94%B7%E7%94%9F&cb=jQuery1102017382318514491035_1481005337608&_=' . (1481004786059 + $w);
$w_file = file_get_contents($wboy);
$partten = '/\"englishname\"\:\"\w{0,}\"/';
$w_name = preg_match_all($partten, $w_file, $matches, PREG_SET_ORDER); $tmp = 0;
foreach ($matches AS $one) {
if ($tmp % 3 == 2) {
$given_name = substr($one[0], 15, strlen($one[0]) - 15 - 1);
$sql = 'INSERT INTO namelist (given_name,grab_url,isboy) VALUES ("' . $given_name . '","' . $wboy . '",1)';
if (mysqli_query($link, $sql)) {
$w_db_incr_boy++;
};
}
$tmp++;
}
} $w_arr = array_merge(range('A', 'Z'));
//http://ename.dict.cn/list/female/R/2
foreach ($w_arr AS $w_range) {
for ($w = 1; $w < 8; $w++) {
$wgirl = 'http://ename.dict.cn/list/female/' . $w_range . '/' . $w;
$w_file = file_get_contents($wgirl);
$partten = '/' . 'href=\"\/\w{0,}\"\>' . '/';
$w_name = preg_match_all($partten, $w_file, $matches, PREG_SET_ORDER);
foreach ($matches AS $one) {
$given_name = substr($one[0], 7, strlen($one[0]) - 7 - 2);
$sql = 'INSERT INTO namelist (given_name,grab_url,isboy) VALUES ("' . $given_name . '","' . $wgirl . '",0)';
if (mysqli_query($link, $sql)) {
$w_db_incr_girl++;
};
}
} for ($w = 1; $w < 8; $w++) {
$wboy = 'http://ename.dict.cn/list/male/' . $w_range . '/' . $w;
$w_file = file_get_contents($wboy);
$partten = '/' . 'href=\"\/\w{0,}\"\>' . '/';
$w_name = preg_match_all($partten, $w_file, $matches, PREG_SET_ORDER);
foreach ($matches AS $one) {
$given_name = substr($one[0], 7, strlen($one[0]) - 7 - 2);
$sql = 'INSERT INTO namelist (given_name,grab_url,isboy) VALUES ("' . $given_name . '","' . $wboy . '",1)';
if (mysqli_query($link, $sql)) {
$w_db_incr_boy++;
};
}
}
} ?>
<script>
document.getElementById('w_last').innerHTML = 'w_db_incr_girl\'s=<?= $w_db_incr_girl?>,w_db_incr_boy\'s=' +<?= $w_db_incr_boy?>;
</script>
             $sql_db_check = 'SEELCT isboy FROM namelist WHERE given_name="'.$given_name.'"';
$check = db_multiple_rows_link($link, $sql_db_check);
if(count($check)==2){
$isboy = 2;
}elseif(count($check)==1){
$isboy = $check['isboy'];
}elseif(count($check)==0){
$w_arr = w_cross_domian_name_isboy($given_name);
//var_dump($w_arr);
$isboy = $w_arr['w_code'];
$grab_url = $w_arr['w_url'];
if($isboy!=4){
if($isboy==1){
$sql_w ='INSERT INTO namelist (given_name,grab_url,isboy) VALUES ("' . $given_name . '","' . $grab_url . '",1)';
}elseif($isboy==0){
$sql_w ='INSERT INTO namelist (given_name,grab_url,isboy) VALUES ("' . $given_name . '","' . $grab_url . '",0)';
}elseif($isboy==2){
$sql_w ='INSERT INTO namelist (given_name,grab_url,isboy) VALUES ("' . $given_name . '","' . $grab_url . '",1)'.';';
$sql_w .='INSERT INTO namelist (given_name,grab_url,isboy) VALUES ("' . $given_name . '","' . $grab_url . '",0)';
}
// var_dump($sql_w);
mysqli_multi_query($link,$sql_w);
 function w_given_name($wstr)
{
$given_name = strstr($wstr, ' ', TRUE);
if (empty($given_name)) $given_name = ltrim($wstr);
$given_name = strtoupper(substr($given_name, 0, 1)) . strtolower(substr($given_name, 1));
RETURN $given_name;
} //http://dict.youdao.com/w/eng/Tommy/#keyfrom=dict2.index
//http://dict.youdao.com/w/eng/Chris/#keyfrom=dict2.index
//http://dict.youdao.com/w/eng/Billie/#keyfrom=dict2.index
//http://dict.youdao.com/w/eng/Mikhael/#keyfrom=dict2.index
function w_cross_domian_name_isboy($name)
{
$url = 'http://dict.youdao.com/w/eng/' . $name . '/#keyfrom=dict2.index';
$w_file = file_get_contents($url);
// $wfile = fopen('w.w', 'w');
//fwrite($wfile, $w_file); $partten = '/' . '您要找的是不是' . '/';
preg_match_all($partten, $w_file, $matches_spell, PREG_SET_ORDER);
if (!empty($matches_spell)) {
} else {
$partten = '/' . '男子名' . '/';
preg_match_all($partten, $w_file, $matches_boy, PREG_SET_ORDER);
$partten = '/' . '女子名' . '/';
preg_match_all($partten, $w_file, $matches_girl, PREG_SET_ORDER);
} $w = array();
$w['w_url'] = $url;
$w['w_code'] = 4;
if (!empty($matches_spell) || (empty($matches_boy) && empty($matches_girl))) {
} elseif (!empty($matches_boy) && !empty($matches_girl)) {
$w['w_code'] = 2;
} elseif (!empty($matches_boy)) {
$w['w_code'] = 1;
} elseif (!empty($matches_girl)) {
$w['w_code'] = 0;
}
RETURN $w;
}
上一篇:Android NDK目录介绍


下一篇:同步推是如何给未越狱的IOS设备安装任意IPA的?